difftreelog
feat(refungible-pallet) fractionalizer contract
in: master
7 files changed
tests/package.jsondiffbeforeafterboth8 "@polkadot/typegen": "8.7.2-15",8 "@polkadot/typegen": "8.7.2-15",9 "@types/chai": "^4.3.1",9 "@types/chai": "^4.3.1",10 "@types/chai-as-promised": "^7.1.5",10 "@types/chai-as-promised": "^7.1.5",11 "@types/chai-like": "^1.1.1",11 "@types/mocha": "^9.1.1",12 "@types/mocha": "^9.1.1",12 "@types/node": "^17.0.35",13 "@types/node": "^17.0.35",13 "@typescript-eslint/eslint-plugin": "^5.26.0",14 "@typescript-eslint/eslint-plugin": "^5.26.0",96 "@polkadot/util-crypto": "9.4.1",97 "@polkadot/util-crypto": "9.4.1",97 "bignumber.js": "^9.0.2",98 "bignumber.js": "^9.0.2",98 "chai-as-promised": "^7.1.1",99 "chai-as-promised": "^7.1.1",100 "chai-like": "^1.1.1",99 "find-process": "^1.4.7",101 "find-process": "^1.4.7",100 "solc": "0.8.14-fixed",102 "solc": "0.8.14-fixed",101 "web3": "^1.7.3"103 "web3": "^1.7.3"tests/src/eth/fractionalizer/Fractionalizer.bindiffbeforeafterbothno changes
tests/src/eth/fractionalizer/Fractionalizer.soldiffbeforeafterbothno changes
tests/src/eth/fractionalizer/FractionalizerAbi.jsondiffbeforeafterbothno changes
tests/src/eth/fractionalizer/fractionalizer.test.tsdiffbeforeafterbothno changes
tests/src/eth/util/helpers.tsdiffbeforeafterboth32import fungibleAbi from '../fungibleAbi.json';32import fungibleAbi from '../fungibleAbi.json';33import nonFungibleAbi from '../nonFungibleAbi.json';33import nonFungibleAbi from '../nonFungibleAbi.json';34import refungibleAbi from '../reFungibleAbi.json';34import refungibleAbi from '../reFungibleAbi.json';35import refungibleTokenAbi from '../reFungibleTokenAbi.json';35import contractHelpersAbi from './contractHelpersAbi.json';36import contractHelpersAbi from './contractHelpersAbi.json';363737export const GAS_ARGS = {gas: 2500000};38export const GAS_ARGS = {gas: 2500000};102 return Web3.utils.toChecksumAddress('0x' + buf.toString('hex'));103 return Web3.utils.toChecksumAddress('0x' + buf.toString('hex'));103}104}105106export function tokenIdFromAddress(address: string) {107 if (!address.startsWith('0x'))108 throw 'address not starts with "0x"';109 if (address.length > 42)110 throw 'address length is more than 20 bytes';111 return {112 collectionId: Number('0x' + address.substring(address.length - 16, address.length - 8)),113 tokenId: Number('0x' + address.substring(address.length - 8)),114 };115}116104export function tokenIdToCross(collection: number, token: number): CrossAccountId {117export function tokenIdToCross(collection: number, token: number): CrossAccountId {105 return {118 return {128 expect(result.success).to.be.true;141 expect(result.success).to.be.true;129}142}143144export async function createRefungibleCollection(api: ApiPromise, web3: Web3, owner: string) {145 const collectionHelper = evmCollectionHelpers(web3, owner);146 const result = await collectionHelper.methods147 .createRefungibleCollection('A', 'B', 'C')148 .send();149 return await getCollectionAddressFromResult(api, result);150}151152153export async function createNonfungibleCollection(api: ApiPromise, web3: Web3, owner: string) {154 const collectionHelper = evmCollectionHelpers(web3, owner);155 const result = await collectionHelper.methods156 .createNonfungibleCollection('A', 'B', 'C')157 .send();158 return await getCollectionAddressFromResult(api, result);159}160161export function uniqueNFT(web3: Web3, address: string, owner: string) {162 return new web3.eth.Contract(nonFungibleAbi as any, address, {163 from: owner,164 ...GAS_ARGS,165 });166}167168export function uniqueRefungible(web3: Web3, collectionAddress: string, owner: string) {169 return new web3.eth.Contract(refungibleAbi as any, collectionAddress, {170 from: owner,171 ...GAS_ARGS,172 });173}174175export function uniqueRefungibleToken(web3: Web3, tokenAddress: string, owner: string) {176 return new web3.eth.Contract(refungibleTokenAbi as any, tokenAddress, {177 from: owner,178 ...GAS_ARGS,179 });180}130181131export async function itWeb3(name: string, cb: (apis: { web3: Web3, api: ApiPromise, privateKeyWrapper: (account: string) => IKeyringPair }) => any, opts: { only?: boolean, skip?: boolean } = {}) {182export async function itWeb3(name: string, cb: (apis: { web3: Web3, api: ApiPromise, privateKeyWrapper: (account: string) => IKeyringPair }) => any, opts: { only?: boolean, skip?: boolean } = {}) {132 let i: any = it;183 let i: any = it;tests/yarn.lockdiffbeforeafterboth963 dependencies:963 dependencies:964 "@types/chai" "*"964 "@types/chai" "*"965965966"@types/chai-like@^1.1.1":967 version "1.1.1"968 resolved "https://registry.yarnpkg.com/@types/chai-like/-/chai-like-1.1.1.tgz#c454039b0a2f92664fb5b7b7a2a66c3358783ae7"969 integrity sha512-s46EZsupBuVhLn66DbRee5B0SELLmL4nFXVrBiV29BxLGm9Sh7Bful623j3AfiQRu2zAP4cnlZ3ETWB3eWc4bA==970 dependencies:971 "@types/chai" "*"972973"@types/chai-things@^0.0.35":974 version "0.0.35"975 resolved "https://registry.yarnpkg.com/@types/chai-things/-/chai-things-0.0.35.tgz#4b5d9ec032067faa62b3bf7bb40dc0bec941945f"976 integrity sha512-BC8FwMf9FHj87XT4dgTwbdb8dNRilGqYWGmwLPdJ54YNk6K2PlcFTt68NGHjgPDnms8zIYcOtmPePd0mPNTo/Q==977 dependencies:978 "@types/chai" "*"979966"@types/chai@*", "@types/chai@^4.3.1":980"@types/chai@*", "@types/chai@^4.3.1":967 version "4.3.1"981 version "4.3.1"968 resolved "https://registry.yarnpkg.com/@types/chai/-/chai-4.3.1.tgz#e2c6e73e0bdeb2521d00756d099218e9f5d90a04"982 resolved "https://registry.yarnpkg.com/@types/chai/-/chai-4.3.1.tgz#e2c6e73e0bdeb2521d00756d099218e9f5d90a04"1544 integrity sha512-azL6xMoi+uxu6z4rhWQ1jbdUhOMhis2PvscD/xjLqNMkv3BPPp2JyyuTHOrf9BOosGpNQ11v6BKv/g57RXbiaA==1558 integrity sha512-azL6xMoi+uxu6z4rhWQ1jbdUhOMhis2PvscD/xjLqNMkv3BPPp2JyyuTHOrf9BOosGpNQ11v6BKv/g57RXbiaA==1545 dependencies:1559 dependencies:1546 check-error "^1.0.2"1560 check-error "^1.0.2"15611562chai-like@^1.1.1:1563 version "1.1.1"1564 resolved "https://registry.yarnpkg.com/chai-like/-/chai-like-1.1.1.tgz#8c558a414c34514e814d497c772547ceb7958f64"1565 integrity sha512-VKa9z/SnhXhkT1zIjtPACFWSoWsqVoaz1Vg+ecrKo5DCKVlgL30F/pEyEvXPBOVwCgLZcWUleCM/C1okaKdTTA==15661567chai-things@^0.2.0:1568 version "0.2.0"1569 resolved "https://registry.yarnpkg.com/chai-things/-/chai-things-0.2.0.tgz#c55128378f9bb399e994f00052151984ed6ebe70"1570 integrity sha512-6ns0SU21xdRCoEXVKH3HGbwnsgfVMXQ+sU5V8PI9rfxaITos8lss1vUxbF1FAcJKjfqmmmLVlr/z3sLes00w+A==154715711548chai@^4.3.6:1572chai@^4.3.6:1549 version "4.3.6"1573 version "4.3.6"