difftreelog
misk: fix after rebase
in: master
14 files changed
Makefilediffbeforeafterboth15NONFUNGIBLE_EVM_STUBS=./pallets/nonfungible/src/stubs15NONFUNGIBLE_EVM_STUBS=./pallets/nonfungible/src/stubs16NONFUNGIBLE_EVM_ABI=./tests/src/eth/nonFungibleAbi.json16NONFUNGIBLE_EVM_ABI=./tests/src/eth/nonFungibleAbi.json171718REFUNGIBLE_EVM_STUBS=./pallets/refungible/src/stubs19RENFUNGIBLE_EVM_ABI=./tests/src/eth/reFungibleAbi.json18RENFUNGIBLE_EVM_ABI=./tests/src/eth/reFungibleAbi.json20RENFUNGIBLE_TOKEN_EVM_ABI=./tests/src/eth/reFungibleTokenAbi.json19RENFUNGIBLE_TOKEN_EVM_ABI=./tests/src/eth/reFungibleTokenAbi.json212028TESTS_API=./tests/src/eth/api/27TESTS_API=./tests/src/eth/api/292830.PHONY: regenerate_solidity29.PHONY: regenerate_solidity31regenerate_solidity: UniqueFungible.sol UniqueNFT.sol UniqueRefungibleToken.sol ContractHelpers.sol CollectionHelpers.sol30regenerate_solidity: UniqueFungible.sol UniqueNFT.sol UniqueRefungible.sol UniqueRefungibleToken.sol ContractHelpers.sol CollectionHelpers.sol323133UniqueFungible.sol:32UniqueFungible.sol:34 PACKAGE=pallet-fungible NAME=erc::gen_iface OUTPUT=$(TESTS_API)/$@ ./.maintain/scripts/generate_sol.sh33 PACKAGE=pallet-fungible NAME=erc::gen_iface OUTPUT=$(TESTS_API)/$@ ./.maintain/scripts/generate_sol.sh38 PACKAGE=pallet-nonfungible NAME=erc::gen_iface OUTPUT=$(TESTS_API)/$@ ./.maintain/scripts/generate_sol.sh37 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.sh38 PACKAGE=pallet-nonfungible NAME=erc::gen_impl OUTPUT=$(NONFUNGIBLE_EVM_STUBS)/$@ ./.maintain/scripts/generate_sol.sh40 39 41UniqueRefungibleToken.sol:40UniqueRFT.sol:42 PACKAGE=pallet-refungible NAME=erc_token::gen_iface OUTPUT=$(TESTS_API)/$@ ./.maintain/scripts/generate_sol.sh41 PACKAGE=pallet-refungible NAME=erc::gen_iface OUTPUT=$(TESTS_API)/$@ ./.maintain/scripts/generate_sol.sh43 PACKAGE=pallet-refungible NAME=erc_token::gen_impl OUTPUT=$(REFUNGIBLE_EVM_STUBS)/$@ ./.maintain/scripts/generate_sol.sh42 PACKAGE=pallet-refungible NAME=erc::gen_impl OUTPUT=$(REFUNGIBLE_EVM_STUBS)/$@ ./.maintain/scripts/generate_sol.sh444345UniqueRefungibleToken.sol:44UniqueRefungibleToken.sol:46 PACKAGE=pallet-refungible NAME=erc_token::gen_iface OUTPUT=$(TESTS_API)/$@ ./.maintain/scripts/generate_sol.sh45 PACKAGE=pallet-refungible NAME=erc_token::gen_iface OUTPUT=$(TESTS_API)/$@ ./.maintain/scripts/generate_sol.sh66 INPUT=$(REFUNGIBLE_EVM_STUBS)/$< OUTPUT=$(REFUNGIBLE_EVM_STUBS)/UniqueRefungibleToken.raw ./.maintain/scripts/compile_stub.sh65 INPUT=$(REFUNGIBLE_EVM_STUBS)/$< OUTPUT=$(REFUNGIBLE_EVM_STUBS)/UniqueRefungibleToken.raw ./.maintain/scripts/compile_stub.sh67 INPUT=$(REFUNGIBLE_EVM_STUBS)/$< OUTPUT=$(RENFUNGIBLE_TOKEN_EVM_ABI) ./.maintain/scripts/generate_abi.sh66 INPUT=$(REFUNGIBLE_EVM_STUBS)/$< OUTPUT=$(RENFUNGIBLE_TOKEN_EVM_ABI) ./.maintain/scripts/generate_abi.sh6768UniqueRefungible: UniqueRFT.sol69 INPUT=$(REFUNGIBLE_EVM_STUBS)/$< OUTPUT=$(REFUNGIBLE_EVM_STUBS)/UniqueRFT.raw ./.maintain/scripts/compile_stub.sh70 INPUT=$(REFUNGIBLE_EVM_STUBS)/$< OUTPUT=$(REFUNGIBLE_EVM_ABI) ./.maintain/scripts/generate_abi.sh687169ContractHelpers: ContractHelpers.sol72ContractHelpers: ContractHelpers.sol70 INPUT=$(CONTRACT_HELPERS_STUBS)/$< OUTPUT=$(CONTRACT_HELPERS_STUBS)/ContractHelpers.raw ./.maintain/scripts/compile_stub.sh73 INPUT=$(CONTRACT_HELPERS_STUBS)/$< OUTPUT=$(CONTRACT_HELPERS_STUBS)/ContractHelpers.raw ./.maintain/scripts/compile_stub.sh74 INPUT=$(COLLECTION_HELPER_STUBS)/$< OUTPUT=$(COLLECTION_HELPER_STUBS)/CollectionHelpers.raw ./.maintain/scripts/compile_stub.sh77 INPUT=$(COLLECTION_HELPER_STUBS)/$< OUTPUT=$(COLLECTION_HELPER_STUBS)/CollectionHelpers.raw ./.maintain/scripts/compile_stub.sh75 INPUT=$(COLLECTION_HELPER_STUBS)/$< OUTPUT=$(COLLECTION_HELPER_ABI) ./.maintain/scripts/generate_abi.sh78 INPUT=$(COLLECTION_HELPER_STUBS)/$< OUTPUT=$(COLLECTION_HELPER_ABI) ./.maintain/scripts/generate_abi.sh767977evm_stubs: UniqueFungible UniqueNFT UniqueRefungibleToken ContractHelpers CollectionHelpers80evm_stubs: UniqueFungible UniqueNFT UniqueRefungible UniqueRefungibleToken ContractHelpers CollectionHelpers788179.PHONY: _bench82.PHONY: _bench80_bench:83_bench:pallets/nonfungible/src/erc.rsdiffbeforeafterboth238 }238 }239 } else if !is_erc721() {239 } else if !is_erc721() {240 return Err("tokenURI not set".into());240 return Err("tokenURI not set".into());241 } else if !is_erc721() {241 }242 return Err("tokenURI not set".into());243 }244242245 if let Some(base_uri) =243 if let Some(base_uri) =246 pallet_common::Pallet::<T>::get_collection_property(self.id, &base_uri_key())244 pallet_common::Pallet::<T>::get_collection_property(self.id, &base_uri_key())499 token_id: uint256,497 token_id: uint256,500 token_uri: string,498 token_uri: string,501 ) -> Result<bool> {499 ) -> Result<bool> {502 let key = u_key();500 let key = url_key();503 let permission = get_token_permission::<T>(self.id, &key)?;501 let permission = get_token_permission::<T>(self.id, &key)?;504 if !permission.collection_admin {502 if !permission.collection_admin {505 return Err("Operation is not allowed".into());503 return Err("Operation is not allowed".into());pallets/nonfungible/src/stubs/UniqueNFT.rawdiffbeforeafterbothbinary blob — no preview
pallets/refungible/src/erc.rsdiffbeforeafterboth38where38where39 T::AccountId: From<[u8; 32]>,39 T::AccountId: From<[u8; 32]>,40{40{41 const CODE: &'static [u8] = include_bytes!("./stubs/UniqueRefungible.raw");41 const CODE: &'static [u8] = include_bytes!("./stubs/UniqueRFT.raw");42 fn call(42 fn call(43 self,43 self,44 handle: &mut impl PrecompileHandle,44 handle: &mut impl PrecompileHandle,pallets/refungible/src/stubs/UniqueRFT.rawdiffbeforeafterbothbinary blob — no preview
pallets/refungible/src/stubs/UniqueRFT.soldiffbeforeafterbothno changes
pallets/refungible/src/stubs/UniqueRefungible.rawdiffbeforeafterbothno changes
pallets/refungible/src/stubs/UniqueRefungibleToken.rawdiffbeforeafterbothbinary blob — no preview
pallets/refungible/src/stubs/UniqueRefungibleToken.soldiffbeforeafterboth333334// Selector: 942e8b2234// Selector: 942e8b2235contract ERC20 is Dummy, ERC165, ERC20Events {35contract ERC20 is Dummy, ERC165, ERC20Events {36 // @return the name of the token.37 //36 // Selector: name() 06fdde0338 // Selector: name() 06fdde0337 function name() public view returns (string memory) {39 function name() public view returns (string memory) {38 require(false, stub_error);40 require(false, stub_error);39 dummy;41 dummy;40 return "";42 return "";41 }43 }424445 // @return the symbol of the token.46 //43 // Selector: symbol() 95d89b4147 // Selector: symbol() 95d89b4144 function symbol() public view returns (string memory) {48 function symbol() public view returns (string memory) {45 require(false, stub_error);49 require(false, stub_error);46 dummy;50 dummy;47 return "";51 return "";48 }52 }495354 // @dev Total number of tokens in existence55 //50 // Selector: totalSupply() 18160ddd56 // Selector: totalSupply() 18160ddd51 function totalSupply() public view returns (uint256) {57 function totalSupply() public view returns (uint256) {52 require(false, stub_error);58 require(false, stub_error);53 dummy;59 dummy;54 return 0;60 return 0;55 }61 }566263 // @dev Not supported64 //57 // Selector: decimals() 313ce56765 // Selector: decimals() 313ce56758 function decimals() public view returns (uint8) {66 function decimals() public view returns (uint8) {59 require(false, stub_error);67 require(false, stub_error);60 dummy;68 dummy;61 return 0;69 return 0;62 }70 }637172 // @dev Gets the balance of the specified address.73 // @param owner The address to query the balance of.74 // @return An uint256 representing the amount owned by the passed address.75 //64 // Selector: balanceOf(address) 70a0823176 // Selector: balanceOf(address) 70a0823165 function balanceOf(address owner) public view returns (uint256) {77 function balanceOf(address owner) public view returns (uint256) {66 require(false, stub_error);78 require(false, stub_error);69 return 0;81 return 0;70 }82 }718384 // @dev Transfer token for a specified address85 // @param to The address to transfer to.86 // @param amount The amount to be transferred.87 //72 // Selector: transfer(address,uint256) a9059cbb88 // Selector: transfer(address,uint256) a9059cbb73 function transfer(address to, uint256 amount) public returns (bool) {89 function transfer(address to, uint256 amount) public returns (bool) {74 require(false, stub_error);90 require(false, stub_error);78 return false;94 return false;79 }95 }809697 // @dev Transfer tokens from one address to another98 // @param from address The address which you want to send tokens from99 // @param to address The address which you want to transfer to100 // @param amount uint256 the amount of tokens to be transferred101 //81 // Selector: transferFrom(address,address,uint256) 23b872dd102 // Selector: transferFrom(address,address,uint256) 23b872dd82 function transferFrom(103 function transferFrom(83 address from,104 address from,92 return false;113 return false;93 }114 }94115116 // @dev Approve the passed address to spend the specified amount of tokens on behalf of `msg.sender`.117 // Beware that changing an allowance with this method brings the risk that someone may use both the old118 // and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this119 // race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:120 // https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729121 // @param spender The address which will spend the funds.122 // @param amount The amount of tokens to be spent.123 //95 // Selector: approve(address,uint256) 095ea7b3124 // Selector: approve(address,uint256) 095ea7b396 function approve(address spender, uint256 amount) public returns (bool) {125 function approve(address spender, uint256 amount) public returns (bool) {97 require(false, stub_error);126 require(false, stub_error);101 return false;130 return false;102 }131 }103132133 // @dev Function to check the amount of tokens that an owner allowed to a spender.134 // @param owner address The address which owns the funds.135 // @param spender address The address which will spend the funds.136 // @return A uint256 specifying the amount of tokens still available for the spender.137 //104 // Selector: allowance(address,address) dd62ed3e138 // Selector: allowance(address,address) dd62ed3e105 function allowance(address owner, address spender)139 function allowance(address owner, address spender)106 public140 public117151118// Selector: ab8deb37152// Selector: ab8deb37119contract ERC20UniqueExtensions is Dummy, ERC165 {153contract ERC20UniqueExtensions is Dummy, ERC165 {154 // @dev Function that burns an amount of the token of a given account,155 // deducting from the sender's allowance for said account.156 // @param from The account whose tokens will be burnt.157 // @param amount The amount that will be burnt.158 //120 // Selector: burnFrom(address,uint256) 79cc6790159 // Selector: burnFrom(address,uint256) 79cc6790121 function burnFrom(address from, uint256 amount) public returns (bool) {160 function burnFrom(address from, uint256 amount) public returns (bool) {122 require(false, stub_error);161 require(false, stub_error);126 return false;165 return false;127 }166 }128167168 // @dev Function that changes total amount of the tokens.169 // Throws if `msg.sender` doesn't owns all of the tokens.170 // @param amount New total amount of the tokens.171 //129 // Selector: repartition(uint256) d2418ca7172 // Selector: repartition(uint256) d2418ca7130 function repartition(uint256 amount) public returns (bool) {173 function repartition(uint256 amount) public returns (bool) {131 require(false, stub_error);174 require(false, stub_error);tests/src/eth/api/UniqueRFT.soldiffbeforeafterbothno changes
tests/src/eth/api/UniqueRefungibleToken.soldiffbeforeafterboth242425// Selector: 942e8b2225// Selector: 942e8b2226interface ERC20 is Dummy, ERC165, ERC20Events {26interface ERC20 is Dummy, ERC165, ERC20Events {27 // @return the name of the token.28 //27 // Selector: name() 06fdde0329 // Selector: name() 06fdde0328 function name() external view returns (string memory);30 function name() external view returns (string memory);293132 // @return the symbol of the token.33 //30 // Selector: symbol() 95d89b4134 // Selector: symbol() 95d89b4131 function symbol() external view returns (string memory);35 function symbol() external view returns (string memory);323637 // @dev Total number of tokens in existence38 //33 // Selector: totalSupply() 18160ddd39 // Selector: totalSupply() 18160ddd34 function totalSupply() external view returns (uint256);40 function totalSupply() external view returns (uint256);354142 // @dev Not supported43 //36 // Selector: decimals() 313ce56744 // Selector: decimals() 313ce56737 function decimals() external view returns (uint8);45 function decimals() external view returns (uint8);384647 // @dev Gets the balance of the specified address.48 // @param owner The address to query the balance of.49 // @return An uint256 representing the amount owned by the passed address.50 //39 // Selector: balanceOf(address) 70a0823151 // Selector: balanceOf(address) 70a0823140 function balanceOf(address owner) external view returns (uint256);52 function balanceOf(address owner) external view returns (uint256);415354 // @dev Transfer token for a specified address55 // @param to The address to transfer to.56 // @param amount The amount to be transferred.57 //42 // Selector: transfer(address,uint256) a9059cbb58 // Selector: transfer(address,uint256) a9059cbb43 function transfer(address to, uint256 amount) external returns (bool);59 function transfer(address to, uint256 amount) external returns (bool);446061 // @dev Transfer tokens from one address to another62 // @param from address The address which you want to send tokens from63 // @param to address The address which you want to transfer to64 // @param amount uint256 the amount of tokens to be transferred65 //45 // Selector: transferFrom(address,address,uint256) 23b872dd66 // Selector: transferFrom(address,address,uint256) 23b872dd46 function transferFrom(67 function transferFrom(47 address from,68 address from,48 address to,69 address to,49 uint256 amount70 uint256 amount50 ) external returns (bool);71 ) external returns (bool);517273 // @dev Approve the passed address to spend the specified amount of tokens on behalf of `msg.sender`.74 // Beware that changing an allowance with this method brings the risk that someone may use both the old75 // and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this76 // race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:77 // https://github.com/ethereum/EIPs/issues/20#issuecomment-26352472978 // @param spender The address which will spend the funds.79 // @param amount The amount of tokens to be spent.80 //52 // Selector: approve(address,uint256) 095ea7b381 // Selector: approve(address,uint256) 095ea7b353 function approve(address spender, uint256 amount) external returns (bool);82 function approve(address spender, uint256 amount) external returns (bool);548384 // @dev Function to check the amount of tokens that an owner allowed to a spender.85 // @param owner address The address which owns the funds.86 // @param spender address The address which will spend the funds.87 // @return A uint256 specifying the amount of tokens still available for the spender.88 //55 // Selector: allowance(address,address) dd62ed3e89 // Selector: allowance(address,address) dd62ed3e56 function allowance(address owner, address spender)90 function allowance(address owner, address spender)57 external91 external619562// Selector: ab8deb3796// Selector: ab8deb3763interface ERC20UniqueExtensions is Dummy, ERC165 {97interface ERC20UniqueExtensions is Dummy, ERC165 {98 // @dev Function that burns an amount of the token of a given account,99 // deducting from the sender's allowance for said account.100 // @param from The account whose tokens will be burnt.101 // @param amount The amount that will be burnt.102 //64 // Selector: burnFrom(address,uint256) 79cc6790103 // Selector: burnFrom(address,uint256) 79cc679065 function burnFrom(address from, uint256 amount) external returns (bool);104 function burnFrom(address from, uint256 amount) external returns (bool);66105106 // @dev Function that changes total amount of the tokens.107 // Throws if `msg.sender` doesn't owns all of the tokens.108 // @param amount New total amount of the tokens.109 //67 // Selector: repartition(uint256) d2418ca7110 // Selector: repartition(uint256) d2418ca768 function repartition(uint256 amount) external returns (bool);111 function repartition(uint256 amount) external returns (bool);69}112}tests/src/eth/createRFTCollection.test.tsdiffbeforeafterboth69 .call()).to.be.true;69 .call()).to.be.true;70 });70 });71 71 72 itWeb3.only('Set sponsorship', async ({api, web3, privateKeyWrapper}) => {72 itWeb3('Set sponsorship', async ({api, web3, privateKeyWrapper}) => {73 const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);73 const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);74 const collectionHelpers = evmCollectionHelpers(web3, owner);74 const collectionHelpers = evmCollectionHelpers(web3, owner);75 let result = await collectionHelpers.methods.createRefungibleCollection('Sponsor collection', '1', '1').send();75 let result = await collectionHelpers.methods.createRefungibleCollection('Sponsor collection', '1', '1').send();76 const {collectionIdAddress, collectionId} = await getCollectionAddressFromResult(api, result);76 const {collectionIdAddress, collectionId} = await getCollectionAddressFromResult(api, result);77 const sponsor = await createEthAccountWithBalance(api, web3, privateKeyWrapper);77 const sponsor = await createEthAccountWithBalance(api, web3, privateKeyWrapper);78 const collectionEvm = evmCollection(web3, owner, collectionIdAddress);78 const collectionEvm = evmCollection(web3, owner, collectionIdAddress, {type: 'ReFungible'});79 result = await collectionEvm.methods.setCollectionSponsor(sponsor).call();79 result = await collectionEvm.methods.setCollectionSponsor(sponsor).send();80 // let collectionSub = (await getDetailedCollectionInfo(api, collectionId))!;80 let collectionSub = (await getDetailedCollectionInfo(api, collectionId))!;81 // expect(collectionSub.sponsorship.isUnconfirmed).to.be.true;81 expect(collectionSub.sponsorship.isUnconfirmed).to.be.true;82 // const ss58Format = (api.registry.getChainProperties())!.toJSON().ss58Format;82 const ss58Format = (api.registry.getChainProperties())!.toJSON().ss58Format;83 // expect(collectionSub.sponsorship.asUnconfirmed.toHuman()).to.be.eq(evmToAddress(sponsor, Number(ss58Format)));83 expect(collectionSub.sponsorship.asUnconfirmed.toHuman()).to.be.eq(evmToAddress(sponsor, Number(ss58Format)));84 // await expect(collectionEvm.methods.confirmCollectionSponsorship().call()).to.be.rejectedWith('caller is not set as sponsor');84 await expect(collectionEvm.methods.confirmCollectionSponsorship().call()).to.be.rejectedWith('caller is not set as sponsor');85 // const sponsorCollection = evmCollection(web3, sponsor, collectionIdAddress);85 const sponsorCollection = evmCollection(web3, sponsor, collectionIdAddress);86 // await sponsorCollection.methods.confirmCollectionSponsorship().send();86 await sponsorCollection.methods.confirmCollectionSponsorship().send();87 // collectionSub = (await getDetailedCollectionInfo(api, collectionId))!;87 collectionSub = (await getDetailedCollectionInfo(api, collectionId))!;88 // expect(collectionSub.sponsorship.isConfirmed).to.be.true;88 expect(collectionSub.sponsorship.isConfirmed).to.be.true;89 // expect(collectionSub.sponsorship.asConfirmed.toHuman()).to.be.eq(evmToAddress(sponsor, Number(ss58Format)));89 expect(collectionSub.sponsorship.asConfirmed.toHuman()).to.be.eq(evmToAddress(sponsor, Number(ss58Format)));90 });90 });919192 // fixtest93 itWeb3('Set limits', async ({api, web3, privateKeyWrapper}) => {92 itWeb3('Set limits', async ({api, web3, privateKeyWrapper}) => {94 const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);93 const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);95 const collectionHelpers = evmCollectionHelpers(web3, owner);94 const collectionHelpers = evmCollectionHelpers(web3, owner);107 transfersEnabled: false,106 transfersEnabled: false,108 };107 };109108110 const collectionEvm = evmCollection(web3, owner, collectionIdAddress);109 const collectionEvm = evmCollection(web3, owner, collectionIdAddress, {type: 'ReFungible'});111 await collectionEvm.methods['setCollectionLimit(string,uint32)']('accountTokenOwnershipLimit', limits.accountTokenOwnershipLimit).send();110 await collectionEvm.methods['setCollectionLimit(string,uint32)']('accountTokenOwnershipLimit', limits.accountTokenOwnershipLimit).send();112 await collectionEvm.methods['setCollectionLimit(string,uint32)']('sponsoredDataSize', limits.sponsoredDataSize).send();111 await collectionEvm.methods['setCollectionLimit(string,uint32)']('sponsoredDataSize', limits.sponsoredDataSize).send();113 await collectionEvm.methods['setCollectionLimit(string,uint32)']('sponsoredDataRateLimit', limits.sponsoredDataRateLimit).send();112 await collectionEvm.methods['setCollectionLimit(string,uint32)']('sponsoredDataRateLimit', limits.sponsoredDataRateLimit).send();193 .call()).to.be.rejectedWith('NotSufficientFounds');192 .call()).to.be.rejectedWith('NotSufficientFounds');194 });193 });195194196 // fixtest197 itWeb3('(!negative test!) Check owner', async ({api, web3, privateKeyWrapper}) => {195 itWeb3('(!negative test!) Check owner', async ({api, web3, privateKeyWrapper}) => {198 const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);196 const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);199 const notOwner = await createEthAccount(web3);197 const notOwner = await createEthAccount(web3);200 const collectionHelpers = evmCollectionHelpers(web3, owner);198 const collectionHelpers = evmCollectionHelpers(web3, owner);201 const result = await collectionHelpers.methods.createRefungibleCollection('A', 'A', 'A').send();199 const result = await collectionHelpers.methods.createRefungibleCollection('A', 'A', 'A').send();202 const {collectionIdAddress} = await getCollectionAddressFromResult(api, result);200 const {collectionIdAddress} = await getCollectionAddressFromResult(api, result);203 const contractEvmFromNotOwner = evmCollection(web3, notOwner, collectionIdAddress);201 const contractEvmFromNotOwner = evmCollection(web3, notOwner, collectionIdAddress, {type: 'ReFungible'});204 const EXPECTED_ERROR = 'NoPermission';202 const EXPECTED_ERROR = 'NoPermission';205 {203 {206 const sponsor = await createEthAccountWithBalance(api, web3, privateKeyWrapper);204 const sponsor = await createEthAccountWithBalance(api, web3, privateKeyWrapper);220 }218 }221 });219 });222220223 // fixtest224 itWeb3('(!negative test!) Set limits', async ({api, web3, privateKeyWrapper}) => {221 itWeb3('(!negative test!) Set limits', async ({api, web3, privateKeyWrapper}) => {225 const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);222 const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);226 const collectionHelpers = evmCollectionHelpers(web3, owner);223 const collectionHelpers = evmCollectionHelpers(web3, owner);227 const result = await collectionHelpers.methods.createRefungibleCollection('Schema collection', 'A', 'A').send();224 const result = await collectionHelpers.methods.createRefungibleCollection('Schema collection', 'A', 'A').send();228 const {collectionIdAddress} = await getCollectionAddressFromResult(api, result);225 const {collectionIdAddress} = await getCollectionAddressFromResult(api, result);229 const collectionEvm = evmCollection(web3, owner, collectionIdAddress);226 const collectionEvm = evmCollection(web3, owner, collectionIdAddress, {type: 'ReFungible'});230 await expect(collectionEvm.methods227 await expect(collectionEvm.methods231 .setCollectionLimit('badLimit', 'true')228 .setCollectionLimit('badLimit', 'true')232 .call()).to.be.rejectedWith('unknown boolean limit "badLimit"');229 .call()).to.be.rejectedWith('unknown boolean limit "badLimit"');tests/src/eth/refungibleAbi.jsondiffbeforeafterbothno changes
tests/src/eth/util/helpers.tsdiffbeforeafterboth25import Web3 from 'web3';25import Web3 from 'web3';26import config from '../../config';26import config from '../../config';27import getBalance from '../../substrate/get-balance';27import getBalance from '../../substrate/get-balance';28import privateKey from '../../substrate/privateKey';29import usingApi, {submitTransactionAsync} from '../../substrate/substrate-api';28import usingApi, {submitTransactionAsync} from '../../substrate/substrate-api';30import waitNewBlocks from '../../substrate/wait-new-blocks';29import waitNewBlocks from '../../substrate/wait-new-blocks';31import {CrossAccountId, getDetailedCollectionInfo, getGenericResult, UNIQUE} from '../../util/helpers';30import {CollectionMode, CrossAccountId, getDetailedCollectionInfo, getGenericResult, UNIQUE} from '../../util/helpers';32import collectionHelpersAbi from '../collectionHelpersAbi.json';31import collectionHelpersAbi from '../collectionHelpersAbi.json';32import fungibleAbi from '../fungibleAbi.json';33import nonFungibleAbi from '../nonFungibleAbi.json';33import nonFungibleAbi from '../nonFungibleAbi.json';34import refungibleAbi from '../refungibleAbi.json';34import contractHelpersAbi from './contractHelpersAbi.json';35import contractHelpersAbi from './contractHelpersAbi.json';353636export const GAS_ARGS = {gas: 2500000};37export const GAS_ARGS = {gas: 2500000};307 * @param caller - eth address308 * @param caller - eth address308 * @returns 309 * @returns 309 */310 */310export function evmCollection(web3: Web3, caller: string, collection: string) {311export function evmCollection(web3: Web3, caller: string, collection: string, mode: CollectionMode = {type: 'NFT'}) {312 let abi;313 switch (mode.type) {314 case 'Fungible':315 abi = fungibleAbi;316 break;317 318 case 'NFT':319 abi = nonFungibleAbi;320 break;321 322 case 'ReFungible':323 abi = refungibleAbi;324 break;325326 default:327 throw 'Bad collection mode';328 }311 return new web3.eth.Contract(nonFungibleAbi as any, collection, {from: caller, ...GAS_ARGS});329 const contract = new web3.eth.Contract(abi as any, collection, {from: caller, ...GAS_ARGS});330 return contract;312}331}313332314/**333/**