-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
358 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,3 +12,6 @@ node_modules | |
# solidity-coverage files | ||
/coverage | ||
/coverage.json | ||
|
||
/deployments/hardhat | ||
/deployments/localhost |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
// SPDX-FileCopyrightText: 2024 IEXEC BLOCKCHAIN TECH <[email protected]> | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
import { deployments, ethers } from 'hardhat'; | ||
import * as voucherHubUtils from '../scripts/voucherHubUtils'; | ||
import * as voucherUtils from '../scripts/voucherUtils'; | ||
import { UpgradeableBeacon } from '../typechain-types'; | ||
|
||
export default async function () { | ||
const iexecPoco = '0x123456789a123456789b123456789b123456789d'; // TODO: Change it | ||
const [admin, assetEligibilityManager, voucherManager] = await ethers.getSigners(); | ||
await deployAll( | ||
admin.address, | ||
assetEligibilityManager.address, | ||
voucherManager.address, | ||
iexecPoco, | ||
); | ||
} | ||
|
||
async function deployAll( | ||
beaconOwner: string, | ||
assetEligibilityManager: string, | ||
voucherManager: string, | ||
iexecPoco: string, | ||
): Promise<string> { | ||
// Deploy Voucher beacon and implementation. | ||
const beacon: UpgradeableBeacon = await voucherUtils.deployBeaconAndImplementation(beaconOwner); | ||
const beaconAddress = await beacon.getAddress(); | ||
console.log(`UpgradeableBeacon: ${beaconAddress}`); | ||
console.log(`Voucher implementation: ${await beacon.implementation()}`); | ||
// Deploy VoucherHub. | ||
const voucherHub = await voucherHubUtils.deployHub( | ||
assetEligibilityManager, | ||
voucherManager, | ||
iexecPoco, | ||
beaconAddress, | ||
); | ||
const voucherHubAddress = await voucherHub.getAddress(); | ||
console.log(`VoucherHub: ${voucherHubAddress}`); | ||
// Check | ||
if ((await voucherHub.getVoucherBeacon()) !== beaconAddress) { | ||
throw new Error('Deployment error'); | ||
} | ||
// Save VoucherHub in deployments folder because | ||
// hardhat-deploy#deploy() is not used. | ||
await deployments.save('VoucherHub', { | ||
// TODO save abi. | ||
abi: [], | ||
address: voucherHubAddress, | ||
}); | ||
return voucherHubAddress; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.