Overview
TheGovernanceEthereum
class retrieves governance rules from the Ethereum blockchain. It interacts with the blockchain via JSON-RPC calls and decodes the governance rules from contract responses.
Features
- Queries Ethereum blockchain for governance rules using JSON-RPC.
- Retrieves governance rule sets using Ethereum smart contract calls.
- Decodes ABI-encoded blockchain responses.
- Implements Asimov’s Laws:
Functions
Note: Etherscan.io does not handle bytes[]/json well. Hence we use the following functions to load and decode rules from blockchain.Method: load_rules_from_blockchain()
- Queries the Ethereum blockchain using JSON-RPC to fetch governance rules.
- Calls the ERC-7777 smart contract function
getRuleSet()
. - Decodes and returns the governance rule set.
- Constructs a JSON-RPC request to call
getRuleSet()
. - Sends a
POST
request to the blockchain RPC endpoint. - Parses the response and extracts the rule set.
str
: Decoded governance rules if successful.None
: If the request fails.
Method: decode_eth_response()
- Decodes the ABI-encoded response from Ethereum smart contract calls.
Parameter | Type | Description |
---|---|---|
hex_response | str | Raw hex response from blockchain. |
- Converts hex to bytes.
- Extracts string length from ABI-encoded data.
- Decodes UTF-8 string from ABI format.
- Cleans non-printable characters.
str
: Decoded governance rule set.None
: If decoding fails.
Ethereum Contract Details
RULES are stored on the ETHEREUM HOLESKY testnet and can be inspected directly atSmart Contract Functions Used
Function | Selector | Description |
---|---|---|
getRuleSet() | 0x1db3d5ff | Retrieves the active rule set. |
getLatestRuleSetVersion() | 0x254e2f1e | Retrieves the latest rule set version (currently 2 ). |