git.delta.rocks / unique-network / refs/commits / fc406280aa2f

difftreelog

feature/mint-for-fungible-token

Grigoriy Simonov2022-08-18parent: #eadc594.patch.diff
in: master

5 files changed

modifiedpallets/fungible/src/erc.rsdiffbeforeafterboth
--- a/pallets/fungible/src/erc.rs
+++ b/pallets/fungible/src/erc.rs
@@ -129,7 +129,23 @@
 	}
 }
 
-#[solidity_interface(name = ERC20UniqueExtensions)]
+#[solidity_interface(name = "ERC20Mintable")]
+impl<T: Config> FungibleHandle<T> {
+	#[weight(<SelfWeightOf<T>>::create_item())]
+	fn mint(&mut self, caller: caller, to: address, amount: uint256) -> Result<bool> {
+		let caller = T::CrossAccountId::from_eth(caller);
+		let to = T::CrossAccountId::from_eth(to);
+		let amount = amount.try_into().map_err(|_| "amount overflow")?;
+		let budget = self
+			.recorder
+			.weight_calls_budget(<StructureWeight<T>>::find_parent());
+		<Pallet<T>>::create_item(&self, &caller, (to, amount), &budget)
+			.map_err(dispatch_to_evm::<T>)?;
+		Ok(true)
+	}
+}
+
+#[solidity_interface(name = "ERC20UniqueExtensions")]
 impl<T: Config> FungibleHandle<T> {
 	#[weight(<SelfWeightOf<T>>::burn_from())]
 	fn burn_from(&mut self, caller: caller, from: address, amount: uint256) -> Result<bool> {
@@ -144,12 +160,29 @@
 			.map_err(dispatch_to_evm::<T>)?;
 		Ok(true)
 	}
+
+	#[weight(<SelfWeightOf<T>>::create_multiple_items_ex(amounts.len() as u32))]
+	fn mint_bulk(&mut self, caller: caller, amounts: Vec<(address, uint256)>) -> Result<bool> {
+		let caller = T::CrossAccountId::from_eth(caller);
+		let budget = self
+			.recorder
+			.weight_calls_budget(<StructureWeight<T>>::find_parent());
+		let amounts = amounts
+			.into_iter()
+			.map(|(to, amount)| Ok((T::CrossAccountId::from_eth(to), amount.try_into().map_err(|_| "amount overflow")?)))
+			.collect::<Result<_>>()?;
+
+		<Pallet<T>>::create_multiple_items(&self, &caller, amounts, &budget)
+			.map_err(dispatch_to_evm::<T>)?;
+		Ok(true)
+	}
 }
 
 #[solidity_interface(
 	name = UniqueFungible,
 	is(
 		ERC20,
+		ERC20Mintable,
 		ERC20UniqueExtensions,
 		Collection(common_mut, CollectionHandle<T>),
 	)
modifiedpallets/fungible/src/stubs/UniqueFungible.soldiffbeforeafterboth
--- a/pallets/fungible/src/stubs/UniqueFungible.sol
+++ b/pallets/fungible/src/stubs/UniqueFungible.sol
@@ -3,7 +3,13 @@
 
 pragma solidity >=0.8.0 <0.9.0;
 
-/// @dev common stubs holder
+// Anonymous struct
+struct Tuple0 {
+	address field_0;
+	uint256 field_1;
+}
+
+// Common stubs holder
 contract Dummy {
 	uint8 dummy;
 	string stub_error = "this contract is implemented in native";
@@ -21,8 +27,49 @@
 	}
 }
 
