Skip to content

Commit

Permalink
feat: nexus on sepolia
Browse files Browse the repository at this point in the history
  • Loading branch information
frontier159 committed Dec 15, 2023
1 parent 29dd2f4 commit fe043cd
Show file tree
Hide file tree
Showing 20 changed files with 556 additions and 1 deletion.
2 changes: 1 addition & 1 deletion protocol/hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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/",
Expand Down
Original file line number Diff line number Diff line change
@@ -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"
];
Original file line number Diff line number Diff line change
@@ -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/"
];
Original file line number Diff line number Diff line change
@@ -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"
];
Original file line number Diff line number Diff line change
@@ -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"
];
Original file line number Diff line number Diff line change
@@ -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"
];
28 changes: 28 additions & 0 deletions protocol/scripts/deploys/sepolia/nexus/00-temple-token.ts
Original file line number Diff line number Diff line change
@@ -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);
});
29 changes: 29 additions & 0 deletions protocol/scripts/deploys/sepolia/nexus/01-nexus-common.ts
Original file line number Diff line number Diff line change
@@ -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);
});
34 changes: 34 additions & 0 deletions protocol/scripts/deploys/sepolia/nexus/02-relic.ts
Original file line number Diff line number Diff line change
@@ -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);
});
35 changes: 35 additions & 0 deletions protocol/scripts/deploys/sepolia/nexus/03-shard.ts
Original file line number Diff line number Diff line change
@@ -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);
});
35 changes: 35 additions & 0 deletions protocol/scripts/deploys/sepolia/nexus/04-temple-sacrifice.ts
Original file line number Diff line number Diff line change
@@ -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);
});
33 changes: 33 additions & 0 deletions protocol/scripts/deploys/sepolia/nexus/05-partner-sacrifice.ts
Original file line number Diff line number Diff line change
@@ -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);
});
31 changes: 31 additions & 0 deletions protocol/scripts/deploys/sepolia/nexus/999a-transfer-ownership.ts
Original file line number Diff line number Diff line change
@@ -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);
});
28 changes: 28 additions & 0 deletions protocol/scripts/deploys/sepolia/nexus/999b-accept-ownership.ts
Original file line number Diff line number Diff line change
@@ -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);
});
Original file line number Diff line number Diff line change
@@ -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);
});
Loading

0 comments on commit fe043cd

Please sign in to comment.