cre/veto/abi.ts50 lines · 2900 bytes
| 1 | // Minimal ABI fragments, written from the signatures in src/AirlockAdmin.sol, src/cre/AirlockReceiver.sol and |
| 2 | // src/DemoBTC.sol, plus Multicall3 (batched reads). |
| 3 | import { keccak256, parseAbi } from 'viem' |
| 4 | |
| 5 | export const AIRLOCK_ADMIN_ABI = parseAbi([ |
| 6 | 'event Proposed(uint256 indexed id, uint8 indexed kind, address indexed target, uint256 value, bytes data, bytes32 codehash, uint64 readyBlock)', |
| 7 | 'event Cleared(uint256 indexed id, address indexed clearer, bytes32 evidenceHash)', |
| 8 | 'event Vetoed(uint256 indexed id, address indexed guardian, bytes32 ruleHash, uint256 vetoCount)', |
| 9 | 'function nextId() view returns (uint256)', |
| 10 | 'function delayBlocks() view returns (uint64)', |
| 11 | 'function isApprovedCodehash(bytes32) view returns (bool)', |
| 12 | 'function clearanceOf(uint256) view returns (bytes32)', |
| 13 | 'function oracleJudged(uint256) view returns (bool)', |
| 14 | 'function proposalDigest(uint256 id) view returns (bytes32)', |
| 15 | 'function getProposal(uint256 id) view returns ((uint8 kind, uint8 status, address proposer, address target, uint256 value, bytes32 codehash, bytes32 dataHash, uint64 proposedBlock, uint64 readyBlock, uint256 vetoCount))', |
| 16 | ]) |
| 17 | |
| 18 | export const RECEIVER_ABI = parseAbi([ |
| 19 | 'event Verdict(uint256 indexed proposalId, uint8 indexed action, bytes32 ruleHash, bytes32 evidenceHash, bytes32 workflowId)', |
| 20 | 'function verdictDigest(uint8 action, uint256 proposalId, bytes32 proposalDigest, bytes32 ruleHash, bytes32 evidenceHash, uint64 validUntilBlock) view returns (bytes32)', |
| 21 | ]) |
| 22 | |
| 23 | export const TOKEN_ABI = parseAbi([ |
| 24 | 'function totalSupply() view returns (uint256)', |
| 25 | 'function owner() view returns (address)', |
| 26 | 'function balanceOf(address) view returns (uint256)', |
| 27 | 'function transfer(address to, uint256 amount) returns (bool)', |
| 28 | 'function transferFrom(address from, address to, uint256 amount) returns (bool)', |
| 29 | 'event Transfer(address indexed from, address indexed to, uint256 value)', |
| 30 | 'event OwnershipTransferred(address indexed previousOwner, address indexed newOwner)', |
| 31 | ]) |
| 32 | |
| 33 | /** Multicall3 (same address on Ethereum mainnet, Sepolia and most EVM chains). */ |
| 34 | export const MULTICALL3_ABI = parseAbi([ |
| 35 | 'struct Call3 { address target; bool allowFailure; bytes callData; }', |
| 36 | 'struct Result { bool success; bytes returnData; }', |
| 37 | 'function aggregate3(Call3[] calls) payable returns (Result[] returnData)', |
| 38 | ]) |
| 39 | export const MULTICALL3_ADDRESS = '0xcA11bde05977b3631167028862bE2a173976CA11' |
| 40 | |
| 41 | /** AirlockAdmin.Status */ |
| 42 | export const STATUS = { None: 0, Pending: 1, Vetoed: 2, Executed: 3 } as const |
| 43 | /** AirlockAdmin.Kind */ |
| 44 | export const KIND = { Upgrade: 0, SetGuardian: 1, SetDelay: 2, SetPausedImpl: 3 } as const |
| 45 | /** AirlockReceiver report actions */ |
| 46 | export const ACTION = { Veto: 0, Clear: 1 } as const |
| 47 | |
| 48 | /** dataHash of a proposal without init data: keccak256(""). */ |
| 49 | export const EMPTY_DATA_HASH = keccak256('0x') |
| 50 | export const ZERO_HASH = `0x${'00'.repeat(32)}` as const |