Deploy your own Law
Creating a Law
Basic Structure
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.26;
import "../Law.sol";
contract MyNewLaw is Law {
constructor() {
// Optional: Configure parameters needed at initlisation. This can be left empty.
bytes memory configParams = abi.encode(
"uint256 maxBudgetLeft",
"bool checkDuration"
);
emit Law__Deployed(configParams);
}
function handleRequest(
address caller,
address powers,
uint16 lawId,
bytes memory lawCalldata,
uint256 nonce
) public view virtual override returns (
uint256 actionId,
address[] memory targets,
uint256[] memory values,
bytes[] memory calldatas,
bytes memory stateChange
) {
// Implement your law's logic here
}
}Key Components
Deploying a Law
Adopting a Law
Best Practices
Example Use Cases
Last updated