Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

start erc20 before deploying because decimals #110

Merged
merged 1 commit into from
Jan 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading