Skip to content

Commit ce5e4b3

Browse files
committed
feat: migrated and deployed the PolicyRegistry
1 parent e4ef880 commit ce5e4b3

File tree

5 files changed

+500
-0
lines changed

5 files changed

+500
-0
lines changed

contracts/README.md

+2
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ Refresh the list of deployed contracts by running `./scripts/generateDeployments
2424
- [HomeGatewayToEthereum](https://goerli-rollup-explorer.arbitrum.io/address/0xc7e3BF90299f6BD9FA7c3703837A9CAbB5743636)
2525
- [IncrementalNG](https://goerli-rollup-explorer.arbitrum.io/address/0x99c1f883f0f5de1737099F1BCB268d1f8D450f8b)
2626
- [KlerosCore](https://goerli-rollup-explorer.arbitrum.io/address/0x87142b7E9C7D026776499120D902AF8896C07894)
27+
- [PolicyRegistry](https://goerli-rollup-explorer.arbitrum.io/address/0xf637A0a4415CCFB97407846486b6be663d3C33ef)
2728
- [SortitionSumTreeFactory](https://goerli-rollup-explorer.arbitrum.io/address/0x26858D60FE92b50b34e236B46874e02724344275)
2829

2930
#### Rinkeby - DEPRECATED
@@ -43,6 +44,7 @@ Refresh the list of deployed contracts by running `./scripts/generateDeployments
4344
- [IncrementalNG](https://testnet.arbiscan.io/address/0x078dAd05373d19d7fd6829735b765F12242a4300)
4445
- [KlerosCore](https://testnet.arbiscan.io/address/0x815d709EFCF5E69e2e9E2F8d3815d762496a2f0F)
4546
- [PNK](https://testnet.arbiscan.io/address/0x364530164a2338cdba211f72c1438eb811b5c639)
47+
- [PolicyRegistry](https://testnet.arbiscan.io/address/0x76262035D1b280cC0b08024177b837893bcAd3DA)
4648
- [SortitionSumTreeFactory](https://testnet.arbiscan.io/address/0x48ce286978C74c288eA6Bc9a536BcC899DF8D177)
4749

4850
## Contributing

contracts/deploy/00-home-chain-arbitration.ts

+6
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,12 @@ const deployArbitration: DeployFunction = async (hre: HardhatRuntimeEnvironment)
2525
const chainId = Number(await getChainId());
2626
console.log("deploying to %s with deployer %s", HomeChains[chainId], deployer);
2727

28+
await deploy("PolicyRegistry", {
29+
from: deployer,
30+
args: [deployer],
31+
log: true,
32+
});
33+
2834
const rng = await deploy("IncrementalNG", {
2935
from: deployer,
3036
args: [67193503189],
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,208 @@
1+
{
2+
"address": "0xf637A0a4415CCFB97407846486b6be663d3C33ef",
3+
"abi": [
4+
{
5+
"inputs": [
6+
{
7+
"internalType": "address",
8+
"name": "_governor",
9+
"type": "address"
10+
}
11+
],
12+
"stateMutability": "nonpayable",
13+
"type": "constructor"
14+
},
15+
{
16+
"anonymous": false,
17+
"inputs": [
18+
{
19+
"indexed": true,
20+
"internalType": "uint256",
21+
"name": "_subcourtID",
22+
"type": "uint256"
23+
},
24+
{
25+
"indexed": false,
26+
"internalType": "string",
27+
"name": "_policy",
28+
"type": "string"
29+
}
30+
],
31+
"name": "PolicyUpdate",
32+
"type": "event"
33+
},
34+
{
35+
"inputs": [
36+
{
37+
"internalType": "address",
38+
"name": "_governor",
39+
"type": "address"
40+
}
41+
],
42+
"name": "changeGovernor",
43+
"outputs": [],
44+
"stateMutability": "nonpayable",
45+
"type": "function"
46+
},
47+
{
48+
"inputs": [],
49+
"name": "governor",
50+
"outputs": [
51+
{
52+
"internalType": "address",
53+
"name": "",
54+
"type": "address"
55+
}
56+
],
57+
"stateMutability": "view",
58+
"type": "function"
59+
},
60+
{
61+
"inputs": [
62+
{
63+
"internalType": "uint256",
64+
"name": "",
65+
"type": "uint256"
66+
}
67+
],
68+
"name": "policies",
69+
"outputs": [
70+
{
71+
"internalType": "string",
72+
"name": "",
73+
"type": "string"
74+
}
75+
],
76+
"stateMutability": "view",
77+
"type": "function"
78+
},
79+
{
80+
"inputs": [
81+
{
82+
"internalType": "uint256",
83+
"name": "_subcourtID",
84+
"type": "uint256"
85+
},
86+
{
87+
"internalType": "string",
88+
"name": "_policy",
89+
"type": "string"
90+
}
91+
],
92+
"name": "setPolicy",
93+
"outputs": [],
94+
"stateMutability": "nonpayable",
95+
"type": "function"
96+
}
97+
],
98+
"transactionHash": "0x7d2432f632f6cc67631b815b1e302c7ace8ae32474334c9b86b04c0cf473e06b",
99+
"receipt": {
100+
"to": null,
101+
"from": "0xF50E77f2A2B6138D16c6c7511562E5C33c4B15A3",
102+
"contractAddress": "0xf637A0a4415CCFB97407846486b6be663d3C33ef",
103+
"transactionIndex": 1,
104+
"gasUsed": "377115",
105+
"logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
106+
"blockHash": "0x0f23d1869698403901179289154fcd74c5c80024ed024876ff56edb765b32d84",
107+
"transactionHash": "0x7d2432f632f6cc67631b815b1e302c7ace8ae32474334c9b86b04c0cf473e06b",
108+
"logs": [],
109+
"blockNumber": 246010,
110+
"cumulativeGasUsed": "377115",
111+
"status": 1,
112+
"byzantium": true
113+
},
114+
"args": [
115+
"0xF50E77f2A2B6138D16c6c7511562E5C33c4B15A3"
116+
],
117+
"numDeployments": 1,
118+
"solcInputHash": "c8bb8c3f437d0a05adb8cac05ba37521",
119+
"metadata": "{\"compiler\":{\"version\":\"0.8.9+commit.e5eed63a\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_governor\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_subcourtID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"_policy\",\"type\":\"string\"}],\"name\":\"PolicyUpdate\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_governor\",\"type\":\"address\"}],\"name\":\"changeGovernor\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"governor\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"policies\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_subcourtID\",\"type\":\"uint256\"},{\"internalType\":\"string\",\"name\":\"_policy\",\"type\":\"string\"}],\"name\":\"setPolicy\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"author\":\"Enrique Piqueras - <[email protected]>\",\"details\":\"A contract to maintain a policy for each subcourt.\",\"events\":{\"PolicyUpdate(uint256,string)\":{\"details\":\"Emitted when a policy is updated.\",\"params\":{\"_policy\":\"The URI of the policy JSON.\",\"_subcourtID\":\"The ID of the policy's subcourt.\"}}},\"kind\":\"dev\",\"methods\":{\"changeGovernor(address)\":{\"details\":\"Changes the `governor` storage variable.\",\"params\":{\"_governor\":\"The new value for the `governor` storage variable.\"}},\"constructor\":{\"details\":\"Constructs the `PolicyRegistry` contract.\",\"params\":{\"_governor\":\"The governor's address.\"}},\"setPolicy(uint256,string)\":{\"details\":\"Sets the policy for the specified subcourt.\",\"params\":{\"_policy\":\"The URI of the policy JSON.\",\"_subcourtID\":\"The ID of the specified subcourt.\"}}},\"title\":\"PolicyRegistry\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"src/arbitration/PolicyRegistry.sol\":\"PolicyRegistry\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"src/arbitration/PolicyRegistry.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8;\\n\\n/**\\n * @title PolicyRegistry\\n * @author Enrique Piqueras - <[email protected]>\\n * @dev A contract to maintain a policy for each subcourt.\\n */\\ncontract PolicyRegistry {\\n \\n // ************************************* //\\n // * Events * //\\n // ************************************* //\\n\\n /** \\n * @dev Emitted when a policy is updated.\\n * @param _subcourtID The ID of the policy's subcourt.\\n * @param _policy The URI of the policy JSON.\\n */\\n event PolicyUpdate(uint indexed _subcourtID, string _policy);\\n\\n // ************************************* //\\n // * Storage * //\\n // ************************************* //\\n\\n address public governor;\\n mapping(uint => string) public policies;\\n\\n // ************************************* //\\n // * Function Modifiers * //\\n // ************************************* //\\n\\n /**\\n * @dev Requires that the sender is the governor.\\n */ \\n modifier onlyByGovernor() {\\n require(governor == msg.sender, \\\"No allowed: governor only\\\"); \\n _;\\n }\\n\\n // ************************************* //\\n // * Constructor * //\\n // ************************************* //\\n\\n /** @dev Constructs the `PolicyRegistry` contract.\\n * @param _governor The governor's address.\\n */\\n constructor(address _governor) {\\n governor = _governor;\\n }\\n\\n // ************************************* //\\n // * Governance * //\\n // ************************************* //\\n\\n /**\\n * @dev Changes the `governor` storage variable.\\n * @param _governor The new value for the `governor` storage variable.\\n */\\n function changeGovernor(address _governor) external onlyByGovernor {\\n governor = _governor;\\n }\\n\\n // ************************************* //\\n // * State Modifiers * //\\n // ************************************* //\\n\\n /**\\n * @dev Sets the policy for the specified subcourt.\\n * @param _subcourtID The ID of the specified subcourt.\\n * @param _policy The URI of the policy JSON.\\n */\\n function setPolicy(uint _subcourtID, string calldata _policy) external onlyByGovernor {\\n policies[_subcourtID] = _policy;\\n emit PolicyUpdate(_subcourtID, policies[_subcourtID]);\\n }\\n}\",\"keccak256\":\"0x224176fa133ecf1ff7aed4d24b78f90510e097df35853c6af5d12316d24236e0\",\"license\":\"MIT\"}},\"version\":1}",
120+
"bytecode": "0x608060405234801561001057600080fd5b506040516105fe3803806105fe83398101604081905261002f91610054565b600080546001600160a01b0319166001600160a01b0392909216919091179055610084565b60006020828403121561006657600080fd5b81516001600160a01b038116811461007d57600080fd5b9392505050565b61056b806100936000396000f3fe608060405234801561001057600080fd5b506004361061004c5760003560e01c80630c340a2414610051578063d3e8948314610081578063e4c0aaf4146100a1578063f00adf5e146100b6575b600080fd5b600054610064906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b61009461008f366004610338565b6100c9565b6040516100789190610351565b6100b46100af3660046103a6565b610163565b005b6100b46100c43660046103d6565b6101e0565b600160205260009081526040902080546100e290610452565b80601f016020809104026020016040519081016040528092919081815260200182805461010e90610452565b801561015b5780601f106101305761010080835404028352916020019161015b565b820191906000526020600020905b81548152906001019060200180831161013e57829003601f168201915b505050505081565b6000546001600160a01b031633146101be5760405162461bcd60e51b81526020600482015260196024820152784e6f20616c6c6f7765643a20676f7665726e6f72206f6e6c7960381b60448201526064015b60405180910390fd5b600080546001600160a01b0319166001600160a01b0392909216919091179055565b6000546001600160a01b031633146102365760405162461bcd60e51b81526020600482015260196024820152784e6f20616c6c6f7765643a20676f7665726e6f72206f6e6c7960381b60448201526064016101b5565b600083815260016020526040902061024f90838361029f565b50827f6363e8b93c0bbb112f6247819a99f3c99f4a3e0f8e119a64e5ceb6edb9b3cc7b60016000868152602001908152602001600020604051610292919061048d565b60405180910390a2505050565b8280546102ab90610452565b90600052602060002090601f0160209004810192826102cd5760008555610313565b82601f106102e65782800160ff19823516178555610313565b82800160010185558215610313579182015b828111156103135782358255916020019190600101906102f8565b5061031f929150610323565b5090565b5b8082111561031f5760008155600101610324565b60006020828403121561034a57600080fd5b5035919050565b600060208083528351808285015260005b8181101561037e57858101830151858201604001528201610362565b81811115610390576000604083870101525b50601f01601f1916929092016040019392505050565b6000602082840312156103b857600080fd5b81356001600160a01b03811681146103cf57600080fd5b9392505050565b6000806000604084860312156103eb57600080fd5b83359250602084013567ffffffffffffffff8082111561040a57600080fd5b818601915086601f83011261041e57600080fd5b81358181111561042d57600080fd5b87602082850101111561043f57600080fd5b6020830194508093505050509250925092565b600181811c9082168061046657607f821691505b6020821081141561048757634e487b7160e01b600052602260045260246000fd5b50919050565b600060208083526000845481600182811c9150808316806104af57607f831692505b8583108114156104cd57634e487b7160e01b85526022600452602485fd5b8786018381526020018180156104ea57600181146104fb57610526565b60ff19861682528782019650610526565b60008b81526020902060005b8681101561052057815484820152908501908901610507565b83019750505b5094999850505050505050505056fea26469706673582212200c1103223f1ae8d623c1720f16b59b98b5d08187d8ac12e3332e184f6d0beead64736f6c63430008090033",
121+
"deployedBytecode": "0x608060405234801561001057600080fd5b506004361061004c5760003560e01c80630c340a2414610051578063d3e8948314610081578063e4c0aaf4146100a1578063f00adf5e146100b6575b600080fd5b600054610064906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b61009461008f366004610338565b6100c9565b6040516100789190610351565b6100b46100af3660046103a6565b610163565b005b6100b46100c43660046103d6565b6101e0565b600160205260009081526040902080546100e290610452565b80601f016020809104026020016040519081016040528092919081815260200182805461010e90610452565b801561015b5780601f106101305761010080835404028352916020019161015b565b820191906000526020600020905b81548152906001019060200180831161013e57829003601f168201915b505050505081565b6000546001600160a01b031633146101be5760405162461bcd60e51b81526020600482015260196024820152784e6f20616c6c6f7765643a20676f7665726e6f72206f6e6c7960381b60448201526064015b60405180910390fd5b600080546001600160a01b0319166001600160a01b0392909216919091179055565b6000546001600160a01b031633146102365760405162461bcd60e51b81526020600482015260196024820152784e6f20616c6c6f7765643a20676f7665726e6f72206f6e6c7960381b60448201526064016101b5565b600083815260016020526040902061024f90838361029f565b50827f6363e8b93c0bbb112f6247819a99f3c99f4a3e0f8e119a64e5ceb6edb9b3cc7b60016000868152602001908152602001600020604051610292919061048d565b60405180910390a2505050565b8280546102ab90610452565b90600052602060002090601f0160209004810192826102cd5760008555610313565b82601f106102e65782800160ff19823516178555610313565b82800160010185558215610313579182015b828111156103135782358255916020019190600101906102f8565b5061031f929150610323565b5090565b5b8082111561031f5760008155600101610324565b60006020828403121561034a57600080fd5b5035919050565b600060208083528351808285015260005b8181101561037e57858101830151858201604001528201610362565b81811115610390576000604083870101525b50601f01601f1916929092016040019392505050565b6000602082840312156103b857600080fd5b81356001600160a01b03811681146103cf57600080fd5b9392505050565b6000806000604084860312156103eb57600080fd5b83359250602084013567ffffffffffffffff8082111561040a57600080fd5b818601915086601f83011261041e57600080fd5b81358181111561042d57600080fd5b87602082850101111561043f57600080fd5b6020830194508093505050509250925092565b600181811c9082168061046657607f821691505b6020821081141561048757634e487b7160e01b600052602260045260246000fd5b50919050565b600060208083526000845481600182811c9150808316806104af57607f831692505b8583108114156104cd57634e487b7160e01b85526022600452602485fd5b8786018381526020018180156104ea57600181146104fb57610526565b60ff19861682528782019650610526565b60008b81526020902060005b8681101561052057815484820152908501908901610507565b83019750505b5094999850505050505050505056fea26469706673582212200c1103223f1ae8d623c1720f16b59b98b5d08187d8ac12e3332e184f6d0beead64736f6c63430008090033",
122+
"devdoc": {
123+
"author": "Enrique Piqueras - <[email protected]>",
124+
"details": "A contract to maintain a policy for each subcourt.",
125+
"events": {
126+
"PolicyUpdate(uint256,string)": {
127+
"details": "Emitted when a policy is updated.",
128+
"params": {
129+
"_policy": "The URI of the policy JSON.",
130+
"_subcourtID": "The ID of the policy's subcourt."
131+
}
132+
}
133+
},
134+
"kind": "dev",
135+
"methods": {
136+
"changeGovernor(address)": {
137+
"details": "Changes the `governor` storage variable.",
138+
"params": {
139+
"_governor": "The new value for the `governor` storage variable."
140+
}
141+
},
142+
"constructor": {
143+
"details": "Constructs the `PolicyRegistry` contract.",
144+
"params": {
145+
"_governor": "The governor's address."
146+
}
147+
},
148+
"setPolicy(uint256,string)": {
149+
"details": "Sets the policy for the specified subcourt.",
150+
"params": {
151+
"_policy": "The URI of the policy JSON.",
152+
"_subcourtID": "The ID of the specified subcourt."
153+
}
154+
}
155+
},
156+
"title": "PolicyRegistry",
157+
"version": 1
158+
},
159+
"userdoc": {
160+
"kind": "user",
161+
"methods": {},
162+
"version": 1
163+
},
164+
"storageLayout": {
165+
"storage": [
166+
{
167+
"astId": 11,
168+
"contract": "src/arbitration/PolicyRegistry.sol:PolicyRegistry",
169+
"label": "governor",
170+
"offset": 0,
171+
"slot": "0",
172+
"type": "t_address"
173+
},
174+
{
175+
"astId": 15,
176+
"contract": "src/arbitration/PolicyRegistry.sol:PolicyRegistry",
177+
"label": "policies",
178+
"offset": 0,
179+
"slot": "1",
180+
"type": "t_mapping(t_uint256,t_string_storage)"
181+
}
182+
],
183+
"types": {
184+
"t_address": {
185+
"encoding": "inplace",
186+
"label": "address",
187+
"numberOfBytes": "20"
188+
},
189+
"t_mapping(t_uint256,t_string_storage)": {
190+
"encoding": "mapping",
191+
"key": "t_uint256",
192+
"label": "mapping(uint256 => string)",
193+
"numberOfBytes": "32",
194+
"value": "t_string_storage"
195+
},
196+
"t_string_storage": {
197+
"encoding": "bytes",
198+
"label": "string",
199+
"numberOfBytes": "32"
200+
},
201+
"t_uint256": {
202+
"encoding": "inplace",
203+
"label": "uint256",
204+
"numberOfBytes": "32"
205+
}
206+
}
207+
}
208+
}

0 commit comments

Comments
 (0)