Skip to content
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
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# Changelog

## vNEXT
- Wait for transactions occurring during deployment. (#94)
- Migrate IexecAccessors tests Typescript & Hardhat. (#96)
- Wait for transactions occurring during deployment. (#95)
- Deploy and configure ENS with hardhat. (#93)
- Fix contribute & finalize with callbacks. (#92)
- [Deploy Poco sponsoring on local fork of Bellecour](./scripts/sponsoring/README.md). (#91)
Expand Down
123 changes: 0 additions & 123 deletions test/byContract/IexecAccessors/IexecAccessors.js

This file was deleted.

105 changes: 105 additions & 0 deletions test/byContract/IexecAccessors/IexecAccessors.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
// SPDX-FileCopyrightText: 2020-2024 IEXEC BLOCKCHAIN TECH <contact@iex.ec>
// SPDX-License-Identifier: Apache-2.0

import { loadFixture } from '@nomicfoundation/hardhat-network-helpers';
import { SignerWithAddress } from '@nomiclabs/hardhat-ethers/signers';
import { deployments, ethers, expect } from 'hardhat';
import { loadHardhatFixtureDeployment } from '../../../scripts/hardhat-fixture-deployer';
import { IexecInterfaceNative, IexecInterfaceNative__factory } from '../../../typechain';
import { getIexecAccounts } from '../../../utils/poco-tools';

/**
* Test state view functions.
*/
describe('IexecAccessors', async () => {
let proxyAddress: string;
let iexecPocoAsAnyone: IexecInterfaceNative;
let anyone: SignerWithAddress;

beforeEach('Deploy', async () => {
// Deploy all contracts
proxyAddress = await loadHardhatFixtureDeployment();
// Initialize test environment
await loadFixture(initFixture);
});

async function initFixture() {
const accounts = await getIexecAccounts();
({ anyone } = accounts);
iexecPocoAsAnyone = IexecInterfaceNative__factory.connect(proxyAddress, anyone);
}

it('name', async function () {
expect(await iexecPocoAsAnyone.name()).to.equal('Staked RLC');
});
it('symbol', async function () {
expect(await iexecPocoAsAnyone.symbol()).to.equal('SRLC');
});
it('decimals', async function () {
expect(await iexecPocoAsAnyone.decimals()).to.equal(9n);
});
it('totalSupply', async function () {
expect(await iexecPocoAsAnyone.totalSupply()).to.equal(0n);
});
// TODO test the case where token() == 0x0 in native mode.
it('token', async function () {
expect(await iexecPocoAsAnyone.token()).to.equal(
'0x5FbDB2315678afecb367f032d93F642f64180aa3',
);
});
it('countCategory', async function () {
expect(await iexecPocoAsAnyone.countCategory()).to.equal(5);
});
it('appRegistry', async function () {
expect(await iexecPocoAsAnyone.appregistry()).to.equal(
(await deployments.get('AppRegistry')).address,
);
});
it('datasetRegistry', async function () {
expect(await iexecPocoAsAnyone.datasetregistry()).to.equal(
(await deployments.get('DatasetRegistry')).address,
);
});
it('workerpoolRegistry', async function () {
expect(await iexecPocoAsAnyone.workerpoolregistry()).to.equal(
(await deployments.get('WorkerpoolRegistry')).address,
);
});
it('teeBroker', async function () {
expect(await iexecPocoAsAnyone.teebroker()).to.equal(ethers.constants.AddressZero);
});
it('callbackGas', async function () {
expect(await iexecPocoAsAnyone.callbackgas()).to.equal(100_000n);
});
it('contributionDeadlineRatio', async function () {
expect(await iexecPocoAsAnyone.contribution_deadline_ratio()).to.equal(7);
});
it('revealDeadlineRatio', async function () {
expect(await iexecPocoAsAnyone.reveal_deadline_ratio()).to.equal(2n);
});
it('finalDeadlineRatio', async function () {
expect(await iexecPocoAsAnyone.final_deadline_ratio()).to.equal(10n);
});
it('workerpoolStakeRatio', async function () {
expect(await iexecPocoAsAnyone.workerpool_stake_ratio()).to.equal(30n);
});
it('kittyRatio', async function () {
expect(await iexecPocoAsAnyone.kitty_ratio()).to.equal(10n);
});
it('kittyMin', async function () {
expect(await iexecPocoAsAnyone.kitty_min()).to.equal(1_000_000_000n);
});
it('kittyAddress', async function () {
expect(await iexecPocoAsAnyone.kitty_address()).to.equal(
'0x99c2268479b93fDe36232351229815DF80837e23',
);
});
it('groupMemberPurpose', async function () {
expect(await iexecPocoAsAnyone.groupmember_purpose()).to.equal(4n);
});
it('eip712domainSeparator', async function () {
expect(await iexecPocoAsAnyone.eip712domain_separator()).to.equal(
'0xfc2178d8b8300e657cb9f8b5a4d1957174cf1392e294f3575b82a9cea1da1c4b',
);
});
});