Skip to content

Commit

Permalink
GMS-2051 Multi-caller v2 (#241)
Browse files Browse the repository at this point in the history
* Multi-caller v2

* Update names

* Use struct

* Fix linting

* Fix type hash

* Improve testing

* Add threat model and rename contract

* Add more test cases

* Check valid function signatures

* Fix solidity version

* Update tests

* Fix threat doc

* Add abi

* Use encode in keccak256

* Address comments

* Add param name to mapping

* update threat model

* Update threat model

---------

Co-authored-by: Allan Almeida <[email protected]>
  • Loading branch information
hiep-immutable and allan-almeida-imtbl authored Sep 2, 2024
1 parent 63bd4db commit 71d1d5f
Show file tree
Hide file tree
Showing 9 changed files with 1,016 additions and 1 deletion.
321 changes: 321 additions & 0 deletions abi/generated.ts
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,327 @@ export const guardedMulticallerAbi = [
},
] as const

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// GuardedMulticaller2
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

export const guardedMulticaller2Abi = [
{
type: 'constructor',
inputs: [
{ name: '_owner', internalType: 'address', type: 'address' },
{ name: '_name', internalType: 'string', type: 'string' },
{ name: '_version', internalType: 'string', type: 'string' },
],
stateMutability: 'nonpayable',
},
{
type: 'function',
inputs: [],
name: 'DEFAULT_ADMIN_ROLE',
outputs: [{ name: '', internalType: 'bytes32', type: 'bytes32' }],
stateMutability: 'view',
},
{
type: 'function',
inputs: [],
name: 'MULTICALL_SIGNER_ROLE',
outputs: [{ name: '', internalType: 'bytes32', type: 'bytes32' }],
stateMutability: 'view',
},
{
type: 'function',
inputs: [],
name: 'eip712Domain',
outputs: [
{ name: 'fields', internalType: 'bytes1', type: 'bytes1' },
{ name: 'name', internalType: 'string', type: 'string' },
{ name: 'version', internalType: 'string', type: 'string' },
{ name: 'chainId', internalType: 'uint256', type: 'uint256' },
{ name: 'verifyingContract', internalType: 'address', type: 'address' },
{ name: 'salt', internalType: 'bytes32', type: 'bytes32' },
{ name: 'extensions', internalType: 'uint256[]', type: 'uint256[]' },
],
stateMutability: 'view',
},
{
type: 'function',
inputs: [
{ name: '_multicallSigner', internalType: 'address', type: 'address' },
{ name: '_reference', internalType: 'bytes32', type: 'bytes32' },
{
name: '_calls',
internalType: 'struct GuardedMulticaller2.Call[]',
type: 'tuple[]',
components: [
{ name: 'target', internalType: 'address', type: 'address' },
{ name: 'functionSignature', internalType: 'string', type: 'string' },
{ name: 'data', internalType: 'bytes', type: 'bytes' },
],
},
{ name: '_deadline', internalType: 'uint256', type: 'uint256' },
{ name: '_signature', internalType: 'bytes', type: 'bytes' },
],
name: 'execute',
outputs: [],
stateMutability: 'nonpayable',
},
{
type: 'function',
inputs: [{ name: 'role', internalType: 'bytes32', type: 'bytes32' }],
name: 'getRoleAdmin',
outputs: [{ name: '', internalType: 'bytes32', type: 'bytes32' }],
stateMutability: 'view',
},
{
type: 'function',
inputs: [{ name: '_user', internalType: 'address', type: 'address' }],
name: 'grantMulticallSignerRole',
outputs: [],
stateMutability: 'nonpayable',
},
{
type: 'function',
inputs: [
{ name: 'role', internalType: 'bytes32', type: 'bytes32' },
{ name: 'account', internalType: 'address', type: 'address' },
],
name: 'grantRole',
outputs: [],
stateMutability: 'nonpayable',
},
{
type: 'function',
inputs: [{ name: '_reference', internalType: 'bytes32', type: 'bytes32' }],
name: 'hasBeenExecuted',
outputs: [{ name: '', internalType: 'bool', type: 'bool' }],
stateMutability: 'view',
},
{
type: 'function',
inputs: [
{ name: 'role', internalType: 'bytes32', type: 'bytes32' },
{ name: 'account', internalType: 'address', type: 'address' },
],
name: 'hasRole',
outputs: [{ name: '', internalType: 'bool', type: 'bool' }],
stateMutability: 'view',
},
{
type: 'function',
inputs: [
{ name: 'role', internalType: 'bytes32', type: 'bytes32' },
{ name: 'account', internalType: 'address', type: 'address' },
],
name: 'renounceRole',
outputs: [],
stateMutability: 'nonpayable',
},
{
type: 'function',
inputs: [{ name: '_user', internalType: 'address', type: 'address' }],
name: 'revokeMulticallSignerRole',
outputs: [],
stateMutability: 'nonpayable',
},
{
type: 'function',
inputs: [
{ name: 'role', internalType: 'bytes32', type: 'bytes32' },
{ name: 'account', internalType: 'address', type: 'address' },
],
name: 'revokeRole',
outputs: [],
stateMutability: 'nonpayable',
},
{
type: 'function',
inputs: [{ name: 'interfaceId', internalType: 'bytes4', type: 'bytes4' }],
name: 'supportsInterface',
outputs: [{ name: '', internalType: 'bool', type: 'bool' }],
stateMutability: 'view',
},
{ type: 'event', anonymous: false, inputs: [], name: 'EIP712DomainChanged' },
{
type: 'event',
anonymous: false,
inputs: [
{
name: '_multicallSigner',
internalType: 'address',
type: 'address',
indexed: true,
},
{
name: '_reference',
internalType: 'bytes32',
type: 'bytes32',
indexed: true,
},
{
name: '_calls',
internalType: 'struct GuardedMulticaller2.Call[]',
type: 'tuple[]',
components: [
{ name: 'target', internalType: 'address', type: 'address' },
{ name: 'functionSignature', internalType: 'string', type: 'string' },
{ name: 'data', internalType: 'bytes', type: 'bytes' },
],
indexed: false,
},
{
name: '_deadline',
internalType: 'uint256',
type: 'uint256',
indexed: false,
},
],
name: 'Multicalled',
},
{
type: 'event',
anonymous: false,
inputs: [
{ name: 'role', internalType: 'bytes32', type: 'bytes32', indexed: true },
{
name: 'previousAdminRole',
internalType: 'bytes32',
type: 'bytes32',
indexed: true,
},
{
name: 'newAdminRole',
internalType: 'bytes32',
type: 'bytes32',
indexed: true,
},
],
name: 'RoleAdminChanged',
},
{
type: 'event',
anonymous: false,
inputs: [
{ name: 'role', internalType: 'bytes32', type: 'bytes32', indexed: true },
{
name: 'account',
internalType: 'address',
type: 'address',
indexed: true,
},
{
name: 'sender',
internalType: 'address',
type: 'address',
indexed: true,
},
],
name: 'RoleGranted',
},
{
type: 'event',
anonymous: false,
inputs: [
{ name: 'role', internalType: 'bytes32', type: 'bytes32', indexed: true },
{
name: 'account',
internalType: 'address',
type: 'address',
indexed: true,
},
{
name: 'sender',
internalType: 'address',
type: 'address',
indexed: true,
},
],
name: 'RoleRevoked',
},
{ type: 'error', inputs: [], name: 'EmptyCallArray' },
{
type: 'error',
inputs: [{ name: '_deadline', internalType: 'uint256', type: 'uint256' }],
name: 'Expired',
},
{
type: 'error',
inputs: [
{
name: '_call',
internalType: 'struct GuardedMulticaller2.Call',
type: 'tuple',
components: [
{ name: 'target', internalType: 'address', type: 'address' },
{ name: 'functionSignature', internalType: 'string', type: 'string' },
{ name: 'data', internalType: 'bytes', type: 'bytes' },
],
},
],
name: 'FailedCall',
},
{
type: 'error',
inputs: [
{
name: '_call',
internalType: 'struct GuardedMulticaller2.Call',
type: 'tuple',
components: [
{ name: 'target', internalType: 'address', type: 'address' },
{ name: 'functionSignature', internalType: 'string', type: 'string' },
{ name: 'data', internalType: 'bytes', type: 'bytes' },
],
},
],
name: 'InvalidFunctionSignature',
},
{
type: 'error',
inputs: [{ name: '_reference', internalType: 'bytes32', type: 'bytes32' }],
name: 'InvalidReference',
},
{ type: 'error', inputs: [], name: 'InvalidShortString' },
{
type: 'error',
inputs: [
{
name: '_call',
internalType: 'struct GuardedMulticaller2.Call',
type: 'tuple',
components: [
{ name: 'target', internalType: 'address', type: 'address' },
{ name: 'functionSignature', internalType: 'string', type: 'string' },
{ name: 'data', internalType: 'bytes', type: 'bytes' },
],
},
],
name: 'NonContractAddress',
},
{
type: 'error',
inputs: [{ name: '_reference', internalType: 'bytes32', type: 'bytes32' }],
name: 'ReusedReference',
},
{
type: 'error',
inputs: [{ name: 'str', internalType: 'string', type: 'string' }],
name: 'StringTooLong',
},
{
type: 'error',
inputs: [{ name: '_signature', internalType: 'bytes', type: 'bytes' }],
name: 'UnauthorizedSignature',
},
{
type: 'error',
inputs: [
{ name: '_multicallSigner', internalType: 'address', type: 'address' },
],
name: 'UnauthorizedSigner',
},
] as const

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// ImmutableERC1155
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Expand Down
2 changes: 2 additions & 0 deletions abi/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
immutableErc721MintByIdAbi as ImmutableERC721MintByIdAbi,
immutableErc1155Abi as ImmutableERC1155Abi,
paymentSplitterAbi as PaymentSplitterAbi,
guardedMulticaller2Abi as GuardedMulticaller2Abi,
} from "./generated";

export {
Expand All @@ -12,4 +13,5 @@ export {
ImmutableERC721MintByIdAbi,
ImmutableERC1155Abi,
PaymentSplitterAbi,
GuardedMulticaller2Abi,
};
Loading

0 comments on commit 71d1d5f

Please sign in to comment.