-/// @title A contract that allows you to work with collections.
-/// @dev the ERC-165 identifier for this interface is 0xe54be640
+// Inline
+contract ERC20Events {
+	event Transfer(address indexed from, address indexed to, uint256 value);
+	event Approval(
+		address indexed owner,
+		address indexed spender,
+		uint256 value
+	);
+}
+
+// Selector: 40c10f19
+contract ERC20Mintable is Dummy, ERC165 {
+	// Selector: mint(address,uint256) 40c10f19
+	function mint(address to, uint256 amount) public returns (bool) {
+		require(false, stub_error);
+		to;
+		amount;
+		dummy = 0;
+		return false;
+	}
+}
+
+// Selector: 63034ac5
+contract ERC20UniqueExtensions is Dummy, ERC165 {
+	// Selector: burnFrom(address,uint256) 79cc6790
+	function burnFrom(address from, uint256 amount) public returns (bool) {
+		require(false, stub_error);
+		from;
+		amount;
+		dummy = 0;
+		return false;
+	}
+
+	// Selector: mintBulk((address,uint256)[]) 1acf2d55
+	function mintBulk(Tuple0[] memory amounts) public returns (bool) {
+		require(false, stub_error);
+		amounts;
+		dummy = 0;
+		return false;
+	}
+}
+
+// Selector: 6cf113cd
 contract Collection is Dummy, ERC165 {
 	/// Set collection property.
 	///
@@ -476,6 +523,7 @@
 	Dummy,
 	ERC165,
 	ERC20,
+	ERC20Mintable,
 	ERC20UniqueExtensions,
 	Collection
 {}
modifiedtests/src/eth/api/UniqueFungible.soldiffbeforeafterboth
--- a/tests/src/eth/api/UniqueFungible.sol
+++ b/tests/src/eth/api/UniqueFungible.sol
@@ -3,7 +3,13 @@
 
 pragma solidity >=0.8.0 <0.9.0;
 
-/// @dev common stubs holder
+// Anonymous struct
+struct Tuple0 {
+	address field_0;
+	uint256 field_1;
+}
+
+// Common stubs holder
 interface Dummy {
 
 }
@@ -12,8 +18,32 @@
 	function supportsInterface(bytes4 interfaceID) external view returns (bool);
 }
 
-/// @title A contract that allows you to work with collections.
-/// @dev the ERC-165 identifier for this interface is 0xe54be640
+// Inline
+interface ERC20Events {
+	event Transfer(address indexed from, address indexed to, uint256 value);
+	event Approval(
+		address indexed owner,
+		address indexed spender,
+		uint256 value
+	);
+}
+
+// Selector: 40c10f19
+interface ERC20Mintable is Dummy, ERC165 {
+	// Selector: mint(address,uint256) 40c10f19
+	function mint(address to, uint256 amount) external returns (bool);
+}
+
+// Selector: 63034ac5
+interface ERC20UniqueExtensions is Dummy, ERC165 {
+	// Selector: burnFrom(address,uint256) 79cc6790
+	function burnFrom(address from, uint256 amount) external returns (bool);
+
+	// Selector: mintBulk((address,uint256)[]) 1acf2d55
+	function mintBulk(Tuple0[] memory amounts) external returns (bool);
+}
+
+// Selector: 6cf113cd
 interface Collection is Dummy, ERC165 {
 	/// Set collection property.
 	///
@@ -207,30 +237,8 @@
 	/// @dev EVM selector for this function is: 0xd34b55b8,
 	///  or in textual repr: uniqueCollectionType()
 	function uniqueCollectionType() external returns (string memory);
-
-	/// Changes collection owner to another account
-	///
-	/// @dev Owner can be changed only by current owner
-	/// @param newOwner new owner account
-	/// @dev EVM selector for this function is: 0x13af4035,
-	///  or in textual repr: setOwner(address)
-	function setOwner(address newOwner) external;
-
-	/// Changes collection owner to another substrate account
-	///
-	/// @dev Owner can be changed only by current owner
-	/// @param newOwner new owner substrate account
-	/// @dev EVM selector for this function is: 0xb212138f,
-	///  or in textual repr: setOwnerSubstrate(uint256)
-	function setOwnerSubstrate(uint256 newOwner) external;
 }
 
