From 4f784e013b3d15b459541d37e3dd3d58c27e77b6 Mon Sep 17 00:00:00 2001 From: sameh-farouk Date: Tue, 23 Jan 2024 13:05:57 +0200 Subject: [PATCH] apply contract type changes --- db/migrations/1705937053109-Data.js | 95 ++ indexer/chart/Chart.yaml | 2 +- indexer/chart/templates/indexer-config.yaml | 32 +- indexer/typesBundle.json | 32 +- src/mappings/contracts.ts | 24 +- src/types/events.ts | 61 + src/types/v147.ts | 79 ++ src/types/v148.ts | 79 ++ typegen/typesBundle.json | 1240 +++++++++++-------- 9 files changed, 1092 insertions(+), 552 deletions(-) create mode 100644 db/migrations/1705937053109-Data.js create mode 100644 src/types/v147.ts create mode 100644 src/types/v148.ts diff --git a/db/migrations/1705937053109-Data.js b/db/migrations/1705937053109-Data.js new file mode 100644 index 0000000..369c2d6 --- /dev/null +++ b/db/migrations/1705937053109-Data.js @@ -0,0 +1,95 @@ +module.exports = class Data1705937053109 { + name = 'Data1705937053109' + + async up(db) { + await db.query(`CREATE TABLE "entity" ("id" character varying NOT NULL, "grid_version" integer NOT NULL, "entity_id" integer NOT NULL, "name" text NOT NULL, "country" text, "city" text, "account_id" text NOT NULL, CONSTRAINT "PK_50a7741b415bc585fcf9c984332" PRIMARY KEY ("id"))`) + await db.query(`CREATE TABLE "twin" ("id" character varying NOT NULL, "grid_version" integer NOT NULL, "twin_id" integer NOT NULL, "account_id" text NOT NULL, "relay" text, "public_key" text, CONSTRAINT "PK_18457170fa91d0a787d9f635d7c" PRIMARY KEY ("id"))`) + await db.query(`CREATE TABLE "entity_proof" ("id" character varying NOT NULL, "entity_id" integer NOT NULL, "signature" text NOT NULL, "twin_rel_id" character varying, CONSTRAINT "PK_b55dee5f461106682013d0beef8" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_3d9cbf30c68b79a801e1d5c9b4" ON "entity_proof" ("twin_rel_id") `) + await db.query(`CREATE TABLE "public_ip" ("id" character varying NOT NULL, "gateway" text NOT NULL, "ip" text NOT NULL, "contract_id" numeric NOT NULL, "farm_id" character varying, CONSTRAINT "PK_f170b0b519632730f41d2ef78f4" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_5cc2d1af1d8132b614abd340b0" ON "public_ip" ("farm_id") `) + await db.query(`CREATE TABLE "farm" ("id" character varying NOT NULL, "grid_version" integer NOT NULL, "farm_id" integer NOT NULL, "name" text NOT NULL, "twin_id" integer NOT NULL, "pricing_policy_id" integer NOT NULL, "certification" character varying(12), "stellar_address" text, "dedicated_farm" boolean, CONSTRAINT "PK_3bf246b27a3b6678dfc0b7a3f64" PRIMARY KEY ("id"))`) + await db.query(`CREATE TABLE "location" ("id" character varying NOT NULL, "longitude" text NOT NULL, "latitude" text NOT NULL, CONSTRAINT "PK_876d7bdba03c72251ec4c2dc827" PRIMARY KEY ("id"))`) + await db.query(`CREATE TABLE "interfaces" ("id" character varying NOT NULL, "name" text NOT NULL, "mac" text NOT NULL, "ips" text NOT NULL, "node_id" character varying, CONSTRAINT "PK_811ec6e568e3c1a89ac5e744731" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_23937641f28c607f061dab4694" ON "interfaces" ("node_id") `) + await db.query(`CREATE TABLE "node" ("id" character varying NOT NULL, "grid_version" integer NOT NULL, "node_id" integer NOT NULL, "farm_id" integer NOT NULL, "twin_id" integer NOT NULL, "country" text, "city" text, "uptime" numeric, "created" integer NOT NULL, "farming_policy_id" integer NOT NULL, "certification" character varying(9), "secure" boolean, "virtualized" boolean, "serial_number" text, "created_at" numeric NOT NULL, "updated_at" numeric NOT NULL, "connection_price" integer, "power" jsonb, "dedicated" boolean NOT NULL, "extra_fee" numeric, "location_id" character varying, CONSTRAINT "PK_8c8caf5f29d25264abe9eaf94dd" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_d224b7b862841f24dd85b55605" ON "node" ("location_id") `) + await db.query(`CREATE TABLE "node_resources_total" ("id" character varying NOT NULL, "hru" numeric NOT NULL, "sru" numeric NOT NULL, "cru" numeric NOT NULL, "mru" numeric NOT NULL, "node_id" character varying NOT NULL, CONSTRAINT "REL_fd430c3a2645c8f409f859c2aa" UNIQUE ("node_id"), CONSTRAINT "PK_964127f256a8ffeba2aa31c098d" PRIMARY KEY ("id"))`) + await db.query(`CREATE UNIQUE INDEX "IDX_fd430c3a2645c8f409f859c2aa" ON "node_resources_total" ("node_id") `) + await db.query(`CREATE TABLE "public_config" ("id" character varying NOT NULL, "ipv4" text, "ipv6" text, "gw4" text, "gw6" text, "domain" text, "node_id" character varying NOT NULL, CONSTRAINT "REL_d394b8b9afbb1b1a2346f9743c" UNIQUE ("node_id"), CONSTRAINT "PK_7839f7dd8f45e37933fb3e35cbb" PRIMARY KEY ("id"))`) + await db.query(`CREATE UNIQUE INDEX "IDX_d394b8b9afbb1b1a2346f9743c" ON "public_config" ("node_id") `) + await db.query(`CREATE TABLE "pricing_policy" ("id" character varying NOT NULL, "grid_version" integer NOT NULL, "pricing_policy_id" integer NOT NULL, "name" text NOT NULL, "su" jsonb NOT NULL, "cu" jsonb NOT NULL, "nu" jsonb NOT NULL, "ipu" jsonb NOT NULL, "foundation_account" text NOT NULL, "certified_sales_account" text NOT NULL, "dedicated_node_discount" integer NOT NULL, CONSTRAINT "PK_78105eb11bd75fd76a23bbc9bb1" PRIMARY KEY ("id"))`) + await db.query(`CREATE TABLE "country" ("id" character varying NOT NULL, "country_id" integer NOT NULL, "code" text NOT NULL, "name" text NOT NULL, "region" text NOT NULL, "subregion" text NOT NULL, "lat" text, "long" text, CONSTRAINT "PK_bf6e37c231c4f4ea56dcd887269" PRIMARY KEY ("id"))`) + await db.query(`CREATE TABLE "city" ("id" character varying NOT NULL, "city_id" integer NOT NULL, "country_id" integer NOT NULL, "name" text NOT NULL, CONSTRAINT "PK_b222f51ce26f7e5ca86944a6739" PRIMARY KEY ("id"))`) + await db.query(`CREATE TABLE "contract_resources" ("id" character varying NOT NULL, "hru" numeric NOT NULL, "sru" numeric NOT NULL, "cru" numeric NOT NULL, "mru" numeric NOT NULL, "contract_id" character varying, CONSTRAINT "PK_557de19994fcca90916e8c6582f" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_621238dffde9099b2233650235" ON "contract_resources" ("contract_id") `) + await db.query(`CREATE TABLE "node_contract" ("id" character varying NOT NULL, "grid_version" integer NOT NULL, "contract_id" numeric NOT NULL, "twin_id" integer NOT NULL, "node_id" integer NOT NULL, "deployment_data" text NOT NULL, "deployment_hash" text NOT NULL, "number_of_public_i_ps" integer NOT NULL, "state" character varying(11) NOT NULL, "created_at" numeric NOT NULL, "solution_provider_id" integer, "resources_used_id" character varying, CONSTRAINT "PK_a5f90b17f504ffcd79d1f66574a" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_f294cfb50bb7c7b976d86c08fd" ON "node_contract" ("resources_used_id") `) + await db.query(`CREATE TABLE "name_contract" ("id" character varying NOT NULL, "grid_version" integer NOT NULL, "contract_id" numeric NOT NULL, "twin_id" integer NOT NULL, "name" text NOT NULL, "state" character varying(11) NOT NULL, "created_at" numeric NOT NULL, "solution_provider_id" integer, CONSTRAINT "PK_7b4cd056bbb83602d211996360f" PRIMARY KEY ("id"))`) + await db.query(`CREATE TABLE "rent_contract" ("id" character varying NOT NULL, "grid_version" integer NOT NULL, "contract_id" numeric NOT NULL, "twin_id" integer NOT NULL, "node_id" integer NOT NULL, "state" character varying(11) NOT NULL, "created_at" numeric NOT NULL, "solution_provider_id" integer, CONSTRAINT "PK_3c99766b627604d5950d704e33a" PRIMARY KEY ("id"))`) + await db.query(`CREATE TABLE "solution_provider" ("id" character varying NOT NULL, "solution_provider_id" numeric NOT NULL, "description" text NOT NULL, "link" text NOT NULL, "approved" boolean NOT NULL, "providers" jsonb, CONSTRAINT "PK_dbb1dd40ae8f70dc9bbe2ce6347" PRIMARY KEY ("id"))`) + await db.query(`CREATE TABLE "nru_consumption" ("id" character varying NOT NULL, "contract_id" numeric NOT NULL, "timestamp" numeric NOT NULL, "window" numeric, "nru" numeric, CONSTRAINT "PK_ca7956fb8fcdb7198737387d9a8" PRIMARY KEY ("id"))`) + await db.query(`CREATE TABLE "contract_bill_report" ("id" character varying NOT NULL, "contract_id" numeric NOT NULL, "discount_received" character varying(7) NOT NULL, "amount_billed" numeric NOT NULL, "timestamp" numeric NOT NULL, CONSTRAINT "PK_5b21fd81e47bddc5f1fdbc8d7ee" PRIMARY KEY ("id"))`) + await db.query(`CREATE TABLE "farming_policy" ("id" character varying NOT NULL, "grid_version" integer NOT NULL, "farming_policy_id" integer NOT NULL, "name" text, "cu" integer, "su" integer, "nu" integer, "ipv4" integer, "minimal_uptime" integer, "policy_created" integer, "policy_end" integer, "immutable" boolean, "default" boolean, "node_certification" character varying(9), "farm_certification" character varying(12), CONSTRAINT "PK_5d2ec9534104f44e4d989c4e82f" PRIMARY KEY ("id"))`) + await db.query(`CREATE TABLE "uptime_event" ("id" character varying NOT NULL, "node_id" integer NOT NULL, "uptime" numeric NOT NULL, "timestamp" numeric NOT NULL, CONSTRAINT "PK_90783463b0d0b660367ebd7f5ff" PRIMARY KEY ("id"))`) + await db.query(`CREATE TABLE "mint_transaction" ("id" character varying NOT NULL, "amount" numeric NOT NULL, "target" text NOT NULL, "block" integer NOT NULL, CONSTRAINT "PK_19f4328320501dfd14e2bae0855" PRIMARY KEY ("id"))`) + await db.query(`CREATE TABLE "burn_transaction" ("id" character varying NOT NULL, "block" integer NOT NULL, "amount" numeric NOT NULL, "target" text NOT NULL, CONSTRAINT "PK_20ec76c5c56dd6b47dec5f0aaa8" PRIMARY KEY ("id"))`) + await db.query(`CREATE TABLE "refund_transaction" ("id" character varying NOT NULL, "block" integer NOT NULL, "amount" numeric NOT NULL, "target" text NOT NULL, "tx_hash" text NOT NULL, CONSTRAINT "PK_74ffc5427c595968dd777f71bf4" PRIMARY KEY ("id"))`) + await db.query(`CREATE TABLE "service_contract" ("id" character varying NOT NULL, "service_contract_id" numeric NOT NULL, "service_twin_id" integer NOT NULL, "consumer_twin_id" integer NOT NULL, "base_fee" numeric NOT NULL, "variable_fee" numeric NOT NULL, "metadata" text NOT NULL, "accepted_by_service" boolean NOT NULL, "accepted_by_consumer" boolean NOT NULL, "last_bill" numeric NOT NULL, "state" character varying(14) NOT NULL, CONSTRAINT "PK_ff58318f8230b8053067edd0343" PRIMARY KEY ("id"))`) + await db.query(`CREATE TABLE "service_contract_bill" ("id" character varying NOT NULL, "service_contract_id" numeric NOT NULL, "variable_amount" numeric NOT NULL, "window" numeric NOT NULL, "metadata" text, "amount" numeric NOT NULL, CONSTRAINT "PK_1fd26292c0913e974b774342fa7" PRIMARY KEY ("id"))`) + await db.query(`ALTER TABLE "entity_proof" ADD CONSTRAINT "FK_3d9cbf30c68b79a801e1d5c9b41" FOREIGN KEY ("twin_rel_id") REFERENCES "twin"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`) + await db.query(`ALTER TABLE "public_ip" ADD CONSTRAINT "FK_5cc2d1af1d8132b614abd340b06" FOREIGN KEY ("farm_id") REFERENCES "farm"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`) + await db.query(`ALTER TABLE "interfaces" ADD CONSTRAINT "FK_23937641f28c607f061dab4694b" FOREIGN KEY ("node_id") REFERENCES "node"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`) + await db.query(`ALTER TABLE "node" ADD CONSTRAINT "FK_d224b7b862841f24dd85b556059" FOREIGN KEY ("location_id") REFERENCES "location"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`) + await db.query(`ALTER TABLE "node_resources_total" ADD CONSTRAINT "FK_fd430c3a2645c8f409f859c2aae" FOREIGN KEY ("node_id") REFERENCES "node"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`) + await db.query(`ALTER TABLE "public_config" ADD CONSTRAINT "FK_d394b8b9afbb1b1a2346f9743cd" FOREIGN KEY ("node_id") REFERENCES "node"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`) + await db.query(`ALTER TABLE "contract_resources" ADD CONSTRAINT "FK_621238dffde9099b2233650235d" FOREIGN KEY ("contract_id") REFERENCES "node_contract"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`) + await db.query(`ALTER TABLE "node_contract" ADD CONSTRAINT "FK_f294cfb50bb7c7b976d86c08fda" FOREIGN KEY ("resources_used_id") REFERENCES "contract_resources"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`) + } + + async down(db) { + await db.query(`DROP TABLE "entity"`) + await db.query(`DROP TABLE "twin"`) + await db.query(`DROP TABLE "entity_proof"`) + await db.query(`DROP INDEX "public"."IDX_3d9cbf30c68b79a801e1d5c9b4"`) + await db.query(`DROP TABLE "public_ip"`) + await db.query(`DROP INDEX "public"."IDX_5cc2d1af1d8132b614abd340b0"`) + await db.query(`DROP TABLE "farm"`) + await db.query(`DROP TABLE "location"`) + await db.query(`DROP TABLE "interfaces"`) + await db.query(`DROP INDEX "public"."IDX_23937641f28c607f061dab4694"`) + await db.query(`DROP TABLE "node"`) + await db.query(`DROP INDEX "public"."IDX_d224b7b862841f24dd85b55605"`) + await db.query(`DROP TABLE "node_resources_total"`) + await db.query(`DROP INDEX "public"."IDX_fd430c3a2645c8f409f859c2aa"`) + await db.query(`DROP TABLE "public_config"`) + await db.query(`DROP INDEX "public"."IDX_d394b8b9afbb1b1a2346f9743c"`) + await db.query(`DROP TABLE "pricing_policy"`) + await db.query(`DROP TABLE "country"`) + await db.query(`DROP TABLE "city"`) + await db.query(`DROP TABLE "contract_resources"`) + await db.query(`DROP INDEX "public"."IDX_621238dffde9099b2233650235"`) + await db.query(`DROP TABLE "node_contract"`) + await db.query(`DROP INDEX "public"."IDX_f294cfb50bb7c7b976d86c08fd"`) + await db.query(`DROP TABLE "name_contract"`) + await db.query(`DROP TABLE "rent_contract"`) + await db.query(`DROP TABLE "solution_provider"`) + await db.query(`DROP TABLE "nru_consumption"`) + await db.query(`DROP TABLE "contract_bill_report"`) + await db.query(`DROP TABLE "farming_policy"`) + await db.query(`DROP TABLE "uptime_event"`) + await db.query(`DROP TABLE "mint_transaction"`) + await db.query(`DROP TABLE "burn_transaction"`) + await db.query(`DROP TABLE "refund_transaction"`) + await db.query(`DROP TABLE "service_contract"`) + await db.query(`DROP TABLE "service_contract_bill"`) + await db.query(`ALTER TABLE "entity_proof" DROP CONSTRAINT "FK_3d9cbf30c68b79a801e1d5c9b41"`) + await db.query(`ALTER TABLE "public_ip" DROP CONSTRAINT "FK_5cc2d1af1d8132b614abd340b06"`) + await db.query(`ALTER TABLE "interfaces" DROP CONSTRAINT "FK_23937641f28c607f061dab4694b"`) + await db.query(`ALTER TABLE "node" DROP CONSTRAINT "FK_d224b7b862841f24dd85b556059"`) + await db.query(`ALTER TABLE "node_resources_total" DROP CONSTRAINT "FK_fd430c3a2645c8f409f859c2aae"`) + await db.query(`ALTER TABLE "public_config" DROP CONSTRAINT "FK_d394b8b9afbb1b1a2346f9743cd"`) + await db.query(`ALTER TABLE "contract_resources" DROP CONSTRAINT "FK_621238dffde9099b2233650235d"`) + await db.query(`ALTER TABLE "node_contract" DROP CONSTRAINT "FK_f294cfb50bb7c7b976d86c08fda"`) + } +} diff --git a/indexer/chart/Chart.yaml b/indexer/chart/Chart.yaml index 7376eb6..d5c8272 100644 --- a/indexer/chart/Chart.yaml +++ b/indexer/chart/Chart.yaml @@ -1,5 +1,5 @@ name: tfchainindexer description: Helm Chart for the tfchain hydra indexer -version: 2.7.7 +version: 2.7.8 apiVersion: v2 appVersion: '2.11.5' diff --git a/indexer/chart/templates/indexer-config.yaml b/indexer/chart/templates/indexer-config.yaml index bae3a49..cb76b2f 100644 --- a/indexer/chart/templates/indexer-config.yaml +++ b/indexer/chart/templates/indexer-config.yaml @@ -478,7 +478,7 @@ data: "pricingPolicyId": "u32", "certification": "FarmCertification", "publicIps": "Vec", - "dedicatedFarm:": "bool", + "dedicatedFarm": "bool", "farmingPolicyLimits": "Option" }, "FarmingPolicyLimit": { @@ -679,6 +679,36 @@ data: ] } } + }, + { + "minmax": [ + 147, + 147 + ], + "types": { + "Cause": { + "_enum": [ + "CanceledByCollective", + "CanceledByUser", + "OutOfFunds" + ] + } + } + }, + { + "minmax": [ + 148, + null + ], + "types": { + "Cause": { + "_enum": [ + "CanceledByUser", + "OutOfFunds", + "CanceledByCollective" + ] + } + } } ] } diff --git a/indexer/typesBundle.json b/indexer/typesBundle.json index fedb774..89a8991 100644 --- a/indexer/typesBundle.json +++ b/indexer/typesBundle.json @@ -475,7 +475,7 @@ "pricingPolicyId": "u32", "certification": "FarmCertification", "publicIps": "Vec", - "dedicatedFarm:": "bool", + "dedicatedFarm": "bool", "farmingPolicyLimits": "Option" }, "FarmingPolicyLimit": { @@ -676,6 +676,36 @@ ] } } + }, + { + "minmax": [ + 147, + 147 + ], + "types": { + "Cause": { + "_enum": [ + "CanceledByCollective", + "CanceledByUser", + "OutOfFunds" + ] + } + } + }, + { + "minmax": [ + 148, + null + ], + "types": { + "Cause": { + "_enum": [ + "CanceledByUser", + "OutOfFunds", + "CanceledByCollective" + ] + } + } } ] } diff --git a/src/mappings/contracts.ts b/src/mappings/contracts.ts index cf5a8eb..a7de53a 100644 --- a/src/mappings/contracts.ts +++ b/src/mappings/contracts.ts @@ -37,9 +37,18 @@ export async function contractCreated( contractEvent = contractCreatedEvent.asV101 } else if (contractCreatedEvent.isV105) { contractEvent = contractCreatedEvent.asV105 + } else if (contractCreatedEvent.isV147) { + contractEvent = contractCreatedEvent.asV147 + ctx.log.debug(`v147: ${contractEvent}`); + } else if (contractCreatedEvent.isV148) { + contractEvent = contractCreatedEvent.asV148 + ctx.log.debug(`v148: ${contractEvent}`); } - if (!contractEvent) return + if (!contractEvent) { + ctx.log.error(`unknown version: ${contractCreatedEvent}`); + return + } let state = ContractState.Created @@ -152,9 +161,20 @@ export async function contractUpdated( contractEvent = contractUpdatedEvent.asV59 } else if (contractUpdatedEvent.isV101) { contractEvent = contractUpdatedEvent.asV101 + } else if (contractUpdatedEvent.isV105) { + contractEvent = contractUpdatedEvent.asV105 + } else if (contractUpdatedEvent.isV147) { + contractEvent = contractUpdatedEvent.asV147 + ctx.log.debug(`v147: ${contractEvent}`); + } else if (contractUpdatedEvent.isV148) { + contractEvent = contractUpdatedEvent.asV148 + ctx.log.debug(`v148: ${contractEvent}`); } - if (!contractEvent) return + if (!contractEvent) { + ctx.log.error(`unknown version: ${contractUpdatedEvent}`); + return + } const SavedNodeContract = await ctx.store.get(NodeContract, { where: { contractID: contractEvent.contractId } }) if (SavedNodeContract) { diff --git a/src/types/events.ts b/src/types/events.ts index ecad871..de5fef0 100644 --- a/src/types/events.ts +++ b/src/types/events.ts @@ -16,6 +16,8 @@ import * as v118 from './v118' import * as v122 from './v122' import * as v124 from './v124' import * as v125 from './v125' +import * as v147 from './v147' +import * as v148 from './v148' export type AccountId32 = Uint8Array @@ -158,6 +160,36 @@ export class SmartContractModuleContractCreatedEvent { assert(this.isV105) return this._chain.decodeEvent(this.event) } + + /** + * A contract got created + */ + get isV147(): boolean { + return this._chain.getEventHash('SmartContractModule.ContractCreated') === '7b1fac3eee26bad6f35e60f95445eaff64030725c074c795899e96ed831a51bc' +} + + /** + * A contract got created + */ + get asV147(): v147.Contract { + assert(this.isV147) + return this._chain.decodeEvent(this.event) + } + + /** + * A contract got created + */ + get isV148(): boolean { + return this._chain.getEventHash('SmartContractModule.ContractCreated') === '57619064e9c1f946a9889f41afe4d6c9cfb49c07403f39eac35870a7b5588845' + } + + /** + * A contract got created + */ + get asV148(): v148.Contract { + assert(this.isV148) + return this._chain.decodeEvent(this.event) + } } export class SmartContractModuleContractUpdatedEvent { @@ -232,6 +264,35 @@ export class SmartContractModuleContractUpdatedEvent { assert(this.isV105) return this._chain.decodeEvent(this.event) } + /** + * A contract was updated + */ + get isV147(): boolean { + return this._chain.getEventHash('SmartContractModule.ContractUpdated') === '7b1fac3eee26bad6f35e60f95445eaff64030725c074c795899e96ed831a51bc' + } + + /** + * A contract was updated + */ + get asV147(): v147.Contract { + assert(this.isV147) + return this._chain.decodeEvent(this.event) + } + + /** + * A contract was updated + */ + get isV148(): boolean { + return this._chain.getEventHash('SmartContractModule.ContractUpdated') === '57619064e9c1f946a9889f41afe4d6c9cfb49c07403f39eac35870a7b5588845' + } + + /** + * A contract was updated + */ + get asV148(): v148.Contract { + assert(this.isV148) + return this._chain.decodeEvent(this.event) + } } export class SmartContractModuleContractGracePeriodEndedEvent { diff --git a/src/types/v147.ts b/src/types/v147.ts new file mode 100644 index 0000000..56b33ca --- /dev/null +++ b/src/types/v147.ts @@ -0,0 +1,79 @@ +import type {Result, Option} from './support' + +export interface Contract { + version: number + state: ContractState + contractId: bigint + twinId: number + contractType: ContractData + solutionProviderId: (bigint | undefined) +} + +export type ContractState = ContractState_Created | ContractState_Deleted | ContractState_GracePeriod + +export interface ContractState_Created { + __kind: 'Created' +} + +export interface ContractState_Deleted { + __kind: 'Deleted' + value: Cause +} + +export interface ContractState_GracePeriod { + __kind: 'GracePeriod' + value: bigint +} + +export type ContractData = ContractData_NodeContract | ContractData_NameContract | ContractData_RentContract + +export interface ContractData_NodeContract { + __kind: 'NodeContract' + value: NodeContract +} + +export interface ContractData_NameContract { + __kind: 'NameContract' + value: NameContract +} + +export interface ContractData_RentContract { + __kind: 'RentContract' + value: RentContract +} + +export type Cause = Cause_CanceledByCollective | Cause_CanceledByUser | Cause_OutOfFunds + +export interface Cause_CanceledByCollective { + __kind: 'CanceledByCollective' +} + +export interface Cause_CanceledByUser { + __kind: 'CanceledByUser' +} + +export interface Cause_OutOfFunds { + __kind: 'OutOfFunds' +} + +export interface NodeContract { + nodeId: number + deploymentHash: Uint8Array + deploymentData: Uint8Array + publicIps: number + publicIpsList: PublicIP[] +} + +export interface NameContract { + name: Uint8Array +} + +export interface RentContract { + nodeId: number +} + +export interface PublicIP { + ip: Uint8Array + gateway: Uint8Array + contractId: bigint +} diff --git a/src/types/v148.ts b/src/types/v148.ts new file mode 100644 index 0000000..7f699c5 --- /dev/null +++ b/src/types/v148.ts @@ -0,0 +1,79 @@ +import type {Result, Option} from './support' + +export interface Contract { + version: number + state: ContractState + contractId: bigint + twinId: number + contractType: ContractData + solutionProviderId: (bigint | undefined) +} + +export type ContractState = ContractState_Created | ContractState_Deleted | ContractState_GracePeriod + +export interface ContractState_Created { + __kind: 'Created' +} + +export interface ContractState_Deleted { + __kind: 'Deleted' + value: Cause +} + +export interface ContractState_GracePeriod { + __kind: 'GracePeriod' + value: bigint +} + +export type ContractData = ContractData_NodeContract | ContractData_NameContract | ContractData_RentContract + +export interface ContractData_NodeContract { + __kind: 'NodeContract' + value: NodeContract +} + +export interface ContractData_NameContract { + __kind: 'NameContract' + value: NameContract +} + +export interface ContractData_RentContract { + __kind: 'RentContract' + value: RentContract +} + +export type Cause = Cause_CanceledByUser | Cause_OutOfFunds | Cause_CanceledByCollective + +export interface Cause_CanceledByUser { + __kind: 'CanceledByUser' +} + +export interface Cause_OutOfFunds { + __kind: 'OutOfFunds' +} + +export interface Cause_CanceledByCollective { + __kind: 'CanceledByCollective' +} + +export interface NodeContract { + nodeId: number + deploymentHash: Uint8Array + deploymentData: Uint8Array + publicIps: number + publicIpsList: PublicIP[] +} + +export interface NameContract { + name: Uint8Array +} + +export interface RentContract { + nodeId: number +} + +export interface PublicIP { + ip: Uint8Array + gateway: Uint8Array + contractId: bigint +} diff --git a/typegen/typesBundle.json b/typegen/typesBundle.json index 9b6296a..89a8991 100644 --- a/typegen/typesBundle.json +++ b/typegen/typesBundle.json @@ -1,567 +1,713 @@ { - "types": { - "Farm": { - "version": "u32", - "id": "u32", - "name": "Vec", - "twin_id": "u32", - "pricing_policy_id": "u32", - "certification_type": "CertificationType", - "public_ips": "Vec" - }, - "PublicIP": { - "ip": "Vec", - "gateway": "Vec", - "contract_id": "u64" - }, - "Entity": { - "version": "u32", - "id": "u32", - "name": "Vec", - "account_id": "AccountId", - "country": "Vec", - "city": "Vec" - }, - "Twin": { - "id": "u32", - "ip": "Vec", - "version": "u32", - "entities": "Vec", - "accountId": "AccountId" - }, - "EntityProof": { - "entity_id": "u32", - "signature": "Vec" - }, - "PublicConfig": { - "ipv4": "Vec", - "ipv6": "Vec", - "gw4": "Vec", - "gw6": "Vec", - "domain": "Vec" - }, - "Location": { - "longitude": "Vec", - "latitude": "Vec" - }, - "Resources": { - "hru": "u64", - "sru": "u64", - "cru": "u64", - "mru": "u64" - }, - "Interface": { - "name": "Vec", - "mac": "Vec", - "ips": "Vec>" - }, - "CertificationType": { - "_enum": [ - "Diy", - "Certified" - ] - }, - "CertificationCodeType": { - "_enum": [ - "Farm", - "Entity" - ] - }, - "CertificationCodes": { - "version": "u32", - "id": "u32", - "name": "Vec", - "description": "Vec", - "certification_code_type": "CertificationCodeType" - }, - "Policy": { - "value": "u32", - "unit": "Unit" - }, - "Unit": { - "_enum": [ - "Bytes", - "Kilobytes", - "Megabytes", - "Gigabytes", - "Terrabytes" - ] - }, - "DiscountLevel": { - "_enum": [ - "None", - "Default", - "Bronze", - "Silver", - "Gold" - ] - }, - "NameRegistration": { - "name_registration_id": "u64", - "twin_id": "u32", - "name": "Vec" - }, - "FarmingPolicy": { - "version": "u32", - "id": "u32", - "name": "Vec", - "cu": "u32", - "su": "u32", - "nu": "u32", - "ipv4": "u32", - "timestamp": "u64", - "certification_type": "CertificationType" - }, - "ContractBill": { - "contract_id": "u64", - "timestamp": "u64", - "discount_level": "DiscountLevel", - "amount_billed": "u128" - }, - "PalletStorageVersion": { - "_enum": [ - "V1", - "V2", - "V3" - ] - }, - "StorageVersion": { - "_enum": [ - "V1Struct", - "V2Struct", - "V3Struct" - ] - }, - "Address": "MultiAddress", - "LookupSource": "MultiAddress", - "BalanceOf": "Balance", - "Public": "[u8;32]", - "U16F16": "[u8; 4]", - "BufferIndex": "u32", - "VestingInfo": { - "locked": "Balance", - "perBlock": "Balance", - "startingBlock": "BlockNumber", - "tft_price": "U16F16", - "lastReleasedBlock": "BlockNumber" - }, - "StellarTransaction": { - "amount": "Balance", - "target": "MultiAddress" - }, - "MintTransaction": { - "amount": "u64", - "target": "AccountId", - "block": "BlockNumber", - "votes": "u32" - }, - "BurnTransaction": { - "block": "BlockNumber", - "amount": "u64", - "target": "Vec", - "signatures": "Vec", - "sequence_number": "u64" - }, - "RefundTransaction": { - "block": "BlockNumber", - "amount": "u64", - "target": "Vec", - "tx_hash": "Vec", - "signatures": "Vec", - "sequence_number": "u64" - }, - "StellarSignature": { - "signature": "Vec", - "stellar_pubkey": "Vec" - }, - "Burn": { - "target": "AccountId", - "amount": "BalanceOf", - "block": "BlockNumber", - "message": "Vec" - }, - "ValueStruct": { - "value": "U16F16" - }, - "AccountInfo": "AccountInfoWithProviders", - "Keys": "SessionKeys2", - "SessionKeys1": "(AccountId)", - "TermsAndConditions": { - "account_id": "AccountId", - "timestamp": "u64", - "document_link": "Vec", - "document_hash": "Vec" - }, - "Validator": { - "validator_node_account": "AccountId", - "stash_account": "AccountId", - "description": "Vec", - "tf_connect_id": "Vec", - "info": "Vec", - "state": "ValidatorRequestState" - }, - "ValidatorRequestState": { - "_enum": [ - "Created", - "Approved", - "Validating" - ] - }, - "PricingPolicy": { - "version": "u32", - "id": "u32", - "name": "Vec", - "su": "Policy", - "cu": "Policy", - "nu": "Policy", - "ipu": "Policy", - "unique_name": "Policy", - "domain_name": "Policy", - "foundation_account": "AccountId", - "certified_sales_account": "AccountId" - }, - "ContractBillingInformation": { - "previous_nu_reported": "u64", - "last_updated": "u64", - "amount_unbilled": "u64" - }, - "ContractResources": { - "contract_id": "u64", - "used": "Resources" - }, - "ContractData": { - "_enum": { - "NodeContract": "NodeContract", - "NameContract": "NameContract" - } - }, - "NodeContract": { - "nodeId": "u32", - "deploymentData": "Vec", - "deploymentHash": "Vec", - "publicIps": "u32", - "publicIpsList": "Vec" - }, - "NameContract": { - "name": "Vec" - }, - "NruConsumption": { - "contract_id": "u64", - "timestamp": "u64", - "window": "u64", - "nru": "u64" - }, - "Consumption": { - "contract_id": "u64", - "timestamp": "u64", - "cru": "u64", - "sru": "u64", - "hru": "u64", - "mru": "u64", - "nru": "u64" - }, - "ContractLock": { - "amount_locked": "Balance", - "lock_updated": "u64", - "cycles": "u16" - } - }, - "versions": [ - { - "minmax": [ - 9, - 27 - ], - "types": { - "Node": { - "version": "u32", - "id": "u32", - "farm_id": "u32", - "twin_id": "u32", - "resources": "Resources", - "location": "Location", - "country": "Vec", - "city": "Vec", - "public_config": "Option", - "created": "u64", - "farming_policy_id": "u32", - "interfaces": "Vec" - } - } - }, - { - "minmax": [ - 9, - 25 - ], - "types": { - "Contract": { - "version": " u32", - "state": "ContractState", - "contractId": "u64", - "twinId": "u32", - "contractType": "ContractData" + "spec": { + "substrate-threefold": { + "types": [ + { + "minmax": [ + 9, + null + ], + "types": { + "ContractLock": { + "amount_locked": "Balance", + "lock_updated": "u64", + "cycles": "u16" + }, + "Farm": { + "version": "u32", + "id": "u32", + "name": "Vec", + "twinId": "u32", + "pricingPolicyId": "u32", + "certificationType": "CertificationType", + "publicIps": "Vec" + }, + "PublicIP": { + "ip": "Vec", + "gateway": "Vec", + "contractId": "u64" + }, + "Entity": { + "version": "u32", + "id": "u32", + "name": "Vec", + "accountId": "AccountId", + "country": "Vec", + "city": "Vec" + }, + "Twin": { + "version": "u32", + "id": "u32", + "accountId": "AccountId", + "ip": "Vec", + "entities": "Vec" + }, + "EntityProof": { + "entityId": "u32", + "signature": "Vec" + }, + "PublicConfig": { + "ipv4": "Vec", + "ipv6": "Vec", + "gw4": "Vec", + "gw6": "Vec", + "domain": "Vec" + }, + "Location": { + "longitude": "Vec", + "latitude": "Vec" + }, + "Resources": { + "hru": "u64", + "sru": "u64", + "cru": "u64", + "mru": "u64" + }, + "Interface": { + "name": "Vec", + "mac": "Vec", + "ips": "Vec>" + }, + "CertificationType": { + "_enum": [ + "Diy", + "Certified" + ] + }, + "CertificationCodeType": { + "_enum": [ + "Farm", + "Entity" + ] + }, + "CertificationCodes": { + "version": "u32", + "id": "u32", + "name": "Vec", + "description": "Vec", + "certificationCodeType": "CertificationCodeType" + }, + "Policy": { + "value": "u32", + "unit": "Unit" + }, + "Unit": { + "_enum": [ + "Bytes", + "Kilobytes", + "Megabytes", + "Gigabytes", + "Terrabytes" + ] + }, + "DiscountLevel": { + "_enum": [ + "None", + "Default", + "Bronze", + "Silver", + "Gold" + ] + }, + "NameRegistration": { + "nameRegistrationId": "u64", + "twinId": "u32", + "name": "Vec" + }, + "FarmingPolicy": { + "version": "u32", + "id": "u32", + "name": "Vec", + "cu": "u32", + "su": "u32", + "nu": "u32", + "ipv4": "u32", + "timestamp": "u64", + "certificationType": "CertificationType" + }, + "ContractBill": { + "contractId": "u64", + "timestamp": "u64", + "discountLevel": "DiscountLevel", + "amountBilled": "u128" + }, + "PalletStorageVersion": { + "_enum": [ + "V1", + "V2", + "V3" + ] + }, + "StorageVersion": { + "_enum": [ + "V1Struct", + "V2Struct", + "V3Struct" + ] + }, + "Address": "MultiAddress", + "LookupSource": "MultiAddress", + "BalanceOf": "Balance", + "Public": "[u8;32]", + "U16F16": "[u8; 4]", + "BufferIndex": "u32", + "VestingInfo": { + "locked": "Balance", + "perBlock": "Balance", + "startingBlock": "BlockNumber", + "tftPrice": "U16F16", + "lastReleasedBlock": "BlockNumber" + }, + "StellarTransaction": { + "amount": "Balance", + "target": "MultiAddress" + }, + "MintTransaction": { + "amount": "u64", + "target": "AccountId", + "block": "BlockNumber", + "votes": "u32" + }, + "BurnTransaction": { + "block": "BlockNumber", + "amount": "u64", + "target": "Vec", + "signatures": "Vec", + "sequenceNumber": "u64" + }, + "RefundTransaction": { + "block": "BlockNumber", + "amount": "u64", + "target": "Vec", + "txHash": "Vec", + "signatures": "Vec", + "sequenceNumber": "u64" + }, + "StellarSignature": { + "signature": "Vec", + "stellarPubkey": "Vec" + }, + "Burn": { + "target": "AccountId", + "amount": "BalanceOf", + "block": "BlockNumber", + "message": "Vec" + }, + "ValueStruct": { + "value": "U16F16" + }, + "AccountInfo": "AccountInfoWithProviders", + "Keys": "SessionKeys2", + "SessionKeys1": "(AccountId)", + "TermsAndConditions": { + "accountId": "AccountId", + "timestamp": "u64", + "documentLink": "Vec", + "documentHash": "Vec" + }, + "Validator": { + "validatorNodeAccount": "AccountId", + "stashAccount": "AccountId", + "description": "Vec", + "tfConnectId": "Vec", + "info": "Vec", + "state": "ValidatorRequestState" + }, + "ValidatorRequestState": { + "_enum": [ + "Created", + "Approved", + "Validating" + ] + }, + "PricingPolicy": { + "version": "u32", + "id": "u32", + "name": "Vec", + "su": "Policy", + "cu": "Policy", + "nu": "Policy", + "ipu": "Policy", + "uniqueName": "Policy", + "domainName": "Policy", + "foundationAccount": "AccountId", + "certifiedSalesAccount": "AccountId" + }, + "ContractData": { + "_enum": { + "NodeContract": "NodeContract", + "NameContract": "NameContract" + } + }, + "NodeContract": { + "nodeId": "u32", + "deploymentData": "Vec", + "deploymentHash": "Vec", + "publicIps": "u32", + "publicIpsList": "Vec" + }, + "NameContract": { + "name": "Vec" + }, + "ContractBillingInformation": { + "previousNuReported": "u64", + "lastUpdated": "u64", + "amountUnbilled": "u64" + }, + "ContractResources": { + "contractId": "u64", + "used": "Resources" + }, + "NruConsumption": { + "contractId": "u64", + "timestamp": "u64", + "window": "u64", + "nru": "u64" + }, + "Consumption": { + "contractId": "u64", + "timestamp": "u64", + "cru": "u64", + "sru": "u64", + "hru": "u64", + "mru": "u64", + "nru": "u64" + } + } }, - "ContractState": { - "_enum": { - "Created": null, - "Deleted": null, - "OutOfFunds": null + { + "minmax": [ + 9, + 27 + ], + "types": { + "Node": { + "version": "u32", + "id": "u32", + "farmId": "u32", + "twinId": "u32", + "resources": "Resources", + "location": "Location", + "country": "Vec", + "city": "Vec", + "publicConfig": "Option", + "created": "u64", + "farmingPolicyId": "u32", + "interfaces": "Vec" + } } - } - } - }, - { - "minmax": [ - 25, - null - ], - "types": { - "Contract": { - "version": " u32", - "state": "ContractState", - "contractId": "u64", - "twinId": "u32", - "contractType": "ContractData" }, - "ContractState": { - "_enum": { - "Created": null, - "Deleted": "Cause" + { + "minmax": [ + 9, + 25 + ], + "types": { + "Contract": { + "version": " u32", + "state": "ContractState", + "contractId": "u64", + "twinId": "u32", + "contractType": "ContractData" + }, + "ContractState": { + "_enum": { + "Created": null, + "Deleted": null, + "OutOfFunds": null + } + } } }, - "Cause": { - "_enum": [ - "CanceledByUser", - "OutOfFunds" - ] - } - } - }, - { - "minmax": [ - 12, - null - ], - "types": { - "PublicConfig": { - "ipv4": "Vec", - "ipv6": "Vec", - "gw4": "Vec", - "gw6": "Vec", - "domain": "Vec" - } - } - }, - { - "minmax": [ - 28, - 42 - ], - "types": { - "Node": { - "version": "u32", - "id": "u32", - "farm_id": "u32", - "twin_id": "u32", - "resources": "Resources", - "location": "Location", - "country": "Vec", - "city": "Vec", - "public_config": "Option", - "created": "u64", - "farming_policy_id": "u32", - "interfaces": "Vec", - "certification_type": "CertificationType" - } - } - }, - { - "minmax": [ - 43, - null - ], - "types": { - "Node": { - "version": "u32", - "id": "u32", - "farm_id": "u32", - "twin_id": "u32", - "resources": "Resources", - "location": "Location", - "country": "Vec", - "city": "Vec", - "public_config": "Option", - "created": "u64", - "farming_policy_id": "u32", - "interfaces": "Vec", - "certification_type": "CertificationType", - "secure_boot": "bool", - "virtualized": "bool", - "serial_number": "Vec" - } - } - }, - { - "minmax": [ - 50, - null - ], - "types": { - "ContractData": { - "_enum": { - "NodeContract": "NodeContract", - "NameContract": "NameContract", - "RentContract": "RentContract" + { + "minmax": [ + 25, + null + ], + "types": { + "Contract": { + "version": " u32", + "state": "ContractState", + "contractId": "u64", + "twinId": "u32", + "contractType": "ContractData" + }, + "ContractState": { + "_enum": { + "Created": null, + "Deleted": "Cause" + } + }, + "Cause": { + "_enum": [ + "CanceledByUser", + "OutOfFunds" + ] + } } }, - "RentContract": { - "nodeId": "u32" + { + "minmax": [ + 28, + 42 + ], + "types": { + "Node": { + "version": "u32", + "id": "u32", + "farmId": "u32", + "twinId": "u32", + "resources": "Resources", + "location": "Location", + "country": "Vec", + "city": "Vec", + "publicConfig": "Option", + "created": "u64", + "farmingPolicyId": "u32", + "interfaces": "Vec", + "certificationType": "CertificationType" + } + } }, - "PricingPolicy": { - "version": "u32", - "id": "u32", - "name": "Vec", - "su": "Policy", - "cu": "Policy", - "nu": "Policy", - "ipu": "Policy", - "unique_name": "Policy", - "domain_name": "Policy", - "foundation_account": "AccountId", - "certified_sales_account": "AccountId", - "discount_for_dedicated_nodes": "u8" - } - } - }, - { - "minmax": [ - 51, - null - ], - "types": { - "PricingPolicy": { - "version": "u32", - "id": "u32", - "name": "Vec", - "su": "Policy", - "cu": "Policy", - "nu": "Policy", - "ipu": "Policy", - "unique_name": "Policy", - "domain_name": "Policy", - "foundation_account": "AccountId", - "certified_sales_account": "AccountId", - "discount_for_dedicated_nodes": "u8" - } - } - }, - { - "minmax": [ - 59, - null - ], - "types": { - "ContractState": { - "_enum": { - "Created": null, - "Deleted": null, - "OutOfFunds": null, - "GracePeriod": "u64" + { + "minmax": [ + 43, + null + ], + "types": { + "Node": { + "version": "u32", + "id": "u32", + "farmId": "u32", + "twinId": "u32", + "resources": "Resources", + "location": "Location", + "country": "Vec", + "city": "Vec", + "publicConfig": "Option", + "created": "u64", + "farmingPolicyId": "u32", + "interfaces": "Vec", + "certificationType": "CertificationType", + "secureBoot": "bool", + "virtualized": "bool", + "serialNumber": "Vec" + } } - } - } - }, - { - "minmax": [ - 63, - null - ], - "types": { - "Farm": { - "version": "u32", - "id": "u32", - "name": "Vec", - "twin_id": "u32", - "pricing_policy_id": "u32", - "certification": "FarmCertification", - "public_ips": "Vec", - "dedicated_farm": "bool", - "farming_policy_limits": "Option" }, - "FarmingPolicyLimit": { - "farming_policy_id": "u32", - "cu": "Option", - "su": "Option", - "end": "Option", - "node_count": "Option", - "node_certification": "bool" + { + "minmax": [ + 50, + null + ], + "types": { + "ContractData": { + "_enum": { + "NodeContract": "NodeContract", + "NameContract": "NameContract", + "RentContract": "RentContract" + } + }, + "RentContract": { + "nodeId": "u32" + }, + "Farm": { + "version": "u32", + "id": "u32", + "name": "Vec", + "twinId": "u32", + "pricingPolicyId": "u32", + "certificationType": "CertificationType", + "publicIps": "Vec", + "dedicatedFarm": "bool" + } + } }, - "Node": { - "version": "u32", - "id": "u32", - "farm_id": "u32", - "twin_id": "u32", - "resources": "Resources", - "location": "Location", - "country": "Vec", - "city": "Vec", - "public_config": "Option", - "created": "u64", - "farming_policy_id": "u32", - "interfaces": "Vec", - "certification": "NodeCertification", - "secure_boot": "bool", - "virtualized": "bool", - "serial_number": "Vec", - "connection_price": "u32" + { + "minmax": [ + 51, + null + ], + "types": { + "PricingPolicy": { + "version": "u32", + "id": "u32", + "name": "Vec", + "su": "Policy", + "cu": "Policy", + "nu": "Policy", + "ipu": "Policy", + "uniqueName": "Policy", + "domainName": "Policy", + "foundationAccount": "AccountId", + "certifiedSalesAccount": "AccountId", + "discountForDedicatedNodes": "u8" + } + } }, - "NodeCertification": { - "_enum": [ - "Diy", - "Certified" - ] + { + "minmax": [ + 59, + null + ], + "types": { + "ContractState": { + "_enum": { + "Created": null, + "Deleted": null, + "OutOfFunds": null, + "GracePeriod": "u64" + } + } + } }, - "FarmCertification": { - "_enum": [ - "NotCertified", - "Gold" - ] + { + "minmax": [ + 63, + null + ], + "types": { + "Farm": { + "version": "u32", + "id": "u32", + "name": "Vec", + "twinId": "u32", + "pricingPolicyId": "u32", + "certification": "FarmCertification", + "publicIps": "Vec", + "dedicatedFarm": "bool", + "farmingPolicyLimits": "Option" + }, + "FarmingPolicyLimit": { + "farmingPolicyId": "u32", + "cu": "Option", + "su": "Option", + "end": "Option", + "nodeCount": "Option", + "nodeCertification": "bool" + }, + "Node": { + "version": "u32", + "id": "u32", + "farmId": "u32", + "twinId": "u32", + "resources": "Resources", + "location": "Location", + "country": "Vec", + "city": "Vec", + "publicConfig": "Option", + "created": "u64", + "farmingPolicyId": "u32", + "interfaces": "Vec", + "certification": "NodeCertification", + "secureBoot": "bool", + "virtualized": "bool", + "serialNumber": "Vec", + "connectionPrice": "u32" + }, + "NodeCertification": { + "_enum": [ + "Diy", + "Certified" + ] + }, + "FarmCertification": { + "_enum": [ + "NotCertified", + "Gold" + ] + }, + "FarmingPolicy": { + "version": "u32", + "id": "u32", + "name": "Vec", + "cu": "u32", + "su": "u32", + "nu": "u32", + "ipv4": "u32", + "minimalUptime": "u16", + "policyCreated": "BlockNumber", + "policyEnd": "BlockNumber", + "immutable": "bool", + "default": "bool", + "nodeCertification": "NodeCertification", + "farmCertification": "FarmCertification" + }, + "ContractLock": { + "amount_locked": "Balance", + "lock_updated": "u64", + "cycles": "u16" + }, + "DaoProposal": { + "index": "u32", + "description": "Vec", + "link": "Vec" + }, + "DaoVotes": { + "index": "u32", + "threshold": "u32", + "ayes": "Vec", + "nayes": "Vec", + "end": "BlockNumber", + "vetos": "Vec" + }, + "VoteWeight": { + "farmId": "u32", + "weight": "u64" + } + } }, - "FarmingPolicy": { - "version": "u32", - "id": "u32", - "name": "Vec", - "cu": "u32", - "su": "u32", - "nu": "u32", - "ipv4": "u32", - "minimal_uptime": "u16", - "policy_created": "BlockNumber", - "policy_end": "BlockNumber", - "immutable": "bool", - "default": "bool", - "node_certification": "NodeCertification", - "farm_certification": "FarmCertification" + { + "minmax": [ + 105, + null + ], + "types": { + "Contract": { + "version": " u32", + "state": "ContractState", + "contractId": "u64", + "twinId": "u32", + "contractType": "ContractData", + "solutionProviderID": "Option" + } + } }, - "DaoProposal": { - "index": "u32", - "description": "Vec", - "link": "Vec" + { + "minmax": [ + 118, + null + ], + "types": { + "Node": { + "version": "u32", + "id": "u32", + "farmId": "u32", + "twinId": "u32", + "resources": "Resources", + "location": "Location", + "country": "Vec", + "city": "Vec", + "publicConfig": "Option", + "created": "u64", + "farmingPolicyId": "u32", + "interfaces": "Vec", + "certification": "NodeCertification", + "secureBoot": "bool", + "virtualized": "bool", + "serialNumber": "Option>", + "connectionPrice": "u32" + }, + "Location": { + "city": "Vec", + "country": "Vec", + "latitude": "Vec", + "longitude": "Vec" + } + } }, - "DaoVotes": { - "index": "u32", - "threshold": "u32", - "ayes": "Vec", - "nayes": "Vec", - "end": "BlockNumber", - "vetos": "Vec" + { + "minmax": [ + 122, + null + ], + "types": { + "ServiceContract": { + "serviceContractId": "u64", + "serviceTwinId:": "u32", + "consumerTwinId": "u32", + "baseFee": "u64", + "variableFee": "u64", + "metadata": "Vec", + "acceptedByService": "bool", + "acceptedByConsumer": "bool", + "lastBill": "u64", + "state": "ServiceContractState" + }, + "ServiceContractState": { + "_enum": { + "Created": null, + "AgreementReady": null, + "ApprovedByBoth": null + } + }, + "ServiceContractBill": { + "variableAmount": "u64", + "window": "u64", + "metadata": "Vec" + } + } }, - "VoteWeight": { - "farm_id": "u32", - "weight": "u64" + { + "minmax": [ + 124, + null + ], + "types": { + "Twin": { + "id": "u32", + "accountId": "AccountId", + "relay": "Vec", + "entities": "Vec", + "pk": "Vec" + } + } + }, + { + "minmax": [ + 125, + null + ], + "types": { + "NodePower": { + "state": "PowerState", + "target": "Power" + }, + "PowerState": { + "_enum": { + "Up": null, + "Down": "BlockNumber" + } + }, + "Power": { + "_enum": [ + "Up", + "Down" + ] + } + } + }, + { + "minmax": [ + 147, + 147 + ], + "types": { + "Cause": { + "_enum": [ + "CanceledByCollective", + "CanceledByUser", + "OutOfFunds" + ] + } + } + }, + { + "minmax": [ + 148, + null + ], + "types": { + "Cause": { + "_enum": [ + "CanceledByUser", + "OutOfFunds", + "CanceledByCollective" + ] + } + } } - } + ] } - ] -} + } +} \ No newline at end of file