git.delta.rocks / unique-network / refs/commits / 7e36fe0db195

difftreelog

Merge branch 'develop' into feature/autoseal-every-n-secs

Igor Kozyrev2022-04-01parents: #1ce1209 #62bde24.patch.diff
in: master

4 files changed

modifiedruntime/opal/src/lib.rsdiffbeforeafterboth
--- a/runtime/opal/src/lib.rs
+++ b/runtime/opal/src/lib.rs
@@ -152,7 +152,7 @@
 	spec_name: create_runtime_str!(RUNTIME_NAME),
 	impl_name: create_runtime_str!(RUNTIME_NAME),
 	authoring_version: 1,
-	spec_version: 918000,
+	spec_version: 918001,
 	impl_version: 0,
 	apis: RUNTIME_API_VERSIONS,
 	transaction_version: 1,
modifiedruntime/quartz/src/lib.rsdiffbeforeafterboth
--- a/runtime/quartz/src/lib.rs
+++ b/runtime/quartz/src/lib.rs
@@ -152,7 +152,7 @@
 	spec_name: create_runtime_str!(RUNTIME_NAME),
 	impl_name: create_runtime_str!(RUNTIME_NAME),
 	authoring_version: 1,
-	spec_version: 918000,
+	spec_version: 918001,
 	impl_version: 0,
 	apis: RUNTIME_API_VERSIONS,
 	transaction_version: 1,
modifiedruntime/unique/src/lib.rsdiffbeforeafterboth
151 spec_name: create_runtime_str!(RUNTIME_NAME),151 spec_name: create_runtime_str!(RUNTIME_NAME),
152 impl_name: create_runtime_str!(RUNTIME_NAME),152 impl_name: create_runtime_str!(RUNTIME_NAME),
153 authoring_version: 1,153 authoring_version: 1,
154 spec_version: 918000,154 spec_version: 918001,
155 impl_version: 0,155 impl_version: 0,
156 apis: RUNTIME_API_VERSIONS,156 apis: RUNTIME_API_VERSIONS,
157 transaction_version: 1,157 transaction_version: 1,
addedtests/src/eth/collectionSponsoring.test.tsdiffbeforeafterboth
--- /dev/null
+++ b/tests/src/eth/collectionSponsoring.test.ts
@@ -0,0 +1,43 @@
+import privateKey from '../substrate/privateKey';
+import {addToAllowListExpectSuccess, confirmSponsorshipExpectSuccess, createCollectionExpectSuccess, enablePublicMintingExpectSuccess, setCollectionSponsorExpectSuccess} from '../util/helpers';
+import {itWeb3, transferBalanceToEth, subToEth, createEthAccount, collectionIdToAddress, GAS_ARGS, normalizeEvents} from './util/helpers';
+import nonFungibleAbi from './nonFungibleAbi.json';
+import {expect} from 'chai';
+
+describe('evm collection sponsoring', () => {
+  itWeb3('sponsors mint transactions', async ({api, web3}) => {
+    const alice = privateKey('//Alice');
+
+    const collection = await createCollectionExpectSuccess();
+    await setCollectionSponsorExpectSuccess(collection, alice.address);
+    await confirmSponsorshipExpectSuccess(collection);
+
+    // Wouldn't be needed after CORE-300
+    await transferBalanceToEth(api, alice, subToEth(alice.address));
+
+    const minter = createEthAccount(web3);
+    expect(await web3.eth.getBalance(minter)).to.equal('0');
+
+    const address = collectionIdToAddress(collection);
+    const contract = new web3.eth.Contract(nonFungibleAbi as any, collectionIdToAddress(collection), {from: minter, ...GAS_ARGS});
+
+    await enablePublicMintingExpectSuccess(alice, collection);
+    await addToAllowListExpectSuccess(alice, collection, {Ethereum: minter});
+
+    const nextTokenId = await contract.methods.nextTokenId().call();
+    expect(nextTokenId).to.equal('1');
+    const result = await contract.methods.mint(minter, nextTokenId).send();
+    const events = normalizeEvents(result.events);
+    expect(events).to.be.deep.equal([
+      {
+        address,
+        event: 'Transfer',
+        args: {
+          from: '0x0000000000000000000000000000000000000000',
+          to: minter,
+          tokenId: nextTokenId,
+        },
+      },
+    ]);
+  });
+});