Skip to content

Commit

Permalink
feat: deploy Merkl contracts on Filecoin
Browse files Browse the repository at this point in the history
  • Loading branch information
sogipec committed Nov 6, 2023
1 parent ea9db69 commit 0876c50
Show file tree
Hide file tree
Showing 20 changed files with 6,922 additions and 27 deletions.
5 changes: 3 additions & 2 deletions deploy/0_distributor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const func: DeployFunction = async ({ deployments, ethers, network }) => {
const { deployer } = await ethers.getNamedSigners();

let core: string;
core = '0xC16B81Af351BA9e64C1a069E3Ab18c244A1E3049';
core = '0x3E399AE5B4D8bc0021e53b51c8BCdD66DD62c03b';
/*
if (!network.live) {
// If we're in mainnet fork, we're using the `CoreBorrow` address from mainnet
Expand All @@ -23,7 +23,7 @@ const func: DeployFunction = async ({ deployments, ethers, network }) => {

console.log('Let us get started with deployment');
console.log(deployer.address);

/*
console.log('Now deploying Distributor');
console.log('Starting with the implementation');
Expand All @@ -32,6 +32,7 @@ const func: DeployFunction = async ({ deployments, ethers, network }) => {
from: deployer.address,
log: !argv.ci,
});
*/

const implementationAddress = (await ethers.getContract('Distributor_Implementation_2')).address;

Expand Down
44 changes: 23 additions & 21 deletions deploy/1_distributionCreator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,18 @@ const func: DeployFunction = async ({ deployments, ethers, network }) => {
const { deployer } = await ethers.getNamedSigners();

let core: string;
core = '0x3E399AE5B4D8bc0021e53b51c8BCdD66DD62c03b';
/*
if (!network.live) {
// If we're in mainnet fork, we're using the `CoreBorrow` address from mainnet
core = registry(ChainId.MAINNET)?.Merkl?.CoreMerkl!;
} else {
// Otherwise, we're using the proxy admin address from the desired network
core = registry(network.config.chainId as ChainId)?.Merkl?.CoreMerkl!;
}
*/

console.log(deployer.address);

console.log('Now deploying DistributionCreator');
console.log('Starting with the implementation');
console.log('deployer ', await deployer.getBalance());
Expand All @@ -35,29 +37,29 @@ const func: DeployFunction = async ({ deployments, ethers, network }) => {
console.log(`Successfully deployed the implementation for DistributionCreator at ${implementationAddress}`);
console.log('');

// const distributor = (await deployments.get('Distributor')).address;
// console.log('Now deploying the Proxy');
const distributor = (await deployments.get('Distributor')).address;
console.log('Now deploying the Proxy');

// await deploy('DistributionCreator', {
// contract: 'ERC1967Proxy',
// from: deployer.address,
// args: [implementationAddress, '0x'],
// log: !argv.ci,
// });
await deploy('DistributionCreator', {
contract: 'ERC1967Proxy',
from: deployer.address,
args: [implementationAddress, '0x'],
log: !argv.ci,
});

// const manager = (await deployments.get('DistributionCreator')).address;
// console.log(`Successfully deployed contract at the address ${manager}`);
// console.log('Initializing the contract');
// const contract = new ethers.Contract(
// manager,
// DistributionCreator__factory.createInterface(),
// deployer,
// ) as DistributionCreator;
const manager = (await deployments.get('DistributionCreator')).address;
console.log(`Successfully deployed contract at the address ${manager}`);
console.log('Initializing the contract');
const contract = new ethers.Contract(
manager,
DistributionCreator__factory.createInterface(),
deployer,
) as DistributionCreator;

// await (await contract.connect(deployer).initialize(core, distributor, parseAmount.gwei('0.03'))).wait();
// console.log('Contract successfully initialized');
// console.log('');
// console.log(await contract.core());
await (await contract.connect(deployer).initialize(core, distributor, parseAmount.gwei('0.03'))).wait();
console.log('Contract successfully initialized');
console.log('');
console.log(await contract.core());

/* Once good some functions need to be called to have everything setup.
Expand Down
1 change: 1 addition & 0 deletions deployments/filecoin/.chainId
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
314
132 changes: 132 additions & 0 deletions deployments/filecoin/DistributionCreator.json

Large diffs are not rendered by default.

Loading

0 comments on commit 0876c50

Please sign in to comment.