Skip to content
This repository has been archived by the owner on Oct 6, 2023. It is now read-only.

AP-794: Switch deploy-related tasks to typed interfaces #390

Merged
merged 1 commit into from
Sep 22, 2023
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
11 changes: 8 additions & 3 deletions contracts/accessory/gift-cards/scripts/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,15 @@ export async function deployGiftCard(
const {deployer} = await getSigners(hre);

// data setup
const GiftCards = new GiftCards__factory(deployer);
const initData = GiftCards.interface.encodeFunctionData("initialize", [GiftCardsDataInput]);
const initData = GiftCards__factory.createInterface().encodeFunctionData("initialize", [
GiftCardsDataInput,
]);
// deploy
const {implementation, proxy} = await deployBehindProxy(GiftCards, admin, initData);
const {implementation, proxy} = await deployBehindProxy(
new GiftCards__factory(deployer),
admin,
initData
);

// update address file
await updateAddresses(
Expand Down
9 changes: 6 additions & 3 deletions contracts/core/index-fund/scripts/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,17 @@ export async function deployIndexFund(
hre: HardhatRuntimeEnvironment
): Promise<ProxyDeployment<IndexFund__factory>> {
// data setup
const IndexFund = new IndexFund__factory(deployer);
const initData = IndexFund.interface.encodeFunctionData("initialize", [
const initData = IndexFund__factory.createInterface().encodeFunctionData("initialize", [
registrar,
CONFIG.INDEX_FUND_DATA.fundRotation,
CONFIG.INDEX_FUND_DATA.fundingGoal,
]);
// deploy
const {implementation, proxy} = await deployBehindProxy(IndexFund, proxyAdmin, initData);
const {implementation, proxy} = await deployBehindProxy(
new IndexFund__factory(deployer),
proxyAdmin,
initData
);

// update owner
logger.out(`Transferring ownership to: ${owner}...`);
Expand Down
18 changes: 12 additions & 6 deletions contracts/core/registrar/scripts/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ export async function deployRegistrar(
const networkName = await getAxlNetworkName(hre);

// data setup
const Registrar = new Registrar__factory(deployer);
const initData = Registrar.interface.encodeFunctionData(
const initData = Registrar__factory.createInterface().encodeFunctionData(
"initialize((address,address,address,address,address,string,address))",
[
{
Expand All @@ -47,7 +46,11 @@ export async function deployRegistrar(
]
);
// deploy
const {implementation, proxy} = await deployBehindProxy(Registrar, proxyAdmin, initData);
const {implementation, proxy} = await deployBehindProxy(
new Registrar__factory(deployer),
proxyAdmin,
initData
);

// update owner
logger.out(`Updating Registrar owner to '${owner}'..."`);
Expand Down Expand Up @@ -84,12 +87,15 @@ export async function deployLocalRegistrar(
hre: HardhatRuntimeEnvironment
): Promise<ProxyDeployment<LocalRegistrar__factory>> {
// data setup
const LocalRegistrar = new LocalRegistrar__factory(deployer);
const initData = LocalRegistrar.interface.encodeFunctionData("initialize", [
const initData = LocalRegistrar__factory.createInterface().encodeFunctionData("initialize", [
await getAxlNetworkName(hre),
]);
// deploy
const {implementation, proxy} = await deployBehindProxy(LocalRegistrar, proxyAdmin, initData);
const {implementation, proxy} = await deployBehindProxy(
new LocalRegistrar__factory(deployer),
proxyAdmin,
initData
);

// update owner
logger.out(`Updating Registrar owner to '${owner}'...`);
Expand Down
9 changes: 6 additions & 3 deletions contracts/core/router/scripts/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,13 @@ export async function deployRouter(
hre: HardhatRuntimeEnvironment
): Promise<ProxyDeployment<Router__factory>> {
// data setup
const Router = new Router__factory(deployer);
const initData = Router.interface.encodeFunctionData("initialize", [registrar]);
const initData = Router__factory.createInterface().encodeFunctionData("initialize", [registrar]);
// deploy
const {implementation, proxy} = await deployBehindProxy(Router, proxyAdmin, initData);
const {implementation, proxy} = await deployBehindProxy(
new Router__factory(deployer),
proxyAdmin,
initData
);

// update address file
await updateAddresses(
Expand Down
9 changes: 6 additions & 3 deletions contracts/core/vault/scripts/deployVaultEmitter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,13 @@ export async function deployVaultEmitter(
hre: HardhatRuntimeEnvironment
): Promise<ProxyDeployment<VaultEmitter__factory>> {
// data setup
const Emitter = new VaultEmitter__factory(deployer);
const initData = Emitter.interface.encodeFunctionData("initialize");
const initData = VaultEmitter__factory.createInterface().encodeFunctionData("initialize");
// deploy
const {implementation, proxy} = await deployBehindProxy(Emitter, proxyAdmin, initData);
const {implementation, proxy} = await deployBehindProxy(
new VaultEmitter__factory(deployer),
proxyAdmin,
initData
);

// update address file
await updateAddresses(
Expand Down
7 changes: 4 additions & 3 deletions contracts/halo/airdrop/scripts/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,12 @@ export async function deployAirdrop(
const proxyAdmin = await getProxyAdminOwner(hre);

// data setup
const Airdrop = new Airdrop__factory(deployer);
const initData = Airdrop.interface.encodeFunctionData("initialize", [AirdropDataInput]);
const initData = Airdrop__factory.createInterface().encodeFunctionData("initialize", [
AirdropDataInput,
]);
// deploy
const {implementation, proxy} = await deployBehindProxy(
Airdrop,
new Airdrop__factory(deployer),
await proxyAdmin.getAddress(),
initData
);
Expand Down
7 changes: 4 additions & 3 deletions contracts/halo/collector/scripts/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,12 @@ export async function deployCollector(
const proxyAdmin = await getProxyAdminOwner(hre);

// data setup
const Collector = new Collector__factory(deployer);
const initData = Collector.interface.encodeFunctionData("initialize", [CollectorDataInput]);
const initData = Collector__factory.createInterface().encodeFunctionData("initialize", [
CollectorDataInput,
]);
// deploy
const {implementation, proxy} = await deployBehindProxy(
Collector,
new Collector__factory(deployer),
await proxyAdmin.getAddress(),
initData
);
Expand Down
7 changes: 4 additions & 3 deletions contracts/halo/community/scripts/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,12 @@ export async function deployCommunity(
const proxyAdmin = await getProxyAdminOwner(hre);

// data setup
const Community = new Community__factory(deployer);
const initData = Community.interface.encodeFunctionData("initialize", [CommunityDataInput]);
const initData = Community__factory.createInterface().encodeFunctionData("initialize", [
CommunityDataInput,
]);
// deploy
const {implementation, proxy} = await deployBehindProxy(
Community,
new Community__factory(deployer),
await proxyAdmin.getAddress(),
initData
);
Expand Down
8 changes: 5 additions & 3 deletions contracts/halo/gov/scripts/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,13 @@ export async function deployGov(
const proxyAdmin = await getProxyAdminOwner(hre);

// data setup
const Gov = new Gov__factory(deployer);
const initData = Gov.interface.encodeFunctionData("initialize", [haloToken, timelock]);
const initData = Gov__factory.createInterface().encodeFunctionData("initialize", [
haloToken,
timelock,
]);
// deploy
const {implementation, proxy} = await deployBehindProxy(
Gov,
new Gov__factory(deployer),
await proxyAdmin.getAddress(),
initData
);
Expand Down
7 changes: 4 additions & 3 deletions contracts/halo/staking/scripts/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,12 @@ export async function deployStaking(
const proxyAdmin = await getProxyAdminOwner(hre);

// data setup
const Staking = new Staking__factory(deployer);
const initData = Staking.interface.encodeFunctionData("initialize", [StakingDataInput]);
const initData = Staking__factory.createInterface().encodeFunctionData("initialize", [
StakingDataInput,
]);
// deploy
const {implementation, proxy} = await deployBehindProxy(
Staking,
new Staking__factory(deployer),
await proxyAdmin.getAddress(),
initData
);
Expand Down
7 changes: 4 additions & 3 deletions contracts/halo/vesting/scripts/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,12 @@ export async function deployVesting(
const proxyAdmin = await getProxyAdminOwner(hre);

// data setup
const Vesting = new Vesting__factory(deployer);
const initData = Vesting.interface.encodeFunctionData("initialize", [VestingDataInput]);
const initData = Vesting__factory.createInterface().encodeFunctionData("initialize", [
VestingDataInput,
]);
// deploy
const {implementation, proxy} = await deployBehindProxy(
Vesting,
new Vesting__factory(deployer),
await proxyAdmin.getAddress(),
initData
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,15 @@ export async function deployEndowmentMultiSigEmitter(
logger.out("Deploying EndowmentMultiSigEmitter...");

// deploy emitter
const Emitter = new EndowmentMultiSigEmitter__factory(deployer);
const initData = Emitter.interface.encodeFunctionData("initEndowmentMultiSigEmitter", [factory]);
const emitter = await deployBehindProxy(Emitter, proxyAdmin, initData);
const initData = EndowmentMultiSigEmitter__factory.createInterface().encodeFunctionData(
"initEndowmentMultiSigEmitter",
[factory]
);
const emitter = await deployBehindProxy(
new EndowmentMultiSigEmitter__factory(deployer),
proxyAdmin,
initData
);

// update address file
await updateAddresses(
Expand Down
9 changes: 6 additions & 3 deletions contracts/multisigs/scripts/deployAPTeamMultiSig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,18 @@ export async function deployAPTeamMultiSig(
: CONFIG.PROD_CONFIG.APTeamMultiSigOwners;

// data setup
const APTeamMultiSig = new APTeamMultiSig__factory(deployer);
const data = APTeamMultiSig.interface.encodeFunctionData("initializeAPTeam", [
const data = APTeamMultiSig__factory.createInterface().encodeFunctionData("initializeAPTeam", [
owners,
CONFIG.AP_TEAM_MULTISIG_DATA.threshold,
CONFIG.AP_TEAM_MULTISIG_DATA.requireExecution,
CONFIG.AP_TEAM_MULTISIG_DATA.transactionExpiry,
]);
// deploy
const {implementation, proxy} = await deployBehindProxy(APTeamMultiSig, proxyAdmin, data);
const {implementation, proxy} = await deployBehindProxy(
new APTeamMultiSig__factory(deployer),
proxyAdmin,
data
);

// update address file
await updateAddresses(
Expand Down
28 changes: 15 additions & 13 deletions contracts/multisigs/scripts/deployCharityApplications.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,23 @@ export async function deployCharityApplications(
: await Promise.all(charityApplicationsOwners.map((x) => x.getAddress()));

// data setup
const CharityApplications = new CharityApplications__factory(deployer);
const initData = CharityApplications.interface.encodeFunctionData("initializeApplications", [
owners,
CONFIG.CHARITY_APPLICATIONS_DATA.threshold,
CONFIG.CHARITY_APPLICATIONS_DATA.requireExecution,
CONFIG.CHARITY_APPLICATIONS_DATA.transactionExpiry,
accountsDiamond,
CONFIG.CHARITY_APPLICATIONS_DATA.gasAmount,
CONFIG.CHARITY_APPLICATIONS_DATA.seedSplitToLiquid,
seedAsset,
CONFIG.CHARITY_APPLICATIONS_DATA.seedAmount,
]);
const initData = CharityApplications__factory.createInterface().encodeFunctionData(
"initializeApplications",
[
owners,
CONFIG.CHARITY_APPLICATIONS_DATA.threshold,
CONFIG.CHARITY_APPLICATIONS_DATA.requireExecution,
CONFIG.CHARITY_APPLICATIONS_DATA.transactionExpiry,
accountsDiamond,
CONFIG.CHARITY_APPLICATIONS_DATA.gasAmount,
CONFIG.CHARITY_APPLICATIONS_DATA.seedSplitToLiquid,
seedAsset,
CONFIG.CHARITY_APPLICATIONS_DATA.seedAmount,
]
);
// deploy
const {implementation, proxy} = await deployBehindProxy(
CharityApplications,
new CharityApplications__factory(deployer),
proxyAdmin,
initData
);
Expand Down