Skip to content

Commit

Permalink
apply contract type changes
Browse files Browse the repository at this point in the history
  • Loading branch information
sameh-farouk committed Jan 23, 2024
1 parent 4990fb7 commit 4f784e0
Show file tree
Hide file tree
Showing 9 changed files with 1,092 additions and 552 deletions.
95 changes: 95 additions & 0 deletions db/migrations/1705937053109-Data.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion indexer/chart/Chart.yaml
Original file line number Diff line number Diff line change
@@ -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'
32 changes: 31 additions & 1 deletion indexer/chart/templates/indexer-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,7 @@ data:
"pricingPolicyId": "u32",
"certification": "FarmCertification",
"publicIps": "Vec<PublicIP>",
"dedicatedFarm:": "bool",
"dedicatedFarm": "bool",
"farmingPolicyLimits": "Option<FarmingPolicyLimit>"
},
"FarmingPolicyLimit": {
Expand Down Expand Up @@ -679,6 +679,36 @@ data:
]
}
}
},
{
"minmax": [
147,
147
],
"types": {
"Cause": {
"_enum": [
"CanceledByCollective",
"CanceledByUser",
"OutOfFunds"
]
}
}
},
{
"minmax": [
148,
null
],
"types": {
"Cause": {
"_enum": [
"CanceledByUser",
"OutOfFunds",
"CanceledByCollective"
]
}
}
}
]
}
Expand Down
32 changes: 31 additions & 1 deletion indexer/typesBundle.json
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,7 @@
"pricingPolicyId": "u32",
"certification": "FarmCertification",
"publicIps": "Vec<PublicIP>",
"dedicatedFarm:": "bool",
"dedicatedFarm": "bool",
"farmingPolicyLimits": "Option<FarmingPolicyLimit>"
},
"FarmingPolicyLimit": {
Expand Down Expand Up @@ -676,6 +676,36 @@
]
}
}
},
{
"minmax": [
147,
147
],
"types": {
"Cause": {
"_enum": [
"CanceledByCollective",
"CanceledByUser",
"OutOfFunds"
]
}
}
},
{
"minmax": [
148,
null
],
"types": {
"Cause": {
"_enum": [
"CanceledByUser",
"OutOfFunds",
"CanceledByCollective"
]
}
}
}
]
}
Expand Down
24 changes: 22 additions & 2 deletions src/mappings/contracts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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) {
Expand Down
Loading

0 comments on commit 4f784e0

Please sign in to comment.