Skip to content

Commit b9c4f5a

Browse files
committed
subgraph mapping for universal recipient registry
subgraph mapping for UniversalRecipientRegistry
1 parent 9348e66 commit b9c4f5a

File tree

12 files changed

+1053
-5
lines changed

12 files changed

+1053
-5
lines changed
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
import { ethers } from 'hardhat'
2+
import { UNIT } from '../utils/constants'
3+
import { RecipientRegistryFactory } from '../utils/recipient-registry-factory'
4+
5+
/*
6+
* Deploy a new recipient registry.
7+
* The following environment variables must be set to run the script
8+
*
9+
* RECIPIENT_REGISTRY_TYPE - default is simple, values can be simple, optimistic, universal
10+
* FUNDING_ROUND_FACTORY_ADDRESS - address of the funding round factory
11+
* WALLET_PRIVATE_KEY - private key of the account that will fund this transaction
12+
* JSONRPC_HTTP_URL - URL to connect to the node
13+
*
14+
* For example, to run the script on rinkeby network:
15+
* From the contracts folder:
16+
* npx hardhat run --network rinkeby scripts/deployRecipientRegistry.ts
17+
*
18+
*/
19+
async function main() {
20+
const recipientRegistryType = process.env.RECIPIENT_REGISTRY_TYPE || 'simple'
21+
const fundingRoundFactoryAddress = process.env.FUNDING_ROUND_FACTORY_ADDRESS
22+
const challengePeriodDuration = process.env.CHALLENGE_PERIOD_IN_SECONDS || 300
23+
const baseDeposit = process.env.BASE_DEPOSIT || UNIT.div(10).toString()
24+
25+
if (!fundingRoundFactoryAddress) {
26+
console.log('Environment variable FUNDING_ROUND_FACTORY_ADDRESS not set')
27+
return
28+
}
29+
const fundingRoundFactory = await ethers.getContractAt(
30+
'FundingRoundFactory',
31+
fundingRoundFactoryAddress
32+
)
33+
const factoryOwner = await fundingRoundFactory.owner()
34+
35+
console.log('*******************')
36+
console.log(`Deploying a new ${recipientRegistryType} recipient registry!`)
37+
console.log(` challenge period in seconds: ${challengePeriodDuration}`)
38+
console.log(` baseDeposit ${baseDeposit}`)
39+
console.log(` fundingRoundFactoryAddress ${fundingRoundFactoryAddress}`)
40+
console.log(` fundingRoundFactoryOwner ${factoryOwner}`)
41+
const [deployer] = await ethers.getSigners()
42+
43+
const recipientRegistry = await RecipientRegistryFactory.deploy(
44+
recipientRegistryType,
45+
{
46+
controller: fundingRoundFactory.address,
47+
baseDeposit,
48+
challengePeriodDuration,
49+
},
50+
deployer
51+
)
52+
console.log(` recipientRegistry address: ${recipientRegistry.address}`)
53+
54+
const setRecipientRegistryTx = await fundingRoundFactory.setRecipientRegistry(
55+
recipientRegistry.address
56+
)
57+
58+
await setRecipientRegistryTx.wait()
59+
console.log('*******************')
60+
}
61+
62+
main()
63+
.then(() => process.exit(0))
64+
.catch((error) => {
65+
console.error(error)
66+
process.exit(1)
67+
})
Lines changed: 243 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,243 @@
1+
[
2+
{
3+
"inputs": [
4+
{ "internalType": "uint256", "name": "_baseDeposit", "type": "uint256" },
5+
{
6+
"internalType": "uint256",
7+
"name": "_challengePeriodDuration",
8+
"type": "uint256"
9+
},
10+
{ "internalType": "address", "name": "_controller", "type": "address" }
11+
],
12+
"stateMutability": "nonpayable",
13+
"type": "constructor"
14+
},
15+
{
16+
"anonymous": false,
17+
"inputs": [
18+
{
19+
"indexed": true,
20+
"internalType": "address",
21+
"name": "previousOwner",
22+
"type": "address"
23+
},
24+
{
25+
"indexed": true,
26+
"internalType": "address",
27+
"name": "newOwner",
28+
"type": "address"
29+
}
30+
],
31+
"name": "OwnershipTransferred",
32+
"type": "event"
33+
},
34+
{
35+
"anonymous": false,
36+
"inputs": [
37+
{
38+
"indexed": true,
39+
"internalType": "bytes32",
40+
"name": "_recipientId",
41+
"type": "bytes32"
42+
},
43+
{
44+
"indexed": true,
45+
"internalType": "enum OptimisticRecipientRegistry.RequestType",
46+
"name": "_type",
47+
"type": "uint8"
48+
},
49+
{
50+
"indexed": true,
51+
"internalType": "bool",
52+
"name": "_rejected",
53+
"type": "bool"
54+
},
55+
{
56+
"indexed": false,
57+
"internalType": "uint256",
58+
"name": "_recipientIndex",
59+
"type": "uint256"
60+
},
61+
{
62+
"indexed": false,
63+
"internalType": "uint256",
64+
"name": "_timestamp",
65+
"type": "uint256"
66+
}
67+
],
68+
"name": "RequestResolved",
69+
"type": "event"
70+
},
71+
{
72+
"anonymous": false,
73+
"inputs": [
74+
{
75+
"indexed": true,
76+
"internalType": "bytes32",
77+
"name": "_recipientId",
78+
"type": "bytes32"
79+
},
80+
{
81+
"indexed": true,
82+
"internalType": "enum OptimisticRecipientRegistry.RequestType",
83+
"name": "_type",
84+
"type": "uint8"
85+
},
86+
{
87+
"indexed": false,
88+
"internalType": "address",
89+
"name": "_recipient",
90+
"type": "address"
91+
},
92+
{
93+
"indexed": false,
94+
"internalType": "string",
95+
"name": "_metadataId",
96+
"type": "string"
97+
},
98+
{
99+
"indexed": false,
100+
"internalType": "uint256",
101+
"name": "_timestamp",
102+
"type": "uint256"
103+
}
104+
],
105+
"name": "RequestSubmitted",
106+
"type": "event"
107+
},
108+
{
109+
"inputs": [
110+
{ "internalType": "address", "name": "_recipient", "type": "address" },
111+
{ "internalType": "string", "name": "_metadataId", "type": "string" }
112+
],
113+
"name": "addRecipient",
114+
"outputs": [],
115+
"stateMutability": "payable",
116+
"type": "function"
117+
},
118+
{
119+
"inputs": [],
120+
"name": "baseDeposit",
121+
"outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
122+
"stateMutability": "view",
123+
"type": "function"
124+
},
125+
{
126+
"inputs": [],
127+
"name": "challengePeriodDuration",
128+
"outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
129+
"stateMutability": "view",
130+
"type": "function"
131+
},
132+
{
133+
"inputs": [
134+
{ "internalType": "bytes32", "name": "_recipientId", "type": "bytes32" },
135+
{
136+
"internalType": "address payable",
137+
"name": "_beneficiary",
138+
"type": "address"
139+
}
140+
],
141+
"name": "challengeRequest",
142+
"outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
143+
"stateMutability": "nonpayable",
144+
"type": "function"
145+
},
146+
{
147+
"inputs": [],
148+
"name": "controller",
149+
"outputs": [{ "internalType": "address", "name": "", "type": "address" }],
150+
"stateMutability": "view",
151+
"type": "function"
152+
},
153+
{
154+
"inputs": [
155+
{ "internalType": "bytes32", "name": "_recipientId", "type": "bytes32" }
156+
],
157+
"name": "executeRequest",
158+
"outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
159+
"stateMutability": "nonpayable",
160+
"type": "function"
161+
},
162+
{
163+
"inputs": [
164+
{ "internalType": "uint256", "name": "_index", "type": "uint256" },
165+
{ "internalType": "uint256", "name": "_startTime", "type": "uint256" },
166+
{ "internalType": "uint256", "name": "_endTime", "type": "uint256" }
167+
],
168+
"name": "getRecipientAddress",
169+
"outputs": [{ "internalType": "address", "name": "", "type": "address" }],
170+
"stateMutability": "view",
171+
"type": "function"
172+
},
173+
{
174+
"inputs": [],
175+
"name": "maxRecipients",
176+
"outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
177+
"stateMutability": "view",
178+
"type": "function"
179+
},
180+
{
181+
"inputs": [],
182+
"name": "owner",
183+
"outputs": [{ "internalType": "address", "name": "", "type": "address" }],
184+
"stateMutability": "view",
185+
"type": "function"
186+
},
187+
{
188+
"inputs": [
189+
{ "internalType": "bytes32", "name": "_recipientId", "type": "bytes32" }
190+
],
191+
"name": "removeRecipient",
192+
"outputs": [],
193+
"stateMutability": "payable",
194+
"type": "function"
195+
},
196+
{
197+
"inputs": [],
198+
"name": "renounceOwnership",
199+
"outputs": [],
200+
"stateMutability": "nonpayable",
201+
"type": "function"
202+
},
203+
{
204+
"inputs": [
205+
{ "internalType": "uint256", "name": "_baseDeposit", "type": "uint256" }
206+
],
207+
"name": "setBaseDeposit",
208+
"outputs": [],
209+
"stateMutability": "nonpayable",
210+
"type": "function"
211+
},
212+
{
213+
"inputs": [
214+
{
215+
"internalType": "uint256",
216+
"name": "_challengePeriodDuration",
217+
"type": "uint256"
218+
}
219+
],
220+
"name": "setChallengePeriodDuration",
221+
"outputs": [],
222+
"stateMutability": "nonpayable",
223+
"type": "function"
224+
},
225+
{
226+
"inputs": [
227+
{ "internalType": "uint256", "name": "_maxRecipients", "type": "uint256" }
228+
],
229+
"name": "setMaxRecipients",
230+
"outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
231+
"stateMutability": "nonpayable",
232+
"type": "function"
233+
},
234+
{
235+
"inputs": [
236+
{ "internalType": "address", "name": "newOwner", "type": "address" }
237+
],
238+
"name": "transferOwnership",
239+
"outputs": [],
240+
"stateMutability": "nonpayable",
241+
"type": "function"
242+
}
243+
]

