Added ERC2771 support & Increased pixTarget max size

This commit is contained in:
PedroCailleret
2023-05-21 02:05:43 -03:00
parent 2129566a27
commit 32469e2480
53 changed files with 1571 additions and 368 deletions

View File

@@ -8,6 +8,8 @@ abstract contract Constants {
0x0b294da292f26e55fd442b5c0164fbb9013036ff00c5cfdde0efd01c1baaf632;
uint256 constant _ALLOWED_ERC20_UPDATED_EVENT_SIGNATURE =
0x5d6e86e5341d57a92c49934296c51542a25015c9b1782a1c2722a940131c3d9a;
uint256 constant _TRUSTED_FORWARDER_UPDATED_EVENT_SIGNATURE =
0xbee55516e29d3969d3cb8eb01351eb3c52d06f9e2435bd5a8bfe3647e185df92;
/// @dev Seller casted to key => Seller's allowlist merkleroot.
/// mapping(uint256 => bytes32) public sellerAllowList;
@@ -18,12 +20,12 @@ abstract contract Constants {
/// @dev `balance` max. value = 10**26.
/// @dev `pixTarget` keys are restricted to 160 bits.
/// mapping(uint256 => mapping(ERC20 => uint256)) public sellerBalance;
/// mapping(uint256 => mapping(ERC20 => { `uint256`, `uint96` } )) public sellerBalance;
/// @dev Bits layout:
/// `bytes32` [0...255] := pixTarget
/// `uint96` [0...94] := balance
/// `uint160` [95...254] := pixTarget
/// `bool` [255] := valid
/// `bool` [95] := valid
/// @dev Value in custom storage slot given by:
/// mstore(0x20, token)
@@ -34,12 +36,10 @@ abstract contract Constants {
/// @dev The bitmask of `sellerBalance` entry.
uint256 constant BITMASK_SB_ENTRY = (1 << 94) - 1;
/// @dev The bit position of `pixTarget` in `sellerBalance`.
uint256 constant BITPOS_PIXTARGET = 95;
/// @dev The bit position of `valid` in `sellerBalance`.
uint256 constant BITPOS_VALID = 255;
uint256 constant BITPOS_VALID = 95;
/// @dev The bitmask of all 256 bits of `sellerBalance` except for the last one.
uint256 constant BITMASK_VALID = (1 << 255) - 1;
// uint256 constant BITMASK_VALID = (1 << 255) - 1;
/// @dev The scalar of BRZ token.
uint256 constant WAD = 1e18;