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

difftreelog

Revert "Deprecate burnFrom for rftToken"

Max Andreev2023-01-12parent: #b9dbd26.patch.diff
in: master
This reverts commit 9fca092ae2601cee947453655e84ee7410a07379.

7 files changed

modifiedpallets/refungible/src/stubs/UniqueRefungibleToken.soldiffbeforeafterboth
3838
39/// @dev the ERC-165 identifier for this interface is 0xe17a7d2b39/// @dev the ERC-165 identifier for this interface is 0xe17a7d2b
40contract ERC20UniqueExtensions is Dummy, ERC165 {40contract ERC20UniqueExtensions is Dummy, ERC165 {
41 // /// @dev Function that burns an amount of the token of a given account,41 /// @dev Function that burns an amount of the token of a given account,
42 // /// deducting from the sender's allowance for said account.42 /// deducting from the sender's allowance for said account.
43 // /// @param from The account whose tokens will be burnt.43 /// @param from The account whose tokens will be burnt.
44 // /// @param amount The amount that will be burnt.44 /// @param amount The amount that will be burnt.
45 // /// @dev EVM selector for this function is: 0x79cc6790,45 /// @dev EVM selector for this function is: 0x79cc6790,
46 // /// or in textual repr: burnFrom(address,uint256)46 /// or in textual repr: burnFrom(address,uint256)
47 // function burnFrom(address from, uint256 amount) public returns (bool) {47 function burnFrom(address from, uint256 amount) public returns (bool) {
48 // require(false, stub_error);48 require(false, stub_error);
49 // from;49 from;
50 // amount;50 amount;
51 // dummy = 0;51 dummy = 0;
52 // return false;52 return false;
53 // }53 }
5454
55 /// @dev Function that burns an amount of the token of a given account,55 /// @dev Function that burns an amount of the token of a given account,
56 /// deducting from the sender's allowance for said account.56 /// deducting from the sender's allowance for said account.
modifiedtests/src/eth/abi/reFungibleToken.jsondiffbeforeafterboth
96 "stateMutability": "view",96 "stateMutability": "view",
97 "type": "function"97 "type": "function"
98 },98 },
99 {
100 "inputs": [
101 { "internalType": "address", "name": "from", "type": "address" },
102 { "internalType": "uint256", "name": "amount", "type": "uint256" }
103 ],
104 "name": "burnFrom",
105 "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
106 "stateMutability": "nonpayable",
107 "type": "function"
108 },
99 {109 {
100 "inputs": [110 "inputs": [
101 {111 {
deletedtests/src/eth/abi/reFungibleTokenDeprecated.jsondiffbeforeafterboth

no changes

modifiedtests/src/eth/api/UniqueRefungibleToken.soldiffbeforeafterboth
2525
26/// @dev the ERC-165 identifier for this interface is 0xe17a7d2b26/// @dev the ERC-165 identifier for this interface is 0xe17a7d2b
27interface ERC20UniqueExtensions is Dummy, ERC165 {27interface ERC20UniqueExtensions is Dummy, ERC165 {
28 // /// @dev Function that burns an amount of the token of a given account,28 /// @dev Function that burns an amount of the token of a given account,
29 // /// deducting from the sender's allowance for said account.29 /// deducting from the sender's allowance for said account.
30 // /// @param from The account whose tokens will be burnt.30 /// @param from The account whose tokens will be burnt.
31 // /// @param amount The amount that will be burnt.31 /// @param amount The amount that will be burnt.
32 // /// @dev EVM selector for this function is: 0x79cc6790,32 /// @dev EVM selector for this function is: 0x79cc6790,
33 // /// or in textual repr: burnFrom(address,uint256)33 /// or in textual repr: burnFrom(address,uint256)
34 // function burnFrom(address from, uint256 amount) external returns (bool);34 function burnFrom(address from, uint256 amount) external returns (bool);
3535
36 /// @dev Function that burns an amount of the token of a given account,36 /// @dev Function that burns an amount of the token of a given account,
37 /// deducting from the sender's allowance for said account.37 /// deducting from the sender's allowance for said account.
modifiedtests/src/eth/reFungible.test.tsdiffbeforeafterboth
7474
75 const result = await contract.methods.mint(caller).send();75 const result = await contract.methods.mint(caller).send();
76 const tokenId = result.events.Transfer.returnValues.tokenId;76 const tokenId = result.events.Transfer.returnValues.tokenId;
77 const tokenContract = await helper.ethNativeContract.rftTokenById(collectionId, tokenId, caller, true);77 const tokenContract = await helper.ethNativeContract.rftTokenById(collectionId, tokenId, caller);
7878
79 await tokenContract.methods.repartition(2).send();79 await tokenContract.methods.repartition(2).send();
80 await tokenContract.methods.transfer(receiver, 1).send();80 await tokenContract.methods.transfer(receiver, 1).send();
316 const address = helper.ethAddress.fromCollectionId(collection.collectionId);316 const address = helper.ethAddress.fromCollectionId(collection.collectionId);
317 const contract = await helper.ethNativeContract.collection(address, 'rft');317 const contract = await helper.ethNativeContract.collection(address, 'rft');
318318
319 const rftToken = await helper.ethNativeContract.rftTokenById(token.collectionId, token.tokenId, owner, true);319 const rftToken = await helper.ethNativeContract.rftTokenById(token.collectionId, token.tokenId, owner);
320320
321 {321 {
322 await rftToken.methods.approve(operator, 15n).send({from: owner});322 await rftToken.methods.approve(operator, 15n).send({from: owner});
modifiedtests/src/eth/reFungibleToken.test.tsdiffbeforeafterboth
458 const result = await contract.methods.mint(caller).send();458 const result = await contract.methods.mint(caller).send();
459 const tokenId = result.events.Transfer.returnValues.tokenId;459 const tokenId = result.events.Transfer.returnValues.tokenId;
460 const tokenAddress = helper.ethAddress.fromTokenId(collectionId, tokenId);460 const tokenAddress = helper.ethAddress.fromTokenId(collectionId, tokenId);
461 const tokenContract = await helper.ethNativeContract.rftToken(tokenAddress, caller, true);461 const tokenContract = await helper.ethNativeContract.rftToken(tokenAddress, caller);
462462
463 await tokenContract.methods.repartition(2).send();463 await tokenContract.methods.repartition(2).send();
464 await tokenContract.methods.transfer(receiver, 1).send();464 await tokenContract.methods.transfer(receiver, 1).send();
modifiedtests/src/eth/util/playgrounds/unique.dev.tsdiffbeforeafterboth
29import refungibleAbi from '../../abi/reFungible.json';29import refungibleAbi from '../../abi/reFungible.json';
30import refungibleDeprecatedAbi from '../../abi/reFungibleDeprecated.json';30import refungibleDeprecatedAbi from '../../abi/reFungibleDeprecated.json';
31import refungibleTokenAbi from '../../abi/reFungibleToken.json';31import refungibleTokenAbi from '../../abi/reFungibleToken.json';
32import refungibleTokenDeprecatedAbi from '../../abi/reFungibleTokenDeprecated.json';
33import contractHelpersAbi from '../../abi/contractHelpers.json';32import contractHelpersAbi from '../../abi/contractHelpers.json';
34import {ICrossAccountId, TEthereumAccount} from '../../../util/playgrounds/types';33import {ICrossAccountId, TEthereumAccount} from '../../../util/playgrounds/types';
35import {TCollectionMode} from '../../../util/playgrounds/types';34import {TCollectionMode} from '../../../util/playgrounds/types';
188 return this.collection(this.helper.ethAddress.fromCollectionId(collectionId), mode, caller, mergeDeprecated);187 return this.collection(this.helper.ethAddress.fromCollectionId(collectionId), mode, caller, mergeDeprecated);
189 }188 }
190189
191 async rftToken(address: string, caller?: string, mergeDeprecated = false) {190 async rftToken(address: string, caller?: string) {
192 const web3 = this.helper.getWeb3();191 const web3 = this.helper.getWeb3();
193 let abi = mergeDeprecated ? [...refungibleTokenAbi, ...refungibleTokenDeprecatedAbi] : refungibleTokenAbi;
194 return unlimitedMoneyHack(new web3.eth.Contract(abi as any, address, {192 return unlimitedMoneyHack(new web3.eth.Contract(refungibleTokenAbi as any, address, {
195 gas: this.helper.eth.DEFAULT_GAS,193 gas: this.helper.eth.DEFAULT_GAS,
196 gasPrice: await this.getGasPrice(),194 gasPrice: await this.getGasPrice(),
197 ...(caller ? {from: caller} : {}),195 ...(caller ? {from: caller} : {}),
198 }));196 }));
199 }197 }
200198
201 rftTokenById(collectionId: number, tokenId: number, caller?: string, mergeDeprecated = false) {199 rftTokenById(collectionId: number, tokenId: number, caller?: string) {
202 return this.rftToken(this.helper.ethAddress.fromTokenId(collectionId, tokenId), caller, true);200 return this.rftToken(this.helper.ethAddress.fromTokenId(collectionId, tokenId), caller);
203 }201 }
204}202}
205203