subgraph/config/arbitrum-rinkeby.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@
22
"network": "arbitrum-rinkeby",
33
"address": "0xC032e80a413Be959d9a9B6e5CadE53c870074d37",
44
"factoryStartBlock": 4806990,
5-
"recipientRegistryStartBlock": 4806990
5+
"recipientRegistryStartBlock": 4806990,
6+
"universalRecipientRegistryStartBlock": 4806990
67
}

subgraph/config/arbitrum.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@
22
"network": "arbitrum-one",
33
"address": "0x2e89494a8fE02891511a43f7877b726787E0C160",
44
"factoryStartBlock": 3461582,
5-
"recipientRegistryStartBlock": 3461582
5+
"recipientRegistryStartBlock": 3461582,
6+
"universalRecipientRegistryStartBlock": 3461582
67
}

subgraph/config/hardhat.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@
22
"network": "hardhat",
33
"address": "0x5FC8d32690cc91D4c39d9d3abcBD16989F875707",
44
"factoryStartBlock": 0,
5-
"recipientRegistryStartBlock": 0
5+
"recipientRegistryStartBlock": 0,
6+
"universalRecipientRegistryStartBlock": 0
67
}

subgraph/config/rinkeby.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@
22
"network": "rinkeby",
33
"address": "0x93A990D939Ca592cD8cCa47b7a0c3F590A598F9d",
44
"factoryStartBlock": 9969110,
5-
"recipientRegistryStartBlock": 9969130
5+
"recipientRegistryStartBlock": 9969130,
6+
"universalRecipientRegistryStartBlock": 10255005
67
}

subgraph/config/xdai.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@
22
"network": "xdai",
33
"address": "0x549F91A93c94358C5f5380D7ABF23E1340CfF2db",
44
"factoryStartBlock": 15217676,
5-
"recipientRegistryStartBlock": 0
5+
"recipientRegistryStartBlock": 0,
6+
"universalRecipientRegistryStartBlock": 15217676
67
}

0 commit comments

Comments
 (0)