Skip to content

Commit

Permalink
deploy scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
princetonbishop committed Dec 30, 2024
1 parent cd7b873 commit 026fbf0
Show file tree
Hide file tree
Showing 11 changed files with 386 additions and 1 deletion.
23 changes: 23 additions & 0 deletions protocol/scripts/deploys/b13_testnet/templegold/01-temple-token.ts
Original file line number Diff line number Diff line change
@@ -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);
});
43 changes: 43 additions & 0 deletions protocol/scripts/deploys/b13_testnet/templegold/02-temple-gold.ts
Original file line number Diff line number Diff line change
@@ -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);
});
Original file line number Diff line number Diff line change
@@ -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);
});
Original file line number Diff line number Diff line change
@@ -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);
});
Original file line number Diff line number Diff line change
@@ -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);
});
43 changes: 43 additions & 0 deletions protocol/scripts/deploys/berachain/templegold/01-temple-gold.ts
Original file line number Diff line number Diff line change
@@ -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);
});
23 changes: 23 additions & 0 deletions protocol/scripts/deploys/berachain/templegold/02-temple-token.ts
Original file line number Diff line number Diff line change
@@ -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);
});
Original file line number Diff line number Diff line change
@@ -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);
});
Original file line number Diff line number Diff line change
@@ -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);
});
Original file line number Diff line number Diff line change
@@ -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);
});
Loading

0 comments on commit 026fbf0

Please sign in to comment.