-/// @dev anonymous struct
-struct Tuple6 {
-	address field_0;
-	uint256 field_1;
-}
-
 /// @dev the ERC-165 identifier for this interface is 0x79cc6790
 interface ERC20UniqueExtensions is Dummy, ERC165 {
 	/// @dev EVM selector for this function is: 0x79cc6790,
@@ -298,6 +306,7 @@
 	Dummy,
 	ERC165,
 	ERC20,
+	ERC20Mintable,
 	ERC20UniqueExtensions,
 	Collection
 {}
modifiedtests/src/eth/fungible.test.tsdiffbeforeafterboth
--- a/tests/src/eth/fungible.test.ts
+++ b/tests/src/eth/fungible.test.ts
@@ -14,10 +14,11 @@
 // You should have received a copy of the GNU General Public License
 // along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
 
-import {approveExpectSuccess, createCollectionExpectSuccess, createFungibleItemExpectSuccess, transferExpectSuccess, transferFromExpectSuccess, UNIQUE} from '../util/helpers';
-import {collectionIdToAddress, createEthAccount, createEthAccountWithBalance, GAS_ARGS, itWeb3, normalizeEvents, recordEthFee, recordEvents, subToEth, transferBalanceToEth} from './util/helpers';
+import {approveExpectSuccess, createCollection, createCollectionExpectSuccess, createFungibleItemExpectSuccess, transferExpectSuccess, transferFromExpectSuccess, UNIQUE} from '../util/helpers';
+import {collectionIdToAddress, createEthAccount, createEthAccountWithBalance, evmCollection, GAS_ARGS, itWeb3, normalizeEvents, recordEthFee, recordEvents, subToEth, transferBalanceToEth} from './util/helpers';
 import fungibleAbi from './fungibleAbi.json';
 import {expect} from 'chai';
+import {submitTransactionAsync} from '../substrate/substrate-api';
 
 describe('Fungible: Information getting', () => {
   itWeb3('totalSupply', async ({api, web3, privateKeyWrapper}) => {
@@ -58,6 +59,129 @@
 });
 
 describe('Fungible: Plain calls', () => {
+  itWeb3('Can perform mint()', async ({web3, api, privateKeyWrapper}) => {
+    const alice = privateKeyWrapper('//Alice');
+    const collection = await createCollection(api, alice, {
+      name: 'token name',
+      mode: {type: 'Fungible', decimalPoints: 0},
+    });
+
+    const receiver = createEthAccount(web3);
+
+    const collectionIdAddress = collectionIdToAddress(collection.collectionId);
+    const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);
+    const changeAdminTx = api.tx.unique.addCollectionAdmin(collection.collectionId, {Ethereum: owner});
+    await submitTransactionAsync(alice, changeAdminTx);
+
+    const collectionContract = evmCollection(web3, owner, collectionIdAddress, {type: 'Fungible', decimalPoints: 0});
+    const result = await collectionContract.methods.mint(receiver, 100).send();
+    const events = normalizeEvents(result.events);
+    
+    expect(events).to.be.deep.equal([
+      {
+        address: collectionIdAddress,
+        event: 'Transfer',
+        args: {
+          from: '0x0000000000000000000000000000000000000000',
+          to: receiver,
+          value: '100',
+        },
+      },
+    ]);
+  });
+
+  itWeb3('Can perform mintBulk()', async ({web3, api, privateKeyWrapper}) => {
+    const alice = privateKeyWrapper('//Alice');
+    const collection = await createCollection(api, alice, {
+      name: 'token name',
+      mode: {type: 'Fungible', decimalPoints: 0},
+    });
+
+    const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);
+    const receiver1 = createEthAccount(web3);
+    const receiver2 = createEthAccount(web3);
+    const receiver3 = createEthAccount(web3);
+
+    const collectionIdAddress = collectionIdToAddress(collection.collectionId);
+    const changeAdminTx = api.tx.unique.addCollectionAdmin(collection.collectionId, {Ethereum: owner});
+    await submitTransactionAsync(alice, changeAdminTx);
+
+    const collectionContract = evmCollection(web3, owner, collectionIdAddress, {type: 'Fungible', decimalPoints: 0});
+    const result = await collectionContract.methods.mintBulk([
+      [receiver1, 10],
+      [receiver2, 20],
+      [receiver3, 30],
+    ]).call();
+    console.log(result);
+    const events = normalizeEvents(result.events);
+
+    expect(events).to.be.deep.equal([
+      {
+        address:collectionIdAddress,
+        event: 'Transfer',
+        args: {
+          from: '0x0000000000000000000000000000000000000000',
+          to: receiver1,
+          value: '10',
+        },
+      },
+      {
+        address:collectionIdAddress,
+        event: 'Transfer',
+        args: {
+          from: '0x0000000000000000000000000000000000000000',
+          to: receiver2,
+          value: '20',
+        },
+      },
+      {
+        address:collectionIdAddress,
+        event: 'Transfer',
+        args: {
+          from: '0x0000000000000000000000000000000000000000',
+          to: receiver3,
+          value: '30',
+        },
+      },
+    ]);
+  });
+
+  itWeb3('Can perform burn()', async ({web3, api, privateKeyWrapper}) => {
+    const alice = privateKeyWrapper('//Alice');
+    const collection = await createCollection(api, alice, {
+      name: 'token name',
+      mode: {type: 'Fungible', decimalPoints: 0},
+    });
+
+    const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);
+    const changeAdminTx = api.tx.unique.addCollectionAdmin(collection.collectionId, {Ethereum: owner});
+    await submitTransactionAsync(alice, changeAdminTx);
+    const receiver = await createEthAccountWithBalance(api, web3, privateKeyWrapper);
+
+    const collectionIdAddress = collectionIdToAddress(collection.collectionId);
+    const collectionContract = evmCollection(web3, owner, collectionIdAddress, {type: 'Fungible', decimalPoints: 0});
+    await collectionContract.methods.mint(receiver, 100).send();
+
+    const result = await collectionContract.methods.burnFrom(receiver, 49).send({from: receiver});
+    
+    const events = normalizeEvents(result.events);
+
+    expect(events).to.be.deep.equal([
+      {
+        address: collectionIdAddress,
+        event: 'Transfer',
+        args: {
+          from: receiver,
+          to: '0x0000000000000000000000000000000000000000',
+          value: '49',
+        },
+      },
+    ]);
+
+    const balance = await collectionContract.methods.balanceOf(receiver).call();
+    expect(balance).to.equal('51');
+  });
+
   itWeb3('Can perform approve()', async ({web3, api, privateKeyWrapper}) => {
     const collection = await createCollectionExpectSuccess({
       name: 'token name',
modifiedtests/src/eth/fungibleAbi.jsondiffbeforeafterboth
before · tests/src/eth/fungibleAbi.json
1[2  {3    "anonymous": false,4    "inputs": [5      {6        "indexed": true,7        "internalType": "address",8        "name": "owner",9        "type": "address"10      },11      {12        "indexed": true,13        "internalType": "address",14        "name": "spender",15        "type": "address"16      },17      {18        "indexed": false,19        "internalType": "uint256",20        "name": "value",21        "type": "uint256"22      }23    ],24    "name": "Approval",25    "type": "event"26  },27  {28    "anonymous": false,29    "inputs": [30      {31        "indexed": true,32        "internalType": "address",33        "name": "from",34        "type": "address"35      },36      {37        "indexed": true,38        "internalType": "address",39        "name": "to",40        "type": "address"41      },42      {43        "indexed": false,44        "internalType": "uint256",45        "name": "value",46        "type": "uint256"47      }48    ],49    "name": "Transfer",50    "type": "event"51  },52  {53    "inputs": [54      { "internalType": "address", "name": "newAdmin", "type": "address" }55    ],56    "name": "addCollectionAdmin",57    "outputs": [],58    "stateMutability": "nonpayable",59    "type": "function"60  },61  {62    "inputs": [63      { "internalType": "uint256", "name": "newAdmin", "type": "uint256" }64    ],65    "name": "addCollectionAdminSubstrate",66    "outputs": [],67    "stateMutability": "nonpayable",68    "type": "function"69  },70  {71    "inputs": [72      { "internalType": "address", "name": "user", "type": "address" }73    ],74    "name": "addToCollectionAllowList",75    "outputs": [],76    "stateMutability": "nonpayable",77    "type": "function"78  },79  {80    "inputs": [81      { "internalType": "address", "name": "owner", "type": "address" },82      { "internalType": "address", "name": "spender", "type": "address" }83    ],84    "name": "allowance",85    "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],86    "stateMutability": "view",87    "type": "function"88  },89  {90    "inputs": [91      { "internalType": "address", "name": "spender", "type": "address" },92      { "internalType": "uint256", "name": "amount", "type": "uint256" }93    ],94    "name": "approve",95    "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],96    "stateMutability": "nonpayable",97    "type": "function"98  },99  {100    "inputs": [101      { "internalType": "address", "name": "owner", "type": "address" }102    ],103    "name": "balanceOf",104    "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],105    "stateMutability": "view",106    "type": "function"107  },108  {109    "inputs": [110      { "internalType": "address", "name": "from", "type": "address" },111      { "internalType": "uint256", "name": "amount", "type": "uint256" }112    ],113    "name": "burnFrom",114    "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],115    "stateMutability": "nonpayable",116    "type": "function"117  },118  {119    "inputs": [{ "internalType": "string", "name": "key", "type": "string" }],120    "name": "collectionProperty",121    "outputs": [{ "internalType": "bytes", "name": "", "type": "bytes" }],122    "stateMutability": "view",123    "type": "function"124  },125  {126    "inputs": [],127    "name": "confirmCollectionSponsorship",128    "outputs": [],129    "stateMutability": "nonpayable",130    "type": "function"131  },132  {133    "inputs": [],134    "name": "contractAddress",135    "outputs": [{ "internalType": "address", "name": "", "type": "address" }],136    "stateMutability": "view",137    "type": "function"138  },139  {140    "inputs": [],141    "name": "decimals",142    "outputs": [{ "internalType": "uint8", "name": "", "type": "uint8" }],143    "stateMutability": "view",144    "type": "function"145  },146  {147    "inputs": [{ "internalType": "string", "name": "key", "type": "string" }],148    "name": "deleteCollectionProperty",149    "outputs": [],150    "stateMutability": "nonpayable",151    "type": "function"152  },153  {154    "inputs": [],155    "name": "getCollectionSponsor",156    "outputs": [157      {158        "components": [159          { "internalType": "address", "name": "field_0", "type": "address" },160          { "internalType": "uint256", "name": "field_1", "type": "uint256" }161        ],162        "internalType": "struct Tuple6",163        "name": "",164        "type": "tuple"165      }166    ],167    "stateMutability": "view",168    "type": "function"169  },170  {171    "inputs": [],172    "name": "hasCollectionPendingSponsor",173    "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],174    "stateMutability": "view",175    "type": "function"176  },177  {178    "inputs": [179      { "internalType": "address", "name": "user", "type": "address" }180    ],181    "name": "isOwnerOrAdmin",182    "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],183    "stateMutability": "view",184    "type": "function"185  },186  {187    "inputs": [188      { "internalType": "uint256", "name": "user", "type": "uint256" }189    ],190    "name": "isOwnerOrAdminSubstrate",191    "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],192    "stateMutability": "view",193    "type": "function"194  },195  {196    "inputs": [],197    "name": "name",198    "outputs": [{ "internalType": "string", "name": "", "type": "string" }],199    "stateMutability": "view",200    "type": "function"201  },202  {203    "inputs": [204      { "internalType": "address", "name": "admin", "type": "address" }205    ],206    "name": "removeCollectionAdmin",207    "outputs": [],208    "stateMutability": "nonpayable",209    "type": "function"210  },211  {212    "inputs": [213      { "internalType": "uint256", "name": "admin", "type": "uint256" }214    ],215    "name": "removeCollectionAdminSubstrate",216    "outputs": [],217    "stateMutability": "nonpayable",218    "type": "function"219  },220  {221    "inputs": [],222    "name": "removeCollectionSponsor",223    "outputs": [],224    "stateMutability": "nonpayable",225    "type": "function"226  },227  {228    "inputs": [229      { "internalType": "address", "name": "user", "type": "address" }230    ],231    "name": "removeFromCollectionAllowList",232    "outputs": [],233    "stateMutability": "nonpayable",234    "type": "function"235  },236  {237    "inputs": [{ "internalType": "uint8", "name": "mode", "type": "uint8" }],238    "name": "setCollectionAccess",239    "outputs": [],240    "stateMutability": "nonpayable",241    "type": "function"242  },243  {244    "inputs": [245      { "internalType": "string", "name": "limit", "type": "string" },246      { "internalType": "uint32", "name": "value", "type": "uint32" }247    ],248    "name": "setCollectionLimit",249    "outputs": [],250    "stateMutability": "nonpayable",251    "type": "function"252  },253  {254    "inputs": [255      { "internalType": "string", "name": "limit", "type": "string" },256      { "internalType": "bool", "name": "value", "type": "bool" }257    ],258    "name": "setCollectionLimit",259    "outputs": [],260    "stateMutability": "nonpayable",261    "type": "function"262  },263  {264    "inputs": [{ "internalType": "bool", "name": "mode", "type": "bool" }],265    "name": "setCollectionMintMode",266    "outputs": [],267    "stateMutability": "nonpayable",268    "type": "function"269  },270  {271    "inputs": [{ "internalType": "bool", "name": "enable", "type": "bool" }],272    "name": "setCollectionNesting",273    "outputs": [],274    "stateMutability": "nonpayable",275    "type": "function"276  },277  {278    "inputs": [279      { "internalType": "bool", "name": "enable", "type": "bool" },280      {281        "internalType": "address[]",282        "name": "collections",283        "type": "address[]"284      }285    ],286    "name": "setCollectionNesting",287    "outputs": [],288    "stateMutability": "nonpayable",289    "type": "function"290  },291  {292    "inputs": [293      { "internalType": "string", "name": "key", "type": "string" },294      { "internalType": "bytes", "name": "value", "type": "bytes" }295    ],296    "name": "setCollectionProperty",297    "outputs": [],298    "stateMutability": "nonpayable",299    "type": "function"300  },301  {302    "inputs": [303      { "internalType": "address", "name": "sponsor", "type": "address" }304    ],305    "name": "setCollectionSponsor",306    "outputs": [],307    "stateMutability": "nonpayable",308    "type": "function"309  },310  {311    "inputs": [312      { "internalType": "uint256", "name": "sponsor", "type": "uint256" }313    ],314    "name": "setCollectionSponsorSubstrate",315    "outputs": [],316    "stateMutability": "nonpayable",317    "type": "function"318  },319  {320    "inputs": [321      { "internalType": "address", "name": "newOwner", "type": "address" }322    ],323    "name": "setOwner",324    "outputs": [],325    "stateMutability": "nonpayable",326    "type": "function"327  },328  {329    "inputs": [330      { "internalType": "uint256", "name": "newOwner", "type": "uint256" }331    ],332    "name": "setOwnerSubstrate",333    "outputs": [],334    "stateMutability": "nonpayable",335    "type": "function"336  },337  {338    "inputs": [339      { "internalType": "bytes4", "name": "interfaceID", "type": "bytes4" }340    ],341    "name": "supportsInterface",342    "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],343    "stateMutability": "view",344    "type": "function"345  },346  {347    "inputs": [],348    "name": "symbol",349    "outputs": [{ "internalType": "string", "name": "", "type": "string" }],350    "stateMutability": "view",351    "type": "function"352  },353  {354    "inputs": [],355    "name": "totalSupply",356    "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],357    "stateMutability": "view",358    "type": "function"359  },360  {361    "inputs": [362      { "internalType": "address", "name": "to", "type": "address" },363      { "internalType": "uint256", "name": "amount", "type": "uint256" }364    ],365    "name": "transfer",366    "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],367    "stateMutability": "nonpayable",368    "type": "function"369  },370  {371    "inputs": [372      { "internalType": "address", "name": "from", "type": "address" },373      { "internalType": "address", "name": "to", "type": "address" },374      { "internalType": "uint256", "name": "amount", "type": "uint256" }375    ],376    "name": "transferFrom",377    "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],378    "stateMutability": "nonpayable",379    "type": "function"380  },381  {382    "inputs": [],383    "name": "uniqueCollectionType",384    "outputs": [{ "internalType": "string", "name": "", "type": "string" }],385    "stateMutability": "nonpayable",386    "type": "function"387  }388]
after · tests/src/eth/fungibleAbi.json
1[2  {3    "anonymous": false,4    "inputs": [5      {6        "indexed": true,7        "internalType": "address",8        "name": "owner",9        "type": "address"10      },11      {12        "indexed": true,13        "internalType": "address",14        "name": "spender",15        "type": "address"16      },17      {18        "indexed": false,19        "internalType": "uint256",20        "name": "value",21        "type": "uint256"22      }23    ],24    "name": "Approval",25    "type": "event"26  },27  {28    "anonymous": false,29    "inputs": [30      {31        "indexed": true,32        "internalType": "address",33        "name": "from",34        "type": "address"35      },36      {37        "indexed": true,38        "internalType": "address",39        "name": "to",40        "type": "address"41      },42      {43        "indexed": false,44        "internalType": "uint256",45        "name": "value",46        "type": "uint256"47      }48    ],49    "name": "Transfer",50    "type": "event"51  },52  {53    "inputs": [54      { "internalType": "address", "name": "newAdmin", "type": "address" }55    ],56    "name": "addCollectionAdmin",57    "outputs": [],58    "stateMutability": "nonpayable",59    "type": "function"60  },61  {62    "inputs": [63      { "internalType": "uint256", "name": "newAdmin", "type": "uint256" }64    ],65    "name": "addCollectionAdminSubstrate",66    "outputs": [],67    "stateMutability": "nonpayable",68    "type": "function"69  },70  {71    "inputs": [72      { "internalType": "address", "name": "user", "type": "address" }73    ],74    "name": "addToCollectionAllowList",75    "outputs": [],76    "stateMutability": "nonpayable",77    "type": "function"78  },79  {80    "inputs": [81      { "internalType": "address", "name": "owner", "type": "address" },82      { "internalType": "address", "name": "spender", "type": "address" }83    ],84    "name": "allowance",85    "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],86    "stateMutability": "view",87    "type": "function"88  },89  {90    "inputs": [91      { "internalType": "address", "name": "spender", "type": "address" },92      { "internalType": "uint256", "name": "amount", "type": "uint256" }93    ],94    "name": "approve",95    "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],96    "stateMutability": "nonpayable",97    "type": "function"98  },99  {100    "inputs": [101      { "internalType": "address", "name": "owner", "type": "address" }102    ],103    "name": "balanceOf",104    "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],105    "stateMutability": "view",106    "type": "function"107  },108  {109    "inputs": [110      { "internalType": "address", "name": "from", "type": "address" },111      { "internalType": "uint256", "name": "amount", "type": "uint256" }112    ],113    "name": "burnFrom",114    "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],115    "stateMutability": "nonpayable",116    "type": "function"117  },118  {119    "inputs": [{ "internalType": "string", "name": "key", "type": "string" }],120    "name": "collectionProperty",121    "outputs": [{ "internalType": "bytes", "name": "", "type": "bytes" }],122    "stateMutability": "view",123    "type": "function"124  },125  {126    "inputs": [],127    "name": "confirmCollectionSponsorship",128    "outputs": [],129    "stateMutability": "nonpayable",130    "type": "function"131  },132  {133    "inputs": [],134    "name": "contractAddress",135    "outputs": [{ "internalType": "address", "name": "", "type": "address" }],136    "stateMutability": "view",137    "type": "function"138  },139  {140    "inputs": [],141    "name": "decimals",142    "outputs": [{ "internalType": "uint8", "name": "", "type": "uint8" }],143    "stateMutability": "view",144    "type": "function"145  },146  {147    "inputs": [{ "internalType": "string", "name": "key", "type": "string" }],148    "name": "deleteCollectionProperty",149    "outputs": [],150    "stateMutability": "nonpayable",151    "type": "function"152  },153  {154    "inputs": [155      { "internalType": "address", "name": "to", "type": "address" },156      { "internalType": "uint256", "name": "amount", "type": "uint256" }157    ],158    "name": "mint",159    "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],160    "stateMutability": "nonpayable",161    "type": "function"162  },163  {164    "inputs": [165      {166        "components": [167          { "internalType": "address", "name": "field_0", "type": "address" },168          { "internalType": "uint256", "name": "field_1", "type": "uint256" }169        ],170        "internalType": "struct Tuple0[]",171        "name": "amounts",172        "type": "tuple[]"173      }174    ],175    "name": "mintBulk",176    "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],177    "stateMutability": "nonpayable",178    "type": "function"179  },180  {181    "inputs": [],182    "name": "getCollectionSponsor",183    "outputs": [184      {185        "components": [186          { "internalType": "address", "name": "field_0", "type": "address" },187          { "internalType": "uint256", "name": "field_1", "type": "uint256" }188        ],189        "internalType": "struct Tuple6",190        "name": "",191        "type": "tuple"192      }193    ],194    "stateMutability": "view",195    "type": "function"196  },197  {198    "inputs": [],199    "name": "hasCollectionPendingSponsor",200    "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],201    "stateMutability": "view",202    "type": "function"203  },204  {205    "inputs": [206      { "internalType": "address", "name": "user", "type": "address" }207    ],208    "name": "isOwnerOrAdmin",209    "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],210    "stateMutability": "view",211    "type": "function"212  },213  {214    "inputs": [215      { "internalType": "uint256", "name": "user", "type": "uint256" }216    ],217    "name": "isOwnerOrAdminSubstrate",218    "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],219    "stateMutability": "view",220    "type": "function"221  },222  {223    "inputs": [],224    "name": "name",225    "outputs": [{ "internalType": "string", "name": "", "type": "string" }],226    "stateMutability": "view",227    "type": "function"228  },229  {230    "inputs": [231      { "internalType": "address", "name": "admin", "type": "address" }232    ],233    "name": "removeCollectionAdmin",234    "outputs": [],235    "stateMutability": "nonpayable",236    "type": "function"237  },238  {239    "inputs": [240      { "internalType": "uint256", "name": "admin", "type": "uint256" }241    ],242    "name": "removeCollectionAdminSubstrate",243    "outputs": [],244    "stateMutability": "nonpayable",245    "type": "function"246  },247  {248    "inputs": [],249    "name": "removeCollectionSponsor",250    "outputs": [],251    "stateMutability": "nonpayable",252    "type": "function"253  },254  {255    "inputs": [256      { "internalType": "address", "name": "user", "type": "address" }257    ],258    "name": "removeFromCollectionAllowList",259    "outputs": [],260    "stateMutability": "nonpayable",261    "type": "function"262  },263  {264    "inputs": [{ "internalType": "uint8", "name": "mode", "type": "uint8" }],265    "name": "setCollectionAccess",266    "outputs": [],267    "stateMutability": "nonpayable",268    "type": "function"269  },270  {271    "inputs": [272      { "internalType": "string", "name": "limit", "type": "string" },273      { "internalType": "uint32", "name": "value", "type": "uint32" }274    ],275    "name": "setCollectionLimit",276    "outputs": [],277    "stateMutability": "nonpayable",278    "type": "function"279  },280  {281    "inputs": [282      { "internalType": "string", "name": "limit", "type": "string" },283      { "internalType": "bool", "name": "value", "type": "bool" }284    ],285    "name": "setCollectionLimit",286    "outputs": [],287    "stateMutability": "nonpayable",288    "type": "function"289  },290  {291    "inputs": [{ "internalType": "bool", "name": "mode", "type": "bool" }],292    "name": "setCollectionMintMode",293    "outputs": [],294    "stateMutability": "nonpayable",295    "type": "function"296  },297  {298    "inputs": [{ "internalType": "bool", "name": "enable", "type": "bool" }],299    "name": "setCollectionNesting",300    "outputs": [],301    "stateMutability": "nonpayable",302    "type": "function"303  },304  {305    "inputs": [306      { "internalType": "bool", "name": "enable", "type": "bool" },307      {308        "internalType": "address[]",309        "name": "collections",310        "type": "address[]"311      }312    ],313    "name": "setCollectionNesting",314    "outputs": [],315    "stateMutability": "nonpayable",316    "type": "function"317  },318  {319    "inputs": [320      { "internalType": "string", "name": "key", "type": "string" },321      { "internalType": "bytes", "name": "value", "type": "bytes" }322    ],323    "name": "setCollectionProperty",324    "outputs": [],325    "stateMutability": "nonpayable",326    "type": "function"327  },328  {329    "inputs": [330      { "internalType": "address", "name": "sponsor", "type": "address" }331    ],332    "name": "setCollectionSponsor",333    "outputs": [],334    "stateMutability": "nonpayable",335    "type": "function"336  },337  {338    "inputs": [339      { "internalType": "uint256", "name": "sponsor", "type": "uint256" }340    ],341    "name": "setCollectionSponsorSubstrate",342    "outputs": [],343    "stateMutability": "nonpayable",344    "type": "function"345  },346  {347    "inputs": [348      { "internalType": "address", "name": "newOwner", "type": "address" }349    ],350    "name": "setOwner",351    "outputs": [],352    "stateMutability": "nonpayable",353    "type": "function"354  },355  {356    "inputs": [357      { "internalType": "uint256", "name": "newOwner", "type": "uint256" }358    ],359    "name": "setOwnerSubstrate",360    "outputs": [],361    "stateMutability": "nonpayable",362    "type": "function"363  },364  {365    "inputs": [366      { "internalType": "bytes4", "name": "interfaceID", "type": "bytes4" }367    ],368    "name": "supportsInterface",369    "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],370    "stateMutability": "view",371    "type": "function"372  },373  {374    "inputs": [],375    "name": "symbol",376    "outputs": [{ "internalType": "string", "name": "", "type": "string" }],377    "stateMutability": "view",378    "type": "function"379  },380  {381    "inputs": [],382    "name": "totalSupply",383    "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],384    "stateMutability": "view",385    "type": "function"386  },387  {388    "inputs": [389      { "internalType": "address", "name": "to", "type": "address" },390      { "internalType": "uint256", "name": "amount", "type": "uint256" }391    ],392    "name": "transfer",393    "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],394    "stateMutability": "nonpayable",395    "type": "function"396  },397  {398    "inputs": [399      { "internalType": "address", "name": "from", "type": "address" },400      { "internalType": "address", "name": "to", "type": "address" },401      { "internalType": "uint256", "name": "amount", "type": "uint256" }402    ],403    "name": "transferFrom",404    "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],405    "stateMutability": "nonpayable",406    "type": "function"407  },408  {409    "inputs": [],410    "name": "uniqueCollectionType",411    "outputs": [{ "internalType": "string", "name": "", "type": "string" }],412    "stateMutability": "nonpayable",413    "type": "function"414  }415]