-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix arcade dao function encoding (#282)
- Loading branch information
Showing
4 changed files
with
209 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,173 @@ | ||
[ | ||
{ | ||
"inputs": [ | ||
{ "internalType": "bytes32", "name": "_merkleRoot", "type": "bytes32" }, | ||
{ | ||
"internalType": "contract IERC20", | ||
"name": "_token", | ||
"type": "address" | ||
}, | ||
{ "internalType": "uint256", "name": "_expiration", "type": "uint256" }, | ||
{ | ||
"internalType": "contract INFTBoostVault", | ||
"name": "_votingVault", | ||
"type": "address" | ||
} | ||
], | ||
"stateMutability": "nonpayable", | ||
"type": "constructor" | ||
}, | ||
{ "inputs": [], "name": "AA_AlreadyClaimed", "type": "error" }, | ||
{ "inputs": [], "name": "AA_ClaimingExpired", "type": "error" }, | ||
{ "inputs": [], "name": "AA_ClaimingNotExpired", "type": "error" }, | ||
{ "inputs": [], "name": "AA_NonParticipant", "type": "error" }, | ||
{ "inputs": [], "name": "AA_NotInitialized", "type": "error" }, | ||
{ | ||
"inputs": [ | ||
{ "internalType": "string", "name": "addressType", "type": "string" } | ||
], | ||
"name": "AA_ZeroAddress", | ||
"type": "error" | ||
}, | ||
{ | ||
"anonymous": false, | ||
"inputs": [ | ||
{ | ||
"indexed": true, | ||
"internalType": "bytes32", | ||
"name": "merkleRoot", | ||
"type": "bytes32" | ||
}, | ||
{ | ||
"indexed": true, | ||
"internalType": "uint256", | ||
"name": "expiration", | ||
"type": "uint256" | ||
} | ||
], | ||
"name": "SetMerkleRoot", | ||
"type": "event" | ||
}, | ||
{ | ||
"inputs": [{ "internalType": "address", "name": "who", "type": "address" }], | ||
"name": "authorize", | ||
"outputs": [], | ||
"stateMutability": "nonpayable", | ||
"type": "function" | ||
}, | ||
{ | ||
"inputs": [{ "internalType": "address", "name": "", "type": "address" }], | ||
"name": "authorized", | ||
"outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], | ||
"stateMutability": "view", | ||
"type": "function" | ||
}, | ||
{ | ||
"inputs": [ | ||
{ "internalType": "address", "name": "delegate", "type": "address" }, | ||
{ "internalType": "uint128", "name": "totalGrant", "type": "uint128" }, | ||
{ | ||
"internalType": "bytes32[]", | ||
"name": "merkleProof", | ||
"type": "bytes32[]" | ||
} | ||
], | ||
"name": "claimAndDelegate", | ||
"outputs": [], | ||
"stateMutability": "nonpayable", | ||
"type": "function" | ||
}, | ||
{ | ||
"inputs": [ | ||
{ "internalType": "address", "name": "", "type": "address" }, | ||
{ "internalType": "bytes32", "name": "", "type": "bytes32" } | ||
], | ||
"name": "claimed", | ||
"outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], | ||
"stateMutability": "view", | ||
"type": "function" | ||
}, | ||
{ | ||
"inputs": [{ "internalType": "address", "name": "who", "type": "address" }], | ||
"name": "deauthorize", | ||
"outputs": [], | ||
"stateMutability": "nonpayable", | ||
"type": "function" | ||
}, | ||
{ | ||
"inputs": [], | ||
"name": "expiration", | ||
"outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], | ||
"stateMutability": "view", | ||
"type": "function" | ||
}, | ||
{ | ||
"inputs": [{ "internalType": "address", "name": "who", "type": "address" }], | ||
"name": "isAuthorized", | ||
"outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], | ||
"stateMutability": "view", | ||
"type": "function" | ||
}, | ||
{ | ||
"inputs": [], | ||
"name": "owner", | ||
"outputs": [{ "internalType": "address", "name": "", "type": "address" }], | ||
"stateMutability": "view", | ||
"type": "function" | ||
}, | ||
{ | ||
"inputs": [ | ||
{ "internalType": "address", "name": "destination", "type": "address" } | ||
], | ||
"name": "reclaim", | ||
"outputs": [], | ||
"stateMutability": "nonpayable", | ||
"type": "function" | ||
}, | ||
{ | ||
"inputs": [], | ||
"name": "rewardsRoot", | ||
"outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], | ||
"stateMutability": "view", | ||
"type": "function" | ||
}, | ||
{ | ||
"inputs": [ | ||
{ "internalType": "bytes32", "name": "_merkleRoot", "type": "bytes32" }, | ||
{ "internalType": "uint256", "name": "_expiration", "type": "uint256" } | ||
], | ||
"name": "setMerkleRoot", | ||
"outputs": [], | ||
"stateMutability": "nonpayable", | ||
"type": "function" | ||
}, | ||
{ | ||
"inputs": [{ "internalType": "address", "name": "who", "type": "address" }], | ||
"name": "setOwner", | ||
"outputs": [], | ||
"stateMutability": "nonpayable", | ||
"type": "function" | ||
}, | ||
{ | ||
"inputs": [], | ||
"name": "token", | ||
"outputs": [ | ||
{ "internalType": "contract IERC20", "name": "", "type": "address" } | ||
], | ||
"stateMutability": "view", | ||
"type": "function" | ||
}, | ||
{ | ||
"inputs": [], | ||
"name": "votingVault", | ||
"outputs": [ | ||
{ | ||
"internalType": "contract INFTBoostVault", | ||
"name": "", | ||
"type": "address" | ||
} | ||
], | ||
"stateMutability": "view", | ||
"type": "function" | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { describe, expect, it } from 'vitest'; | ||
import type { JSONABIArgument } from '../../../../types/Contract.types'; | ||
import { encodeData } from '../../../utils/encode-decode-transaction'; | ||
import abi from './arcade.abi.json'; | ||
|
||
describe('arcade DAO contract', () => { | ||
it('should encode [address, bytes32]', async () => { | ||
const evmAddress = '0xE38a6F2045738Ea9F5Ad425E63537BA7679Eb82e'; | ||
const merkleRoot = | ||
'0x9c76bb33425ea109e9bddd5ff9e97d10de0dc8de5d123a7c288f8387a4b2ba2d'; | ||
// this was captured by running it on the live network first | ||
const mockEncoded = | ||
'0x0f2d940b000000000000000000000000e38a6f2045738ea9f5ad425e63537ba7679eb82e9c76bb33425ea109e9bddd5ff9e97d10de0dc8de5d123a7c288f8387a4b2ba2d'; | ||
const args = [evmAddress, merkleRoot]; | ||
const jsonABIArgument = abi.find( | ||
(abi) => abi.name === 'claimed', | ||
) as JSONABIArgument; | ||
const encoded = encodeData(jsonABIArgument, args); | ||
expect(encoded).toBe(mockEncoded); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters