Skip to content

Commit

Permalink
Merge branch 'develop' into feature/match-orders-boost
Browse files Browse the repository at this point in the history
  • Loading branch information
gfournieriExec committed Apr 29, 2024
2 parents 91ecfa8 + 965a71f commit bba6389
Show file tree
Hide file tree
Showing 7 changed files with 358 additions and 43 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,6 @@ node_modules
# solidity-coverage files
/coverage
/coverage.json

/deployments/hardhat
/deployments/localhost
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## vNEXT
- Match orders boost through voucher. (#16)
- Use hardhat deploy. (#15)
- Upload coverage reports to Codecov. (#14)
- Clean some TODOs. (#13)
- Match orders through voucher. (#12)
Expand Down
52 changes: 52 additions & 0 deletions deploy/deploy.ts
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;
}
1 change: 1 addition & 0 deletions hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import '@nomicfoundation/hardhat-toolbox';
import '@openzeppelin/hardhat-upgrades';
import 'hardhat-dependency-compiler';
import 'hardhat-deploy';
import { HardhatUserConfig } from 'hardhat/config';
import {
HARDHAT_NETWORK_MNEMONIC,
Expand Down
Loading

0 comments on commit bba6389

Please sign in to comment.