diff --git a/protocol/contracts/fakes/nexus/TestnetRelic.sol b/protocol/contracts/fakes/nexus/TestnetRelic.sol index 58a65b0cc..3ad44ea8a 100644 --- a/protocol/contracts/fakes/nexus/TestnetRelic.sol +++ b/protocol/contracts/fakes/nexus/TestnetRelic.sol @@ -15,7 +15,7 @@ import { CommonEventsAndErrors } from "../../common/CommonEventsAndErrors.sol"; import { IShard } from "../../interfaces/nexus/IShard.sol"; -contract Relic is ERC721ACustom, ERC1155Receiver { +contract TestnetRelic is ERC721ACustom, ERC1155Receiver { using SafeERC20 for IERC20; using EnumerableSet for EnumerableSet.UintSet; diff --git a/protocol/contracts/fakes/nexus/TestnetShard.sol b/protocol/contracts/fakes/nexus/TestnetShard.sol index 96b8d9945..fafc6849b 100644 --- a/protocol/contracts/fakes/nexus/TestnetShard.sol +++ b/protocol/contracts/fakes/nexus/TestnetShard.sol @@ -8,7 +8,7 @@ import { ERC1155Burnable } from "@openzeppelin/contracts/token/ERC1155/extension import { EnumerableSet } from "@openzeppelin/contracts/utils/structs/EnumerableSet.sol"; import { CommonEventsAndErrors } from "../../common/CommonEventsAndErrors.sol"; -contract Shard is ERC1155, ERC1155Burnable { +contract TestnetShard is ERC1155, ERC1155Burnable { using EnumerableSet for EnumerableSet.UintSet; /// @notice Relic NFT contract IRelic public relic; @@ -90,6 +90,7 @@ contract Shard is ERC1155, ERC1155Burnable { ) ERC1155(_uri) { relic = IRelic(_relic); _currentIndex = _currentRecipeIndex = _startTokenId(); + operators[msg.sender] = true; } function setOperator(address operator, bool allow) external onlyOperator { diff --git a/protocol/contracts/fakes/nexus/TestnetTempleSacrifice.sol b/protocol/contracts/fakes/nexus/TestnetTempleSacrifice.sol index 3c8a848cf..7a1942405 100644 --- a/protocol/contracts/fakes/nexus/TestnetTempleSacrifice.sol +++ b/protocol/contracts/fakes/nexus/TestnetTempleSacrifice.sol @@ -9,7 +9,7 @@ import { ITempleERC20Token } from "../../interfaces/core/ITempleERC20Token.sol"; import { CommonEventsAndErrors } from "../../common/CommonEventsAndErrors.sol"; import { mulDiv } from "@prb/math/src/Common.sol"; -contract TempleSacrifice is Ownable { +contract TestnetTempleSacrifice is Ownable { using SafeERC20 for ITempleERC20Token; /// @notice the Relic ERC721A token diff --git a/protocol/scripts/deploys/arbitrumGoerli/nexus/01-relic.ts b/protocol/scripts/deploys/arbitrumGoerli/nexus/01-relic.ts index 08463a1b8..615927606 100644 --- a/protocol/scripts/deploys/arbitrumGoerli/nexus/01-relic.ts +++ b/protocol/scripts/deploys/arbitrumGoerli/nexus/01-relic.ts @@ -5,13 +5,11 @@ import { deployAndMine, ensureExpectedEnvvars, } from '../../helpers'; -import { getDeployedContracts } from '../../v2/sepolia/contract-addresses'; async function main() { ensureExpectedEnvvars(); const [owner] = await ethers.getSigners(); - const ownerAddress = await owner.getAddress(); const relicFactory= new TestnetRelic__factory(owner); await deployAndMine( 'RELIC', diff --git a/protocol/scripts/deploys/arbitrumGoerli/nexus/99a-relic-post-deployment.ts b/protocol/scripts/deploys/arbitrumGoerli/nexus/99a-relic-post-deployment.ts index cd205ba33..984879210 100644 --- a/protocol/scripts/deploys/arbitrumGoerli/nexus/99a-relic-post-deployment.ts +++ b/protocol/scripts/deploys/arbitrumGoerli/nexus/99a-relic-post-deployment.ts @@ -17,9 +17,8 @@ async function main() { const ownerAddress = await owner.getAddress(); - // TESTNET ONLY -- Allow msig & owner to mint Testnet Temple - { - // await mine(templeV2contracts.templeToken.addMinter(TEMPLE_V2_DEPLOYED.CORE.EXECUTOR_MSIG)); + // TESTNET ONLY -- Allow owner to mint Testnet Temple + { await mine(temple.addMinter(ownerAddress)); } diff --git a/protocol/scripts/deploys/arbitrumGoerli/nexus/99b-shard-post-deployment.ts b/protocol/scripts/deploys/arbitrumGoerli/nexus/99b-shard-post-deployment.ts index 717532284..1371c183c 100644 --- a/protocol/scripts/deploys/arbitrumGoerli/nexus/99b-shard-post-deployment.ts +++ b/protocol/scripts/deploys/arbitrumGoerli/nexus/99b-shard-post-deployment.ts @@ -10,7 +10,6 @@ async function main() { ensureExpectedEnvvars(); const [owner] = await ethers.getSigners(); - const ownerAddress = await owner.getAddress(); const deployedContracts = DEPLOYED_CONTRACTS[network.name]; const shardId1 = 123; const shardId2 = 456; @@ -22,13 +21,6 @@ async function main() { const uri4 = "http://example4.com"; const shard = TestnetShard__factory.connect(deployedContracts.SHARD, owner); - // minters and partners - { - const shardIds = [shardId4]; - const allowed = [true]; - await mine(shard.setPartnerAllowedShardIds(ownerAddress, shardIds, allowed)); - await mine(shard.setPartnerAllowedShardCaps(ownerAddress, shardIds, [99999])); - } // uri and recipe { const recipe = { @@ -37,8 +29,7 @@ async function main() { outputShardIds: [shardId3], outputShardAmounts: [1] }; - const recipeId = 1; - await mine(shard.setRecipe(recipeId, recipe)); + await mine(shard.setRecipe(recipe)); await mine(shard.setShardUri(shardId1, uri1)); await mine(shard.setShardUri(shardId2, uri2)); await mine(shard.setShardUri(shardId3, uri3)); diff --git a/protocol/scripts/deploys/mainnet/nexus/01-relic.ts b/protocol/scripts/deploys/mainnet/nexus/01-relic.ts new file mode 100644 index 000000000..bb8a811ff --- /dev/null +++ b/protocol/scripts/deploys/mainnet/nexus/01-relic.ts @@ -0,0 +1,36 @@ +import '@nomiclabs/hardhat-ethers'; +import { ethers } from 'hardhat'; +import { Relic__factory } from '../../../../typechain'; +import { + deployAndMine, + ensureExpectedEnvvars, +} from '../../helpers'; + + +async function main() { + ensureExpectedEnvvars(); + const [owner] = await ethers.getSigners(); + const initialRescuer = ""; + const initialExecutor = ""; + + const relicFactory = new Relic__factory(owner); + await deployAndMine( + 'RELIC', + relicFactory, + relicFactory.deploy, + 'RELIC', + 'REL', + initialRescuer, + initialExecutor + ); +} + +// 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); + }); + diff --git a/protocol/scripts/deploys/mainnet/nexus/02-shard.ts b/protocol/scripts/deploys/mainnet/nexus/02-shard.ts new file mode 100644 index 000000000..354722e81 --- /dev/null +++ b/protocol/scripts/deploys/mainnet/nexus/02-shard.ts @@ -0,0 +1,37 @@ +import '@nomiclabs/hardhat-ethers'; +import { ethers, network } from 'hardhat'; +import { Shard__factory } from '../../../../typechain'; +import { + deployAndMine, + ensureExpectedEnvvars, + DEPLOYED_CONTRACTS +} from '../../helpers'; + +async function main() { + ensureExpectedEnvvars(); + const [owner] = await ethers.getSigners(); + const initialRescuer = ""; + const initialExecutor = ""; + const relicAddress = DEPLOYED_CONTRACTS[network.name].RELIC;; + const uri = ""; + + const shardFactory = new Shard__factory(owner); + await deployAndMine( + 'SHARD', + shardFactory, + shardFactory.deploy, + relicAddress, + initialRescuer, + initialExecutor, + 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/mainnet/nexus/03-temple-sacrifice.ts b/protocol/scripts/deploys/mainnet/nexus/03-temple-sacrifice.ts new file mode 100644 index 000000000..d3cf3b4ff --- /dev/null +++ b/protocol/scripts/deploys/mainnet/nexus/03-temple-sacrifice.ts @@ -0,0 +1,35 @@ +import '@nomiclabs/hardhat-ethers'; +import { ethers, network } from 'hardhat'; +import { TempleSacrifice__factory } from '../../../../typechain'; +import { + deployAndMine, + ensureExpectedEnvvars, + DEPLOYED_CONTRACTS +} from '../../helpers'; + +async function main() { + ensureExpectedEnvvars(); + const [owner] = await ethers.getSigners(); + + const relicAddress = DEPLOYED_CONTRACTS[network.name].RELIC; + const templeTokenAddress = DEPLOYED_CONTRACTS[network.name].TEMPLE;; + + const templeSacrificeFactory = new TempleSacrifice__factory(owner); + await deployAndMine( + 'TEMPLE_SACRIFICE', + templeSacrificeFactory, + templeSacrificeFactory.deploy, + relicAddress, + templeTokenAddress + ); +} + + +// 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/mainnet/nexus/99a-relic-post-deployment.ts b/protocol/scripts/deploys/mainnet/nexus/99a-relic-post-deployment.ts new file mode 100644 index 000000000..d557e2188 --- /dev/null +++ b/protocol/scripts/deploys/mainnet/nexus/99a-relic-post-deployment.ts @@ -0,0 +1,40 @@ +import { ethers, network } from 'hardhat'; +import { + ensureExpectedEnvvars, + mine +} from '../../helpers'; +import { Relic__factory } from '../../../../typechain'; +import { DEPLOYED_CONTRACTS } from '../../helpers'; + + +async function main() { + ensureExpectedEnvvars(); + + const [owner] = await ethers.getSigners(); + const deployedContracts = DEPLOYED_CONTRACTS[network.name]; + const relic = Relic__factory.connect(deployedContracts.RELIC, owner); + + // set shard + const shardAddress = deployedContracts.SHARD; + { + await mine(relic.setShard(shardAddress)); + } + // set relic minter (temple sacrifice) + const templeSacrificeAddress = deployedContracts.TEMPLE_SACRIFICE; + { + await mine(relic.setRelicMinter(templeSacrificeAddress, true)); + } + // set xp controller + { + + } +} + +// 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/mainnet/nexus/99b-shard-post-deployment.ts b/protocol/scripts/deploys/mainnet/nexus/99b-shard-post-deployment.ts new file mode 100644 index 000000000..e765552c3 --- /dev/null +++ b/protocol/scripts/deploys/mainnet/nexus/99b-shard-post-deployment.ts @@ -0,0 +1,27 @@ +import { ethers, network } from 'hardhat'; +import { + ensureExpectedEnvvars, + mine +} from '../../helpers'; +import { TempleERC20Token__factory, Shard__factory } from '../../../../typechain'; +import { DEPLOYED_CONTRACTS } from '../../helpers'; + + +async function main() { + ensureExpectedEnvvars(); + + const [owner] = await ethers.getSigners(); + const deployedContracts = DEPLOYED_CONTRACTS[network.name]; + const shard = Shard__factory.connect(deployedContracts.SHARD, owner); + + +} + +// 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/mainnet/nexus/99c-temple-sacrifice-post-deployment.ts b/protocol/scripts/deploys/mainnet/nexus/99c-temple-sacrifice-post-deployment.ts new file mode 100644 index 000000000..2ff1d830f --- /dev/null +++ b/protocol/scripts/deploys/mainnet/nexus/99c-temple-sacrifice-post-deployment.ts @@ -0,0 +1,44 @@ +import { ethers, network } from 'hardhat'; +import { + ensureExpectedEnvvars, + mine, + toAtto +} from '../../helpers'; +import { TempleSacrifice__factory } from '../../../../typechain'; +import { DEPLOYED_CONTRACTS } from '../../helpers'; + + +async function main() { + ensureExpectedEnvvars(); + + const [owner] = await ethers.getSigners(); + const deployedContracts = DEPLOYED_CONTRACTS[network.name]; + const templeSacrifice = TempleSacrifice__factory.connect(deployedContracts.TEMPLE_SACRIFICE, owner); + + // set sacrificed temple recipient + { + await mine(templeSacrifice.setSacrificedTempleRecipient('')); + } + // set price params + { + const priceParams = { + minimumPrice: toAtto(40), + maximumPrice: toAtto(100), + priceMaxPeriod: 365 * 24 * 60 * 60 + } + await mine(templeSacrifice.setPriceParams(priceParams)); + } + // set origin time + { + + } +} + +// 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