diff --git a/protocol/scripts/deploys/b13_testnet/templegold/01-temple-token.ts b/protocol/scripts/deploys/b13_testnet/templegold/01-temple-token.ts new file mode 100644 index 000000000..5ec91de1a --- /dev/null +++ b/protocol/scripts/deploys/b13_testnet/templegold/01-temple-token.ts @@ -0,0 +1,23 @@ +import '@nomiclabs/hardhat-ethers'; +import { ethers } from 'hardhat'; +import { TempleERC20Token, TempleERC20Token__factory } from '../../../../typechain'; +import { deployAndMine, ensureExpectedEnvvars } from '../../helpers'; + +async function main() { + ensureExpectedEnvvars(); + const [owner] = await ethers.getSigners(); + + const templeFactory = new TempleERC20Token__factory(owner); + const TEMPLE: TempleERC20Token = await deployAndMine( + 'TEMPLE', 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/b13_testnet/templegold/02-temple-gold.ts b/protocol/scripts/deploys/b13_testnet/templegold/02-temple-gold.ts new file mode 100644 index 000000000..e08e966f1 --- /dev/null +++ b/protocol/scripts/deploys/b13_testnet/templegold/02-temple-gold.ts @@ -0,0 +1,43 @@ +import '@nomiclabs/hardhat-ethers'; +import { ethers } from 'hardhat'; +import { TempleGold__factory } from '../../../../typechain'; +import { + deployAndMine, + ensureExpectedEnvvars, +} from '../../helpers'; +import { getDeployedTempleGoldContracts } from '../../mainnet/templegold/contract-addresses'; + +async function main() { + ensureExpectedEnvvars(); + const [owner] = await ethers.getSigners(); + const ownerAddress = await owner.getAddress(); + const TEMPLEGOLD_ADDRESSES = getDeployedTempleGoldContracts(); + const B13_TESTNET_CHAIN_ID = 80000; + const B13_TESTNET_LZ_EID = 40346; + const _initArgs = { + // Changed in transfer ownership to TempleAdmin + executor: ownerAddress, // executor is also used as delegate in LayerZero Endpoint. + layerZeroEndpoint: TEMPLEGOLD_ADDRESSES.EXTERNAL.LAYER_ZERO.ENDPOINT, // local endpoint address + mintChainId: B13_TESTNET_CHAIN_ID, + mintChainLzEid: B13_TESTNET_LZ_EID, + name: "TEMPLE GOLD", + symbol: "TGLD" + }; + const factory = new TempleGold__factory(owner); + await deployAndMine( + 'TEMPLE_GOLD', + factory, + factory.deploy, + _initArgs + ); + +} + +// 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/b13_testnet/templegold/03-temple-teleporter.ts b/protocol/scripts/deploys/b13_testnet/templegold/03-temple-teleporter.ts new file mode 100644 index 000000000..335b281a8 --- /dev/null +++ b/protocol/scripts/deploys/b13_testnet/templegold/03-temple-teleporter.ts @@ -0,0 +1,35 @@ +import '@nomiclabs/hardhat-ethers'; +import { ethers } from 'hardhat'; +import { TempleTeleporter__factory } from '../../../../typechain'; +import { + deployAndMine, + ensureExpectedEnvvars, +} from '../../helpers'; +import { getDeployedTempleGoldContracts } from '../../mainnet/templegold/contract-addresses'; +import { getDeployedContracts } from '../../mainnet/v2/contract-addresses'; + +async function main() { + ensureExpectedEnvvars(); + const [owner] = await ethers.getSigners(); + const TEMPLEGOLD_ADDRESSES = getDeployedTempleGoldContracts(); + const CORE_ADDRESSES = getDeployedContracts(); + + const factory = new TempleTeleporter__factory(owner); + await deployAndMine( + 'TEMPLE_TELEPORTER', + factory, + factory.deploy, + CORE_ADDRESSES.CORE.EXECUTOR_MSIG, + CORE_ADDRESSES.CORE.TEMPLE_TOKEN, + TEMPLEGOLD_ADDRESSES.EXTERNAL.LAYER_ZERO.ENDPOINT + ); +} + +// 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/b13_testnet/templegold/04-temple-gold-admin.ts b/protocol/scripts/deploys/b13_testnet/templegold/04-temple-gold-admin.ts new file mode 100644 index 000000000..b8c6184fd --- /dev/null +++ b/protocol/scripts/deploys/b13_testnet/templegold/04-temple-gold-admin.ts @@ -0,0 +1,35 @@ +import '@nomiclabs/hardhat-ethers'; +import { ethers } from 'hardhat'; +import { TempleGoldAdmin__factory } from '../../../../typechain'; +import { + deployAndMine, + ensureExpectedEnvvars, +} from '../../helpers'; +import { getDeployedTempleGoldContracts } from '../../mainnet/templegold/contract-addresses'; +import { getDeployedContracts } from '../../mainnet/v2/contract-addresses'; + +async function main() { + ensureExpectedEnvvars(); + const [owner] = await ethers.getSigners(); + const TEMPLEGOLD_ADDRESSES = getDeployedTempleGoldContracts(); + const CORE_ADDRESSES = getDeployedContracts(); + + const factory = new TempleGoldAdmin__factory(owner); + await deployAndMine( + 'TEMPLE_GOLD_ADMIN', + factory, + factory.deploy, + CORE_ADDRESSES.CORE.RESCUER_MSIG, + CORE_ADDRESSES.CORE.EXECUTOR_MSIG, + TEMPLEGOLD_ADDRESSES.TEMPLE_GOLD.TEMPLE_GOLD + ); +} + +// 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/b13_testnet/templegold/999-transfer-ownership.ts b/protocol/scripts/deploys/b13_testnet/templegold/999-transfer-ownership.ts new file mode 100644 index 000000000..6ada4bc31 --- /dev/null +++ b/protocol/scripts/deploys/b13_testnet/templegold/999-transfer-ownership.ts @@ -0,0 +1,43 @@ +import { ethers } from 'hardhat'; +import { + ensureExpectedEnvvars, + mine, +} from '../../helpers'; +import { connectToContracts, getDeployedTempleGoldContracts } from '../../mainnet/templegold/contract-addresses'; +import { getDeployedContracts } from "../../mainnet/v2/contract-addresses"; + +async function main() { + ensureExpectedEnvvars(); + const [owner] = await ethers.getSigners(); + const TEMPLE_GOLD_ADDRESSES = getDeployedTempleGoldContracts(); + const V2_ADDRESSES = getDeployedContracts(); + const TEMPLE_GOLD_INSTANCES = connectToContracts(owner); + + // Transfer ownership to the temple gold admin + await mine( + TEMPLE_GOLD_INSTANCES.TEMPLE_GOLD.TEMPLE_GOLD.transferOwnership( + TEMPLE_GOLD_ADDRESSES.TEMPLE_GOLD.TEMPLE_GOLD_ADMIN + ) + ); + // temple token + await mine( + TEMPLE_GOLD_INSTANCES.CORE.TEMPLE_TOKEN.transferOwnership( + V2_ADDRESSES.CORE.EXECUTOR_MSIG + ) + ); + // temple teleporter + await mine( + TEMPLE_GOLD_INSTANCES.TEMPLE_GOLD.TEMPLE_TELEPORTER.transferOwnership( + V2_ADDRESSES.CORE.EXECUTOR_MSIG + ) + ); +} + +// 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/berachain/templegold/01-temple-gold.ts b/protocol/scripts/deploys/berachain/templegold/01-temple-gold.ts new file mode 100644 index 000000000..ec9656010 --- /dev/null +++ b/protocol/scripts/deploys/berachain/templegold/01-temple-gold.ts @@ -0,0 +1,43 @@ +import '@nomiclabs/hardhat-ethers'; +import { ethers } from 'hardhat'; +import { TempleGold__factory } from '../../../../typechain'; +import { + deployAndMine, + ensureExpectedEnvvars, +} from '../../helpers'; +import { getDeployedTempleGoldContracts } from '../../mainnet/templegold/contract-addresses'; + +async function main() { + ensureExpectedEnvvars(); + const [owner] = await ethers.getSigners(); + const ownerAddress = await owner.getAddress(); + const TEMPLEGOLD_ADDRESSES = getDeployedTempleGoldContracts(); + const BERACHAIN_CHAIN_ID = ""; + const BERACHAIN_LZ_EID = ""; + const _initArgs = { + // Changed in transfer ownership to TempleAdmin + executor: ownerAddress, // executor is also used as delegate in LayerZero Endpoint. + layerZeroEndpoint: TEMPLEGOLD_ADDRESSES.EXTERNAL.LAYER_ZERO.ENDPOINT, // local endpoint address + mintChainId: BERACHAIN_CHAIN_ID, + mintChainLzEid: BERACHAIN_LZ_EID, + name: "TEMPLE GOLD", + symbol: "TGLD" + }; + const factory = new TempleGold__factory(owner); + await deployAndMine( + 'TEMPLE_GOLD', + factory, + factory.deploy, + _initArgs + ); + +} + +// 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/berachain/templegold/02-temple-token.ts b/protocol/scripts/deploys/berachain/templegold/02-temple-token.ts new file mode 100644 index 000000000..5ec91de1a --- /dev/null +++ b/protocol/scripts/deploys/berachain/templegold/02-temple-token.ts @@ -0,0 +1,23 @@ +import '@nomiclabs/hardhat-ethers'; +import { ethers } from 'hardhat'; +import { TempleERC20Token, TempleERC20Token__factory } from '../../../../typechain'; +import { deployAndMine, ensureExpectedEnvvars } from '../../helpers'; + +async function main() { + ensureExpectedEnvvars(); + const [owner] = await ethers.getSigners(); + + const templeFactory = new TempleERC20Token__factory(owner); + const TEMPLE: TempleERC20Token = await deployAndMine( + 'TEMPLE', 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/berachain/templegold/03-temple-teleporter.ts b/protocol/scripts/deploys/berachain/templegold/03-temple-teleporter.ts new file mode 100644 index 000000000..335b281a8 --- /dev/null +++ b/protocol/scripts/deploys/berachain/templegold/03-temple-teleporter.ts @@ -0,0 +1,35 @@ +import '@nomiclabs/hardhat-ethers'; +import { ethers } from 'hardhat'; +import { TempleTeleporter__factory } from '../../../../typechain'; +import { + deployAndMine, + ensureExpectedEnvvars, +} from '../../helpers'; +import { getDeployedTempleGoldContracts } from '../../mainnet/templegold/contract-addresses'; +import { getDeployedContracts } from '../../mainnet/v2/contract-addresses'; + +async function main() { + ensureExpectedEnvvars(); + const [owner] = await ethers.getSigners(); + const TEMPLEGOLD_ADDRESSES = getDeployedTempleGoldContracts(); + const CORE_ADDRESSES = getDeployedContracts(); + + const factory = new TempleTeleporter__factory(owner); + await deployAndMine( + 'TEMPLE_TELEPORTER', + factory, + factory.deploy, + CORE_ADDRESSES.CORE.EXECUTOR_MSIG, + CORE_ADDRESSES.CORE.TEMPLE_TOKEN, + TEMPLEGOLD_ADDRESSES.EXTERNAL.LAYER_ZERO.ENDPOINT + ); +} + +// 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/berachain/templegold/04-temple-gold-admin.ts b/protocol/scripts/deploys/berachain/templegold/04-temple-gold-admin.ts new file mode 100644 index 000000000..b8c6184fd --- /dev/null +++ b/protocol/scripts/deploys/berachain/templegold/04-temple-gold-admin.ts @@ -0,0 +1,35 @@ +import '@nomiclabs/hardhat-ethers'; +import { ethers } from 'hardhat'; +import { TempleGoldAdmin__factory } from '../../../../typechain'; +import { + deployAndMine, + ensureExpectedEnvvars, +} from '../../helpers'; +import { getDeployedTempleGoldContracts } from '../../mainnet/templegold/contract-addresses'; +import { getDeployedContracts } from '../../mainnet/v2/contract-addresses'; + +async function main() { + ensureExpectedEnvvars(); + const [owner] = await ethers.getSigners(); + const TEMPLEGOLD_ADDRESSES = getDeployedTempleGoldContracts(); + const CORE_ADDRESSES = getDeployedContracts(); + + const factory = new TempleGoldAdmin__factory(owner); + await deployAndMine( + 'TEMPLE_GOLD_ADMIN', + factory, + factory.deploy, + CORE_ADDRESSES.CORE.RESCUER_MSIG, + CORE_ADDRESSES.CORE.EXECUTOR_MSIG, + TEMPLEGOLD_ADDRESSES.TEMPLE_GOLD.TEMPLE_GOLD + ); +} + +// 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/berachain/templegold/999-transfer-ownership.ts b/protocol/scripts/deploys/berachain/templegold/999-transfer-ownership.ts new file mode 100644 index 000000000..6ada4bc31 --- /dev/null +++ b/protocol/scripts/deploys/berachain/templegold/999-transfer-ownership.ts @@ -0,0 +1,43 @@ +import { ethers } from 'hardhat'; +import { + ensureExpectedEnvvars, + mine, +} from '../../helpers'; +import { connectToContracts, getDeployedTempleGoldContracts } from '../../mainnet/templegold/contract-addresses'; +import { getDeployedContracts } from "../../mainnet/v2/contract-addresses"; + +async function main() { + ensureExpectedEnvvars(); + const [owner] = await ethers.getSigners(); + const TEMPLE_GOLD_ADDRESSES = getDeployedTempleGoldContracts(); + const V2_ADDRESSES = getDeployedContracts(); + const TEMPLE_GOLD_INSTANCES = connectToContracts(owner); + + // Transfer ownership to the temple gold admin + await mine( + TEMPLE_GOLD_INSTANCES.TEMPLE_GOLD.TEMPLE_GOLD.transferOwnership( + TEMPLE_GOLD_ADDRESSES.TEMPLE_GOLD.TEMPLE_GOLD_ADMIN + ) + ); + // temple token + await mine( + TEMPLE_GOLD_INSTANCES.CORE.TEMPLE_TOKEN.transferOwnership( + V2_ADDRESSES.CORE.EXECUTOR_MSIG + ) + ); + // temple teleporter + await mine( + TEMPLE_GOLD_INSTANCES.TEMPLE_GOLD.TEMPLE_TELEPORTER.transferOwnership( + V2_ADDRESSES.CORE.EXECUTOR_MSIG + ) + ); +} + +// 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/templegold/contract-addresses.ts b/protocol/scripts/deploys/mainnet/templegold/contract-addresses.ts index 7f7d01941..87c51caac 100644 --- a/protocol/scripts/deploys/mainnet/templegold/contract-addresses.ts +++ b/protocol/scripts/deploys/mainnet/templegold/contract-addresses.ts @@ -100,7 +100,7 @@ const TEMPLEGOLD_DEPLOYED_CONTRACTS: {[key: string]: ContractAddresses} = { AUCTION_AUTOMATION_EOA: "string", STAKING_AUTOMATION_EOA: "string", SPICE_AUCTION_OPERATOR: "string", - TEMPLE_GOLD: "0x2ae6318e34bb97ae3755AFcE75559452aA223A5D", //"0x192aA9BfDcA5540406E211950C226C8E0cd5047F", + TEMPLE_GOLD: "0x2ae6318e34bb97ae3755AFcE75559452aA223A5D", TEMPLE_GOLD_ADMIN: "string", TEMPLE_GOLD_STAKING: "0xdbDAc0FCA9cF8CA2F2Ef718775f0F265f581808F", TEMPLE_TELEPORTER: "0x7De0066A6BD454B2Ecaeb3E54814458a71D345A5", @@ -122,6 +122,33 @@ const TEMPLEGOLD_DEPLOYED_CONTRACTS: {[key: string]: ContractAddresses} = { } }, }, + b13_testnet: { + TEMPLE_GOLD: { + AUCTION_AUTOMATION_EOA: "string", + STAKING_AUTOMATION_EOA: "string", + SPICE_AUCTION_OPERATOR: "string", + TEMPLE_GOLD: "string", + TEMPLE_GOLD_ADMIN: "string", + TEMPLE_GOLD_STAKING: "string", + TEMPLE_TELEPORTER: "string", + SPICE_AUCTION: "string", + SPICE_AUCTION_FACTORY: "string", + STABLE_GOLD_AUCTION: "string", + EXECUTOR_MSIG: "string", + RESCUER_MSIG: "string", + }, + CORE: { + TEMPLE_TOKEN: "string", + }, + EXTERNAL: { + LAYER_ZERO: { + ENDPOINT: "0x6C7Ab2202C98C4227C5c46f1417D81144DA716Ff", + }, + MAKER_DAO: { + DAI_TOKEN: "string", + } + }, + }, arbitrumSepolia: { TEMPLE_GOLD: { AUCTION_AUTOMATION_EOA: "string",