diff --git a/packages/backend/src/entity/Deployment.ts b/packages/backend/src/entity/Deployment.ts index 5efb28b4..cf0889e8 100644 --- a/packages/backend/src/entity/Deployment.ts +++ b/packages/backend/src/entity/Deployment.ts @@ -38,6 +38,7 @@ export interface ApplicationDeploymentRequest { auction?: string; config: string; meta: string; + payment: string; } export interface ApplicationDeploymentRemovalRequest { diff --git a/packages/backend/src/registry.ts b/packages/backend/src/registry.ts index 9f3b314c..3e35d779 100644 --- a/packages/backend/src/registry.ts +++ b/packages/backend/src/registry.ts @@ -248,6 +248,7 @@ export class Registry { lrn: string, environmentVariables: { [key: string]: string }, dns: string, + payment: string }): Promise<{ applicationDeploymentRequestId: string; applicationDeploymentRequestData: ApplicationDeploymentRequest; @@ -267,6 +268,7 @@ export class Registry { name: `${applicationRecord.attributes.name}@${applicationRecord.attributes.app_version}`, application: `${lrn}@${applicationRecord.attributes.app_version}`, dns: data.dns, + payment: data.payment, // https://git.vdb.to/cerc-io/laconic-registry-cli/commit/129019105dfb93bebcea02fde0ed64d0f8e5983b config: JSON.stringify({ diff --git a/packages/backend/src/service.ts b/packages/backend/src/service.ts index e697b663..b5c57cf5 100644 --- a/packages/backend/src/service.ts +++ b/packages/backend/src/service.ts @@ -648,7 +648,8 @@ export class Service { repository: repoUrl, environmentVariables: environmentVariablesObj, dns: `${newDeployment.project.name}`, - lrn: deployer!.deployerLrn! + lrn: deployer!.deployerLrn!, + payment: data.project.txHash! }); } @@ -660,6 +661,7 @@ export class Service { lrn: deployer!.deployerLrn!, environmentVariables: environmentVariablesObj, dns: `${newDeployment.project.name}-${newDeployment.id}`, + payment: data.project.txHash! }); await this.db.updateDeploymentById(newDeployment.id, { @@ -725,6 +727,7 @@ export class Service { dns: `${newDeployment.project.name}`, auctionId: project.auctionId!, lrn: deployerLrn, + payment: project.txHash! }); } @@ -738,6 +741,7 @@ export class Service { lrn: deployerLrn, environmentVariables: environmentVariablesObj, dns: `${newDeployment.project.name}-${newDeployment.id}`, + payment: project.txHash! }); await this.db.updateDeploymentById(newDeployment.id, { @@ -1342,12 +1346,13 @@ export class Service { } const auction = await this.getAuctionData(project.auctionId); + const maxPrice = Number(auction.maxPrice.quantity) * auction.numProviders; let amountToBeReturned; if (winningDeployersPresent) { - amountToBeReturned = auction.winnerPrice * auction.numProviders; + amountToBeReturned = maxPrice - auction.winnerAddresses.length * Number(auction.winnerPrice.quantity); } else { - amountToBeReturned = auction.maxPrice * auction.numProviders; + amountToBeReturned = maxPrice; } await this.laconicRegistry.sendTokensToAccount(