Skip to content

Commit

Permalink
add optimism-sepolia
Browse files Browse the repository at this point in the history
  • Loading branch information
yuetloo committed Feb 21, 2024
1 parent 4268c4f commit 38d8a47
Show file tree
Hide file tree
Showing 26 changed files with 1,368 additions and 1,070 deletions.
16 changes: 7 additions & 9 deletions .github/workflows/finalize-round.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ name: Finalize a test round
on:
workflow_dispatch:
inputs:
subgraph_name:
description: 'Clrfund subgraph name'
subgraph_id:
description: 'Clrfund subgraph id'
required: true
default: 'clrfund/clrfund-testnet'
default: 'QmfPjzSRsm7Lt665KaEEq6Tnr5QHLZt1SE3pxr2nix5pU2'

env:
NODE_VERSION: 20.x
Expand Down Expand Up @@ -58,12 +58,10 @@ jobs:
yarn && yarn build
- name: Run finalize scripts
run: |
export SUBGRPAH_URL="https://api.thegraph.com/subgraphs/name/${{ github.event.inputs.subgraph_name }}"
echo $SUBGRAPH_URL
export SUBGRAPH_NAME=${{ github.event.inputs.subgraph_name }}
export CHAIN_QUERY=$(node -e 'console.log(`{"query":"{indexingStatusForCurrentVersion(subgraphName: \\\"${process.env.SUBGRAPH_NAME}\\\") { chains { network }}}"}`)')
export CHAIN=$(curl -s -X POST -d "$CHAIN_QUERY" https://api.thegraph.com/index-node/graphql)
export NETWORK=$(node -e 'console.log(JSON.parse(process.env.CHAIN).data.indexingStatusForCurrentVersion.chains[0].network)')
export SUBGRPAH_ID="${{ github.event.inputs.subgraph_id }}"
export SUBGRAPH_QUERY=$(node -e 'console.log(`{"query":"{indexingStatuses(subgraphs: [\\\"${process.env.SUBGRAPH_ID}\\\"]) { chains { network }}}"}`)')
export SUBGRAPH_STATUS=$(curl -s -X POST -d "$SUBGRAPH_QUERY" https://api.thegraph.com/index-node/graphql)
export NETWORK=$(node -e 'console.log(JSON.parse(process.env.SUBGRAPH_STATUS).data.indexingStatuses[0].chains[0].network)')
echo $NETWORK
export ROUND=$(curl -X POST -d '{"query":"{clrFunds {id currentRound {id maci maciTxHash}}}"}' $SUBGRPAH_URL)
export CLRFUND_ADDRESS=$(node -e 'console.log(JSON.parse(process.env.ROUND).data.clrFunds[0].id)')
Expand Down
42 changes: 21 additions & 21 deletions contracts/hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,14 @@ export default {
'https://sepolia-rollup.arbitrum.io/rpc',
accounts,
},
optimism: {
url: process.env.JSONRPC_HTTP_URL || 'https://mainnet.optimism.io',
accounts,
},
'optimism-sepolia': {
url: process.env.JSONRPC_HTTP_URL || 'https://sepolia.optimism.io',
accounts,
},
sepolia: {
url: process.env.JSONRPC_HTTP_URL || 'http://127.0.0.1:8545',
accounts,
Expand All @@ -78,6 +86,8 @@ export default {
arbitrum: process.env.ARBISCAN_API_KEY || 'YOUR_ARBISCAN_API_KEY',
'arbitrum-sepolia':
process.env.ARBISCAN_API_KEY || 'YOUR_ARBISCAN_API_KEY',
'optimism-sepolia':
process.env.OPTIMISMSCAN_API_KEY || 'YOUR_ARBISCAN_API_KEY',
},
customChains: [
{
Expand All @@ -88,6 +98,14 @@ export default {
browserURL: 'https://sepolia.arbiscan.io',
},
},
{
network: 'optimism-sepolia',
chainId: 11155420,
urls: {
apiURL: 'https://api-sepolia-optimistic.etherscan.io/api',
browserURL: 'https://sepolia-optimism.etherscan.io',
},
},
],
},
sourcify: {
Expand Down Expand Up @@ -129,26 +147,8 @@ export default {
},
},
},
'contracts/snarkVerifiers/BatchUpdateStateTreeVerifier32.sol': {
version: '0.6.12',
settings: {
optimizer: {
enabled: true,
runs: 10000000,
},
},
},
'contracts/snarkVerifiers/QuadVoteTallyVerifier32.sol': {
version: '0.6.12',
settings: {
optimizer: {
enabled: true,
runs: 10000000,
},
},
},
'contracts/recipientRegistry/OptimisticRecipientRegistry.sol': {
version: '0.6.12',
version: '0.8.10',
settings: {
optimizer: {
enabled: true,
Expand All @@ -157,7 +157,7 @@ export default {
},
},
'contracts/userRegistry/SimpleUserRegistry.sol': {
version: '0.6.12',
version: '0.8.10',
settings: {
optimizer: {
enabled: true,
Expand All @@ -166,7 +166,7 @@ export default {
},
},
'contracts/userRegistry/BrightIdUserRegistry.sol': {
version: '0.6.12',
version: '0.8.10',
settings: {
optimizer: {
enabled: true,
Expand Down
6 changes: 6 additions & 0 deletions subgraph/config/optimism-sepolia.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"network": "optimism-sepolia",
"address": "0x87790498127fF044f43b9230506833Ca89113757",
"clrFundStartBlock": 8344520,
"recipientRegistryStartBlock": 8344520
}
14 changes: 7 additions & 7 deletions subgraph/generated/ClrFund/BrightIdUserRegistry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
Entity,
Bytes,
Address,
BigInt
BigInt,
} from "@graphprotocol/graph-ts";

export class OwnershipTransferred extends ethereum.Event {
Expand Down Expand Up @@ -103,7 +103,7 @@ export class BrightIdUserRegistry extends ethereum.SmartContract {
let result = super.call(
"brightIdSponsor",
"brightIdSponsor():(address)",
[]
[],
);

return result[0].toAddress();
Expand All @@ -113,7 +113,7 @@ export class BrightIdUserRegistry extends ethereum.SmartContract {
let result = super.tryCall(
"brightIdSponsor",
"brightIdSponsor():(address)",
[]
[],
);
if (result.reverted) {
return new ethereum.CallResult();
Expand Down Expand Up @@ -141,7 +141,7 @@ export class BrightIdUserRegistry extends ethereum.SmartContract {
let result = super.call(
"isVerifiedUser",
"isVerifiedUser(address):(bool)",
[ethereum.Value.fromAddress(_user)]
[ethereum.Value.fromAddress(_user)],
);

return result[0].toBoolean();
Expand All @@ -151,7 +151,7 @@ export class BrightIdUserRegistry extends ethereum.SmartContract {
let result = super.tryCall(
"isVerifiedUser",
"isVerifiedUser(address):(bool)",
[ethereum.Value.fromAddress(_user)]
[ethereum.Value.fromAddress(_user)],
);
if (result.reverted) {
return new ethereum.CallResult();
Expand Down Expand Up @@ -179,7 +179,7 @@ export class BrightIdUserRegistry extends ethereum.SmartContract {
let result = super.call(
"verifications",
"verifications(address):(uint256)",
[ethereum.Value.fromAddress(param0)]
[ethereum.Value.fromAddress(param0)],
);

return result[0].toBigInt();
Expand All @@ -189,7 +189,7 @@ export class BrightIdUserRegistry extends ethereum.SmartContract {
let result = super.tryCall(
"verifications",
"verifications(address):(uint256)",
[ethereum.Value.fromAddress(param0)]
[ethereum.Value.fromAddress(param0)],
);
if (result.reverted) {
return new ethereum.CallResult();
Expand Down
38 changes: 18 additions & 20 deletions subgraph/generated/ClrFund/ClrFund.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
Entity,
Bytes,
Address,
BigInt
BigInt,
} from "@graphprotocol/graph-ts";

export class CoordinatorChanged extends ethereum.Event {
Expand Down Expand Up @@ -278,7 +278,7 @@ export class ClrFund extends ethereum.SmartContract {
let result = super.call(
"MESSAGE_DATA_LENGTH",
"MESSAGE_DATA_LENGTH():(uint8)",
[]
[],
);

return result[0].toI32();
Expand All @@ -288,7 +288,7 @@ export class ClrFund extends ethereum.SmartContract {
let result = super.tryCall(
"MESSAGE_DATA_LENGTH",
"MESSAGE_DATA_LENGTH():(uint8)",
[]
[],
);
if (result.reverted) {
return new ethereum.CallResult();
Expand Down Expand Up @@ -316,22 +316,20 @@ export class ClrFund extends ethereum.SmartContract {
let result = super.call(
"coordinatorPubKey",
"coordinatorPubKey():(uint256,uint256)",
[]
[],
);

return new ClrFund__coordinatorPubKeyResult(
result[0].toBigInt(),
result[1].toBigInt()
result[1].toBigInt(),
);
}

try_coordinatorPubKey(): ethereum.CallResult<
ClrFund__coordinatorPubKeyResult
> {
try_coordinatorPubKey(): ethereum.CallResult<ClrFund__coordinatorPubKeyResult> {
let result = super.tryCall(
"coordinatorPubKey",
"coordinatorPubKey():(uint256,uint256)",
[]
[],
);
if (result.reverted) {
return new ethereum.CallResult();
Expand All @@ -340,16 +338,16 @@ export class ClrFund extends ethereum.SmartContract {
return ethereum.CallResult.fromValue(
new ClrFund__coordinatorPubKeyResult(
value[0].toBigInt(),
value[1].toBigInt()
)
value[1].toBigInt(),
),
);
}

getCurrentRound(): Address {
let result = super.call(
"getCurrentRound",
"getCurrentRound():(address)",
[]
[],
);

return result[0].toAddress();
Expand All @@ -359,7 +357,7 @@ export class ClrFund extends ethereum.SmartContract {
let result = super.tryCall(
"getCurrentRound",
"getCurrentRound():(address)",
[]
[],
);
if (result.reverted) {
return new ethereum.CallResult();
Expand All @@ -372,7 +370,7 @@ export class ClrFund extends ethereum.SmartContract {
let result = super.call(
"getMatchingFunds",
"getMatchingFunds(address):(uint256)",
[ethereum.Value.fromAddress(token)]
[ethereum.Value.fromAddress(token)],
);

return result[0].toBigInt();
Expand All @@ -382,7 +380,7 @@ export class ClrFund extends ethereum.SmartContract {
let result = super.tryCall(
"getMatchingFunds",
"getMatchingFunds(address):(uint256)",
[ethereum.Value.fromAddress(token)]
[ethereum.Value.fromAddress(token)],
);
if (result.reverted) {
return new ethereum.CallResult();
Expand All @@ -395,7 +393,7 @@ export class ClrFund extends ethereum.SmartContract {
let result = super.call(
"getMaxRecipients",
"getMaxRecipients():(uint256)",
[]
[],
);

return result[0].toBigInt();
Expand All @@ -405,7 +403,7 @@ export class ClrFund extends ethereum.SmartContract {
let result = super.tryCall(
"getMaxRecipients",
"getMaxRecipients():(uint256)",
[]
[],
);
if (result.reverted) {
return new ethereum.CallResult();
Expand Down Expand Up @@ -463,7 +461,7 @@ export class ClrFund extends ethereum.SmartContract {
let result = super.call(
"recipientRegistry",
"recipientRegistry():(address)",
[]
[],
);

return result[0].toAddress();
Expand All @@ -473,7 +471,7 @@ export class ClrFund extends ethereum.SmartContract {
let result = super.tryCall(
"recipientRegistry",
"recipientRegistry():(address)",
[]
[],
);
if (result.reverted) {
return new ethereum.CallResult();
Expand Down Expand Up @@ -738,7 +736,7 @@ export class SetCoordinatorCall__Inputs {

get _coordinatorPubKey(): SetCoordinatorCall_coordinatorPubKeyStruct {
return changetype<SetCoordinatorCall_coordinatorPubKeyStruct>(
this._call.inputValues[1].value.toTuple()
this._call.inputValues[1].value.toTuple(),
);
}
}
Expand Down
Loading

0 comments on commit 38d8a47

Please sign in to comment.