Uniswap/permit2

multiple arrays that must be same length is better represented as array of structs

Closed this issue · 2 comments

// ERC20 token addresses
address[] tokens;
// address permissioned on the allowed tokens
address spender;
// the maximum amounts allowed to spend per token
uint160[] amounts;
// timestamp at which a spender's token allowances become invalid, assigned per token
uint64[] expirations;

for readability, this might better be represented as array of structs, something like:

struct Permit {
  address token;
  uint32 nonce;
  uint160 amount;
  uint64 expiry;
}

struct PermitSingle {
  Permit permit;
  address spender;
}

struct PermitBatch {
  Permit[] permits;
  address spender;
}

this structure will also allow passing in a nonce per "permit" for AllowanceTransfer batchPermit

closed with #98