Skip to content

Commit

Permalink
Merge pull request #7 from nation3/build/support_sepolia
Browse files Browse the repository at this point in the history
build: support seplia testnet
  • Loading branch information
TTNguyenDev authored Feb 18, 2024
2 parents 9cab13e + 4b11de9 commit 5bbe6bc
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 0 deletions.
12 changes: 12 additions & 0 deletions packages/contracts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ forge test
```

## Deployment
Before deployment, you should specify the ARBITRATION_TOKEN in script/deploy.sol, in this case, we use the $NATION token
```
address ARBITRATION_TOKEN = 0x333A4823466879eeF910A04D473505da62142069; // Mainnet
```

Run the deploy script first to verify that can be broadcasted:
```
Expand All @@ -49,3 +53,11 @@ forge build --force --optimize --optimizer-runs 20000 --build-info --build-info-
jq .input build-info/*.json > inputs.json;
rm -r build-info;
```

Alternatively, we can use the Verify.ts script to verify contracts:
```
ts-node script/Verify.ts
```

You can find constructor arguments on Etherscan
![image](https://github.com/nation3/jurisdiction/assets/42999269/36b465e6-bd92-4f97-a46a-3bffcf032514)
5 changes: 5 additions & 0 deletions packages/contracts/deployments/sepolia.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"ArbitrationToken": "0x23Ca3002706b71a440860E3cf8ff64679A00C9d7",
"Arbitrator": "0xBe67cEdCD1FE38aac8a5781A51250FDeFB344E6C",
"CollateralAgreementFramework": "0xD96aA6e2568f4e9632D2A5234Bb8410ca7609a27"
}
50 changes: 50 additions & 0 deletions packages/contracts/script/Verify.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import { exec } from "child_process";

const verifyArbitrationToken = async (address: string, path: string) => {
exec(
["forge verify-contract", address, path, "--constructor-args", "000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000012000000000000000000000000000000000000000000000000000000000000000b436f75727420546f6b656e00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000024354000000000000000000000000000000000000000000000000000000000000", "--chain-id", 11155111, "--etherscan-api-key", "6EI6Z7T8UAAVRIY8JXRXKVKM5A1WH8PURD"].join(" "),
(error, stdout, stderr) => {
console.log(error)
console.log(stdout)
console.log(stderr)
}
);
}


const verifyArbitrator = async (address: string, path: string) => {
exec(
["forge verify-contract", address, path, "--constructor-args", "000000000000000000000000000000000022d473030f116ddee9f6b43ac78ba30000000000000000000000000c47a93ffca9bc0b116d055f2a062b625481677d", "--chain-id", 11155111, "--etherscan-api-key", "6EI6Z7T8UAAVRIY8JXRXKVKM5A1WH8PURD"].join(" "),
(error, stdout, stderr) => {
console.log(error)
console.log(stdout)
console.log(stderr)
}
);
}
const verifyCollateralAgreementFramework = async (address: string, path: string) => {
exec(
["forge verify-contract", address, path, "--constructor-args", "000000000000000000000000000000000022d473030f116ddee9f6b43ac78ba30000000000000000000000000c47a93ffca9bc0b116d055f2a062b625481677d", "--chain-id", 11155111, "--etherscan-api-key", "6EI6Z7T8UAAVRIY8JXRXKVKM5A1WH8PURD"].join(" "),
(error, stdout, stderr) => {
console.log(error)
console.log(stdout)
console.log(stderr)
}
);
}

// Find these addresses in deployments folder
const arbitrationToken = "0x23Ca3002706b71a440860E3cf8ff64679A00C9d7"
const arbitrator = "0xBe67cEdCD1FE38aac8a5781A51250FDeFB344E6C"
const collateralAgreementFramework = "0xD96aA6e2568f4e9632D2A5234Bb8410ca7609a27"

const main = async () => {
console.log("Contract verification...")
await verifyArbitrationToken(arbitrationToken, "lib/solmate/src/test/utils/mocks/MockERC20.sol:MockERC20")
await verifyArbitrator(arbitrator, "src/Arbitrator.sol:Arbitrator")
await verifyCollateralAgreementFramework(collateralAgreementFramework, "src/frameworks/CollateralAgreement.sol:CollateralAgreement")
}
main().catch((error) => {
console.error(error);
process.exitCode = 1;
});

0 comments on commit 5bbe6bc

Please sign in to comment.