Skip to content

Commit

Permalink
fixed MAO test
Browse files Browse the repository at this point in the history
  • Loading branch information
peersky committed Nov 19, 2024
1 parent f9be60d commit 448b827
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion deploy/05_deployMocks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const func: DeployFunction = async (hre: HardhatRuntimeEnvironment) => {
from: deployer,
skipIfAlreadyDeployed: true,
});
console.log('deployed rank token at', result.address);
// console.log('deployed rank token at', result.address);
};

export default func;
Expand Down
1 change: 0 additions & 1 deletion deploy/mao.ts
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,6 @@ const func: DeployFunction = async (hre: HardhatRuntimeEnvironment) => {
_distributionVersion,
],
});
console.warn('where 0');

const MaoDistrCode = await hre.ethers.provider.getCode(result.address);
const MaoDistrCodeId = ethers.utils.keccak256(MaoDistrCode);
Expand Down
11 changes: 9 additions & 2 deletions test/MAODistribution.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* global ethers */

import { deployments, ethers } from 'hardhat';
import { deployments, ethers, getNamedAccounts } from 'hardhat';
import hre from 'hardhat';
import { expect } from 'chai';
import { IDAO, MAODistribution, DAODistributor, Rankify, RankifyDiamondInstance } from '../types';
Expand Down Expand Up @@ -77,7 +77,14 @@ describe('MAODistribution', async function () {
const distributorsDistId = ethers.utils.keccak256(
ethers.utils.defaultAbiCoder.encode(['bytes32', 'address'], [maoId, ethers.constants.AddressZero]),
);
const tx = await distributorContract.instantiate(distributorsDistId, data);
const token = await deployments.get('Rankify');
const { owner } = await getNamedAccounts();
const oSigner = await ethers.getSigner(owner);
const tokenContract = new ethers.Contract(token.address, token.abi, oSigner) as Rankify;
await tokenContract.mint(oSigner.address, ethers.utils.parseEther('100'));
await tokenContract.approve(distributorContract.address, ethers.constants.MaxUint256);

const tx = await distributorContract.connect(oSigner).instantiate(distributorsDistId, data);
// const receipt = await tx.wait(1);
await expect(tx).not.reverted;
expect((await distributorContract.functions.getDistributions()).length).to.equal(1);
Expand Down

0 comments on commit 448b827

Please sign in to comment.