git.delta.rocks / unique-network / refs/commits / 3c77c1e2ea04

difftreelog

tests: eth_getCode

Max Andreev2023-01-13parent: #48a519d.patch.diff
in: master

5 files changed

modifiedtests/src/apiConsts.test.tsdiffbeforeafterboth
15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
1616
17import {ApiPromise} from '@polkadot/api';17import {ApiPromise} from '@polkadot/api';
18import {usingPlaygrounds, itSub, expect} from './util';18import {usingPlaygrounds, itSub, expect, COLLECTION_HELPER, CONTRACT_HELPER} from './util';
1919
2020
21const MAX_COLLECTION_DESCRIPTION_LENGTH = 256n;21const MAX_COLLECTION_DESCRIPTION_LENGTH = 256n;
41 transfersEnabled: true,41 transfersEnabled: true,
42};42};
43
44const EVM_COLLECTION_HELPERS_ADDRESS = '0x6c4e9fe1ae37a41e93cee429e8e1881abdcbb54f';
45const HELPERS_CONTRACT_ADDRESS = '0x842899ECF380553E8a4de75bF534cdf6fBF64049';
4643
47describe('integration test: API UNIQUE consts', () => {44describe('integration test: API UNIQUE consts', () => {
48 let api: ApiPromise;45 let api: ApiPromise;
106 });103 });
107104
108 itSub('HELPERS_CONTRACT_ADDRESS', () => {105 itSub('HELPERS_CONTRACT_ADDRESS', () => {
109 expect(api.consts.evmContractHelpers.contractAddress.toString().toLowerCase()).to.be.equal(HELPERS_CONTRACT_ADDRESS.toLowerCase());106 expect(api.consts.evmContractHelpers.contractAddress.toString().toLowerCase()).to.be.equal(CONTRACT_HELPER.toLowerCase());
110 });107 });
111108
112 itSub('EVM_COLLECTION_HELPERS_ADDRESS', () => {109 itSub('EVM_COLLECTION_HELPERS_ADDRESS', () => {
113 expect(api.consts.common.contractAddress.toString().toLowerCase()).to.be.equal(EVM_COLLECTION_HELPERS_ADDRESS.toLowerCase());110 expect(api.consts.common.contractAddress.toString().toLowerCase()).to.be.equal(COLLECTION_HELPER.toLowerCase());
114 });111 });
115});112});
116113
modifiedtests/src/eth/collectionHelperAddress.test.tsdiffbeforeafterboth
1616
17import {itEth, usingEthPlaygrounds, expect} from './util';17import {itEth, usingEthPlaygrounds, expect} from './util';
18import {IKeyringPair} from '@polkadot/types/types';18import {IKeyringPair} from '@polkadot/types/types';
19import {Pallets} from '../util';19import {COLLECTION_HELPER, Pallets} from '../util';
20
21const EVM_COLLECTION_HELPERS_ADDRESS = '0x6c4e9fe1ae37a41e93cee429e8e1881abdcbb54f';
2220
23describe('[eth]CollectionHelperAddress test: ERC20/ERC721 ', () => {21describe('[eth]CollectionHelperAddress test: ERC20/ERC721 ', () => {
24 let donor: IKeyringPair;22 let donor: IKeyringPair;
36 const nftCollection = await helper.ethNativeContract.collection(nftCollectionAddress, 'nft', owner);34 const nftCollection = await helper.ethNativeContract.collection(nftCollectionAddress, 'nft', owner);
3735
38 expect((await nftCollection.methods.collectionHelperAddress().call())36 expect((await nftCollection.methods.collectionHelperAddress().call())
39 .toString().toLowerCase()).to.be.equal(EVM_COLLECTION_HELPERS_ADDRESS);37 .toString().toLowerCase()).to.be.equal(COLLECTION_HELPER);
40 });38 });
4139
42 itEth.ifWithPallets('RFT ', [Pallets.ReFungible], async ({helper}) => {40 itEth.ifWithPallets('RFT ', [Pallets.ReFungible], async ({helper}) => {
4644
47 const rftCollection = await helper.ethNativeContract.collection(rftCollectionAddress, 'rft', owner);45 const rftCollection = await helper.ethNativeContract.collection(rftCollectionAddress, 'rft', owner);
48 expect((await rftCollection.methods.collectionHelperAddress().call())46 expect((await rftCollection.methods.collectionHelperAddress().call())
49 .toString().toLowerCase()).to.be.equal(EVM_COLLECTION_HELPERS_ADDRESS);47 .toString().toLowerCase()).to.be.equal(COLLECTION_HELPER);
50 });48 });
5149
52 itEth('FT', async ({helper}) => {50 itEth('FT', async ({helper}) => {
56 const collection = await helper.ethNativeContract.collection(collectionAddress, 'ft', owner);54 const collection = await helper.ethNativeContract.collection(collectionAddress, 'ft', owner);
5755
58 expect((await collection.methods.collectionHelperAddress().call())56 expect((await collection.methods.collectionHelperAddress().call())
59 .toString().toLowerCase()).to.be.equal(EVM_COLLECTION_HELPERS_ADDRESS);57 .toString().toLowerCase()).to.be.equal(COLLECTION_HELPER);
60 });58 });
6159
62 itEth('[collectionHelpers] convert collectionId into address', async ({helper}) => {60 itEth('[collectionHelpers] convert collectionId into address', async ({helper}) => {
modifiedtests/src/eth/createNFTCollection.test.tsdiffbeforeafterboth
18import {IKeyringPair} from '@polkadot/types/types';18import {IKeyringPair} from '@polkadot/types/types';
19import {expect, itEth, usingEthPlaygrounds} from './util';19import {expect, itEth, usingEthPlaygrounds} from './util';
20import {CollectionLimitField} from './util/playgrounds/types';20import {CollectionLimitField} from './util/playgrounds/types';
21import {COLLECTION_HELPER} from '../util';
2122
2223
23describe('Create NFT collection from EVM', () => {24describe('Create NFT collection from EVM', () => {
4243
43 expect(events).to.be.deep.equal([44 expect(events).to.be.deep.equal([
44 {45 {
45 address: '0x6C4E9fE1AE37a41E93CEE429e8E1881aBdcbb54F',46 address: COLLECTION_HELPER,
46 event: 'CollectionCreated',47 event: 'CollectionCreated',
47 args: {48 args: {
48 owner: owner,49 owner: owner,
addedtests/src/eth/getCode.test.tsdiffbeforeafterboth

no changes

modifiedtests/src/util/index.tsdiffbeforeafterboth
100export const LOCKING_PERIOD = 12n; // 12 blocks of relay100export const LOCKING_PERIOD = 12n; // 12 blocks of relay
101export const UNLOCKING_PERIOD = 6n; // 6 blocks of parachain101export const UNLOCKING_PERIOD = 6n; // 6 blocks of parachain
102102
103// Native contracts
104export const COLLECTION_HELPER = '0x6c4e9fe1ae37a41e93cee429e8e1881abdcbb54f';
105export const CONTRACT_HELPER = '0x842899ECF380553E8a4de75bF534cdf6fBF64049';
103106
104export enum Pallets {107export enum Pallets {
105 Inflation = 'inflation',108 Inflation = 'inflation',