Skip to content

Commit

Permalink
Fix deployer
Browse files Browse the repository at this point in the history
  • Loading branch information
boyuanx committed May 23, 2024
1 parent 24b0802 commit e837a50
Show file tree
Hide file tree
Showing 12 changed files with 131 additions and 529 deletions.
122 changes: 0 additions & 122 deletions contracts/hooks/KYCHook.sol

This file was deleted.

40 changes: 0 additions & 40 deletions contracts/mock/MockKYCHook.sol

This file was deleted.

49 changes: 0 additions & 49 deletions contracts/mock/MockZETA.sol

This file was deleted.

18 changes: 13 additions & 5 deletions contracts/proxy/TTUDeployerLite.sol
Original file line number Diff line number Diff line change
Expand Up @@ -162,14 +162,22 @@ contract TTUDeployerLite is ITTUDeployer, Ownable, IVersionable {
)
);
futureToken.initialize(projectToken, isTransferable);
unlocker = ITokenTableUnlockerV2(
Clones.clone(
beaconManager
.beacons("TokenTableUnlockerV2")
.implementation()
)
);
} else {
futureToken = ITTFutureTokenV2(existingFutureToken);
unlocker = ITokenTableUnlockerV2(
Clones.clone(
beaconManager.beacons("TTUV2ExternalFT").implementation()
)
);
}
unlocker = ITokenTableUnlockerV2(
Clones.clone(
beaconManager.beacons("TokenTableUnlockerV2").implementation()
)
);

unlocker.initialize(
projectToken,
address(futureToken),
Expand Down
56 changes: 31 additions & 25 deletions deploy/10-deploy-ttudeployer-lite.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {DeployFunction} from 'hardhat-deploy/dist/types'
import {HardhatRuntimeEnvironment} from 'hardhat/types'
// eslint-disable-next-line @typescript-eslint/no-unused-vars
import {network, ethers, run} from 'hardhat'
import {TTUDeployerLite} from '../typechain-types'
import {TTUDeployerLite, TTUV2BeaconManager} from '../typechain-types'
import {log} from '../config/logging'

// Replicating logic in TTUDeployer
Expand All @@ -20,6 +20,12 @@ const deployLite: DeployFunction = async (hre: HardhatRuntimeEnvironment) => {
args: [],
waitConfirmations: 1
})
const unlockerExternalFTDeploymentResult = await deploy('TTUV2ExternalFT', {
from: deployer,
log: true,
args: [],
waitConfirmations: 1
})
const ftDeploymentResult = await deploy('TTFutureTokenV2', {
from: deployer,
log: true,
Expand Down Expand Up @@ -63,45 +69,45 @@ const deployLite: DeployFunction = async (hre: HardhatRuntimeEnvironment) => {
const beaconManagerDeploymentResult = await deploy('TTUV2BeaconManager', {
from: deployer,
log: true,
args: [
unlockerDeploymentResult.address,
ftDeploymentResult.address,
ttDeploymentResult.address
],
args: [],
waitConfirmations: 1
})

// Getting instances
const DeployerLiteFactory =
await ethers.getContractFactory('TTUDeployerLite')
const deployerLiteInstance = DeployerLiteFactory.attach(
deployerLiteDeploymentResult.address
) as TTUDeployerLite
const BeaconManagerFactory =
await ethers.getContractFactory('TTUV2BeaconManager')
const beaconManagerInstance = BeaconManagerFactory.attach(
beaconManagerDeploymentResult.address
) as TTUV2BeaconManager
// Setup
await deployerLiteInstance.setFeeCollector(
feeCollectorDeploymentResult.address
)
await deployerLiteInstance.setBeaconManager(
beaconManagerDeploymentResult.address
)
/*
* Run verification
* await run('verify:verify', {
* address: beaconManagerDeploymentResult.address,
* constructorArguments: [
* unlockerDeploymentResult.address,
* ftDeploymentResult.address,
* ttDeploymentResult.address
* ]
* })
* await run('verify:verify', {
* address: deployerLiteDeploymentResult.address,
* contract: 'contracts/proxy/TTUDeployerLite.sol:TTUDeployerLite'
* })
* await run('verify:verify', {
* address: feeCollectorDeploymentResult.address
* })
* Print results to console (save this!)
*/
await beaconManagerInstance.upgradeCustomBeacon(
'TokenTableUnlockerV2',
unlockerDeploymentResult.address
)
await beaconManagerInstance.upgradeCustomBeacon(
'TTFutureTokenV2',
ftDeploymentResult.address
)
await beaconManagerInstance.upgradeCustomBeacon(
'TTTrackerTokenV2',
ttDeploymentResult.address
)
await beaconManagerInstance.upgradeCustomBeacon(
'TTUV2ExternalFT',
unlockerExternalFTDeploymentResult.address
)

log.info(
`Chain ID: ${chainId} | BeaconManager: ${beaconManagerDeploymentResult.address} | FeeCollector: ${feeCollectorDeploymentResult.address} | DeployerLite: ${deployerLiteDeploymentResult.address}`
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
/* eslint-disable @typescript-eslint/no-explicit-any */
// TypeScript
import {DeployFunction} from 'hardhat-deploy/dist/types'
import {HardhatRuntimeEnvironment} from 'hardhat/types'

const deployClone: DeployFunction = async (hre: HardhatRuntimeEnvironment) => {
const deployTTUFeeCollector: DeployFunction = async (
hre: HardhatRuntimeEnvironment
) => {
// eslint-disable-next-line @typescript-eslint/unbound-method
const {deploy} = hre.deployments
const {deployer} = await hre.getNamedAccounts()

await deploy('KYCHook', {
await deploy('TTUFeeCollector', {
from: deployer,
log: true,
args: [],
waitConfirmations: 1
})
}

export default deployClone
deployClone.tags = ['KYCHook']
export default deployTTUFeeCollector
deployTTUFeeCollector.tags = ['TTUFeeCollector']
Loading

0 comments on commit e837a50

Please sign in to comment.