Skip to content

Commit

Permalink
Verify proxies and tokens of factories
Browse files Browse the repository at this point in the history
  • Loading branch information
ScreamingHawk committed Nov 14, 2023
1 parent 52e24d5 commit 496cdb5
Show file tree
Hide file tree
Showing 3 changed files with 361 additions and 0 deletions.
53 changes: 53 additions & 0 deletions scripts/deploy-contracts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ import { MAIN_MODULE_V2_VERIFICATION } from './factories/v2/MainModuleV2'
import { SEQUENCE_UTILS_V2_VERIFICATION } from './factories/v2/SequenceUtilsV2'
import { deployDeveloperMultisig } from './wallets/DeveloperMultisig'
import { deployGuard } from './wallets/Guard'
import {
TUBPROXY_VERIFICATION,
TransparentUpgradeableBeaconProxy
} from './factories/token_library/TransparentUpgradeableBeaconProxy'
import { UPGRADEABLEBEACON_VERIFICATION, UpgradeableBeacon } from './factories/token_library/UpgradeableBeacon'

dotenvConfig()

Expand Down Expand Up @@ -282,6 +287,7 @@ export const deployContracts = async (rpcUrl: string, deployerPK: string, networ
// Library contracts

prompt.start(`Verifying Library contracts\n`)
// Factories
await verifier.verifyContract(erc20MinterFactory.address, {
...ERC20MINTERFACTORY_VERIFICATION,
waitForSuccess,
Expand All @@ -307,6 +313,53 @@ export const deployContracts = async (rpcUrl: string, deployerPK: string, networ
waitForSuccess,
constructorArgs: defaultAbiCoder.encode(['address'], [developerMultisig.address])
})
// Also deploy the TUBProxy for verification purposes
const tubProxy = await singletonDeployer.deploy(
'TransparentUpgradeableBeaconProxy',
TransparentUpgradeableBeaconProxy,
0,
txParams
)
// Token contracts deployed by the factories
const beacon = new UpgradeableBeacon(signer)
await verifier.verifyContract(await beacon.attach(await erc20MinterFactory.beacon()).implementation(), {
...ERC20MINTERFACTORY_VERIFICATION,
contractToVerify: 'src/tokens/ERC20/presets/minter/ERC20TokenMinter.sol:ERC20TokenMinter',
waitForSuccess
})
await verifier.verifyContract(await beacon.attach(await erc721MinterFactory.beacon()).implementation(), {
...ERC721MINTERFACTORY_VERIFICATION,
contractToVerify: 'src/tokens/ERC721/presets/minter/ERC721TokenMinter.sol:ERC721TokenMinter',
waitForSuccess
})
await verifier.verifyContract(await beacon.attach(await erc721SaleFactory.beacon()).implementation(), {
...ERC721SALEFACTORY_VERIFICATION,
contractToVerify: 'src/tokens/ERC721/presets/sale/ERC721Sale.sol:ERC721Sale',
waitForSuccess
})
await verifier.verifyContract(await beacon.attach(await erc1155MinterFactory.beacon()).implementation(), {
...ERC1155MINTERFACTORY_VERIFICATION,
contractToVerify: 'src/tokens/ERC1155/presets/minter/ERC1155TokenMinter.sol:ERC1155TokenMinter',
waitForSuccess
})
const erc1155SaleBeacon = await erc1155SaleFactory.beacon()
const erc1155SaleImplementation = await beacon.attach(erc1155SaleBeacon).implementation()
await verifier.verifyContract(erc1155SaleImplementation, {
...ERC1155SALEFACTORY_VERIFICATION,
contractToVerify: 'src/tokens/ERC1155/presets/sale/ERC1155Sale.sol:ERC1155Sale',
waitForSuccess
})
// Proxies
await verifier.verifyContract(erc1155SaleBeacon, {
...UPGRADEABLEBEACON_VERIFICATION,
waitForSuccess,
constructorArgs: defaultAbiCoder.encode(['address'], [erc1155SaleImplementation])
})
await verifier.verifyContract(tubProxy.address, {
...TUBPROXY_VERIFICATION,
waitForSuccess
})

prompt.succeed(`Verified Library contracts\n`)
}

Expand Down
Loading

0 comments on commit 496cdb5

Please sign in to comment.