cre/veto/rules.ts20 lines · 749 bytes
| 1 | // Rule ids and ruleHash = keccak256(utf8("GUARD/<ID>")): the bytes32 a Veto report carries and AirlockAdmin's Vetoed |
| 2 | // event records. The war room derives the same hashes from the same ids (web/src/types.ts ruleHashOf), so the chain, |
| 3 | // the war room and the reports all read the same rule hashes. |
| 4 | import { type Hex, keccak256, stringToBytes } from 'viem' |
| 5 | |
| 6 | export const RULE_IDS = [ |
| 7 | 'R1_TOTAL_SUPPLY', |
| 8 | 'R2_OWNER', |
| 9 | 'R3_TRANSFER_CONSERVATION', |
| 10 | 'R4_TRANSFER_LIVENESS', |
| 11 | 'R5_STRICT_CODEHASH', |
| 12 | 'R6_SIM_FAILURE', |
| 13 | 'R7_CONFIG_GUARD', |
| 14 | 'R8_INIT_DATA', |
| 15 | 'R3B_THIRD_PARTY_FUNDS', |
| 16 | 'R9_NEW_OPCODES', |
| 17 | ] as const |
| 18 | export type RuleId = (typeof RULE_IDS)[number] |
| 19 | |
| 20 | export const ruleHash = (id: RuleId): Hex => keccak256(stringToBytes(`GUARD/${id}`)) |