From fe043cd3fcd5db0e1f2270dd7ed19817b84d3151 Mon Sep 17 00:00:00 2001 From: frontier159 <103474701+frontier159@users.noreply.github.com> Date: Fri, 15 Dec 2023 15:47:07 +1100 Subject: [PATCH] feat: nexus on sepolia --- protocol/hardhat.config.ts | 2 +- ...0ACA5d7e58502585F4653BA6330B24170b109Eb.js | 6 ++ ...Ad4Bf5aa9C00eDaa6c8a30c6ac21e5497B6E58f.js | 8 ++ ...3F27cF3329344cF728571826eC844C5518aD679.js | 8 ++ ...69D0CC9E0AD59ee30A53455A2E3957d0ebfFFC7.js | 8 ++ ...5968367a8acBe9ffACA4049E40A4C1F78b18952.js | 5 ++ .../deploys/sepolia/nexus/00-temple-token.ts | 28 +++++++ .../deploys/sepolia/nexus/01-nexus-common.ts | 29 +++++++ .../scripts/deploys/sepolia/nexus/02-relic.ts | 34 ++++++++ .../scripts/deploys/sepolia/nexus/03-shard.ts | 35 ++++++++ .../sepolia/nexus/04-temple-sacrifice.ts | 35 ++++++++ .../sepolia/nexus/05-partner-sacrifice.ts | 33 ++++++++ .../sepolia/nexus/999a-transfer-ownership.ts | 31 +++++++ .../sepolia/nexus/999b-accept-ownership.ts | 28 +++++++ .../nexus/99a-relic-post-deployment.ts | 42 ++++++++++ .../nexus/99b-shard-post-deployment.ts | 46 +++++++++++ .../99c-temple-sacrifice-post-deployment.ts | 33 ++++++++ .../nexus/99d-nexus-common-post-deployment.ts | 38 +++++++++ ...-partner-zero-sacrifice-post-deployment.ts | 27 +++++++ .../sepolia/nexus/contract-addresses.ts | 81 +++++++++++++++++++ 20 files changed, 556 insertions(+), 1 deletion(-) create mode 100644 protocol/scripts/deploys/sepolia/deploymentArgs/0x30ACA5d7e58502585F4653BA6330B24170b109Eb.js create mode 100644 protocol/scripts/deploys/sepolia/deploymentArgs/0x5Ad4Bf5aa9C00eDaa6c8a30c6ac21e5497B6E58f.js create mode 100644 protocol/scripts/deploys/sepolia/deploymentArgs/0x73F27cF3329344cF728571826eC844C5518aD679.js create mode 100644 protocol/scripts/deploys/sepolia/deploymentArgs/0xd69D0CC9E0AD59ee30A53455A2E3957d0ebfFFC7.js create mode 100644 protocol/scripts/deploys/sepolia/deploymentArgs/0xf5968367a8acBe9ffACA4049E40A4C1F78b18952.js create mode 100644 protocol/scripts/deploys/sepolia/nexus/00-temple-token.ts create mode 100644 protocol/scripts/deploys/sepolia/nexus/01-nexus-common.ts create mode 100644 protocol/scripts/deploys/sepolia/nexus/02-relic.ts create mode 100644 protocol/scripts/deploys/sepolia/nexus/03-shard.ts create mode 100644 protocol/scripts/deploys/sepolia/nexus/04-temple-sacrifice.ts create mode 100644 protocol/scripts/deploys/sepolia/nexus/05-partner-sacrifice.ts create mode 100644 protocol/scripts/deploys/sepolia/nexus/999a-transfer-ownership.ts create mode 100644 protocol/scripts/deploys/sepolia/nexus/999b-accept-ownership.ts create mode 100644 protocol/scripts/deploys/sepolia/nexus/99a-relic-post-deployment.ts create mode 100644 protocol/scripts/deploys/sepolia/nexus/99b-shard-post-deployment.ts create mode 100644 protocol/scripts/deploys/sepolia/nexus/99c-temple-sacrifice-post-deployment.ts create mode 100644 protocol/scripts/deploys/sepolia/nexus/99d-nexus-common-post-deployment.ts create mode 100644 protocol/scripts/deploys/sepolia/nexus/99e-partner-zero-sacrifice-post-deployment.ts create mode 100644 protocol/scripts/deploys/sepolia/nexus/contract-addresses.ts diff --git a/protocol/hardhat.config.ts b/protocol/hardhat.config.ts index afa3820a7..7a130ef72 100644 --- a/protocol/hardhat.config.ts +++ b/protocol/hardhat.config.ts @@ -180,7 +180,7 @@ module.exports = { accounts: process.env.SEPOLIA_ADDRESS_PRIVATE_KEY ? [process.env.SEPOLIA_ADDRESS_PRIVATE_KEY] : [], - gasPrice: 2000000000, + gasPrice: parseInt(process.env.SEPOLIA_GAS_IN_GWEI || '0') * 1000000000, }, anvil: { url: "http://127.0.0.1:8545/", diff --git a/protocol/scripts/deploys/sepolia/deploymentArgs/0x30ACA5d7e58502585F4653BA6330B24170b109Eb.js b/protocol/scripts/deploys/sepolia/deploymentArgs/0x30ACA5d7e58502585F4653BA6330B24170b109Eb.js new file mode 100644 index 000000000..9d8bad07d --- /dev/null +++ b/protocol/scripts/deploys/sepolia/deploymentArgs/0x30ACA5d7e58502585F4653BA6330B24170b109Eb.js @@ -0,0 +1,6 @@ +// sepolia: NEXUS.PARTNER_ZERO_SACRIFICE=0x30ACA5d7e58502585F4653BA6330B24170b109Eb +// yarn hardhat verify --network sepolia 0x30ACA5d7e58502585F4653BA6330B24170b109Eb --constructor-args scripts/deploys/sepolia/deploymentArgs/0x30ACA5d7e58502585F4653BA6330B24170b109Eb.js +module.exports = [ + "0x73F27cF3329344cF728571826eC844C5518aD679", + "0x81960c465605cddD9772a8653111D4aBE580Ce1e" +]; \ No newline at end of file diff --git a/protocol/scripts/deploys/sepolia/deploymentArgs/0x5Ad4Bf5aa9C00eDaa6c8a30c6ac21e5497B6E58f.js b/protocol/scripts/deploys/sepolia/deploymentArgs/0x5Ad4Bf5aa9C00eDaa6c8a30c6ac21e5497B6E58f.js new file mode 100644 index 000000000..660630b12 --- /dev/null +++ b/protocol/scripts/deploys/sepolia/deploymentArgs/0x5Ad4Bf5aa9C00eDaa6c8a30c6ac21e5497B6E58f.js @@ -0,0 +1,8 @@ +// sepolia: NEXUS.SHARD=0x5Ad4Bf5aa9C00eDaa6c8a30c6ac21e5497B6E58f +// yarn hardhat verify --network sepolia 0x5Ad4Bf5aa9C00eDaa6c8a30c6ac21e5497B6E58f --constructor-args scripts/deploys/sepolia/deploymentArgs/0x5Ad4Bf5aa9C00eDaa6c8a30c6ac21e5497B6E58f.js +module.exports = [ + "0x73F27cF3329344cF728571826eC844C5518aD679", + "0xf5968367a8acBe9ffACA4049E40A4C1F78b18952", + "0x81960c465605cddD9772a8653111D4aBE580Ce1e", + "ipfs://QmVBhkqq3qEeQvdCDWSXQGMX7hFDymZvy7X7J4z9GsUAB3/" +]; \ No newline at end of file diff --git a/protocol/scripts/deploys/sepolia/deploymentArgs/0x73F27cF3329344cF728571826eC844C5518aD679.js b/protocol/scripts/deploys/sepolia/deploymentArgs/0x73F27cF3329344cF728571826eC844C5518aD679.js new file mode 100644 index 000000000..2b745ccca --- /dev/null +++ b/protocol/scripts/deploys/sepolia/deploymentArgs/0x73F27cF3329344cF728571826eC844C5518aD679.js @@ -0,0 +1,8 @@ +// sepolia: NEXUS.RELIC=0x73F27cF3329344cF728571826eC844C5518aD679 +// yarn hardhat verify --network sepolia 0x73F27cF3329344cF728571826eC844C5518aD679 --constructor-args scripts/deploys/sepolia/deploymentArgs/0x73F27cF3329344cF728571826eC844C5518aD679.js +module.exports = [ + "RELIC", + "REL", + "0xf5968367a8acBe9ffACA4049E40A4C1F78b18952", + "0x81960c465605cddD9772a8653111D4aBE580Ce1e" +]; \ No newline at end of file diff --git a/protocol/scripts/deploys/sepolia/deploymentArgs/0xd69D0CC9E0AD59ee30A53455A2E3957d0ebfFFC7.js b/protocol/scripts/deploys/sepolia/deploymentArgs/0xd69D0CC9E0AD59ee30A53455A2E3957d0ebfFFC7.js new file mode 100644 index 000000000..0f2bb4132 --- /dev/null +++ b/protocol/scripts/deploys/sepolia/deploymentArgs/0xd69D0CC9E0AD59ee30A53455A2E3957d0ebfFFC7.js @@ -0,0 +1,8 @@ +// sepolia: NEXUS.TEMPLE_SACRIFICE=0xd69D0CC9E0AD59ee30A53455A2E3957d0ebfFFC7 +// yarn hardhat verify --network sepolia 0xd69D0CC9E0AD59ee30A53455A2E3957d0ebfFFC7 --constructor-args scripts/deploys/sepolia/deploymentArgs/0xd69D0CC9E0AD59ee30A53455A2E3957d0ebfFFC7.js +module.exports = [ + "0x73F27cF3329344cF728571826eC844C5518aD679", + "0x64a925B0fA211c44337148C0807f959Bd44b0B67", + "0x81960c465605cddD9772a8653111D4aBE580Ce1e", + "0x81960c465605cddD9772a8653111D4aBE580Ce1e" +]; \ No newline at end of file diff --git a/protocol/scripts/deploys/sepolia/deploymentArgs/0xf5968367a8acBe9ffACA4049E40A4C1F78b18952.js b/protocol/scripts/deploys/sepolia/deploymentArgs/0xf5968367a8acBe9ffACA4049E40A4C1F78b18952.js new file mode 100644 index 000000000..c8e6cf64a --- /dev/null +++ b/protocol/scripts/deploys/sepolia/deploymentArgs/0xf5968367a8acBe9ffACA4049E40A4C1F78b18952.js @@ -0,0 +1,5 @@ +// sepolia: NEXUS.NEXUS_COMMON=0xf5968367a8acBe9ffACA4049E40A4C1F78b18952 +// yarn hardhat verify --network sepolia 0xf5968367a8acBe9ffACA4049E40A4C1F78b18952 --constructor-args scripts/deploys/sepolia/deploymentArgs/0xf5968367a8acBe9ffACA4049E40A4C1F78b18952.js +module.exports = [ + "0x81960c465605cddD9772a8653111D4aBE580Ce1e" +]; \ No newline at end of file diff --git a/protocol/scripts/deploys/sepolia/nexus/00-temple-token.ts b/protocol/scripts/deploys/sepolia/nexus/00-temple-token.ts new file mode 100644 index 000000000..a1190694d --- /dev/null +++ b/protocol/scripts/deploys/sepolia/nexus/00-temple-token.ts @@ -0,0 +1,28 @@ +import '@nomiclabs/hardhat-ethers'; +import { ethers } from 'hardhat'; +import { TempleERC20Token__factory } from '../../../../typechain'; +import { + deployAndMine, + ensureExpectedEnvvars, +} from '../../helpers'; + +async function main() { + ensureExpectedEnvvars(); + const [owner] = await ethers.getSigners(); + + const templeFactory = new TempleERC20Token__factory(owner); + await deployAndMine( + 'CORE.TEMPLE_TOKEN', + templeFactory, + templeFactory.deploy, + ); +} + +// We recommend this pattern to be able to use async/await everywhere +// and properly handle errors. +main() + .then(() => process.exit(0)) + .catch(error => { + console.error(error); + process.exit(1); + }); \ No newline at end of file diff --git a/protocol/scripts/deploys/sepolia/nexus/01-nexus-common.ts b/protocol/scripts/deploys/sepolia/nexus/01-nexus-common.ts new file mode 100644 index 000000000..4d83be034 --- /dev/null +++ b/protocol/scripts/deploys/sepolia/nexus/01-nexus-common.ts @@ -0,0 +1,29 @@ +import '@nomiclabs/hardhat-ethers'; +import { ethers } from 'hardhat'; +import { NexusCommon__factory } from '../../../../typechain'; +import { + deployAndMine, + ensureExpectedEnvvars, +} from '../../helpers'; + +async function main() { + ensureExpectedEnvvars(); + const [owner] = await ethers.getSigners(); + + const nexusCommonFactory= new NexusCommon__factory(owner); + await deployAndMine( + 'NEXUS.NEXUS_COMMON', + nexusCommonFactory, + nexusCommonFactory.deploy, + await owner.getAddress() // initial executor + ); +} + +// We recommend this pattern to be able to use async/await everywhere +// and properly handle errors. +main() + .then(() => process.exit(0)) + .catch(error => { + console.error(error); + process.exit(1); + }); \ No newline at end of file diff --git a/protocol/scripts/deploys/sepolia/nexus/02-relic.ts b/protocol/scripts/deploys/sepolia/nexus/02-relic.ts new file mode 100644 index 000000000..129f92c23 --- /dev/null +++ b/protocol/scripts/deploys/sepolia/nexus/02-relic.ts @@ -0,0 +1,34 @@ +import '@nomiclabs/hardhat-ethers'; +import { ethers } from 'hardhat'; +import { Relic__factory } from '../../../../typechain'; +import { + deployAndMine, + ensureExpectedEnvvars, +} from '../../helpers'; +import { getDeployedContracts } from "./contract-addresses"; + +async function main() { + ensureExpectedEnvvars(); + const [owner] = await ethers.getSigners(); + const deployedContracts = getDeployedContracts(); + + const relicFactory= new Relic__factory(owner); + await deployAndMine( + 'NEXUS.RELIC', + relicFactory, + relicFactory.deploy, + "RELIC", + "REL", + deployedContracts.NEXUS.NEXUS_COMMON, + await owner.getAddress() // initial executor + ); +} + +// We recommend this pattern to be able to use async/await everywhere +// and properly handle errors. +main() + .then(() => process.exit(0)) + .catch(error => { + console.error(error); + process.exit(1); + }); \ No newline at end of file diff --git a/protocol/scripts/deploys/sepolia/nexus/03-shard.ts b/protocol/scripts/deploys/sepolia/nexus/03-shard.ts new file mode 100644 index 000000000..1d5663d69 --- /dev/null +++ b/protocol/scripts/deploys/sepolia/nexus/03-shard.ts @@ -0,0 +1,35 @@ +import '@nomiclabs/hardhat-ethers'; +import { ethers } from 'hardhat'; +import { Shard__factory } from '../../../../typechain'; +import { + deployAndMine, + ensureExpectedEnvvars +} from '../../helpers'; +import { getDeployedContracts } from "./contract-addresses"; + +async function main() { + ensureExpectedEnvvars(); + const [owner] = await ethers.getSigners(); + const deployedContracts = getDeployedContracts(); + + const shardFactory = new Shard__factory(owner); + const uri = 'ipfs://QmVBhkqq3qEeQvdCDWSXQGMX7hFDymZvy7X7J4z9GsUAB3/'; + await deployAndMine( + 'NEXUS.SHARD', + shardFactory, + shardFactory.deploy, + deployedContracts.NEXUS.RELIC, + deployedContracts.NEXUS.NEXUS_COMMON, + await owner.getAddress(), // initial executor + uri + ); +} + +// We recommend this pattern to be able to use async/await everywhere +// and properly handle errors. +main() + .then(() => process.exit(0)) + .catch(error => { + console.error(error); + process.exit(1); + }); \ No newline at end of file diff --git a/protocol/scripts/deploys/sepolia/nexus/04-temple-sacrifice.ts b/protocol/scripts/deploys/sepolia/nexus/04-temple-sacrifice.ts new file mode 100644 index 000000000..e92678d97 --- /dev/null +++ b/protocol/scripts/deploys/sepolia/nexus/04-temple-sacrifice.ts @@ -0,0 +1,35 @@ +import '@nomiclabs/hardhat-ethers'; +import { ethers } from 'hardhat'; +import { TempleSacrifice__factory } from '../../../../typechain'; +import { + deployAndMine, + ensureExpectedEnvvars +} from '../../helpers'; +import { getDeployedContracts } from "./contract-addresses"; + +async function main() { + ensureExpectedEnvvars(); + const [owner] = await ethers.getSigners(); + const deployedContracts = getDeployedContracts(); + + const templeSacrifice = new TempleSacrifice__factory(owner); + const executor = await owner.getAddress(); + await deployAndMine( + 'NEXUS.TEMPLE_SACRIFICE', + templeSacrifice, + templeSacrifice.deploy, + deployedContracts.NEXUS.RELIC, + deployedContracts.CORE.TEMPLE_TOKEN, + executor, // sacrificed token recipient + executor // initial executor + ); +} + +// We recommend this pattern to be able to use async/await everywhere +// and properly handle errors. +main() + .then(() => process.exit(0)) + .catch(error => { + console.error(error); + process.exit(1); + }); \ No newline at end of file diff --git a/protocol/scripts/deploys/sepolia/nexus/05-partner-sacrifice.ts b/protocol/scripts/deploys/sepolia/nexus/05-partner-sacrifice.ts new file mode 100644 index 000000000..69b828924 --- /dev/null +++ b/protocol/scripts/deploys/sepolia/nexus/05-partner-sacrifice.ts @@ -0,0 +1,33 @@ +import '@nomiclabs/hardhat-ethers'; +import { ethers } from 'hardhat'; +import { PartnerZeroSacrifice__factory } from '../../../../typechain'; +import { + deployAndMine, + ensureExpectedEnvvars +} from '../../helpers'; +import { getDeployedContracts } from "./contract-addresses"; + +async function main() { + ensureExpectedEnvvars(); + const [owner] = await ethers.getSigners(); + const deployedContracts = getDeployedContracts(); + + const partnerSacrifice = new PartnerZeroSacrifice__factory(owner); + const executor = await owner.getAddress(); + await deployAndMine( + 'NEXUS.PARTNER_ZERO_SACRIFICE', + partnerSacrifice, + partnerSacrifice.deploy, + deployedContracts.NEXUS.RELIC, + executor + ); +} + +// We recommend this pattern to be able to use async/await everywhere +// and properly handle errors. +main() + .then(() => process.exit(0)) + .catch(error => { + console.error(error); + process.exit(1); + }); \ No newline at end of file diff --git a/protocol/scripts/deploys/sepolia/nexus/999a-transfer-ownership.ts b/protocol/scripts/deploys/sepolia/nexus/999a-transfer-ownership.ts new file mode 100644 index 000000000..0fc2e934c --- /dev/null +++ b/protocol/scripts/deploys/sepolia/nexus/999a-transfer-ownership.ts @@ -0,0 +1,31 @@ +import { ethers } from 'hardhat'; +import { + ensureExpectedEnvvars, + mine +} from '../../helpers'; +import { connectToContracts, getDeployedContracts } from './contract-addresses'; + +async function main() { + ensureExpectedEnvvars(); + + const [owner] = await ethers.getSigners(); + const multisig = getDeployedContracts().CORE.CORE_MULTISIG; + const deployedContracts = connectToContracts(owner); + + await mine(deployedContracts.CORE.TEMPLE_TOKEN.transferOwnership(multisig)); + + await mine(deployedContracts.NEXUS.NEXUS_COMMON.proposeNewExecutor(multisig)); + await mine(deployedContracts.NEXUS.RELIC.proposeNewExecutor(multisig)); + await mine(deployedContracts.NEXUS.SHARD.proposeNewExecutor(multisig)); + await mine(deployedContracts.NEXUS.TEMPLE_SACRIFICE.proposeNewExecutor(multisig)); + await mine(deployedContracts.NEXUS.PARTNER_ZERO_SACRIFICE.proposeNewExecutor(multisig)); +} + +// We recommend this pattern to be able to use async/await everywhere +// and properly handle errors. +main() + .then(() => process.exit(0)) + .catch(error => { + console.error(error); + process.exit(1); + }); \ No newline at end of file diff --git a/protocol/scripts/deploys/sepolia/nexus/999b-accept-ownership.ts b/protocol/scripts/deploys/sepolia/nexus/999b-accept-ownership.ts new file mode 100644 index 000000000..de8eb7dce --- /dev/null +++ b/protocol/scripts/deploys/sepolia/nexus/999b-accept-ownership.ts @@ -0,0 +1,28 @@ +import { ethers } from 'hardhat'; +import { + ensureExpectedEnvvars, + mine +} from '../../helpers'; +import { connectToContracts } from './contract-addresses'; + +async function main() { + ensureExpectedEnvvars(); + + const [owner] = await ethers.getSigners(); + const deployedContracts = connectToContracts(owner); + + await mine(deployedContracts.NEXUS.NEXUS_COMMON.acceptExecutor()); + await mine(deployedContracts.NEXUS.RELIC.acceptExecutor()); + await mine(deployedContracts.NEXUS.SHARD.acceptExecutor()); + await mine(deployedContracts.NEXUS.TEMPLE_SACRIFICE.acceptExecutor()); + await mine(deployedContracts.NEXUS.PARTNER_ZERO_SACRIFICE.acceptExecutor()); +} + +// We recommend this pattern to be able to use async/await everywhere +// and properly handle errors. +main() + .then(() => process.exit(0)) + .catch(error => { + console.error(error); + process.exit(1); + }); \ No newline at end of file diff --git a/protocol/scripts/deploys/sepolia/nexus/99a-relic-post-deployment.ts b/protocol/scripts/deploys/sepolia/nexus/99a-relic-post-deployment.ts new file mode 100644 index 000000000..06cd4b339 --- /dev/null +++ b/protocol/scripts/deploys/sepolia/nexus/99a-relic-post-deployment.ts @@ -0,0 +1,42 @@ +import { ethers } from 'hardhat'; +import { + ensureExpectedEnvvars, + mine +} from '../../helpers'; +import { connectToContracts } from './contract-addresses'; + +async function main() { + ensureExpectedEnvvars(); + + const [owner] = await ethers.getSigners(); + const deployedContracts = connectToContracts(owner); + const relic = deployedContracts.NEXUS.RELIC; + const temple = deployedContracts.CORE.TEMPLE_TOKEN; + + const ownerAddress = await owner.getAddress(); + + // set shard + await mine(relic.setShard(deployedContracts.NEXUS.SHARD.address)); + await mine(relic.setNexusCommon(deployedContracts.NEXUS.NEXUS_COMMON.address)); + + // set Relic minter enclave IDs + const enclaveIds = [1, 2, 3, 4, 5]; + const allow = [true, true, true, true, true]; + await mine(relic.setRelicMinterEnclaveIds(deployedContracts.NEXUS.TEMPLE_SACRIFICE.address, enclaveIds, allow)); + const zeroRarityUri = "ipfs://QmVBhkqq3qEeQvdCDWSXQGMX7hFDymZvy7X7J4z9GsUAB3/"; + await mine(relic.setBaseUriRarity(0, zeroRarityUri)); + + // TESTNET ONLY -- Allow owner to mint Testnet Temple + { + await mine(temple.addMinter(ownerAddress)); + } +} + +// We recommend this pattern to be able to use async/await everywhere +// and properly handle errors. +main() + .then(() => process.exit(0)) + .catch(error => { + console.error(error); + process.exit(1); + }); \ No newline at end of file diff --git a/protocol/scripts/deploys/sepolia/nexus/99b-shard-post-deployment.ts b/protocol/scripts/deploys/sepolia/nexus/99b-shard-post-deployment.ts new file mode 100644 index 000000000..0f2b6df58 --- /dev/null +++ b/protocol/scripts/deploys/sepolia/nexus/99b-shard-post-deployment.ts @@ -0,0 +1,46 @@ +import { ethers } from 'hardhat'; +import { + ensureExpectedEnvvars, + mine +} from '../../helpers'; +import { connectToContracts } from './contract-addresses'; + +async function main() { + ensureExpectedEnvvars(); + + const [owner] = await ethers.getSigners(); + const deployedContracts = connectToContracts(owner); + + const shardId1 = 1; + const shardId2 = 2; + const shardId3 = 3; + + const shard = deployedContracts.NEXUS.SHARD; + + await mine(shard.setNexusCommon(deployedContracts.NEXUS.NEXUS_COMMON.address)); + const ownerAddress = await owner.getAddress(); + const minters = [ownerAddress, ownerAddress, ownerAddress, ownerAddress, ownerAddress] + await mine(shard.setNewMinterShards(minters)); + + // recipe + { + const recipe = { + inputShardIds: [shardId1, shardId2], + inputShardAmounts: [2, 1], + outputShardIds: [shardId3], + outputShardAmounts: [1] + }; + await mine(shard.addRecipe(recipe)); + } + const shard1Uri = 'http://www.example.com/1'; + await mine(shard.setShardUri(shardId1, shard1Uri)); +} + +// We recommend this pattern to be able to use async/await everywhere +// and properly handle errors. +main() + .then(() => process.exit(0)) + .catch(error => { + console.error(error); + process.exit(1); + }); \ No newline at end of file diff --git a/protocol/scripts/deploys/sepolia/nexus/99c-temple-sacrifice-post-deployment.ts b/protocol/scripts/deploys/sepolia/nexus/99c-temple-sacrifice-post-deployment.ts new file mode 100644 index 000000000..f8696562a --- /dev/null +++ b/protocol/scripts/deploys/sepolia/nexus/99c-temple-sacrifice-post-deployment.ts @@ -0,0 +1,33 @@ +import { ethers } from 'hardhat'; +import { + blockTimestamp, + ensureExpectedEnvvars, + mine, + toAtto +} from '../../helpers'; +import { connectToContracts } from './contract-addresses'; + +async function main() { + ensureExpectedEnvvars(); + + const [owner] = await ethers.getSigners(); + const deployedContracts = connectToContracts(owner); + const templeSacrifice = deployedContracts.NEXUS.TEMPLE_SACRIFICE; + + await mine(templeSacrifice.setOriginTime(await blockTimestamp() + 360)); + const priceParams = { + priceMaxPeriod: 1732125018, + minimumPrice: toAtto(30), + maximumPrice: toAtto(100) + } + await mine(templeSacrifice.setPriceParams(priceParams)); +} + +// We recommend this pattern to be able to use async/await everywhere +// and properly handle errors. +main() + .then(() => process.exit(0)) + .catch(error => { + console.error(error); + process.exit(1); + }); \ No newline at end of file diff --git a/protocol/scripts/deploys/sepolia/nexus/99d-nexus-common-post-deployment.ts b/protocol/scripts/deploys/sepolia/nexus/99d-nexus-common-post-deployment.ts new file mode 100644 index 000000000..1c5c430b1 --- /dev/null +++ b/protocol/scripts/deploys/sepolia/nexus/99d-nexus-common-post-deployment.ts @@ -0,0 +1,38 @@ +import { ethers } from 'hardhat'; +import { + ensureExpectedEnvvars, + mine +} from '../../helpers'; +import { connectToContracts } from './contract-addresses'; + +async function main() { + ensureExpectedEnvvars(); + + const [owner] = await ethers.getSigners(); + const deployedContracts = connectToContracts(owner); + const nexusCommon = deployedContracts.NEXUS.NEXUS_COMMON; + + // set shard + await mine(nexusCommon.setShard(deployedContracts.NEXUS.SHARD.address)); + // enclave names + await mine(nexusCommon.setEnclaveName(1, "CHAOS")); + await mine(nexusCommon.setEnclaveName(2, "ORDER")); + await mine(nexusCommon.setEnclaveName(3, "LOGIC")); + await mine(nexusCommon.setEnclaveName(4, "STRUCTURE")); + await mine(nexusCommon.setEnclaveName(5, "MYSTERY")); + // shard enclave Ids + await mine(nexusCommon.setShardEnclave(1, 1)); + await mine(nexusCommon.setShardEnclave(2, 2)); + await mine(nexusCommon.setShardEnclave(3, 3)); + await mine(nexusCommon.setShardEnclave(4, 4)); + await mine(nexusCommon.setShardEnclave(5, 5)); +} + +// We recommend this pattern to be able to use async/await everywhere +// and properly handle errors. +main() + .then(() => process.exit(0)) + .catch(error => { + console.error(error); + process.exit(1); + }); \ No newline at end of file diff --git a/protocol/scripts/deploys/sepolia/nexus/99e-partner-zero-sacrifice-post-deployment.ts b/protocol/scripts/deploys/sepolia/nexus/99e-partner-zero-sacrifice-post-deployment.ts new file mode 100644 index 000000000..2a7021667 --- /dev/null +++ b/protocol/scripts/deploys/sepolia/nexus/99e-partner-zero-sacrifice-post-deployment.ts @@ -0,0 +1,27 @@ +import { ethers } from 'hardhat'; +import { + blockTimestamp, + ensureExpectedEnvvars, + mine +} from '../../helpers'; +import { connectToContracts } from './contract-addresses'; + +async function main() { + ensureExpectedEnvvars(); + + const [owner] = await ethers.getSigners(); + const deployedContracts = connectToContracts(owner); + const partnerSacrifice = deployedContracts.NEXUS.PARTNER_ZERO_SACRIFICE; + + // for tesnet, use close time to enable sacrifice immediately. here 360 seconds from now + await mine(partnerSacrifice.setOriginTime(await blockTimestamp() + 360)); +} + +// We recommend this pattern to be able to use async/await everywhere +// and properly handle errors. +main() + .then(() => process.exit(0)) + .catch(error => { + console.error(error); + process.exit(1); + }); \ No newline at end of file diff --git a/protocol/scripts/deploys/sepolia/nexus/contract-addresses.ts b/protocol/scripts/deploys/sepolia/nexus/contract-addresses.ts new file mode 100644 index 000000000..ee3aaa14f --- /dev/null +++ b/protocol/scripts/deploys/sepolia/nexus/contract-addresses.ts @@ -0,0 +1,81 @@ +import { network } from "hardhat"; +import { + NexusCommon, NexusCommon__factory, + PartnerZeroSacrifice, PartnerZeroSacrifice__factory, + Relic, Relic__factory, + Shard, Shard__factory, + TempleERC20Token, TempleERC20Token__factory, + TempleSacrifice, TempleSacrifice__factory +} from '../../../../typechain'; +import { Signer } from "ethers"; + +export interface ContractAddresses { + CORE: { + TEMPLE_TOKEN: string, + CORE_MULTISIG: string, + }, + + NEXUS: { + NEXUS_COMMON: string, + RELIC: string, + SHARD: string, + TEMPLE_SACRIFICE: string, + PARTNER_ZERO_SACRIFICE: string, + } +} + +const NEXUS_DEPLOYED_CONTRACTS: {[key: string]: ContractAddresses} = { + sepolia: { + CORE: { + TEMPLE_TOKEN: '0x64a925B0fA211c44337148C0807f959Bd44b0B67', + CORE_MULTISIG: '0x81960c465605cddD9772a8653111D4aBE580Ce1e', + }, + NEXUS: { + NEXUS_COMMON: '0xf5968367a8acBe9ffACA4049E40A4C1F78b18952', + RELIC: '0x73F27cF3329344cF728571826eC844C5518aD679', + SHARD: '0x5Ad4Bf5aa9C00eDaa6c8a30c6ac21e5497B6E58f', + TEMPLE_SACRIFICE: '0xd69D0CC9E0AD59ee30A53455A2E3957d0ebfFFC7', + PARTNER_ZERO_SACRIFICE: '0x30ACA5d7e58502585F4653BA6330B24170b109Eb', + } + }, +} + +export function getDeployedContracts(): ContractAddresses { + if (NEXUS_DEPLOYED_CONTRACTS[network.name] === undefined) { + console.log(`No contracts configured for ${network.name}`); + throw new Error(`No contracts configured for ${network.name}`); + } else { + return NEXUS_DEPLOYED_CONTRACTS[network.name]; + } +} + +export interface ContractInstances { + CORE: { + TEMPLE_TOKEN: TempleERC20Token, + }, + + NEXUS: { + NEXUS_COMMON: NexusCommon, + RELIC: Relic, + SHARD: Shard, + TEMPLE_SACRIFICE: TempleSacrifice, + PARTNER_ZERO_SACRIFICE: PartnerZeroSacrifice, + }, +} + +export function connectToContracts(owner: Signer): ContractInstances { + const CORE_ADDRESSES = getDeployedContracts(); + + return { + CORE: { + TEMPLE_TOKEN: TempleERC20Token__factory.connect(CORE_ADDRESSES.CORE.TEMPLE_TOKEN, owner), + }, + NEXUS: { + NEXUS_COMMON: NexusCommon__factory.connect(CORE_ADDRESSES.NEXUS.NEXUS_COMMON, owner), + RELIC: Relic__factory.connect(CORE_ADDRESSES.NEXUS.RELIC, owner), + SHARD: Shard__factory.connect(CORE_ADDRESSES.NEXUS.SHARD, owner), + TEMPLE_SACRIFICE: TempleSacrifice__factory.connect(CORE_ADDRESSES.NEXUS.TEMPLE_SACRIFICE, owner), + PARTNER_ZERO_SACRIFICE: PartnerZeroSacrifice__factory.connect(CORE_ADDRESSES.NEXUS.PARTNER_ZERO_SACRIFICE, owner), + }, + } +} \ No newline at end of file