Skip to content

Commit

Permalink
start erc20 before deploying because decimals (#110)
Browse files Browse the repository at this point in the history
  • Loading branch information
vhcsilva committed Jan 15, 2024
1 parent 037a7e7 commit 0ff7140
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/models/network-registry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ export class Network_Registry extends Model<Network_RegistryMethods> implements

const token = new ERC20(this.connection, _erc20);

await token.start();

const deployOptions = {
data: Network_RegistryJson.bytecode,
arguments: [
Expand Down
10 changes: 9 additions & 1 deletion test/models/network-registry.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ describe(`Network_Registry`, () => {
let registryAddress: string;
let networkAddress: string;
let erc20Address: string;
const lockAmountForNetworkCreation = 1000;
const lockFeePercentage = 1000000;

before(async () => {
web3Connection = await defaultWeb3Connection(true, true);
Expand All @@ -31,7 +33,7 @@ describe(`Network_Registry`, () => {
it(`Deploys`, async () => {
const registry = new Network_Registry(web3Connection);
await registry.loadAbi();
const receipt = await registry.deployJsonAbi(erc20Address, 1000, await web3Connection.getAddress(), 10000);
const receipt = await registry.deployJsonAbi(erc20Address, lockAmountForNetworkCreation, await web3Connection.getAddress(), lockFeePercentage);
expect(receipt.contractAddress, "Should have deployed");
registryAddress = receipt.contractAddress;
});
Expand Down Expand Up @@ -71,6 +73,12 @@ describe(`Network_Registry`, () => {
});

describe(`Green Path`, () => {
it (`Parameters on contract should be the same of deployment`, async () => {
expect(await registry.erc20()).to.eq(erc20Address);
expect(+(await registry.lockAmountForNetworkCreation())).to.eq(lockAmountForNetworkCreation);
expect(+(await registry.networkCreationFeePercentage())).to.eq(lockFeePercentage / registry.divisor);
});

it(`Test MAX_LOCK_PERCENTAGE_FEE should be equal to 99%`, async () => {
const maxLockPercentageFee = await registry.getMAX_LOCK_PERCENTAGE_FEE();

Expand Down

0 comments on commit 0ff7140

Please sign in to comment.