difftreelog
chore add check for ERC-20 transfer event on ERC-721 transfer method call
in: master
1 file changed
tests/src/eth/reFungible.test.tsdiffbeforeafterboth14// You should have received a copy of the GNU General Public License14// You should have received a copy of the GNU General Public License15// 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/>.161617import {createCollectionExpectSuccess, transfer, UNIQUE} from '../util/helpers';17import {createCollectionExpectSuccess, UNIQUE} from '../util/helpers';18import {collectionIdToAddress, createEthAccount, createEthAccountWithBalance, evmCollection, evmCollectionHelpers, GAS_ARGS, getCollectionAddressFromResult, itWeb3, normalizeEvents, recordEthFee, recordEvents, tokenIdToAddress} from './util/helpers';18import {collectionIdToAddress, createEthAccount, createEthAccountWithBalance, evmCollection, evmCollectionHelpers, GAS_ARGS, getCollectionAddressFromResult, itWeb3, normalizeEvents, recordEthFee, recordEvents, tokenIdToAddress} from './util/helpers';19import reFungibleAbi from './reFungibleAbi.json';20import reFungibleTokenAbi from './reFungibleTokenAbi.json';19import reFungibleTokenAbi from './reFungibleTokenAbi.json';21import {expect} from 'chai';20import {expect} from 'chai';2221242 const caller = await createEthAccountWithBalance(api, web3, privateKeyWrapper);241 const caller = await createEthAccountWithBalance(api, web3, privateKeyWrapper);243 const helper = evmCollectionHelpers(web3, caller);242 const helper = evmCollectionHelpers(web3, caller);244 const result = await helper.methods.createRefungibleCollection('Mint collection', '6', '6').send();243 const result = await helper.methods.createRefungibleCollection('Mint collection', '6', '6').send();245 const {collectionIdAddress} = await getCollectionAddressFromResult(api, result);244 const {collectionIdAddress, collectionId} = await getCollectionAddressFromResult(api, result);246 const contract = evmCollection(web3, caller, collectionIdAddress, {type: 'ReFungible'});245 const contract = evmCollection(web3, caller, collectionIdAddress, {type: 'ReFungible'});247246248 const receiver = createEthAccount(web3);247 const receiver = createEthAccount(web3);249248250 const tokenId = await contract.methods.nextTokenId().call();249 const tokenId = await contract.methods.nextTokenId().call();251 await contract.methods.mint(caller, tokenId).send();250 await contract.methods.mint(caller, tokenId).send();251252 const address = tokenIdToAddress(collectionId, tokenId);253 const tokenContract = new web3.eth.Contract(reFungibleTokenAbi as any, address, {from: caller, ...GAS_ARGS});254 await tokenContract.methods.repartition(15).send();255256 {252 {257 const erc20Events = await recordEvents(tokenContract, async () => {253 const result = await contract.methods.transferFrom(caller, receiver, tokenId).send();258 const result = await contract.methods.transferFrom(caller, receiver, tokenId).send();254 const events = normalizeEvents(result.events);259 const events = normalizeEvents(result.events);255 expect(events).to.include.deep.members([260 expect(events).to.include.deep.members([263 },268 },264 },269 },265 ]);270 ]);266 }271 });272 273 expect(erc20Events).to.include.deep.members([274 {275 address,276 event: 'Transfer',277 args: {278 from: caller,279 to: receiver,280 value: '15',281 },282 },283 ]);284 }267285268 {286 {