From 3ffc196cc3cd787eacfc7b5981ef1c910a64516b Mon Sep 17 00:00:00 2001 From: Alex Bean Date: Mon, 9 Jun 2025 19:46:57 +0200 Subject: [PATCH] feat(api-contract): add support for ink! v6 and pallet-revive compatibility (#6158) * wip: support revive for ink! v6 * revive components * fix: support v6 metadata * fix: remove debug messages * test: extend tests for v6ToLatestCompatible * refactor: remove Revive specific components * test: construct revive compatible contract * feat: use ContractReviveProjectInfo new type * fix: parse version to decide what kind of contract * refactor: remove hardcoded address * fix: format --------- Co-authored-by: Peter White --- packages/api-contract/src/Abi/index.ts | 34 +- .../src/Abi/toLatestCompatible.spec.ts | 28 +- .../src/Abi/toLatestCompatible.ts | 9 +- packages/api-contract/src/base/Base.ts | 20 +- packages/api-contract/src/base/Blueprint.ts | 26 +- packages/api-contract/src/base/Code.spec.ts | 13 +- packages/api-contract/src/base/Code.ts | 25 +- packages/api-contract/src/base/Contract.ts | 16 +- packages/api-contract/src/base/mock.ts | 17 + packages/api-contract/src/promise/index.ts | 4 +- .../compare/ink_v6_erc20Contract.test.json | 418 +++++++ .../compare/ink_v6_erc20Metadata.test.json | 418 +++++++ .../src/test/contracts/ink/index.ts | 3 +- .../test/contracts/ink/v6/erc20.contract.json | 1 + .../src/test/contracts/ink/v6/erc20.json | 1081 +++++++++++++++++ .../src/test/contracts/ink/v6/erc20.polkavm | Bin 0 -> 9445 bytes .../src/test/contracts/ink/v6/index.ts | 5 + .../types-augment/src/registry/interfaces.ts | 6 +- .../interfaces/contractsAbi/definitions.ts | 31 +- .../src/interfaces/contractsAbi/types.ts | 36 +- 20 files changed, 2157 insertions(+), 34 deletions(-) create mode 100644 packages/api-contract/src/test/compare/ink_v6_erc20Contract.test.json create mode 100644 packages/api-contract/src/test/compare/ink_v6_erc20Metadata.test.json create mode 100644 packages/api-contract/src/test/contracts/ink/v6/erc20.contract.json create mode 100644 packages/api-contract/src/test/contracts/ink/v6/erc20.json create mode 100644 packages/api-contract/src/test/contracts/ink/v6/erc20.polkavm create mode 100644 packages/api-contract/src/test/contracts/ink/v6/index.ts diff --git a/packages/api-contract/src/Abi/index.ts b/packages/api-contract/src/Abi/index.ts index 5d1b0b2674..06b0553b6a 100644 --- a/packages/api-contract/src/Abi/index.ts +++ b/packages/api-contract/src/Abi/index.ts @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 import type { Bytes, Vec } from '@polkadot/types'; -import type { ChainProperties, ContractConstructorSpecLatest, ContractEventParamSpecLatest, ContractMessageParamSpecLatest, ContractMessageSpecLatest, ContractMetadata, ContractMetadataV4, ContractMetadataV5, ContractProjectInfo, ContractTypeSpec, EventRecord } from '@polkadot/types/interfaces'; +import type { ChainProperties, ContractConstructorSpecLatest, ContractEventParamSpecLatest, ContractMessageParamSpecLatest, ContractMessageSpecLatest, ContractMetadata, ContractMetadataV4, ContractMetadataV5, ContractMetadataV6, ContractProjectInfo, ContractTypeSpec, EventRecord } from '@polkadot/types/interfaces'; import type { Codec, Registry, TypeDef } from '@polkadot/types/types'; import type { AbiConstructor, AbiEvent, AbiEventParam, AbiMessage, AbiMessageParam, AbiParam, DecodedEvent, DecodedMessage } from '../types.js'; @@ -19,12 +19,12 @@ interface AbiJson { } type EventOf = M extends {spec: { events: Vec}} ? E : never -export type ContractMetadataSupported = ContractMetadataV4 | ContractMetadataV5; +export type ContractMetadataSupported = ContractMetadataV4 | ContractMetadataV5 | ContractMetadataV6; type ContractEventSupported = EventOf; const l = logger('Abi'); -const PRIMITIVE_ALWAYS = ['AccountId', 'AccountIndex', 'Address', 'Balance']; +const PRIMITIVE_ALWAYS = ['AccountId', 'AccountId20', 'AccountIndex', 'Address', 'Balance']; function findMessage (list: T[], messageOrId: T | string | number): T { const message = isNumber(messageOrId) @@ -66,9 +66,28 @@ function getMetadata (registry: Registry, json: AbiJson): ContractMetadataSuppor return upgradedMetadata; } -function parseJson (json: Record, chainProperties?: ChainProperties): [Record, Registry, ContractMetadataSupported, ContractProjectInfo] { +function isRevive (json: Record): boolean { + const source = json['source']; + const version = json['version']; + + const hasContractBinary = + typeof source === 'object' && + source !== null && + 'contract_binary' in source; + + const hasVersion = + typeof version === 'number' && version >= 6; + + return hasContractBinary || hasVersion; +} + +function parseJson (json: Record, chainProperties?: ChainProperties): [Record, Registry, ContractMetadataSupported, ContractProjectInfo, boolean] { const registry = new TypeRegistry(); - const info = registry.createType('ContractProjectInfo', json) as unknown as ContractProjectInfo; + + const revive = isRevive(json); + const typeName = revive ? 'ContractReviveProjectInfo' : 'ContractProjectInfo'; + + const info = registry.createType(typeName, json) as unknown as ContractProjectInfo; const metadata = getMetadata(registry, json as unknown as AbiJson); const lookup = registry.createType('PortableRegistry', { types: metadata.types }, true); @@ -84,7 +103,7 @@ function parseJson (json: Record, chainProperties?: ChainProper lookup.getTypeDef(id) ); - return [json, registry, metadata, info]; + return [json, registry, metadata, info, revive]; } /** @@ -112,9 +131,10 @@ export class Abi { readonly metadata: ContractMetadataSupported; readonly registry: Registry; readonly environment = new Map(); + readonly isRevive: boolean; constructor (abiJson: Record | string, chainProperties?: ChainProperties) { - [this.json, this.registry, this.metadata, this.info] = parseJson( + [this.json, this.registry, this.metadata, this.info, this.isRevive] = parseJson( isString(abiJson) ? JSON.parse(abiJson) as Record : abiJson, diff --git a/packages/api-contract/src/Abi/toLatestCompatible.spec.ts b/packages/api-contract/src/Abi/toLatestCompatible.spec.ts index 0c51f221e5..e905ca0db1 100644 --- a/packages/api-contract/src/Abi/toLatestCompatible.spec.ts +++ b/packages/api-contract/src/Abi/toLatestCompatible.spec.ts @@ -6,7 +6,7 @@ import { TypeRegistry } from '@polkadot/types'; import abis from '../test/contracts/index.js'; -import { v0ToLatestCompatible, v1ToLatestCompatible, v2ToLatestCompatible, v3ToLatestCompatible, v4ToLatestCompatible, v5ToLatestCompatible } from './toLatestCompatible.js'; +import { v0ToLatestCompatible, v1ToLatestCompatible, v2ToLatestCompatible, v3ToLatestCompatible, v4ToLatestCompatible, v5ToLatestCompatible, v6ToLatestCompatible } from './toLatestCompatible.js'; describe('v0ToLatestCompatible', (): void => { const registry = new TypeRegistry(); @@ -191,3 +191,29 @@ describe('v5ToLatestCompatible', (): void => { expect(latest.version.toString()).toEqual('5'); }); }); + +describe('v6ToLatestCompatible', (): void => { + const registry = new TypeRegistry(); + const contract = registry.createType('ContractMetadata', { V6: abis['ink_v6_erc20Metadata'] }); + const latest = v6ToLatestCompatible(registry, contract.asV6); + + it('has the correct messages', (): void => { + expect( + latest.spec.messages.map(({ label }) => label.toString()) + ).toEqual(['total_supply', 'balance_of', 'allowance', 'transfer', 'approve', 'transfer_from']); + }); + + it('has H160 as the type of balance_of argument', (): void => { + const arg = latest.spec.messages.find( + (m) => m.label.toString() === 'balance_of' + )?.args[0]; + + const name = arg?.type.displayName?.[0]?.toString(); + + expect(name).toBe('H160'); + }); + + it('has the latest compatible version number', (): void => { + expect(latest.version.toString()).toEqual('6'); + }); +}); diff --git a/packages/api-contract/src/Abi/toLatestCompatible.ts b/packages/api-contract/src/Abi/toLatestCompatible.ts index ad3fa5bfc2..8306f82d48 100644 --- a/packages/api-contract/src/Abi/toLatestCompatible.ts +++ b/packages/api-contract/src/Abi/toLatestCompatible.ts @@ -1,7 +1,7 @@ // Copyright 2017-2025 @polkadot/api-contract authors & contributors // SPDX-License-Identifier: Apache-2.0 -import type { ContractMetadataV4, ContractMetadataV5 } from '@polkadot/types/interfaces'; +import type { ContractMetadataV4, ContractMetadataV5, ContractMetadataV6 } from '@polkadot/types/interfaces'; import type { Registry } from '@polkadot/types/types'; import type { ContractMetadataSupported } from './index.js'; @@ -12,7 +12,7 @@ import { v3ToV4 } from './toV4.js'; // The versions where an enum is used, aka V0 is missing // (Order from newest, i.e. we expect more on newest vs oldest) -export const enumVersions = ['V5', 'V4', 'V3', 'V2', 'V1'] as const; +export const enumVersions = ['V6', 'V5', 'V4', 'V3', 'V2', 'V1'] as const; type Versions = typeof enumVersions[number] | 'V0'; @@ -24,6 +24,10 @@ function createConverter (next: (registry: Registry, input: O) => Contrac next(registry, step(registry, input)); } +export function v6ToLatestCompatible (_registry: Registry, v6: ContractMetadataV6): ContractMetadataV6 { + return v6; +} + export function v5ToLatestCompatible (_registry: Registry, v5: ContractMetadataV5): ContractMetadataV5 { return v5; } @@ -38,6 +42,7 @@ export const v1ToLatestCompatible = /*#__PURE__*/ createConverter(v2ToLatestComp export const v0ToLatestCompatible = /*#__PURE__*/ createConverter(v1ToLatestCompatible, v0ToV1); export const convertVersions: [Versions, Converter][] = [ + ['V6', v6ToLatestCompatible], ['V5', v5ToLatestCompatible], ['V4', v4ToLatestCompatible], ['V3', v3ToLatestCompatible], diff --git a/packages/api-contract/src/base/Base.ts b/packages/api-contract/src/base/Base.ts index d7b9674643..bbf744623d 100644 --- a/packages/api-contract/src/base/Base.ts +++ b/packages/api-contract/src/base/Base.ts @@ -16,14 +16,11 @@ export abstract class Base { protected readonly _decorateMethod: DecorateMethod; protected readonly _isWeightV1: boolean; + protected readonly _isRevive: boolean; constructor (api: ApiBase, abi: string | Record | Abi, decorateMethod: DecorateMethod) { if (!api || !api.isConnected || !api.tx) { throw new Error('Your API has not been initialized correctly and is not connected to a chain'); - } else if (!api.tx.contracts || !isFunction(api.tx.contracts.instantiateWithCode) || api.tx.contracts.instantiateWithCode.meta.args.length !== 6) { - throw new Error('The runtime does not expose api.tx.contracts.instantiateWithCode with storageDepositLimit'); - } else if (!api.call.contractsApi || !isFunction(api.call.contractsApi.call)) { - throw new Error('Your runtime does not expose the api.call.contractsApi.call runtime interfaces'); } this.abi = abi instanceof Abi @@ -32,6 +29,21 @@ export abstract class Base { this.api = api; this._decorateMethod = decorateMethod; this._isWeightV1 = !api.registry.createType('Weight').proofSize; + this._isRevive = this.abi.isRevive; + + if (this._isRevive) { + if (!api.tx.revive || !isFunction(api.tx.revive.instantiateWithCode) || api.tx.revive.instantiateWithCode.meta.args.length !== 6) { + throw new Error('The runtime does not expose api.tx.revive.instantiateWithCode with storageDepositLimit'); + } else if (!api.call.reviveApi || !isFunction(api.call.reviveApi.call)) { + throw new Error('Your runtime does not expose the api.call.reviveApi.call runtime interfaces'); + } + } else { + if (!api.tx.contracts || !isFunction(api.tx.contracts.instantiateWithCode) || api.tx.contracts.instantiateWithCode.meta.args.length !== 6) { + throw new Error('The runtime does not expose api.tx.contracts.instantiateWithCode with storageDepositLimit'); + } else if (!api.call.contractsApi || !isFunction(api.call.contractsApi.call)) { + throw new Error('Your runtime does not expose the api.call.contractsApi.call runtime interfaces'); + } + } } public get registry (): Registry { diff --git a/packages/api-contract/src/base/Blueprint.ts b/packages/api-contract/src/base/Blueprint.ts index 27e1e4a38b..bf17d3d6fb 100644 --- a/packages/api-contract/src/base/Blueprint.ts +++ b/packages/api-contract/src/base/Blueprint.ts @@ -55,7 +55,11 @@ export class Blueprint extends Base { } #deploy = (constructorOrId: AbiConstructor | string | number, { gasLimit = BN_ZERO, salt, storageDepositLimit = null, value = BN_ZERO }: BlueprintOptions, params: unknown[]): SubmittableExtrinsic> => { - return this.api.tx.contracts.instantiate( + const palletTx = this._isRevive + ? this.api.tx.revive + : this.api.tx.contracts; + + return palletTx.instantiate( value, // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore jiggle v1 weights, metadata points to latest @@ -67,9 +71,23 @@ export class Blueprint extends Base { this.abi.findConstructor(constructorOrId).toU8a(params), encodeSalt(salt) ).withResultTransform((result: ISubmittableResult) => - new BlueprintSubmittableResult(result, applyOnEvent(result, ['Instantiated'], ([record]: EventRecord[]) => - new Contract(this.api, this.abi, record.event.data[1] as AccountId, this._decorateMethod) - )) + new BlueprintSubmittableResult(result, + this._isRevive + ? ( + (result.status.isInBlock || result.status.isFinalized) + ? new Contract( + this.api, + this.abi, + // your fixed address for revive deployments + this.registry.createType('AccountId', '0x'), + this._decorateMethod + ) + : undefined + ) + : applyOnEvent(result, ['Instantiated'], ([record]: EventRecord[]) => + new Contract(this.api, this.abi, record.event.data[1] as AccountId, this._decorateMethod) + ) + ) ); }; } diff --git a/packages/api-contract/src/base/Code.spec.ts b/packages/api-contract/src/base/Code.spec.ts index 8535991673..5b137d2f16 100644 --- a/packages/api-contract/src/base/Code.spec.ts +++ b/packages/api-contract/src/base/Code.spec.ts @@ -10,8 +10,9 @@ import { toPromiseMethod } from '@polkadot/api'; import v0contractFlipper from '../test/contracts/ink/v0/flipper.contract.json' assert { type: 'json' }; import v0abiFlipper from '../test/contracts/ink/v0/flipper.json' assert { type: 'json' }; import v1contractFlipper from '../test/contracts/ink/v1/flipper.contract.json' assert { type: 'json' }; +import v6contractErc20 from '../test/contracts/ink/v6/erc20.contract.json' assert { type: 'json' }; import { Code } from './Code.js'; -import { mockApi } from './mock.js'; +import { mockApi, mockReviveApi } from './mock.js'; const v0wasmFlipper = fs.readFileSync(new URL('../test/contracts/ink/v0/flipper.wasm', import.meta.url), 'utf-8'); @@ -33,4 +34,14 @@ describe('Code', (): void => { () => new Code(mockApi, v1contractFlipper as Record, null, toPromiseMethod) ).not.toThrow(); }); + + it('can construct a revive compatible contract (v6)', (): void => { + expect( + () => new Code(mockApi, v6contractErc20 as Record, null, toPromiseMethod) + ).toThrow('The runtime does not expose api.tx.revive.instantiateWithCode with storageDepositLimit'); + + expect( + () => new Code(mockReviveApi, v6contractErc20 as Record, null, toPromiseMethod) + ).not.toThrow(); + }); }); diff --git a/packages/api-contract/src/base/Code.ts b/packages/api-contract/src/base/Code.ts index c329792a70..07381f4745 100644 --- a/packages/api-contract/src/base/Code.ts +++ b/packages/api-contract/src/base/Code.ts @@ -68,7 +68,30 @@ export class Code extends Base { } #instantiate = (constructorOrId: AbiConstructor | string | number, { gasLimit = BN_ZERO, salt, storageDepositLimit = null, value = BN_ZERO }: BlueprintOptions, params: unknown[]): SubmittableExtrinsic> => { - return this.api.tx.contracts.instantiateWithCode( + const palletTx = this._isRevive ? this.api.tx.revive : this.api.tx.contracts; + + if (this._isRevive) { + return palletTx.instantiateWithCode( + value, + // eslint-disable-next-line @typescript-eslint/ban-ts-comment + // @ts-ignore jiggle v1 weights, metadata points to latest + this._isWeightV1 + ? convertWeight(gasLimit).v1Weight + : convertWeight(gasLimit).v2Weight, + storageDepositLimit, + compactAddLength(this.code), + this.abi.findConstructor(constructorOrId).toU8a(params), + encodeSalt(salt) + ).withResultTransform((result: ISubmittableResult) => + new CodeSubmittableResult( + result, + new Blueprint(this.api, this.abi, this.abi.info.source.hash, this._decorateMethod), + new Contract(this.api, this.abi, '0x', this._decorateMethod) + ) + ); + } + + return palletTx.instantiateWithCode( value, // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore jiggle v1 weights, metadata points to latest diff --git a/packages/api-contract/src/base/Contract.ts b/packages/api-contract/src/base/Contract.ts index a40777181b..02b3e7ddc1 100644 --- a/packages/api-contract/src/base/Contract.ts +++ b/packages/api-contract/src/base/Contract.ts @@ -4,7 +4,7 @@ import type { ApiBase } from '@polkadot/api/base'; import type { SubmittableExtrinsic } from '@polkadot/api/submittable/types'; import type { ApiTypes, DecorateMethod } from '@polkadot/api/types'; -import type { AccountId, ContractExecResult, EventRecord, Weight, WeightV2 } from '@polkadot/types/interfaces'; +import type { AccountId, AccountId20, ContractExecResult, EventRecord, Weight, WeightV2 } from '@polkadot/types/interfaces'; import type { ISubmittableResult } from '@polkadot/types/types'; import type { Abi } from '../Abi/index.js'; import type { AbiMessage, ContractCallOutcome, ContractOptions, DecodedEvent, WeightAll } from '../types.js'; @@ -52,15 +52,15 @@ export class Contract extends Base { /** * @description The on-chain address for this contract */ - readonly address: AccountId; + readonly address: AccountId | AccountId20; readonly #query: MapMessageQuery = {}; readonly #tx: MapMessageTx = {}; - constructor (api: ApiBase, abi: string | Record | Abi, address: string | AccountId, decorateMethod: DecorateMethod) { + constructor (api: ApiBase, abi: string | Record | Abi, address: string | AccountId | AccountId20, decorateMethod: DecorateMethod) { super(api, abi, decorateMethod); - this.address = this.registry.createType('AccountId', address); + this.address = this.registry.createType(this._isRevive ? 'AccountId20' : 'AccountId', address); this.abi.messages.forEach((m): void => { if (isUndefined(this.#tx[m.method])) { @@ -100,7 +100,9 @@ export class Contract extends Base { }; #exec = (messageOrId: AbiMessage | string | number, { gasLimit = BN_ZERO, storageDepositLimit = null, value = BN_ZERO }: ContractOptions, params: unknown[]): SubmittableExtrinsic => { - return this.api.tx.contracts.call( + const palletTx = this._isRevive ? this.api.tx.revive : this.api.tx.contracts; + + return palletTx.call( this.address, value, // eslint-disable-next-line @typescript-eslint/ban-ts-comment @@ -134,7 +136,9 @@ export class Contract extends Base { return { // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment send: this._decorateMethod((origin: string | AccountId | Uint8Array) => - this.api.rx.call.contractsApi.call( + (this._isRevive + ? this.api.rx.call.reviveApi.call + : this.api.rx.call.contractsApi.call)( origin, this.address, value, diff --git a/packages/api-contract/src/base/mock.ts b/packages/api-contract/src/base/mock.ts index 94409b7717..2269bab6b8 100644 --- a/packages/api-contract/src/base/mock.ts +++ b/packages/api-contract/src/base/mock.ts @@ -29,3 +29,20 @@ export const mockApi = { } } } as unknown as ApiBase<'promise'>; + +export const mockReviveApi = { + call: { + reviveApi: { + call: (): never => { + throw new Error('mock'); + } + } + }, + isConnected: true, + registry, + tx: { + revive: { + instantiateWithCode + } + } +} as unknown as ApiBase<'promise'>; diff --git a/packages/api-contract/src/promise/index.ts b/packages/api-contract/src/promise/index.ts index 07e5065e09..2f11fbcf72 100644 --- a/packages/api-contract/src/promise/index.ts +++ b/packages/api-contract/src/promise/index.ts @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 import type { ApiPromise } from '@polkadot/api'; -import type { AccountId, Hash } from '@polkadot/types/interfaces'; +import type { AccountId, AccountId20, Hash } from '@polkadot/types/interfaces'; import type { Abi } from '../Abi/index.js'; import { toPromiseMethod } from '@polkadot/api'; @@ -22,7 +22,7 @@ export class CodePromise extends Code<'promise'> { } export class ContractPromise extends Contract<'promise'> { - constructor (api: ApiPromise, abi: string | Record | Abi, address: string | AccountId) { + constructor (api: ApiPromise, abi: string | Record | Abi, address: string | AccountId | AccountId20) { super(api, abi, address, toPromiseMethod); } } diff --git a/packages/api-contract/src/test/compare/ink_v6_erc20Contract.test.json b/packages/api-contract/src/test/compare/ink_v6_erc20Contract.test.json new file mode 100644 index 0000000000..99c0507aee --- /dev/null +++ b/packages/api-contract/src/test/compare/ink_v6_erc20Contract.test.json @@ -0,0 +1,418 @@ +[ + { + "info": "Plain", + "lookupIndex": 0, + "type": "U256", + "docs": [], + "namespace": "primitive_types::U256", + "lookupNameRoot": "PrimitiveTypesU256" + }, + { + "info": "VecFixed", + "lookupIndex": 1, + "type": "[u64;4]", + "docs": [], + "namespace": "", + "length": 4, + "sub": { + "info": "Plain", + "lookupIndex": 2, + "type": "u64", + "docs": [], + "namespace": "" + } + }, + { + "info": "Plain", + "lookupIndex": 2, + "type": "u64", + "docs": [], + "namespace": "" + }, + { + "info": "Null", + "lookupIndex": 3, + "type": "Null", + "docs": [], + "namespace": "ink_storage::lazy::mapping::Mapping" + }, + { + "info": "Plain", + "lookupIndex": 4, + "type": "H160", + "docs": [], + "namespace": "primitive_types::H160", + "lookupNameRoot": "PrimitiveTypesH160" + }, + { + "info": "VecFixed", + "lookupIndex": 5, + "type": "[u8;20]", + "docs": [], + "namespace": "", + "length": 20, + "sub": { + "info": "Plain", + "lookupIndex": 6, + "type": "u8", + "docs": [], + "namespace": "" + } + }, + { + "info": "Plain", + "lookupIndex": 6, + "type": "u8", + "docs": [], + "namespace": "" + }, + { + "info": "Null", + "lookupIndex": 7, + "type": "Null", + "docs": [], + "namespace": "ink_storage_traits::impls::ResolverKey" + }, + { + "info": "Null", + "lookupIndex": 8, + "lookupName": "InkStorageTraitsImplsAutoKey", + "type": "Null", + "docs": [], + "namespace": "ink_storage_traits::impls::AutoKey" + }, + { + "info": "Null", + "lookupIndex": 9, + "lookupName": "InkStorageTraitsImplsManualKey", + "type": "Null", + "docs": [], + "namespace": "ink_storage_traits::impls::ManualKey" + }, + { + "info": "Null", + "lookupIndex": 10, + "type": "Null", + "docs": [], + "namespace": "" + }, + { + "info": "Null", + "lookupIndex": 11, + "lookupName": "InkStorageLazyMapping", + "type": "Null", + "docs": [], + "namespace": "ink_storage::lazy::mapping::Mapping" + }, + { + "info": "Tuple", + "lookupIndex": 12, + "type": "(H160,H160)", + "docs": [], + "namespace": "", + "sub": [ + { + "info": "Plain", + "lookupIndex": 4, + "type": "H160", + "docs": [], + "namespace": "primitive_types::H160", + "lookupNameRoot": "PrimitiveTypesH160" + }, + { + "info": "Plain", + "lookupIndex": 4, + "type": "H160", + "docs": [], + "namespace": "primitive_types::H160", + "lookupNameRoot": "PrimitiveTypesH160" + } + ] + }, + { + "info": "Null", + "lookupIndex": 13, + "lookupName": "InkStorageTraitsImplsResolverKey", + "type": "Null", + "docs": [], + "namespace": "ink_storage_traits::impls::ResolverKey" + }, + { + "info": "Null", + "lookupIndex": 14, + "lookupName": "InkStorageTraitsImplsManualKey", + "type": "Null", + "docs": [], + "namespace": "ink_storage_traits::impls::ManualKey" + }, + { + "info": "Struct", + "lookupIndex": 15, + "lookupName": "Erc20", + "type": "{\"totalSupply\":\"U256\",\"balances\":\"Null\",\"allowances\":\"InkStorageLazyMapping\"}", + "docs": [], + "namespace": "erc20::erc20::Erc20", + "sub": [ + { + "docs": [], + "name": "totalSupply", + "info": "Plain", + "lookupIndex": 0, + "type": "U256", + "namespace": "primitive_types::U256", + "lookupNameRoot": "PrimitiveTypesU256", + "typeName": "" + }, + { + "docs": [], + "name": "balances", + "info": "Null", + "lookupIndex": 3, + "type": "Null", + "namespace": "ink_storage::lazy::mapping::Mapping", + "typeName": "" + }, + { + "docs": [], + "name": "allowances", + "info": "Null", + "lookupIndex": 11, + "lookupName": "InkStorageLazyMapping", + "type": "Null", + "namespace": "ink_storage::lazy::mapping::Mapping", + "typeName": "" + } + ] + }, + { + "info": "Result", + "lookupIndex": 16, + "type": "Result", + "docs": [], + "namespace": "Result", + "sub": [ + { + "name": "Ok", + "info": "Null", + "lookupIndex": 10, + "type": "Null", + "docs": [], + "namespace": "" + }, + { + "name": "Error", + "docs": [], + "info": "Si", + "lookupIndex": 17, + "lookupName": "InkPrimitivesLangError", + "type": "Lookup17" + } + ] + }, + { + "info": "Enum", + "lookupIndex": 17, + "lookupName": "InkPrimitivesLangError", + "type": "{\"_enum\":[\"__Unused0\",\"CouldNotReadInput\"]}", + "docs": [], + "namespace": "ink_primitives::LangError", + "sub": [ + { + "index": 0, + "info": "Null", + "name": "__Unused0", + "type": "Null" + }, + { + "info": "Null", + "type": "Null", + "index": 1, + "name": "CouldNotReadInput" + } + ] + }, + { + "info": "Result", + "lookupIndex": 18, + "type": "Result", + "docs": [], + "namespace": "Result", + "sub": [ + { + "name": "Ok", + "info": "Plain", + "lookupIndex": 0, + "type": "U256", + "docs": [], + "namespace": "primitive_types::U256", + "lookupNameRoot": "PrimitiveTypesU256" + }, + { + "name": "Error", + "docs": [], + "info": "Si", + "lookupIndex": 17, + "lookupName": "InkPrimitivesLangError", + "type": "Lookup17" + } + ] + }, + { + "info": "Result", + "lookupIndex": 19, + "type": "Result, InkPrimitivesLangError>", + "docs": [], + "namespace": "Result", + "sub": [ + { + "name": "Ok", + "info": "Result", + "lookupIndex": 20, + "type": "Result", + "docs": [], + "namespace": "Result", + "sub": [ + { + "name": "Ok", + "info": "Null", + "lookupIndex": 10, + "type": "Null", + "docs": [], + "namespace": "" + }, + { + "name": "Error", + "docs": [], + "info": "Si", + "lookupIndex": 21, + "lookupName": "Erc20Error", + "type": "Lookup21" + } + ] + }, + { + "name": "Error", + "docs": [], + "info": "Si", + "lookupIndex": 17, + "lookupName": "InkPrimitivesLangError", + "type": "Lookup17" + } + ] + }, + { + "info": "Result", + "lookupIndex": 20, + "type": "Result", + "docs": [], + "namespace": "Result", + "sub": [ + { + "name": "Ok", + "info": "Null", + "lookupIndex": 10, + "type": "Null", + "docs": [], + "namespace": "" + }, + { + "name": "Error", + "docs": [], + "info": "Si", + "lookupIndex": 21, + "lookupName": "Erc20Error", + "type": "Lookup21" + } + ] + }, + { + "info": "Enum", + "lookupIndex": 21, + "lookupName": "Erc20Error", + "type": "{\"_enum\":[\"InsufficientBalance\",\"InsufficientAllowance\"]}", + "docs": [], + "namespace": "erc20::erc20::Error", + "sub": [ + { + "info": "Null", + "type": "Null", + "index": 0, + "name": "InsufficientBalance" + }, + { + "info": "Null", + "type": "Null", + "index": 1, + "name": "InsufficientAllowance" + } + ] + }, + { + "info": "Option", + "lookupIndex": 22, + "type": "Option", + "docs": [], + "namespace": "Option", + "sub": { + "info": "Plain", + "lookupIndex": 4, + "type": "H160", + "docs": [], + "namespace": "primitive_types::H160", + "lookupNameRoot": "PrimitiveTypesH160" + } + }, + { + "info": "Plain", + "lookupIndex": 23, + "type": "AccountId", + "docs": [], + "namespace": "ink_primitives::types::AccountId", + "lookupNameRoot": "InkPrimitivesAccountId" + }, + { + "info": "VecFixed", + "lookupIndex": 24, + "type": "[u8;32]", + "docs": [], + "namespace": "", + "length": 32, + "sub": { + "info": "Plain", + "lookupIndex": 6, + "type": "u8", + "docs": [], + "namespace": "" + } + }, + { + "info": "Plain", + "lookupIndex": 25, + "type": "u128", + "docs": [], + "namespace": "" + }, + { + "info": "Plain", + "lookupIndex": 26, + "type": "Hash", + "docs": [], + "namespace": "ink_primitives::types::Hash", + "lookupNameRoot": "InkPrimitivesHash" + }, + { + "info": "Plain", + "lookupIndex": 27, + "type": "u32", + "docs": [], + "namespace": "" + }, + { + "info": "Plain", + "lookupIndex": 28, + "type": "NoChainExtension", + "docs": [], + "namespace": "ink_primitives::types::NoChainExtension", + "lookupNameRoot": "InkPrimitivesNoChainExtension" + } +] \ No newline at end of file diff --git a/packages/api-contract/src/test/compare/ink_v6_erc20Metadata.test.json b/packages/api-contract/src/test/compare/ink_v6_erc20Metadata.test.json new file mode 100644 index 0000000000..99c0507aee --- /dev/null +++ b/packages/api-contract/src/test/compare/ink_v6_erc20Metadata.test.json @@ -0,0 +1,418 @@ +[ + { + "info": "Plain", + "lookupIndex": 0, + "type": "U256", + "docs": [], + "namespace": "primitive_types::U256", + "lookupNameRoot": "PrimitiveTypesU256" + }, + { + "info": "VecFixed", + "lookupIndex": 1, + "type": "[u64;4]", + "docs": [], + "namespace": "", + "length": 4, + "sub": { + "info": "Plain", + "lookupIndex": 2, + "type": "u64", + "docs": [], + "namespace": "" + } + }, + { + "info": "Plain", + "lookupIndex": 2, + "type": "u64", + "docs": [], + "namespace": "" + }, + { + "info": "Null", + "lookupIndex": 3, + "type": "Null", + "docs": [], + "namespace": "ink_storage::lazy::mapping::Mapping" + }, + { + "info": "Plain", + "lookupIndex": 4, + "type": "H160", + "docs": [], + "namespace": "primitive_types::H160", + "lookupNameRoot": "PrimitiveTypesH160" + }, + { + "info": "VecFixed", + "lookupIndex": 5, + "type": "[u8;20]", + "docs": [], + "namespace": "", + "length": 20, + "sub": { + "info": "Plain", + "lookupIndex": 6, + "type": "u8", + "docs": [], + "namespace": "" + } + }, + { + "info": "Plain", + "lookupIndex": 6, + "type": "u8", + "docs": [], + "namespace": "" + }, + { + "info": "Null", + "lookupIndex": 7, + "type": "Null", + "docs": [], + "namespace": "ink_storage_traits::impls::ResolverKey" + }, + { + "info": "Null", + "lookupIndex": 8, + "lookupName": "InkStorageTraitsImplsAutoKey", + "type": "Null", + "docs": [], + "namespace": "ink_storage_traits::impls::AutoKey" + }, + { + "info": "Null", + "lookupIndex": 9, + "lookupName": "InkStorageTraitsImplsManualKey", + "type": "Null", + "docs": [], + "namespace": "ink_storage_traits::impls::ManualKey" + }, + { + "info": "Null", + "lookupIndex": 10, + "type": "Null", + "docs": [], + "namespace": "" + }, + { + "info": "Null", + "lookupIndex": 11, + "lookupName": "InkStorageLazyMapping", + "type": "Null", + "docs": [], + "namespace": "ink_storage::lazy::mapping::Mapping" + }, + { + "info": "Tuple", + "lookupIndex": 12, + "type": "(H160,H160)", + "docs": [], + "namespace": "", + "sub": [ + { + "info": "Plain", + "lookupIndex": 4, + "type": "H160", + "docs": [], + "namespace": "primitive_types::H160", + "lookupNameRoot": "PrimitiveTypesH160" + }, + { + "info": "Plain", + "lookupIndex": 4, + "type": "H160", + "docs": [], + "namespace": "primitive_types::H160", + "lookupNameRoot": "PrimitiveTypesH160" + } + ] + }, + { + "info": "Null", + "lookupIndex": 13, + "lookupName": "InkStorageTraitsImplsResolverKey", + "type": "Null", + "docs": [], + "namespace": "ink_storage_traits::impls::ResolverKey" + }, + { + "info": "Null", + "lookupIndex": 14, + "lookupName": "InkStorageTraitsImplsManualKey", + "type": "Null", + "docs": [], + "namespace": "ink_storage_traits::impls::ManualKey" + }, + { + "info": "Struct", + "lookupIndex": 15, + "lookupName": "Erc20", + "type": "{\"totalSupply\":\"U256\",\"balances\":\"Null\",\"allowances\":\"InkStorageLazyMapping\"}", + "docs": [], + "namespace": "erc20::erc20::Erc20", + "sub": [ + { + "docs": [], + "name": "totalSupply", + "info": "Plain", + "lookupIndex": 0, + "type": "U256", + "namespace": "primitive_types::U256", + "lookupNameRoot": "PrimitiveTypesU256", + "typeName": "" + }, + { + "docs": [], + "name": "balances", + "info": "Null", + "lookupIndex": 3, + "type": "Null", + "namespace": "ink_storage::lazy::mapping::Mapping", + "typeName": "" + }, + { + "docs": [], + "name": "allowances", + "info": "Null", + "lookupIndex": 11, + "lookupName": "InkStorageLazyMapping", + "type": "Null", + "namespace": "ink_storage::lazy::mapping::Mapping", + "typeName": "" + } + ] + }, + { + "info": "Result", + "lookupIndex": 16, + "type": "Result", + "docs": [], + "namespace": "Result", + "sub": [ + { + "name": "Ok", + "info": "Null", + "lookupIndex": 10, + "type": "Null", + "docs": [], + "namespace": "" + }, + { + "name": "Error", + "docs": [], + "info": "Si", + "lookupIndex": 17, + "lookupName": "InkPrimitivesLangError", + "type": "Lookup17" + } + ] + }, + { + "info": "Enum", + "lookupIndex": 17, + "lookupName": "InkPrimitivesLangError", + "type": "{\"_enum\":[\"__Unused0\",\"CouldNotReadInput\"]}", + "docs": [], + "namespace": "ink_primitives::LangError", + "sub": [ + { + "index": 0, + "info": "Null", + "name": "__Unused0", + "type": "Null" + }, + { + "info": "Null", + "type": "Null", + "index": 1, + "name": "CouldNotReadInput" + } + ] + }, + { + "info": "Result", + "lookupIndex": 18, + "type": "Result", + "docs": [], + "namespace": "Result", + "sub": [ + { + "name": "Ok", + "info": "Plain", + "lookupIndex": 0, + "type": "U256", + "docs": [], + "namespace": "primitive_types::U256", + "lookupNameRoot": "PrimitiveTypesU256" + }, + { + "name": "Error", + "docs": [], + "info": "Si", + "lookupIndex": 17, + "lookupName": "InkPrimitivesLangError", + "type": "Lookup17" + } + ] + }, + { + "info": "Result", + "lookupIndex": 19, + "type": "Result, InkPrimitivesLangError>", + "docs": [], + "namespace": "Result", + "sub": [ + { + "name": "Ok", + "info": "Result", + "lookupIndex": 20, + "type": "Result", + "docs": [], + "namespace": "Result", + "sub": [ + { + "name": "Ok", + "info": "Null", + "lookupIndex": 10, + "type": "Null", + "docs": [], + "namespace": "" + }, + { + "name": "Error", + "docs": [], + "info": "Si", + "lookupIndex": 21, + "lookupName": "Erc20Error", + "type": "Lookup21" + } + ] + }, + { + "name": "Error", + "docs": [], + "info": "Si", + "lookupIndex": 17, + "lookupName": "InkPrimitivesLangError", + "type": "Lookup17" + } + ] + }, + { + "info": "Result", + "lookupIndex": 20, + "type": "Result", + "docs": [], + "namespace": "Result", + "sub": [ + { + "name": "Ok", + "info": "Null", + "lookupIndex": 10, + "type": "Null", + "docs": [], + "namespace": "" + }, + { + "name": "Error", + "docs": [], + "info": "Si", + "lookupIndex": 21, + "lookupName": "Erc20Error", + "type": "Lookup21" + } + ] + }, + { + "info": "Enum", + "lookupIndex": 21, + "lookupName": "Erc20Error", + "type": "{\"_enum\":[\"InsufficientBalance\",\"InsufficientAllowance\"]}", + "docs": [], + "namespace": "erc20::erc20::Error", + "sub": [ + { + "info": "Null", + "type": "Null", + "index": 0, + "name": "InsufficientBalance" + }, + { + "info": "Null", + "type": "Null", + "index": 1, + "name": "InsufficientAllowance" + } + ] + }, + { + "info": "Option", + "lookupIndex": 22, + "type": "Option", + "docs": [], + "namespace": "Option", + "sub": { + "info": "Plain", + "lookupIndex": 4, + "type": "H160", + "docs": [], + "namespace": "primitive_types::H160", + "lookupNameRoot": "PrimitiveTypesH160" + } + }, + { + "info": "Plain", + "lookupIndex": 23, + "type": "AccountId", + "docs": [], + "namespace": "ink_primitives::types::AccountId", + "lookupNameRoot": "InkPrimitivesAccountId" + }, + { + "info": "VecFixed", + "lookupIndex": 24, + "type": "[u8;32]", + "docs": [], + "namespace": "", + "length": 32, + "sub": { + "info": "Plain", + "lookupIndex": 6, + "type": "u8", + "docs": [], + "namespace": "" + } + }, + { + "info": "Plain", + "lookupIndex": 25, + "type": "u128", + "docs": [], + "namespace": "" + }, + { + "info": "Plain", + "lookupIndex": 26, + "type": "Hash", + "docs": [], + "namespace": "ink_primitives::types::Hash", + "lookupNameRoot": "InkPrimitivesHash" + }, + { + "info": "Plain", + "lookupIndex": 27, + "type": "u32", + "docs": [], + "namespace": "" + }, + { + "info": "Plain", + "lookupIndex": 28, + "type": "NoChainExtension", + "docs": [], + "namespace": "ink_primitives::types::NoChainExtension", + "lookupNameRoot": "InkPrimitivesNoChainExtension" + } +] \ No newline at end of file diff --git a/packages/api-contract/src/test/contracts/ink/index.ts b/packages/api-contract/src/test/contracts/ink/index.ts index 3ae97f89b6..5b4bb5f6ac 100644 --- a/packages/api-contract/src/test/contracts/ink/index.ts +++ b/packages/api-contract/src/test/contracts/ink/index.ts @@ -8,5 +8,6 @@ import * as v2 from './v2/index.js'; import * as v3 from './v3/index.js'; import * as v4 from './v4/index.js'; import * as v5 from './v5/index.js'; +import * as v6 from './v6/index.js'; -export default createVersionedExport({ v0, v1, v2, v3, v4, v5 }); +export default createVersionedExport({ v0, v1, v2, v3, v4, v5, v6 }); diff --git a/packages/api-contract/src/test/contracts/ink/v6/erc20.contract.json b/packages/api-contract/src/test/contracts/ink/v6/erc20.contract.json new file mode 100644 index 0000000000..70b01a2923 --- /dev/null +++ b/packages/api-contract/src/test/contracts/ink/v6/erc20.contract.json @@ -0,0 +1 @@ +{"source":{"hash":"0x15fa048bd28a4649ced787f88707e271f48ff04a966f525b28877c08c60ea014","language":"ink! 6.0.0-alpha","compiler":"rustc 1.86.0","contract_binary":"0x50564d0000e52400000000000001078098d01440a000028098c8000000f2000000e8000000ec000000ca000000f6000000b721a0ec63616c6ce7dc2326011ecb48b1e08876a3b5a17f9ce1350cbc5e4f264b3162dbc757be9de4b15f1e8301e4c2a1aef088c9f187a0e3f8016deaf4bdeb7954fb410c32bf8a6a033ecc3b5b00000d0000000100000002000000030000000400000005000000060000000700000008000000090000000a0000000b00000004808308000000000e00000014000000210000002c0000003b000000460000005100000063616c6c5f646174615f636f707963616c6c65726465706f7369745f6576656e746765745f73746f72616765686173685f626c616b65325f3235367365616c5f72657475726e7365745f73746f7261676576616c75655f7472616e736665727265640511028da40463616c6c975d066465706c6f7906a397809b029e8ad000f50006014e0173018401cb01e20119021e0232024b02800285029802b10221032d0365038b0319042c0464049304d60403050d053b05810592059c05ac05b605e805f205220653065e066906bd066007690777072f085c081b093909620987099809e909fd09160a2e0a880adc0afc0a470b650b9a0bf60b160c4c0c980ca30cb90cc60cd20c470d590d6d0d8d0dbb0dde0d710e890e9b0eaa0ebb0ecc0ef70e0f0f210f300f410f520f840fa611f9110a121c122b123c124c12661276129012b812e61248136f138713f6130714181429144e145a14681493149f14d1140c151a1528153515611564157415d015dc150a1611162916bd16cb16e116fb160b1755177317b717d117e117ef17cc18e418ee18121949196b198d19a819121a221a2c1af31a1c1b3d1b561bd31bec1b8b1cb31c9f1d9511e87b10107b15087b16531910688d7a84a207c8270b648c6475aeb7107cca785a95550195cc01acb5f6c82804c929028423f8844807c83b0a51085c9748038480388446f882658d88848c38956808aeab1b8286d00505cfc609d459097bb995bb089588086465acabebc834088429072805647a01c8a909ae9a107c8b78ab95aa01958801ac9af6821010821508821695111832006448aeabd382897bb995bb08958808acabf628c39511c87b10307b15287b16207b1833081400137b180849111000404911189518085010025504821518821710ac5740821608c85608c957077b18087b171049111895180882175010047e1a821718821810ac781b821a08501206441d0a068210308215288216209511383200009511b07b10487b15407b16387b1933091800017b19087b17107b181833071400137b17204911280040491130951708951820501008a103821530821728ac5740821620c85608c957077b18207b1728491130951820821750100a001a821730821828ac781b821a2050120cc61c0a068210488215408216389511503200009511a07b10587b15507b16486478827708828610ac6755aa67528285c967077b1708c8650546059517103309017b18645850100e06017b15308217087b17384911409517109518305010103207821740c86707ac671682187b87108210588215508216489511603200009511a07b10587b15507b1648827908827610ac6954501212431c5010140b19821920821718ac97418218109517105010169f0082177b17308217087b1738491140951710951830501018c906821740c86707ac67147b57108210588215508216489511603200009511a07b10587b15507b1648827908827610ac695350121adc1b50101ca418821920821718ac974082181095171050101e3882177b17308217087b17384911409517109518305010206306821740c86707ac67147b57108210588215508216489511603200009511b07b10487b15406475491118491110491108490153192138491138491130491128491120979920989a20951920648764a80a04821720821828821930821a387b177b18087b19107b1a1828096417501022e4fc64183309206457501024d8fc82104882154095115032009511f07b10087b15828a086475330920330701ac9a1d828995aae09597207b877b8a0895570864985010265c193307017b57821008821595111032009511a07b10587b15507b164864866475951720501028b1821720510708330701283c8217407b1718821738821830821928826a087b17107b18087b19330701520a1d3307821818821910821a08821b7b58207b59187b5a107b5b08017b578210588215508216489511603200951170ff7b1088007b1580007b1678828908330a146476aca9a20082879599ec957a147b8a7b89087c79117c7a107c7b127c7c1350122a621a7a19487c79017c7a7c7b027c7c0350122c4f1a7c7a057c7b047c7c067c750797aa08d4ba0a97cc10975518d45c0cd4ca0a97aa20d4a9097b19387c79097c7a087c7b0a7c7c0b50122e171a7c7a0d7c7b0c7c7c0e7c770f97aa08d4ba0a97cc10977718d4c707d4a707977720d497077b1740951750501030aafe82175051070a3307017b67283b8217708218688219607b17307b18287b1920821758821838821940811a487b17187b187b19087a1a1095670864183309385010322ffb49060182108800821580008216789511900032009511e87b10107b15087b16647582776486330034817728041682570864685010361c16825710646882101082150882169511182807169511e87b10107b15087b16648564763300383307e7dc232628cc1564676458821010821508821695111828da15951170ff7b1088007b1580007b1678647595763533071400137b17604911680040491170330925000195174895186050103a2d047c572051071095582195174850103cd9fc280a95174850103efefb7c67510710955836951748501040bffc280a951748501042e4fb7b16308217508216587b1728ac67d7008218487b18387b15209557207b1718c868077b170898650595176064585010445a0295176064585010468c028215708218687b16108467e09a767b15409755057b18c88505018218385106249587207b17383309206457501048e3f98217409577017b174095662095552028db821728821810c987078218087b18607b176849117095186082171850104a8f0495186082173050104c840495186082172050104e0a15821770821868ac782a821960821840978820988820977720987a2082170a028210880082158000821678951190003200009511c87b10307b15287b1620330514001333071400130a076417641664585010500416330705019577ff51071082689566085108f53307042806330705018210308215288216209511383200958a20957918330ce00164c3510c1b829b82a7f895a2f89599f8953c08642aaa7bebd87b092805648201d382078e77db390784770132009511d8827848018279087b1808827810827a187b19109517087b18187b1a209511d8827818827910827a0882777b18207b19187b1a107b17084801641733005c28f00264576468501054bc0382103082152882162095113832007c67257c68247c69267c6a27977708d4870797991097aa18d4a909d497077a17407c671d7c681c7c691e7c6a1f977708d4870797991097aa18d4a909d497077c68217c69207c6a227c6b23978808d4980897aa1097bb18d4ba0ad4a808978820d487077b17387c67157c68147c69167c6a17977708d4870797991097aa18d4a909d497077c68197c69187c6a1a7c6b1b978808d4980897aa1097bb18d4ba0ad4a808978820d487077b173095193064579518085010589a0382105882155082164895116032009511e87b10107b15087b166486978805570812647551060e648750105af11152070800330701017b567b570849151082101082150882169511183200827910827ac99a0aac8a053200648b330a20649864b9281a119511f87b158293829b08829a108284828c08ae3417d8bc0585b2ffc8c202d3cb0b88bc01c85c0c2809c9bc02d8bc0c01828510829b18c9a509d8a50a510c0dd8c905c9c909c85a0a01828518c93408c9b50c510a11d8b50bd8ac05c9ac0cd45b0a2806d8b50a017b787b72087b79107b7c18520a0a8215951108320000330920647a648764a828b4110033005e9511f87b101f03140013010133081400133307013309020a0500009511c87b10307b15287b16207b1733071400137b170849111000404911189518083307501060a711821518821710ac5740821608c85608c957077b18087b17104911189518088217501062ec11821718821810ac781b821a08501264b2140a068210308215288216209511383200009511987b10607b15587b16506486647551096e7b1510826708826510ac5787008268c95707c858087b187b18187b17087b172049112895181864975010662bff821928821720ac975d821818951718501068d4f882177b17388217087b174049114895171895183850106afefe821748c85707ac57307b67108215102809646750106c6cf782671082680882697b57107b58087b598210608215588216509511683200009511d87b10207b1518817833091400137b19330500407b150851080f1f031400130101330902281f9577081e0314001349111001641850106eeb10821910835501ac590400330814001333070a0500848bff003309021e03140013ab9b0a330833090128091e031500130101330a140013c89a0a78a89598013300709511f87b1097882098892033081400130a0500009511e87b10107b15087b167c7964855109229576013308016457501072bc0f64676458821010821508821695111828191064573308821010821508821695111828960f9511a87b10507b15486489647533071400137b171049111800404911209518106497501074def9821820821918ac8976821710c8870ac989097b1a7b19086419501076a41097772098772051170d19330803ab875133074915184915104915084905283682178218087b17387b1840951710951838501078dff7821710520726821730821828821920821a187b57187b58107b59087b5a018210508215489511583200009511907b10687b1560647533071800017b177b18087b191033071400137b17284911300040491138641795182850107af9f8821838821930ac8979821728c8870ac989097b1a187b192095191850107cf30f97772098772051170d19330803ab87523307491518491510491508490528378217188218207b17507b185895172895185050107e2df7821728520726821748821840821938821a307b57187b58107b59087b5a01821068821560951170320000951148ff7b10b0007b15a8007b16a00064957b180864769517106468502080008efe95171064585020820049fa510708330728e900951750951810645950208400dffb9518507b16646750208600eaf39517308218085020880054fe8219308257821a38825808c87906c8a808d8a80bae960d958801888901c89b0b01821a40825910c8a909d8a90a821708510b0fc89b0bd89b09c89a0a64b901821c48825b18c8cb0bd8cb0c510a10520c8300c8ba0ad8ba0c64ab01520c767b16507b18587b19607b1b68951850647650208a0069f346117001951771330914821850208c00adf2462185000195178600330914646850208e0099f28257825808825910825a187b17507b18587b19607b1a6895175050209000c6f7330702018210b0008215a8008216a0009511b8003200009511d0fd951700027b70287b75207b761850209200e5f88477ff0052170575073306d43f33051400133308004033071400133309330094000a01646c955504380a1400137b1500029567287b17080297a93098993897a82898883898a71884aaff00330b0b3305140013aaba0a03511a0f1d0295ab98510b3595ab96510b380195ab7cff510baa0095aa25ff520aecfa95999d5209e5fa95888b5208defa957758ff5207d6fa3306280404521912cdfa95889a5208c5fa957760ff5207bdfa95177801951800025020960075f5821778015207a7fa95188001951736330938502098007df195168600330938646795183650209a006bf19517d600330938646850209c005cf1951718019518d00033092750209e004bf19518a700951778013309175020a0003af133060428810395995fff520946fa9588a352083ffa95775fff520737fa95177801951800025020a200eff482177801520721fa951880019517363309385020a400f7f09516860033093864679518365020a600e5f09517d60033093864685020a800d6f0951718019518d0003309275020aa00c5f09518a700951778013309175020ac00b4f033060328fb025209c4f9521816c0f99577a25207b8f9340618001395c7147b17080295172b019558183309145020ae0082f07c57177c58167c591578172a01978808d49808791828017c57067c58057c59077c5a08977708d4870797991097aa18d4a909d497077c580a7c59097c5a0b7c5b0c978808d4980897aa1097bb18d4ba0ad4a808978820d487077b1718017c570e7c580d7c590f7c5a10977708d4870797991097aa18d4a909d497077c58127c59117c5a137c5b14978808d49808646997aa1097bb18d4ba0ad4a808978820d487077b17200133060228240295998b5209eaf89588a65208e3f89577aa5207dcf834072b001334082a0013340929001378172a01978808d498087918280134071a0013340819001334091b0013340a1c0013977708d4870797991097aa18d4a909d4970734081e001334091d0013340a1f0013340b200013978808d4980897aa1097bb18d4ba0ad4a808978820d487077b171801340722001334082100133409230013340a240013977708d4870797991097aa183408260013d4a909d497073409250013978808340a270013340b280013d49808340918001397aa1097bb18d4ba0ad4a808978820d487077b172001330601283b019599c7520901f89588915208faf7521718f6f7390728001338082400137a175001380720001397882038091c0013380a180013d487077b174801979920d4a9097b19400195572c380830001338092c00137b1700027b1c0802978820d49808380738001338093400137b18e00139083c0013977720d497077b17e8017a18f00195171801951800025020b00098f182171801510706286ff78217380182183001821928017b1710017b1808017b190001821720018218400182194801811a50017b17f8007b18d0007b19d8007a1ae0009517e4009518e0013309145020b2000dee95177e019518d0003309485020b400fced951636330948646795187e015020b600eaed9517860033094864685020b800dbed95171801951880003309275020ba00caed951857951778013309275020bc00baed33060501781630781931951732951818013309275020be00a0ed951759951878013309275020c00090ed7b157801492180010040492188019518780133075020c2007a088218880182198001ac899c0282177801c8870ac989097b1ae0017b19e8019519e0015020c4005209977720987720511703760252170d71028217e0018218e8017b17d0007b18d800951778019518d0005020c60058f08217780152074a02821798018218900182198801821a8001821bd8007b1798007b1890007b1988007b1a8000520b2202821798007b17580182179000821888009766023309000001c86909821a8000819b7b1750017b1848019519317b1a4001320b821758018218500182194801821a40017b1790017b1888017b1980017b1a78019517780128b1f3951838951740017b17d0009517d8003309385020cc007fec8217688218608219587b1798007b1890008217507b198800330514001333061400137b17800033071400130a0139072400133808180013951b00027ab71038071400139788203809200013380a1c0013d487077bb7979920d4a9097bb908951950951700029518d8005020ce0027ed9517a000951800023309145020d000ffeb9517b4003309149518d8005020d200eeeb95177801951880003309485020d400ddeb951598017b16e0014921e80100404921f0013309460001951760019518e0015020d60061f59517600164585020d800abed951760019518ac015020da009ded8217680182167001ac67c4007b1718821760017b1720c867077b17089865059517e00164585020dc00b0f39517e00164585020de00e0f38218208215f0018217e8017b15289755057b17c875057b16108467e09a765106299587207b172033092064575020e00035eb8217289577017b17289555209566208218205206dd821718821810c987078218087b18e0017b17e8014921f0019518e001951798015020e2001e069518e0019517ac015020e4001006951778019518e0015020e6004c068217f0018218e801ae78e3010095177801951840013300ea009511a07b10587b15507b1648649664757b18951708330928646833005628a2ea28a900951838951780013309385020ee0092ea95174001330514001333061400137b17780133071400130a01390724001338081800137a17900038071400139788203809200013380a1c0013d487077b178000979920d4a9097b1988009519980195178000951880015020f000acf68478ff00511802570128340195177801951840013300f4009511c87b10307b15287b1620649a64757b18951608330914646764a833005228f9e995177801280ff1951838951740017b177801951780013309485020f800dde981175c8018587a17d801801754978820801950801a4cd487077b17d001979920d4a9098217608218687b19c8018219707b17e0017b18e8018217787b19f00133061400137b17f80133071400130a0139072400133808180013951b00027ab7103807140013951580019788203809200013380a1c0013d487077bb7979920d4a9097bb9089517d0009519000264585020fa000df59517d0009518e0015020fc0021f033080152073f9518c8019519e00164575020fe009bf58478ff0052180228951780009518d0009519e001502000019df1951800029519800064575020020112ea2820330701288cf38219e001821828978820988820977720987a2082170a0201821758018218500182194801821a40017b1790017b1888017b1980017b1a78019517780150200401ebf133080233072842f3951130ff7b10c8007b15c0007b16b800502006012def8477ff00521705a4013306140013330514001333080040330714001333090a0139071400139555047b1550491158fc3f52479bae9d5e79f19517689518505020080187eb821768510706285ff195187095152e330920645750200a0135e89516063309206467645850200c0125e895176e330920646850200e0117e87e1788007e1886007e198a007e1a8c00977710d4870797992097aa30d4a909d497077b17407e1780007e187e7e1982007e1a8400977710d4870797992097aa30d4a909d497077b17387e17787e18767e197a7e1a7c977710d4870797992097aa30d4a909d497077b17307e17707e186e7e19727e1a74977710d4870797992097aa30d4a909d4970733051400137b172833071400130a01390724001338081800137a176038071400139788203809200013380a1c0013d487077b1750979920d4a9097b195833072000017b176895167033091464676458502010013ae77b1549110800404911103307e7dc2326641850201201260264186467502014013c02821610821708ac67278215c86508c967077b187b17084911109517286418502016016202821710821808ae780400821a976920989920977720987b20330764580a064621880046219d000195179e0095185033091450201801bde6821728821830821938821a407b17687b18707b19787b1a800095176850201a01e8eb821740821838821930821a287b1780007b18787b19707b1a6895176850201c01b3ef33001e019511f87b101f03140013330814001333090233070a0500009511c07b10387b15307b1628c88909ac898f006475827897870195abff330c04330608dbbc06e46909e47909d69a0752076fca9a075707697b1910510812caa808825a08491120019519182806951920017b988218205108288218185108227b187b1a0850202001455107356476821808821950202201e4e5821710280f502024012164768217105106167b56087b57821038821530821628951140320000510705280733070132003309000003340a0000036478510a0a3a07080003281f3307120003330a013b0a0000033e0708000333091000033b0a10000301c87808ac78233409100003330a120013939aac8a1b33090800033e08080003d8780894873200d878089487320000827910827a08aea912827ac89a0a78a89599017b79103200009511e87b10107b15087b166475827710c89706ac7624825a08ac6a1e825ac8a7075020260113e57b561082101082150882169511183200009511f07b1008648a7a170495180433090464a750202801b582100895111032009511d07b10287b15207b16186485647633071450202a0111ff5107304901147b17084911103308146419646750202c010f0182180882191064578210288215208216189511302862ff009511b07b10487b15407b163864854911184911104911084901641833090401827a788a98ab38788b0798ab30788b0698ab28788b0598ab20788b0498ab18788b0398ab10788b0298aa08788a019588089577089599ff5209c933072033062050202e017bfe5107307b16207b17284911306417330820c881095020300178821828821930645782104882154082163895115028ccfe009511e07b10187b15107b16086495829608647c829a7a1604978820988920951b04330764c80a0301801904ac962f837a33080c7b5908ae8a1484770f9777023308680001c8870781780164878210188215108216089511203200009511d87b10207b15187b161064958296108299c9690a64896478ac9a297b1908825708c86707502032017be3821708c876067b56108210208215188216109511283200330a0164577b186468649650203401fcfc8218646982561028c29511c07c89197c8a187c8b1a7c8c1b979908d4a90997bb1097cc18d4cb0bd49b027c8a1d7c8b1c7c8c1e7c891f97aa08d4ba0a97cc10979918d4c909d4a909979920d429097b19187c89117c8a107c8b127c8c13979908d4a90997bb1097cc18d4cb0bd49b027c8a157c8b147c8c167c891797aa08d4ba0a97cc10979918d4c909d4a909979920d429097b19107c89097c8a087c8b0a7c8c0b979908d4a90997bb1097cc18d4cb0bd49b027c8a0d7c8b0c7c8c0e7c890f97aa08d4ba0a97cc10979918d4c909d4a909979920d429097b19087c89017c8a7c8b027c8c0350223601dd007c8a057c8b047c8c067c880797aa08d4ba0a97cc10978818d4c808d4a808978820d498087b184911204911284911304911386418951220330304017c8b017c8c7c89027c8a0397bb08d4cb0b97991097aa18d4a909d4b9047c8a057c8b047c8c067c890797aa08d4ba0a97cc10979918d4c909d4a909979920d449097b299588089522089533ff5203b4821838821930821a28821b207b78187b79107b7a087b7b9511403200975920989920977720987b20330764683202647564878258c96909c868087b187b18107b19087b19184911209518103202979908d4a90997bb1097cc18d4cb0bd4b9093202498a924a254992244925294949496a52499252a92425492121094992244921494249d224292409094942922449524892509234494a92929454489224242949d2244912429224942449489224699224092149122549129224499aa424459224a992a424154a21494929494949a1a5942495485292244949494a9225491191a4282949129292902449922449929024499224494852499224494a5242231225a94a4921252549aa04a9a4242252424242129224945092504292449224490a2924494999242924494a9224494842129224495211892649085521939294495292a52429a9292995244992242549251592a4244992244992244992244992244992244992244992a48424294925a5905992945252a9a4929224494a2649924c9224294b92d25499140849274921212924499224852409254993a492244a4a92149224a124494292a4425252923449a1480229210a49861a092905434a52123a4995a45049492525492a24248524494a2189a424559224244992a4499aa45012125242922449421249492a4992902449922669444429052948490a524112a42449924c92244993249134499282480a42a4a02449922023221a91248810214271099148924442842411119148449490888808222209222588144424884890442422228288488248092205110922122411122111499024924892244992244992249224499224494a922492442211428824420821499210424892248910424892908484909024492489440821424248249110229210222411114124111111111111111109221224451029884890489049224122410411051111494404490811111141444444444444444442a288441111111191444482241189102214422424849424114144824804110922820811411444041191489228888244242529490a922449924444441011440411312292a44a4a924810214428840809219144440411121149522595441211099248924492442212214221444224849424a2202248220a2222228828288924498d8888888820252222881042840e4908488224490a920a9282888824491289489224499224499224499290500809092149129254504850504192929214245992541122099224492448924892205208a993245149922449922452962425a414a4509292a4298550422121843009a184904a4d524a9aa492242548529a94a490942495204952415292649294a4b292244992244992244892929094249924a592a49a9424096949d22429a59224489224a52aa89424499224499224499224499224499224499224499224499224494a822449922429494aa62449922449922429499224492949aa2a29495292240100","build_info":{"build_mode":"Release","cargo_contract_version":"6.0.0-alpha.1","rust_toolchain":"stable-aarch64-apple-darwin"}},"contract":{"name":"erc20","version":"6.0.0-alpha","authors":["Use Ink "]},"image":null,"spec":{"constructors":[{"args":[{"label":"total_supply","type":{"displayName":["U256"],"type":0}}],"default":false,"docs":["Creates a new ERC-20 contract with the specified initial supply."],"label":"new","payable":false,"returnType":{"displayName":["ink_primitives","ConstructorResult"],"type":16},"selector":"0x9bae9d5e"}],"docs":[],"environment":{"accountId":{"displayName":["AccountId"],"type":23},"balance":{"displayName":["Balance"],"type":25},"blockNumber":{"displayName":["BlockNumber"],"type":27},"chainExtension":{"displayName":["ChainExtension"],"type":28},"hash":{"displayName":["Hash"],"type":26},"maxEventTopics":4,"staticBufferSize":16384,"timestamp":{"displayName":["Timestamp"],"type":2}},"events":[{"args":[{"docs":[],"indexed":true,"label":"from","type":{"displayName":["Option"],"type":22}},{"docs":[],"indexed":true,"label":"to","type":{"displayName":["Option"],"type":22}},{"docs":[],"indexed":false,"label":"value","type":{"displayName":["U256"],"type":0}}],"docs":["Event emitted when a token transfer occurs."],"label":"Transfer","module_path":"erc20::erc20","signature_topic":"0x1ecb48b1e08876a3b5a17f9ce1350cbc5e4f264b3162dbc757be9de4b15f1e83"},{"args":[{"docs":[],"indexed":true,"label":"owner","type":{"displayName":["H160"],"type":4}},{"docs":[],"indexed":true,"label":"spender","type":{"displayName":["H160"],"type":4}},{"docs":[],"indexed":false,"label":"value","type":{"displayName":["U256"],"type":0}}],"docs":["Event emitted when an approval occurs that `spender` is allowed to withdraw","up to the amount of `value` tokens from `owner`."],"label":"Approval","module_path":"erc20::erc20","signature_topic":"0xe4c2a1aef088c9f187a0e3f8016deaf4bdeb7954fb410c32bf8a6a033ecc3b5b"}],"lang_error":{"displayName":["ink","LangError"],"type":17},"messages":[{"args":[],"default":false,"docs":[" Returns the total token supply."],"label":"total_supply","mutates":false,"payable":false,"returnType":{"displayName":["ink","MessageResult"],"type":18},"selector":"0xdb6375a8"},{"args":[{"label":"owner","type":{"displayName":["H160"],"type":4}}],"default":false,"docs":[" Returns the account balance for the specified `owner`.",""," Returns `0` if the account is non-existent."],"label":"balance_of","mutates":false,"payable":false,"returnType":{"displayName":["ink","MessageResult"],"type":18},"selector":"0x0f755a56"},{"args":[{"label":"owner","type":{"displayName":["H160"],"type":4}},{"label":"spender","type":{"displayName":["H160"],"type":4}}],"default":false,"docs":[" Returns the amount which `spender` is still allowed to withdraw from `owner`.",""," Returns `0` if no allowance has been set."],"label":"allowance","mutates":false,"payable":false,"returnType":{"displayName":["ink","MessageResult"],"type":18},"selector":"0x6a00165e"},{"args":[{"label":"to","type":{"displayName":["H160"],"type":4}},{"label":"value","type":{"displayName":["U256"],"type":0}}],"default":false,"docs":[" Transfers `value` amount of tokens from the caller's account to account `to`.",""," On success a `Transfer` event is emitted.",""," # Errors",""," Returns `InsufficientBalance` error if there are not enough tokens on"," the caller's account balance."],"label":"transfer","mutates":true,"payable":false,"returnType":{"displayName":["ink","MessageResult"],"type":19},"selector":"0x84a15da1"},{"args":[{"label":"spender","type":{"displayName":["H160"],"type":4}},{"label":"value","type":{"displayName":["U256"],"type":0}}],"default":false,"docs":[" Allows `spender` to withdraw from the caller's account multiple times, up to"," the `value` amount.",""," If this function is called again it overwrites the current allowance with"," `value`.",""," An `Approval` event is emitted."],"label":"approve","mutates":true,"payable":false,"returnType":{"displayName":["ink","MessageResult"],"type":19},"selector":"0x681266a0"},{"args":[{"label":"from","type":{"displayName":["H160"],"type":4}},{"label":"to","type":{"displayName":["H160"],"type":4}},{"label":"value","type":{"displayName":["U256"],"type":0}}],"default":false,"docs":[" Transfers `value` tokens on the behalf of `from` to the account `to`.",""," This can be used to allow a contract to transfer tokens on ones behalf and/or"," to charge fees in sub-currencies, for example.",""," On success a `Transfer` event is emitted.",""," # Errors",""," Returns `InsufficientAllowance` error if there are not enough tokens allowed"," for the caller to withdraw from `from`.",""," Returns `InsufficientBalance` error if there are not enough tokens on"," the account balance of `from`."],"label":"transfer_from","mutates":true,"payable":false,"returnType":{"displayName":["ink","MessageResult"],"type":19},"selector":"0x0b396f18"}]},"storage":{"root":{"layout":{"struct":{"fields":[{"layout":{"leaf":{"key":"0x00000000","ty":0}},"name":"total_supply"},{"layout":{"root":{"layout":{"leaf":{"key":"0xe7dc2326","ty":0}},"root_key":"0xe7dc2326","ty":3}},"name":"balances"},{"layout":{"root":{"layout":{"leaf":{"key":"0xb721a0ec","ty":0}},"root_key":"0xb721a0ec","ty":11}},"name":"allowances"}],"name":"Erc20"}},"root_key":"0x00000000","ty":15}},"types":[{"id":0,"type":{"def":{"composite":{"fields":[{"type":1,"typeName":"[u64; 4]"}]}},"path":["primitive_types","U256"]}},{"id":1,"type":{"def":{"array":{"len":4,"type":2}}}},{"id":2,"type":{"def":{"primitive":"u64"}}},{"id":3,"type":{"def":{"composite":{}},"params":[{"name":"K","type":4},{"name":"V","type":0},{"name":"KeyType","type":7}],"path":["ink_storage","lazy","mapping","Mapping"]}},{"id":4,"type":{"def":{"composite":{"fields":[{"type":5,"typeName":"[u8; 20]"}]}},"path":["primitive_types","H160"]}},{"id":5,"type":{"def":{"array":{"len":20,"type":6}}}},{"id":6,"type":{"def":{"primitive":"u8"}}},{"id":7,"type":{"def":{"composite":{}},"params":[{"name":"L","type":8},{"name":"R","type":9}],"path":["ink_storage_traits","impls","ResolverKey"]}},{"id":8,"type":{"def":{"composite":{}},"path":["ink_storage_traits","impls","AutoKey"]}},{"id":9,"type":{"def":{"composite":{}},"params":[{"name":"ParentKey","type":10}],"path":["ink_storage_traits","impls","ManualKey"]}},{"id":10,"type":{"def":{"tuple":[]}}},{"id":11,"type":{"def":{"composite":{}},"params":[{"name":"K","type":12},{"name":"V","type":0},{"name":"KeyType","type":13}],"path":["ink_storage","lazy","mapping","Mapping"]}},{"id":12,"type":{"def":{"tuple":[4,4]}}},{"id":13,"type":{"def":{"composite":{}},"params":[{"name":"L","type":8},{"name":"R","type":14}],"path":["ink_storage_traits","impls","ResolverKey"]}},{"id":14,"type":{"def":{"composite":{}},"params":[{"name":"ParentKey","type":10}],"path":["ink_storage_traits","impls","ManualKey"]}},{"id":15,"type":{"def":{"composite":{"fields":[{"name":"total_supply","type":0,"typeName":",>>::Type"},{"name":"balances","type":3,"typeName":" as::ink::storage::traits::AutoStorableHint<\n::ink::storage::traits::ManualKey<639884519u32, ()>,>>::Type"},{"name":"allowances","type":11,"typeName":" as::ink::storage::traits::\nAutoStorableHint<::ink::storage::traits::ManualKey<3969917367u32,\n()>,>>::Type"}]}},"path":["erc20","erc20","Erc20"]}},{"id":16,"type":{"def":{"variant":{"variants":[{"fields":[{"type":10}],"index":0,"name":"Ok"},{"fields":[{"type":17}],"index":1,"name":"Err"}]}},"params":[{"name":"T","type":10},{"name":"E","type":17}],"path":["Result"]}},{"id":17,"type":{"def":{"variant":{"variants":[{"index":1,"name":"CouldNotReadInput"}]}},"path":["ink_primitives","LangError"]}},{"id":18,"type":{"def":{"variant":{"variants":[{"fields":[{"type":0}],"index":0,"name":"Ok"},{"fields":[{"type":17}],"index":1,"name":"Err"}]}},"params":[{"name":"T","type":0},{"name":"E","type":17}],"path":["Result"]}},{"id":19,"type":{"def":{"variant":{"variants":[{"fields":[{"type":20}],"index":0,"name":"Ok"},{"fields":[{"type":17}],"index":1,"name":"Err"}]}},"params":[{"name":"T","type":20},{"name":"E","type":17}],"path":["Result"]}},{"id":20,"type":{"def":{"variant":{"variants":[{"fields":[{"type":10}],"index":0,"name":"Ok"},{"fields":[{"type":21}],"index":1,"name":"Err"}]}},"params":[{"name":"T","type":10},{"name":"E","type":21}],"path":["Result"]}},{"id":21,"type":{"def":{"variant":{"variants":[{"index":0,"name":"InsufficientBalance"},{"index":1,"name":"InsufficientAllowance"}]}},"path":["erc20","erc20","Error"]}},{"id":22,"type":{"def":{"variant":{"variants":[{"index":0,"name":"None"},{"fields":[{"type":4}],"index":1,"name":"Some"}]}},"params":[{"name":"T","type":4}],"path":["Option"]}},{"id":23,"type":{"def":{"composite":{"fields":[{"type":24,"typeName":"[u8; 32]"}]}},"path":["ink_primitives","types","AccountId"]}},{"id":24,"type":{"def":{"array":{"len":32,"type":6}}}},{"id":25,"type":{"def":{"primitive":"u128"}}},{"id":26,"type":{"def":{"composite":{"fields":[{"type":24,"typeName":"[u8; 32]"}]}},"path":["ink_primitives","types","Hash"]}},{"id":27,"type":{"def":{"primitive":"u32"}}},{"id":28,"type":{"def":{"variant":{}},"path":["ink_primitives","types","NoChainExtension"]}}],"version":6} \ No newline at end of file diff --git a/packages/api-contract/src/test/contracts/ink/v6/erc20.json b/packages/api-contract/src/test/contracts/ink/v6/erc20.json new file mode 100644 index 0000000000..28fca165b5 --- /dev/null +++ b/packages/api-contract/src/test/contracts/ink/v6/erc20.json @@ -0,0 +1,1081 @@ +{ + "source": { + "hash": "0x15fa048bd28a4649ced787f88707e271f48ff04a966f525b28877c08c60ea014", + "language": "ink! 6.0.0-alpha", + "compiler": "rustc 1.86.0", + "build_info": { + "build_mode": "Release", + "cargo_contract_version": "6.0.0-alpha.1", + "rust_toolchain": "stable-aarch64-apple-darwin" + } + }, + "contract": { + "name": "erc20", + "version": "6.0.0-alpha", + "authors": [ + "Use Ink " + ] + }, + "image": null, + "spec": { + "constructors": [ + { + "args": [ + { + "label": "total_supply", + "type": { + "displayName": [ + "U256" + ], + "type": 0 + } + } + ], + "default": false, + "docs": [ + "Creates a new ERC-20 contract with the specified initial supply." + ], + "label": "new", + "payable": false, + "returnType": { + "displayName": [ + "ink_primitives", + "ConstructorResult" + ], + "type": 16 + }, + "selector": "0x9bae9d5e" + } + ], + "docs": [], + "environment": { + "accountId": { + "displayName": [ + "AccountId" + ], + "type": 23 + }, + "balance": { + "displayName": [ + "Balance" + ], + "type": 25 + }, + "blockNumber": { + "displayName": [ + "BlockNumber" + ], + "type": 27 + }, + "chainExtension": { + "displayName": [ + "ChainExtension" + ], + "type": 28 + }, + "hash": { + "displayName": [ + "Hash" + ], + "type": 26 + }, + "maxEventTopics": 4, + "staticBufferSize": 16384, + "timestamp": { + "displayName": [ + "Timestamp" + ], + "type": 2 + } + }, + "events": [ + { + "args": [ + { + "docs": [], + "indexed": true, + "label": "from", + "type": { + "displayName": [ + "Option" + ], + "type": 22 + } + }, + { + "docs": [], + "indexed": true, + "label": "to", + "type": { + "displayName": [ + "Option" + ], + "type": 22 + } + }, + { + "docs": [], + "indexed": false, + "label": "value", + "type": { + "displayName": [ + "U256" + ], + "type": 0 + } + } + ], + "docs": [ + "Event emitted when a token transfer occurs." + ], + "label": "Transfer", + "module_path": "erc20::erc20", + "signature_topic": "0x1ecb48b1e08876a3b5a17f9ce1350cbc5e4f264b3162dbc757be9de4b15f1e83" + }, + { + "args": [ + { + "docs": [], + "indexed": true, + "label": "owner", + "type": { + "displayName": [ + "H160" + ], + "type": 4 + } + }, + { + "docs": [], + "indexed": true, + "label": "spender", + "type": { + "displayName": [ + "H160" + ], + "type": 4 + } + }, + { + "docs": [], + "indexed": false, + "label": "value", + "type": { + "displayName": [ + "U256" + ], + "type": 0 + } + } + ], + "docs": [ + "Event emitted when an approval occurs that `spender` is allowed to withdraw", + "up to the amount of `value` tokens from `owner`." + ], + "label": "Approval", + "module_path": "erc20::erc20", + "signature_topic": "0xe4c2a1aef088c9f187a0e3f8016deaf4bdeb7954fb410c32bf8a6a033ecc3b5b" + } + ], + "lang_error": { + "displayName": [ + "ink", + "LangError" + ], + "type": 17 + }, + "messages": [ + { + "args": [], + "default": false, + "docs": [ + " Returns the total token supply." + ], + "label": "total_supply", + "mutates": false, + "payable": false, + "returnType": { + "displayName": [ + "ink", + "MessageResult" + ], + "type": 18 + }, + "selector": "0xdb6375a8" + }, + { + "args": [ + { + "label": "owner", + "type": { + "displayName": [ + "H160" + ], + "type": 4 + } + } + ], + "default": false, + "docs": [ + " Returns the account balance for the specified `owner`.", + "", + " Returns `0` if the account is non-existent." + ], + "label": "balance_of", + "mutates": false, + "payable": false, + "returnType": { + "displayName": [ + "ink", + "MessageResult" + ], + "type": 18 + }, + "selector": "0x0f755a56" + }, + { + "args": [ + { + "label": "owner", + "type": { + "displayName": [ + "H160" + ], + "type": 4 + } + }, + { + "label": "spender", + "type": { + "displayName": [ + "H160" + ], + "type": 4 + } + } + ], + "default": false, + "docs": [ + " Returns the amount which `spender` is still allowed to withdraw from `owner`.", + "", + " Returns `0` if no allowance has been set." + ], + "label": "allowance", + "mutates": false, + "payable": false, + "returnType": { + "displayName": [ + "ink", + "MessageResult" + ], + "type": 18 + }, + "selector": "0x6a00165e" + }, + { + "args": [ + { + "label": "to", + "type": { + "displayName": [ + "H160" + ], + "type": 4 + } + }, + { + "label": "value", + "type": { + "displayName": [ + "U256" + ], + "type": 0 + } + } + ], + "default": false, + "docs": [ + " Transfers `value` amount of tokens from the caller's account to account `to`.", + "", + " On success a `Transfer` event is emitted.", + "", + " # Errors", + "", + " Returns `InsufficientBalance` error if there are not enough tokens on", + " the caller's account balance." + ], + "label": "transfer", + "mutates": true, + "payable": false, + "returnType": { + "displayName": [ + "ink", + "MessageResult" + ], + "type": 19 + }, + "selector": "0x84a15da1" + }, + { + "args": [ + { + "label": "spender", + "type": { + "displayName": [ + "H160" + ], + "type": 4 + } + }, + { + "label": "value", + "type": { + "displayName": [ + "U256" + ], + "type": 0 + } + } + ], + "default": false, + "docs": [ + " Allows `spender` to withdraw from the caller's account multiple times, up to", + " the `value` amount.", + "", + " If this function is called again it overwrites the current allowance with", + " `value`.", + "", + " An `Approval` event is emitted." + ], + "label": "approve", + "mutates": true, + "payable": false, + "returnType": { + "displayName": [ + "ink", + "MessageResult" + ], + "type": 19 + }, + "selector": "0x681266a0" + }, + { + "args": [ + { + "label": "from", + "type": { + "displayName": [ + "H160" + ], + "type": 4 + } + }, + { + "label": "to", + "type": { + "displayName": [ + "H160" + ], + "type": 4 + } + }, + { + "label": "value", + "type": { + "displayName": [ + "U256" + ], + "type": 0 + } + } + ], + "default": false, + "docs": [ + " Transfers `value` tokens on the behalf of `from` to the account `to`.", + "", + " This can be used to allow a contract to transfer tokens on ones behalf and/or", + " to charge fees in sub-currencies, for example.", + "", + " On success a `Transfer` event is emitted.", + "", + " # Errors", + "", + " Returns `InsufficientAllowance` error if there are not enough tokens allowed", + " for the caller to withdraw from `from`.", + "", + " Returns `InsufficientBalance` error if there are not enough tokens on", + " the account balance of `from`." + ], + "label": "transfer_from", + "mutates": true, + "payable": false, + "returnType": { + "displayName": [ + "ink", + "MessageResult" + ], + "type": 19 + }, + "selector": "0x0b396f18" + } + ] + }, + "storage": { + "root": { + "layout": { + "struct": { + "fields": [ + { + "layout": { + "leaf": { + "key": "0x00000000", + "ty": 0 + } + }, + "name": "total_supply" + }, + { + "layout": { + "root": { + "layout": { + "leaf": { + "key": "0xe7dc2326", + "ty": 0 + } + }, + "root_key": "0xe7dc2326", + "ty": 3 + } + }, + "name": "balances" + }, + { + "layout": { + "root": { + "layout": { + "leaf": { + "key": "0xb721a0ec", + "ty": 0 + } + }, + "root_key": "0xb721a0ec", + "ty": 11 + } + }, + "name": "allowances" + } + ], + "name": "Erc20" + } + }, + "root_key": "0x00000000", + "ty": 15 + } + }, + "types": [ + { + "id": 0, + "type": { + "def": { + "composite": { + "fields": [ + { + "type": 1, + "typeName": "[u64; 4]" + } + ] + } + }, + "path": [ + "primitive_types", + "U256" + ] + } + }, + { + "id": 1, + "type": { + "def": { + "array": { + "len": 4, + "type": 2 + } + } + } + }, + { + "id": 2, + "type": { + "def": { + "primitive": "u64" + } + } + }, + { + "id": 3, + "type": { + "def": { + "composite": {} + }, + "params": [ + { + "name": "K", + "type": 4 + }, + { + "name": "V", + "type": 0 + }, + { + "name": "KeyType", + "type": 7 + } + ], + "path": [ + "ink_storage", + "lazy", + "mapping", + "Mapping" + ] + } + }, + { + "id": 4, + "type": { + "def": { + "composite": { + "fields": [ + { + "type": 5, + "typeName": "[u8; 20]" + } + ] + } + }, + "path": [ + "primitive_types", + "H160" + ] + } + }, + { + "id": 5, + "type": { + "def": { + "array": { + "len": 20, + "type": 6 + } + } + } + }, + { + "id": 6, + "type": { + "def": { + "primitive": "u8" + } + } + }, + { + "id": 7, + "type": { + "def": { + "composite": {} + }, + "params": [ + { + "name": "L", + "type": 8 + }, + { + "name": "R", + "type": 9 + } + ], + "path": [ + "ink_storage_traits", + "impls", + "ResolverKey" + ] + } + }, + { + "id": 8, + "type": { + "def": { + "composite": {} + }, + "path": [ + "ink_storage_traits", + "impls", + "AutoKey" + ] + } + }, + { + "id": 9, + "type": { + "def": { + "composite": {} + }, + "params": [ + { + "name": "ParentKey", + "type": 10 + } + ], + "path": [ + "ink_storage_traits", + "impls", + "ManualKey" + ] + } + }, + { + "id": 10, + "type": { + "def": { + "tuple": [] + } + } + }, + { + "id": 11, + "type": { + "def": { + "composite": {} + }, + "params": [ + { + "name": "K", + "type": 12 + }, + { + "name": "V", + "type": 0 + }, + { + "name": "KeyType", + "type": 13 + } + ], + "path": [ + "ink_storage", + "lazy", + "mapping", + "Mapping" + ] + } + }, + { + "id": 12, + "type": { + "def": { + "tuple": [ + 4, + 4 + ] + } + } + }, + { + "id": 13, + "type": { + "def": { + "composite": {} + }, + "params": [ + { + "name": "L", + "type": 8 + }, + { + "name": "R", + "type": 14 + } + ], + "path": [ + "ink_storage_traits", + "impls", + "ResolverKey" + ] + } + }, + { + "id": 14, + "type": { + "def": { + "composite": {} + }, + "params": [ + { + "name": "ParentKey", + "type": 10 + } + ], + "path": [ + "ink_storage_traits", + "impls", + "ManualKey" + ] + } + }, + { + "id": 15, + "type": { + "def": { + "composite": { + "fields": [ + { + "name": "total_supply", + "type": 0, + "typeName": ",>>::Type" + }, + { + "name": "balances", + "type": 3, + "typeName": " as::ink::storage::traits::AutoStorableHint<\n::ink::storage::traits::ManualKey<639884519u32, ()>,>>::Type" + }, + { + "name": "allowances", + "type": 11, + "typeName": " as::ink::storage::traits::\nAutoStorableHint<::ink::storage::traits::ManualKey<3969917367u32,\n()>,>>::Type" + } + ] + } + }, + "path": [ + "erc20", + "erc20", + "Erc20" + ] + } + }, + { + "id": 16, + "type": { + "def": { + "variant": { + "variants": [ + { + "fields": [ + { + "type": 10 + } + ], + "index": 0, + "name": "Ok" + }, + { + "fields": [ + { + "type": 17 + } + ], + "index": 1, + "name": "Err" + } + ] + } + }, + "params": [ + { + "name": "T", + "type": 10 + }, + { + "name": "E", + "type": 17 + } + ], + "path": [ + "Result" + ] + } + }, + { + "id": 17, + "type": { + "def": { + "variant": { + "variants": [ + { + "index": 1, + "name": "CouldNotReadInput" + } + ] + } + }, + "path": [ + "ink_primitives", + "LangError" + ] + } + }, + { + "id": 18, + "type": { + "def": { + "variant": { + "variants": [ + { + "fields": [ + { + "type": 0 + } + ], + "index": 0, + "name": "Ok" + }, + { + "fields": [ + { + "type": 17 + } + ], + "index": 1, + "name": "Err" + } + ] + } + }, + "params": [ + { + "name": "T", + "type": 0 + }, + { + "name": "E", + "type": 17 + } + ], + "path": [ + "Result" + ] + } + }, + { + "id": 19, + "type": { + "def": { + "variant": { + "variants": [ + { + "fields": [ + { + "type": 20 + } + ], + "index": 0, + "name": "Ok" + }, + { + "fields": [ + { + "type": 17 + } + ], + "index": 1, + "name": "Err" + } + ] + } + }, + "params": [ + { + "name": "T", + "type": 20 + }, + { + "name": "E", + "type": 17 + } + ], + "path": [ + "Result" + ] + } + }, + { + "id": 20, + "type": { + "def": { + "variant": { + "variants": [ + { + "fields": [ + { + "type": 10 + } + ], + "index": 0, + "name": "Ok" + }, + { + "fields": [ + { + "type": 21 + } + ], + "index": 1, + "name": "Err" + } + ] + } + }, + "params": [ + { + "name": "T", + "type": 10 + }, + { + "name": "E", + "type": 21 + } + ], + "path": [ + "Result" + ] + } + }, + { + "id": 21, + "type": { + "def": { + "variant": { + "variants": [ + { + "index": 0, + "name": "InsufficientBalance" + }, + { + "index": 1, + "name": "InsufficientAllowance" + } + ] + } + }, + "path": [ + "erc20", + "erc20", + "Error" + ] + } + }, + { + "id": 22, + "type": { + "def": { + "variant": { + "variants": [ + { + "index": 0, + "name": "None" + }, + { + "fields": [ + { + "type": 4 + } + ], + "index": 1, + "name": "Some" + } + ] + } + }, + "params": [ + { + "name": "T", + "type": 4 + } + ], + "path": [ + "Option" + ] + } + }, + { + "id": 23, + "type": { + "def": { + "composite": { + "fields": [ + { + "type": 24, + "typeName": "[u8; 32]" + } + ] + } + }, + "path": [ + "ink_primitives", + "types", + "AccountId" + ] + } + }, + { + "id": 24, + "type": { + "def": { + "array": { + "len": 32, + "type": 6 + } + } + } + }, + { + "id": 25, + "type": { + "def": { + "primitive": "u128" + } + } + }, + { + "id": 26, + "type": { + "def": { + "composite": { + "fields": [ + { + "type": 24, + "typeName": "[u8; 32]" + } + ] + } + }, + "path": [ + "ink_primitives", + "types", + "Hash" + ] + } + }, + { + "id": 27, + "type": { + "def": { + "primitive": "u32" + } + } + }, + { + "id": 28, + "type": { + "def": { + "variant": {} + }, + "path": [ + "ink_primitives", + "types", + "NoChainExtension" + ] + } + } + ], + "version": 6 +} \ No newline at end of file diff --git a/packages/api-contract/src/test/contracts/ink/v6/erc20.polkavm b/packages/api-contract/src/test/contracts/ink/v6/erc20.polkavm new file mode 100644 index 0000000000000000000000000000000000000000..64886b65146198d57f144142ffad192cda8f7509 GIT binary patch literal 9445 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', environment: 'ContractEnvironmentV4' }, + ContractContractSpecV6: { + constructors: 'Vec', + messages: 'Vec', + events: 'Vec', + docs: 'Vec', + environment: 'ContractEnvironmentV4' + }, ContractDisplayName: 'SiPath', ContractEventParamSpecV0: { @@ -221,7 +228,7 @@ const latest = { ContractEventParamSpecLatest: 'ContractEventParamSpecV2', ContractMessageParamSpecLatest: 'ContractMessageParamSpecV2', ContractMessageSpecLatest: 'ContractMessageSpecV3', - ContractMetadataLatest: 'ContractMetadataV5' + ContractMetadataLatest: 'ContractMetadataV6' }; export default { @@ -234,6 +241,10 @@ export default { source: 'ContractProjectSource', contract: 'ContractProjectContract' }, + ContractReviveProjectInfo: { + source: 'ContractReviveProjectSource', + contract: 'ContractProjectContract' + }, ContractMetadataV0: { metadataVersion: 'Text', types: 'Vec', @@ -261,6 +272,11 @@ export default { spec: 'ContractContractSpecV5', version: 'u64' }, + ContractMetadataV6: { + types: 'Vec', + spec: 'ContractContractSpecV6', + version: 'u64' + }, ContractMetadata: { _enum: { V0: 'ContractMetadataV0', @@ -268,7 +284,8 @@ export default { V2: 'ContractMetadataV2', V3: 'ContractMetadataV3', V4: 'ContractMetadataV4', - V5: 'ContractMetadataV5' + V5: 'ContractMetadataV5', + V6: 'ContractMetadataV6' } }, ContractProjectV0: { @@ -301,6 +318,16 @@ export default { compiler: 'Text', wasm: 'Raw' }, + ContractReviveProjectSource: { + _alias: { + wasmHash: 'hash', + wasm: 'contract_binary' + }, + wasmHash: '[u8; 32]', + language: 'Text', + compiler: 'Text', + wasm: 'Raw' + }, ContractEnvironmentV4: { _alias: { hashType: 'hash' diff --git a/packages/types/src/interfaces/contractsAbi/types.ts b/packages/types/src/interfaces/contractsAbi/types.ts index 935edb9c8d..d4e480c082 100644 --- a/packages/types/src/interfaces/contractsAbi/types.ts +++ b/packages/types/src/interfaces/contractsAbi/types.ts @@ -103,6 +103,15 @@ export interface ContractContractSpecV5 extends Struct { readonly environment: ContractEnvironmentV4; } +/** @name ContractContractSpecV6 */ +export interface ContractContractSpecV6 extends Struct { + readonly constructors: Vec; + readonly messages: Vec; + readonly events: Vec; + readonly docs: Vec; + readonly environment: ContractEnvironmentV4; +} + /** @name ContractCryptoHasher */ export interface ContractCryptoHasher extends Enum { readonly isBlake2x256: boolean; @@ -304,11 +313,13 @@ export interface ContractMetadata extends Enum { readonly asV4: ContractMetadataV4; readonly isV5: boolean; readonly asV5: ContractMetadataV5; - readonly type: 'V0' | 'V1' | 'V2' | 'V3' | 'V4' | 'V5'; + readonly isV6: boolean; + readonly asV6: ContractMetadataV6; + readonly type: 'V0' | 'V1' | 'V2' | 'V3' | 'V4' | 'V5' | 'V6'; } /** @name ContractMetadataLatest */ -export interface ContractMetadataLatest extends ContractMetadataV5 {} +export interface ContractMetadataLatest extends ContractMetadataV6 {} /** @name ContractMetadataV0 */ export interface ContractMetadataV0 extends Struct { @@ -349,6 +360,13 @@ export interface ContractMetadataV5 extends Struct { readonly version: u64; } +/** @name ContractMetadataV6 */ +export interface ContractMetadataV6 extends Struct { + readonly types: Vec; + readonly spec: ContractContractSpecV6; + readonly version: u64; +} + /** @name ContractProject */ export interface ContractProject extends ITuple<[ContractProjectInfo, ContractMetadata]> {} @@ -387,6 +405,20 @@ export interface ContractProjectV0 extends Struct { readonly spec: ContractContractSpecV0; } +/** @name ContractReviveProjectInfo */ +export interface ContractReviveProjectInfo extends Struct { + readonly source: ContractReviveProjectSource; + readonly contract: ContractProjectContract; +} + +/** @name ContractReviveProjectSource */ +export interface ContractReviveProjectSource extends Struct { + readonly wasmHash: U8aFixed; + readonly language: Text; + readonly compiler: Text; + readonly wasm: Raw; +} + /** @name ContractSelector */ export interface ContractSelector extends U8aFixed {}