Pass payment in deployment requests

This commit is contained in:
IshaVenikar 2024-10-28 19:06:35 +05:30
parent 519e318190
commit 827213c9e7
3 changed files with 11 additions and 3 deletions

View File

@ -38,6 +38,7 @@ export interface ApplicationDeploymentRequest {
auction?: string;
config: string;
meta: string;
payment: string;
}
export interface ApplicationDeploymentRemovalRequest {

View File

@ -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({

View File

@ -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(