Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix soultion provider ID, deployment data and hash #155

Merged
merged 1 commit into from
Feb 4, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 26 additions & 4 deletions src/mappings/contracts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,14 @@ export async function contractCreated(
contractEvent = contractCreatedEvent.asV105
newNameContract.solutionProviderID = Number(contractEvent.solutionProviderId) || 0
}
if (contractCreatedEvent.isV147) {
contractEvent = contractCreatedEvent.asV147
newNameContract.solutionProviderID = Number(contractEvent.solutionProviderId) || 0
}
if (contractCreatedEvent.isV148) {
contractEvent = contractCreatedEvent.asV148
newNameContract.solutionProviderID = Number(contractEvent.solutionProviderId) || 0
}
await ctx.store.save<NameContract>(newNameContract)
}
else if (contractEvent.contractType.__kind === "NodeContract") {
Expand All @@ -90,7 +98,14 @@ export async function contractCreated(
contractEvent = contractCreatedEvent.asV105
newNodeContract.solutionProviderID = Number(contractEvent.solutionProviderId) || 0
}

if (contractCreatedEvent.isV147) {
contractEvent = contractCreatedEvent.asV147
newNodeContract.solutionProviderID = Number(contractEvent.solutionProviderId) || 0
}
if (contractCreatedEvent.isV148) {
contractEvent = contractCreatedEvent.asV148
newNodeContract.solutionProviderID = Number(contractEvent.solutionProviderId) || 0
}
// Gather IPS and update them
let touchedIps: PublicIp[] = await ctx.store.find(PublicIp, {
where: {
Expand Down Expand Up @@ -131,6 +146,14 @@ export async function contractCreated(
contractEvent = contractCreatedEvent.asV105
newRentContract.solutionProviderID = Number(contractEvent.solutionProviderId) || 0
}
if (contractCreatedEvent.isV147) {
contractEvent = contractCreatedEvent.asV147
newRentContract.solutionProviderID = Number(contractEvent.solutionProviderId) || 0
}
if (contractCreatedEvent.isV148) {
contractEvent = contractCreatedEvent.asV148
newRentContract.solutionProviderID = Number(contractEvent.solutionProviderId) || 0
}
await ctx.store.save<RentContract>(newRentContract)

// Update node to dedicated if it is rented
Expand Down Expand Up @@ -194,9 +217,8 @@ async function updateNodeContract(ctx: Ctx, ctr: any, contract: NodeContract, st
contract.nodeID = parsedNodeContract.nodeId
contract.numberOfPublicIPs = parsedNodeContract.publicIps


contract.deploymentData = validateString(ctx, contract.deploymentData.toString())
contract.deploymentHash = validateString(ctx, contract.deploymentHash.toString())
contract.deploymentData = validateString(ctx, parsedNodeContract.deploymentData.toString())
contract.deploymentHash = validateString(ctx, parsedNodeContract.deploymentHash.toString())

let state = ContractState.OutOfFunds
switch (ctr.state.__kind) {
Expand Down
Loading