difftreelog
chore compile fractionalizer in typescript
in: master
4 files changed
.maintain/scripts/compile_fractionalizer.shdiffbeforeafterboth--- a/.maintain/scripts/compile_fractionalizer.sh
+++ /dev/null
@@ -1,21 +0,0 @@
-#!/bin/sh
-set -eu
-
-dir=$PWD
-
-tmp=$(mktemp -d)
-cd $tmp
-mkdir refungible
-mkdir api
-cp $dir/tests/src/eth/fractionalizer/Fractionalizer.sol refungible/input.sol
-cp $dir/tests/src/eth/api/CollectionHelpers.sol api/CollectionHelpers.sol
-cp $dir/tests/src/eth/api/ContractHelpers.sol api/ContractHelpers.sol
-cp $dir/tests/src/eth/api/UniqueRefungibleToken.sol api/UniqueRefungibleToken.sol
-cp $dir/tests/src/eth/api/UniqueRefungible.sol api/UniqueRefungible.sol
-cp $dir/tests/src/eth/api/UniqueNFT.sol api/UniqueNFT.sol
-solcjs --optimize --bin refungible/input.sol -o $PWD
-solcjs --abi -p refungible/input.sol
-
-mv refungible_input_sol_Fractionalizer.bin $dir/tests/src/eth/fractionalizer/Fractionalizer.bin
-mv refungible_input_sol_Fractionalizer.abi refungible_input_sol_Fractionalizer.json
-prettier refungible_input_sol_Fractionalizer.json > $dir/tests/src/eth/fractionalizer/FractionalizerAbi.json
Makefilediffbeforeafterboth1.PHONY: _help2_help:3 @echo "regenerate_solidity - generate stubs/interfaces for contracts defined in native (via evm-coder)"4 @echo "evm_stubs - recompile contract stubs and ABI"5 @echo "bench - run frame-benchmarking"6 @echo " bench-evm-migration"7 @echo " bench-unique"89FUNGIBLE_EVM_STUBS=./pallets/fungible/src/stubs10FUNGIBLE_EVM_ABI=./tests/src/eth/fungibleAbi.json1112REFUNGIBLE_EVM_STUBS=./pallets/refungible/src/stubs13REFUNGIBLE_EVM_ABI=./tests/src/eth/refungibleAbi.json1415NONFUNGIBLE_EVM_STUBS=./pallets/nonfungible/src/stubs16NONFUNGIBLE_EVM_ABI=./tests/src/eth/nonFungibleAbi.json1718REFUNGIBLE_EVM_STUBS=./pallets/refungible/src/stubs19REFUNGIBLE_EVM_ABI=./tests/src/eth/reFungibleAbi.json20REFUNGIBLE_TOKEN_EVM_ABI=./tests/src/eth/reFungibleTokenAbi.json2122CONTRACT_HELPERS_STUBS=./pallets/evm-contract-helpers/src/stubs/23CONTRACT_HELPERS_ABI=./tests/src/eth/util/contractHelpersAbi.json2425COLLECTION_HELPER_STUBS=./pallets/unique/src/eth/stubs/26COLLECTION_HELPER_ABI=./tests/src/eth/collectionHelpersAbi.json2728TESTS_API=./tests/src/eth/api/2930.PHONY: regenerate_solidity31regenerate_solidity: UniqueFungible.sol UniqueNFT.sol UniqueRefungible.sol UniqueRefungibleToken.sol ContractHelpers.sol CollectionHelpers.sol3233UniqueFungible.sol:34 PACKAGE=pallet-fungible NAME=erc::gen_iface OUTPUT=$(TESTS_API)/$@ ./.maintain/scripts/generate_sol.sh35 PACKAGE=pallet-fungible NAME=erc::gen_impl OUTPUT=$(FUNGIBLE_EVM_STUBS)/$@ ./.maintain/scripts/generate_sol.sh3637UniqueNFT.sol:38 PACKAGE=pallet-nonfungible NAME=erc::gen_iface OUTPUT=$(TESTS_API)/$@ ./.maintain/scripts/generate_sol.sh39 PACKAGE=pallet-nonfungible NAME=erc::gen_impl OUTPUT=$(NONFUNGIBLE_EVM_STUBS)/$@ ./.maintain/scripts/generate_sol.sh4041UniqueRefungible.sol:42 PACKAGE=pallet-refungible NAME=erc::gen_iface OUTPUT=$(TESTS_API)/$@ ./.maintain/scripts/generate_sol.sh43 PACKAGE=pallet-refungible NAME=erc::gen_impl OUTPUT=$(REFUNGIBLE_EVM_STUBS)/$@ ./.maintain/scripts/generate_sol.sh4445UniqueRefungibleToken.sol:46 PACKAGE=pallet-refungible NAME=erc_token::gen_iface OUTPUT=$(TESTS_API)/$@ ./.maintain/scripts/generate_sol.sh47 PACKAGE=pallet-refungible NAME=erc_token::gen_impl OUTPUT=$(REFUNGIBLE_EVM_STUBS)/$@ ./.maintain/scripts/generate_sol.sh4849ContractHelpers.sol:50 PACKAGE=pallet-evm-contract-helpers NAME=eth::contract_helpers_iface OUTPUT=$(TESTS_API)/$@ ./.maintain/scripts/generate_sol.sh51 PACKAGE=pallet-evm-contract-helpers NAME=eth::contract_helpers_impl OUTPUT=$(CONTRACT_HELPERS_STUBS)/$@ ./.maintain/scripts/generate_sol.sh5253CollectionHelpers.sol:54 PACKAGE=pallet-unique NAME=eth::collection_helper_iface OUTPUT=$(TESTS_API)/$@ ./.maintain/scripts/generate_sol.sh55 PACKAGE=pallet-unique NAME=eth::collection_helper_impl OUTPUT=$(COLLECTION_HELPER_STUBS)/$@ ./.maintain/scripts/generate_sol.sh5657UniqueFungible: UniqueFungible.sol58 INPUT=$(FUNGIBLE_EVM_STUBS)/$< OUTPUT=$(FUNGIBLE_EVM_STUBS)/UniqueFungible.raw ./.maintain/scripts/compile_stub.sh59 INPUT=$(FUNGIBLE_EVM_STUBS)/$< OUTPUT=$(FUNGIBLE_EVM_ABI) ./.maintain/scripts/generate_abi.sh6061UniqueNFT: UniqueNFT.sol62 INPUT=$(NONFUNGIBLE_EVM_STUBS)/$< OUTPUT=$(NONFUNGIBLE_EVM_STUBS)/UniqueNFT.raw ./.maintain/scripts/compile_stub.sh63 INPUT=$(NONFUNGIBLE_EVM_STUBS)/$< OUTPUT=$(NONFUNGIBLE_EVM_ABI) ./.maintain/scripts/generate_abi.sh6465UniqueRefungible: UniqueRefungible.sol66 INPUT=$(REFUNGIBLE_EVM_STUBS)/$< OUTPUT=$(REFUNGIBLE_EVM_STUBS)/UniqueRefungible.raw ./.maintain/scripts/compile_stub.sh67 INPUT=$(REFUNGIBLE_EVM_STUBS)/$< OUTPUT=$(REFUNGIBLE_EVM_ABI) ./.maintain/scripts/generate_abi.sh6869UniqueRefungibleToken: UniqueRefungibleToken.sol70 INPUT=$(REFUNGIBLE_EVM_STUBS)/$< OUTPUT=$(REFUNGIBLE_EVM_STUBS)/UniqueRefungibleToken.raw ./.maintain/scripts/compile_stub.sh71 INPUT=$(REFUNGIBLE_EVM_STUBS)/$< OUTPUT=$(REFUNGIBLE_TOKEN_EVM_ABI) ./.maintain/scripts/generate_abi.sh7273ContractHelpers: ContractHelpers.sol74 INPUT=$(CONTRACT_HELPERS_STUBS)/$< OUTPUT=$(CONTRACT_HELPERS_STUBS)/ContractHelpers.raw ./.maintain/scripts/compile_stub.sh75 INPUT=$(CONTRACT_HELPERS_STUBS)/$< OUTPUT=$(CONTRACT_HELPERS_ABI) ./.maintain/scripts/generate_abi.sh7677CollectionHelpers: CollectionHelpers.sol78 INPUT=$(COLLECTION_HELPER_STUBS)/$< OUTPUT=$(COLLECTION_HELPER_STUBS)/CollectionHelpers.raw ./.maintain/scripts/compile_stub.sh79 INPUT=$(COLLECTION_HELPER_STUBS)/$< OUTPUT=$(COLLECTION_HELPER_ABI) ./.maintain/scripts/generate_abi.sh8081Fractionalizer:82 ./.maintain/scripts/compile_fractionalizer.sh8384evm_stubs: UniqueFungible UniqueNFT UniqueRefungible UniqueRefungibleToken ContractHelpers CollectionHelpers Fractionalizer8586.PHONY: _bench87_bench:88 cargo run --release --features runtime-benchmarks,$(RUNTIME) -- \89 benchmark pallet --pallet pallet-$(if $(PALLET),$(PALLET),$(error Must set PALLET)) \90 --wasm-execution compiled --extrinsic '*' \91 --template .maintain/frame-weight-template.hbs --steps=50 --repeat=80 --heap-pages=4096 \92 --output=./pallets/$(if $(PALLET_DIR),$(PALLET_DIR),$(PALLET))/src/weights.rs9394.PHONY: bench-evm-migration95bench-evm-migration:96 make _bench PALLET=evm-migration9798.PHONY: bench-common99bench-common:100 make _bench PALLET=common101102.PHONY: bench-unique103bench-unique:104 make _bench PALLET=unique105106.PHONY: bench-fungible107bench-fungible:108 make _bench PALLET=fungible109110.PHONY: bench-refungible111bench-refungible:112 make _bench PALLET=refungible113114.PHONY: bench-nonfungible115bench-nonfungible:116 make _bench PALLET=nonfungible117118.PHONY: bench-structure119bench-structure:120 make _bench PALLET=structure121122.PHONY: bench-scheduler123bench-scheduler:124 make _bench PALLET=unique-scheduler PALLET_DIR=scheduler125126.PHONY: bench-rmrk-core127bench-rmrk-core:128 make _bench PALLET=proxy-rmrk-core129130.PHONY: bench-rmrk-equip131bench-rmrk-equip:132 make _bench PALLET=proxy-rmrk-equip133134.PHONY: bench135bench: bench-evm-migration bench-unique bench-structure bench-fungible bench-refungible bench-nonfungible bench-scheduler bench-rmrk-core bench-rmrk-equip1.PHONY: _help2_help:3 @echo "regenerate_solidity - generate stubs/interfaces for contracts defined in native (via evm-coder)"4 @echo "evm_stubs - recompile contract stubs and ABI"5 @echo "bench - run frame-benchmarking"6 @echo " bench-evm-migration"7 @echo " bench-unique"89FUNGIBLE_EVM_STUBS=./pallets/fungible/src/stubs10FUNGIBLE_EVM_ABI=./tests/src/eth/fungibleAbi.json1112REFUNGIBLE_EVM_STUBS=./pallets/refungible/src/stubs13REFUNGIBLE_EVM_ABI=./tests/src/eth/refungibleAbi.json1415NONFUNGIBLE_EVM_STUBS=./pallets/nonfungible/src/stubs16NONFUNGIBLE_EVM_ABI=./tests/src/eth/nonFungibleAbi.json1718REFUNGIBLE_EVM_STUBS=./pallets/refungible/src/stubs19REFUNGIBLE_EVM_ABI=./tests/src/eth/reFungibleAbi.json20REFUNGIBLE_TOKEN_EVM_ABI=./tests/src/eth/reFungibleTokenAbi.json2122CONTRACT_HELPERS_STUBS=./pallets/evm-contract-helpers/src/stubs/23CONTRACT_HELPERS_ABI=./tests/src/eth/util/contractHelpersAbi.json2425COLLECTION_HELPER_STUBS=./pallets/unique/src/eth/stubs/26COLLECTION_HELPER_ABI=./tests/src/eth/collectionHelpersAbi.json2728TESTS_API=./tests/src/eth/api/2930.PHONY: regenerate_solidity31regenerate_solidity: UniqueFungible.sol UniqueNFT.sol UniqueRefungible.sol UniqueRefungibleToken.sol ContractHelpers.sol CollectionHelpers.sol3233UniqueFungible.sol:34 PACKAGE=pallet-fungible NAME=erc::gen_iface OUTPUT=$(TESTS_API)/$@ ./.maintain/scripts/generate_sol.sh35 PACKAGE=pallet-fungible NAME=erc::gen_impl OUTPUT=$(FUNGIBLE_EVM_STUBS)/$@ ./.maintain/scripts/generate_sol.sh3637UniqueNFT.sol:38 PACKAGE=pallet-nonfungible NAME=erc::gen_iface OUTPUT=$(TESTS_API)/$@ ./.maintain/scripts/generate_sol.sh39 PACKAGE=pallet-nonfungible NAME=erc::gen_impl OUTPUT=$(NONFUNGIBLE_EVM_STUBS)/$@ ./.maintain/scripts/generate_sol.sh4041UniqueRefungible.sol:42 PACKAGE=pallet-refungible NAME=erc::gen_iface OUTPUT=$(TESTS_API)/$@ ./.maintain/scripts/generate_sol.sh43 PACKAGE=pallet-refungible NAME=erc::gen_impl OUTPUT=$(REFUNGIBLE_EVM_STUBS)/$@ ./.maintain/scripts/generate_sol.sh4445UniqueRefungibleToken.sol:46 PACKAGE=pallet-refungible NAME=erc_token::gen_iface OUTPUT=$(TESTS_API)/$@ ./.maintain/scripts/generate_sol.sh47 PACKAGE=pallet-refungible NAME=erc_token::gen_impl OUTPUT=$(REFUNGIBLE_EVM_STUBS)/$@ ./.maintain/scripts/generate_sol.sh4849ContractHelpers.sol:50 PACKAGE=pallet-evm-contract-helpers NAME=eth::contract_helpers_iface OUTPUT=$(TESTS_API)/$@ ./.maintain/scripts/generate_sol.sh51 PACKAGE=pallet-evm-contract-helpers NAME=eth::contract_helpers_impl OUTPUT=$(CONTRACT_HELPERS_STUBS)/$@ ./.maintain/scripts/generate_sol.sh5253CollectionHelpers.sol:54 PACKAGE=pallet-unique NAME=eth::collection_helper_iface OUTPUT=$(TESTS_API)/$@ ./.maintain/scripts/generate_sol.sh55 PACKAGE=pallet-unique NAME=eth::collection_helper_impl OUTPUT=$(COLLECTION_HELPER_STUBS)/$@ ./.maintain/scripts/generate_sol.sh5657UniqueFungible: UniqueFungible.sol58 INPUT=$(FUNGIBLE_EVM_STUBS)/$< OUTPUT=$(FUNGIBLE_EVM_STUBS)/UniqueFungible.raw ./.maintain/scripts/compile_stub.sh59 INPUT=$(FUNGIBLE_EVM_STUBS)/$< OUTPUT=$(FUNGIBLE_EVM_ABI) ./.maintain/scripts/generate_abi.sh6061UniqueNFT: UniqueNFT.sol62 INPUT=$(NONFUNGIBLE_EVM_STUBS)/$< OUTPUT=$(NONFUNGIBLE_EVM_STUBS)/UniqueNFT.raw ./.maintain/scripts/compile_stub.sh63 INPUT=$(NONFUNGIBLE_EVM_STUBS)/$< OUTPUT=$(NONFUNGIBLE_EVM_ABI) ./.maintain/scripts/generate_abi.sh6465UniqueRefungible: UniqueRefungible.sol66 INPUT=$(REFUNGIBLE_EVM_STUBS)/$< OUTPUT=$(REFUNGIBLE_EVM_STUBS)/UniqueRefungible.raw ./.maintain/scripts/compile_stub.sh67 INPUT=$(REFUNGIBLE_EVM_STUBS)/$< OUTPUT=$(REFUNGIBLE_EVM_ABI) ./.maintain/scripts/generate_abi.sh6869UniqueRefungibleToken: UniqueRefungibleToken.sol70 INPUT=$(REFUNGIBLE_EVM_STUBS)/$< OUTPUT=$(REFUNGIBLE_EVM_STUBS)/UniqueRefungibleToken.raw ./.maintain/scripts/compile_stub.sh71 INPUT=$(REFUNGIBLE_EVM_STUBS)/$< OUTPUT=$(REFUNGIBLE_TOKEN_EVM_ABI) ./.maintain/scripts/generate_abi.sh7273ContractHelpers: ContractHelpers.sol74 INPUT=$(CONTRACT_HELPERS_STUBS)/$< OUTPUT=$(CONTRACT_HELPERS_STUBS)/ContractHelpers.raw ./.maintain/scripts/compile_stub.sh75 INPUT=$(CONTRACT_HELPERS_STUBS)/$< OUTPUT=$(CONTRACT_HELPERS_ABI) ./.maintain/scripts/generate_abi.sh7677CollectionHelpers: CollectionHelpers.sol78 INPUT=$(COLLECTION_HELPER_STUBS)/$< OUTPUT=$(COLLECTION_HELPER_STUBS)/CollectionHelpers.raw ./.maintain/scripts/compile_stub.sh79 INPUT=$(COLLECTION_HELPER_STUBS)/$< OUTPUT=$(COLLECTION_HELPER_ABI) ./.maintain/scripts/generate_abi.sh8081evm_stubs: UniqueFungible UniqueNFT UniqueRefungible UniqueRefungibleToken ContractHelpers CollectionHelpers8283.PHONY: _bench84_bench:85 cargo run --release --features runtime-benchmarks,$(RUNTIME) -- \86 benchmark pallet --pallet pallet-$(if $(PALLET),$(PALLET),$(error Must set PALLET)) \87 --wasm-execution compiled --extrinsic '*' \88 --template .maintain/frame-weight-template.hbs --steps=50 --repeat=80 --heap-pages=4096 \89 --output=./pallets/$(if $(PALLET_DIR),$(PALLET_DIR),$(PALLET))/src/weights.rs9091.PHONY: bench-evm-migration92bench-evm-migration:93 make _bench PALLET=evm-migration9495.PHONY: bench-common96bench-common:97 make _bench PALLET=common9899.PHONY: bench-unique100bench-unique:101 make _bench PALLET=unique102103.PHONY: bench-fungible104bench-fungible:105 make _bench PALLET=fungible106107.PHONY: bench-refungible108bench-refungible:109 make _bench PALLET=refungible110111.PHONY: bench-nonfungible112bench-nonfungible:113 make _bench PALLET=nonfungible114115.PHONY: bench-structure116bench-structure:117 make _bench PALLET=structure118119.PHONY: bench-scheduler120bench-scheduler:121 make _bench PALLET=unique-scheduler PALLET_DIR=scheduler122123.PHONY: bench-rmrk-core124bench-rmrk-core:125 make _bench PALLET=proxy-rmrk-core126127.PHONY: bench-rmrk-equip128bench-rmrk-equip:129 make _bench PALLET=proxy-rmrk-equip130131.PHONY: bench132bench: bench-evm-migration bench-unique bench-structure bench-fungible bench-refungible bench-nonfungible bench-scheduler bench-rmrk-core bench-rmrk-equiptests/src/eth/fractionalizer/fractionalizer.test.tsdiffbeforeafterboth--- a/tests/src/eth/fractionalizer/fractionalizer.test.ts
+++ b/tests/src/eth/fractionalizer/fractionalizer.test.ts
@@ -19,11 +19,11 @@
import {ApiPromise} from '@polkadot/api';
import {evmToAddress} from '@polkadot/util-crypto';
import {readFile} from 'fs/promises';
-import fractionalizerAbi from './FractionalizerAbi.json';
import {submitTransactionAsync} from '../../substrate/substrate-api';
import {UNIQUE} from '../../util/helpers';
-import {collectionIdToAddress, createEthAccountWithBalance, createNonfungibleCollection, createRefungibleCollection, GAS_ARGS, itWeb3, tokenIdFromAddress, uniqueNFT, uniqueRefungible, uniqueRefungibleToken} from '../util/helpers';
+import {collectionIdToAddress, CompiledContract, createEthAccountWithBalance, createNonfungibleCollection, createRefungibleCollection, GAS_ARGS, itWeb3, tokenIdFromAddress, uniqueNFT, uniqueRefungible, uniqueRefungibleToken} from '../util/helpers';
import {Contract} from 'web3-eth-contract';
+import * as solc from 'solc';
import chai from 'chai';
import chaiAsPromised from 'chai-as-promised';
@@ -32,17 +32,67 @@
chai.use(chaiAsPromised);
chai.use(chaiLike);
const expect = chai.expect;
+let fractionalizer: CompiledContract;
+
+async function compileFractionalizer() {
+ if (!fractionalizer) {
+ const input = {
+ language: 'Solidity',
+ sources: {
+ ['Fractionalizer.sol']: {
+ content: (await readFile(`${__dirname}/Fractionalizer.sol`)).toString(),
+ },
+ },
+ settings: {
+ outputSelection: {
+ '*': {
+ '*': ['*'],
+ },
+ },
+ },
+ };
+ const json = JSON.parse(solc.compile(JSON.stringify(input), {import: await findImports()}));
+ const out = json.contracts['Fractionalizer.sol']['Fractionalizer'];
+
+ fractionalizer = {
+ abi: out.abi,
+ object: '0x' + out.evm.bytecode.object,
+ };
+ }
+ return fractionalizer;
+}
+
+async function findImports() {
+ const collectionHelpers = (await readFile(`${__dirname}/../api/CollectionHelpers.sol`)).toString();
+ const contractHelpers = (await readFile(`${__dirname}/../api/ContractHelpers.sol`)).toString();
+ const uniqueRefungibleToken = (await readFile(`${__dirname}/../api/UniqueRefungibleToken.sol`)).toString();
+ const uniqueRefungible = (await readFile(`${__dirname}/../api/UniqueRefungible.sol`)).toString();
+ const uniqueNFT = (await readFile(`${__dirname}/../api/UniqueNFT.sol`)).toString();
-async function deployFractionalizer(api: ApiPromise, web3: Web3, owner: string) {
- const fractionalizerContract = new web3.eth.Contract(fractionalizerAbi as any, undefined, {
+ return function(path: string) {
+ switch (path) {
+ case 'api/CollectionHelpers.sol': return {contents: `${collectionHelpers}`};
+ case 'api/ContractHelpers.sol': return {contents: `${contractHelpers}`};
+ case 'api/UniqueRefungibleToken.sol': return {contents: `${uniqueRefungibleToken}`};
+ case 'api/UniqueRefungible.sol': return {contents: `${uniqueRefungible}`};
+ case 'api/UniqueNFT.sol': return {contents: `${uniqueNFT}`};
+ default: return {error: 'File not found'};
+ }
+ };
+}
+
+async function deployFractionalizer(web3: Web3, owner: string) {
+ const compiled = await compileFractionalizer();
+ const fractionalizerContract = new web3.eth.Contract(compiled.abi, undefined, {
+ data: compiled.object,
from: owner,
...GAS_ARGS,
});
- return await fractionalizerContract.deploy({data: (await readFile(`${__dirname}/Fractionalizer.bin`)).toString()}).send({from: owner});
+ return await fractionalizerContract.deploy({data: compiled.object}).send({from: owner});
}
async function initFractionalizer(api: ApiPromise, web3: Web3, privateKeyWrapper: (account: string) => IKeyringPair, owner: string) {
- const fractionalizer = await deployFractionalizer(api, web3, owner);
+ const fractionalizer = await deployFractionalizer(web3, owner);
const tx = api.tx.balances.transfer(evmToAddress(fractionalizer.options.address), 10n * UNIQUE);
const alice = privateKeyWrapper('//Alice');
await submitTransactionAsync(alice, tx);
@@ -71,7 +121,7 @@
describe('Fractionalizer contract usage', () => {
itWeb3('Set RFT collection', async ({api, web3, privateKeyWrapper}) => {
const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);
- const fractionalizer = await deployFractionalizer(api, web3, owner);
+ const fractionalizer = await deployFractionalizer(web3, owner);
const {collectionIdAddress} = await createRefungibleCollection(api, web3, owner);
const refungibleContract = uniqueRefungible(web3, collectionIdAddress, owner);
await refungibleContract.methods.addCollectionAdmin(fractionalizer.options.address).send();
@@ -88,7 +138,7 @@
itWeb3('Mint RFT collection', async ({api, web3, privateKeyWrapper}) => {
const alice = privateKeyWrapper('//Alice');
const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);
- const fractionalizer = await deployFractionalizer(api, web3, owner);
+ const fractionalizer = await deployFractionalizer(web3, owner);
const tx = api.tx.balances.transfer(evmToAddress(fractionalizer.options.address), 10n * UNIQUE);
await submitTransactionAsync(alice, tx);
@@ -183,7 +233,7 @@
const {collectionIdAddress} = await createRefungibleCollection(api, web3, owner);
const refungibleContract = uniqueRefungible(web3, collectionIdAddress, owner);
- const fractionalizer = await deployFractionalizer(api, web3, owner);
+ const fractionalizer = await deployFractionalizer(web3, owner);
await refungibleContract.methods.addCollectionAdmin(fractionalizer.options.address).send();
await fractionalizer.methods.setRFTCollection(collectionIdAddress).send();
@@ -196,7 +246,7 @@
const {collectionIdAddress} = await createNonfungibleCollection(api, web3, owner);
const nftContract = uniqueNFT(web3, collectionIdAddress, owner);
- const fractionalizer = await deployFractionalizer(api, web3, owner);
+ const fractionalizer = await deployFractionalizer(web3, owner);
await nftContract.methods.addCollectionAdmin(fractionalizer.options.address).send();
await expect(fractionalizer.methods.setRFTCollection(collectionIdAddress).call())
@@ -205,7 +255,7 @@
itWeb3('call setRFTCollection while not collection admin', async ({api, web3, privateKeyWrapper}) => {
const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);
- const fractionalizer = await deployFractionalizer(api, web3, owner);
+ const fractionalizer = await deployFractionalizer(web3, owner);
const {collectionIdAddress} = await createRefungibleCollection(api, web3, owner);
await expect(fractionalizer.methods.setRFTCollection(collectionIdAddress).call())
@@ -215,7 +265,7 @@
itWeb3('call setRFTCollection after createAndSetRFTCollection', async ({api, web3, privateKeyWrapper}) => {
const alice = privateKeyWrapper('//Alice');
const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);
- const fractionalizer = await deployFractionalizer(api, web3, owner);
+ const fractionalizer = await deployFractionalizer(web3, owner);
const tx = api.tx.balances.transfer(evmToAddress(fractionalizer.options.address), 10n * UNIQUE);
await submitTransactionAsync(alice, tx);
@@ -234,7 +284,7 @@
const nftTokenId = await nftContract.methods.nextTokenId().call();
await nftContract.methods.mint(owner, nftTokenId).send();
- const fractionalizer = await deployFractionalizer(api, web3, owner);
+ const fractionalizer = await deployFractionalizer(web3, owner);
await expect(fractionalizer.methods.nft2rft(nftCollectionAddress, nftTokenId, 100).call())
.to.eventually.be.rejectedWith(/RFT collection is not set$/g);
@@ -291,7 +341,7 @@
itWeb3('call rft2nft without setting RFT collection for contract', async ({api, web3, privateKeyWrapper}) => {
const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);
- const fractionalizer = await deployFractionalizer(api, web3, owner);
+ const fractionalizer = await deployFractionalizer(web3, owner);
const {collectionIdAddress: rftCollectionAddress} = await createRefungibleCollection(api, web3, owner);
const refungibleContract = uniqueRefungible(web3, rftCollectionAddress, owner);
const rftTokenId = await refungibleContract.methods.nextTokenId().call();
@@ -318,7 +368,7 @@
const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);
const {collectionIdAddress: rftCollectionAddress} = await createRefungibleCollection(api, web3, owner);
- const fractionalizer = await deployFractionalizer(api, web3, owner);
+ const fractionalizer = await deployFractionalizer(web3, owner);
const refungibleContract = uniqueRefungible(web3, rftCollectionAddress, owner);
await refungibleContract.methods.addCollectionAdmin(fractionalizer.options.address).send();
tests/src/eth/util/helpers.tsdiffbeforeafterboth--- a/tests/src/eth/util/helpers.ts
+++ b/tests/src/eth/util/helpers.ts
@@ -250,7 +250,12 @@
return Web3.utils.toChecksumAddress(subToEthLowercase(eth));
}
-export function compileContract(name: string, src: string) {
+export interface CompiledContract {
+ abi: any,
+ object: string,
+}
+
+export function compileContract(name: string, src: string) : CompiledContract {
const out = JSON.parse(solc.compile(JSON.stringify({
language: 'Solidity',
sources: {