Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
"deploy:main": "npx hardhat run --network mainnet scripts/deploy/migrations.ts",
"deploy:fip": "IS_FIP=true npm run deploy:main",
"deploy:fuse": "DEPLOY_FILE=compoundPCVDeposit npx hardhat run --network mainnet scripts/deploy/migrations.ts",
"deploy:timelock": "DEPLOY_FILE=optimisticTimelockDeploy npx hardhat run --network mainnet scripts/deploy/migrations.ts",
"deploy:stw": "DEPLOY_FILE=deployStakedTokenWrapper npx hardhat run --network mainnet scripts/deploy/migrations.ts",
"deploy:ropsten": "npx hardhat run --network ropsten scripts/deploy/migrations.ts",
"deploy:rinkeby": "npx hardhat run --network rinkeby scripts/deploy/migrations.ts",
"abis": "node scripts/abis.js",
Expand Down
25 changes: 25 additions & 0 deletions scripts/deploy/deployStakedTokenWrapper.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { ethers } from 'hardhat';
import { DeployUpgradeFunc } from '@custom-types/types';

export const deploy: DeployUpgradeFunc = async (deployAddress, addresses, logging = false) => {
const { tribalChief } = addresses;

const STAKED_TOKEN_BENEFICIARY = process.env.STAKED_TOKEN_BENEFICIARY;

if (!STAKED_TOKEN_BENEFICIARY) {
throw new Error('STAKED_TOKEN_BENEFICIARY environment variable contract address is not set');
}

if (!tribalChief) {
throw new Error('TribalChief contract address is not set');
}

const stakingTokenWrapperFactory = await ethers.getContractFactory('StakingTokenWrapper');
const stakingTokenWrapper = await stakingTokenWrapperFactory.deploy(tribalChief, STAKED_TOKEN_BENEFICIARY);

logging && console.log('StakingTokenWrapper impl deployed to: ', stakingTokenWrapper.address);

return {
stakingTokenWrapper
};
};
28 changes: 28 additions & 0 deletions scripts/deploy/optimisticTimelockDeploy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { DeployUpgradeFunc } from '@custom-types/types';
import { ethers } from 'hardhat';

const fourDays = 4 * 24 * 60 * 60;

const deploy: DeployUpgradeFunc = async (deployAddress, addresses, logging = false) => {
const { core } = addresses;

const TIMELOCK_ADMIN_ADDRESS = process.env.TIMELOCK_ADMIN_ADDRESS;

if (!TIMELOCK_ADMIN_ADDRESS) {
throw new Error('TIMELOCK_ADMIN_ADDRESS environment variable contract address is not set');
}

if (!core) {
throw new Error('Core contract address is not set');
}

const optimisticTimelock = await (
await ethers.getContractFactory('OptimisticTimelock')
).deploy(core, fourDays, [TIMELOCK_ADMIN_ADDRESS], [TIMELOCK_ADMIN_ADDRESS]);

logging && console.log('Optimistic Timelock deployed to: ', optimisticTimelock.address);

return { optimisticTimelock };
};

module.exports = { deploy };