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

Validation updated for doSwapAndWithdraw api. multiswapNetworkFIBERInformations and swapAndWithdrawTransactions model updated for forge #374

Merged
merged 2 commits into from
Feb 21, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
8 changes: 6 additions & 2 deletions app/helpers/multiSwapHelpers/swapTransactionHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,13 @@ module.exports = {
!req.query.sourceCabnId ||
!req.query.destinationCabnId ||
!req.body.sourceAssetType ||
!req.body.destinationAssetType
!req.body.destinationAssetType ||
!req.body.sourceGasPriceInNumber ||
!req.body.sourceGasPriceInMachine ||
!req.body.destinationGasPriceInNumber ||
!req.body.destinationGasPriceInMachine
) {
throw "swapTxId & sourceNetworkId & destinationNetworkId & sourceCabnId & destinationCabnId & sourceAssetType & destinationAssetType are required.";
throw "swapTxId & sourceNetworkId & destinationNetworkId & sourceCabnId & destinationCabnId & sourceAssetType & destinationAssetType & sourceGasPriceInNumber & sourceGasPriceInMachine & destinationGasPriceInNumber & destinationGasPriceInMachine are required.";
}

if (!mongoose.Types.ObjectId.isValid(req.query.sourceNetworkId)) {
Expand Down
33 changes: 20 additions & 13 deletions app/models/multiswapNetworkFIBERInformations.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,24 @@
'use strict';
var mongoose = require('mongoose');
"use strict";
var mongoose = require("mongoose");

var schema = mongoose.Schema({
rpcUrl: { type: String, default: "" },
fundManager: { type: String, default: "" },
fiberRouter: { type: String, default: "" },
router: { type: String, default: "" },
foundryTokenAddress: { type: String, default: "" },
weth: { type: String, default: "" },
var schema = mongoose.Schema(
{
rpcUrl: { type: String, default: "" },
fundManager: { type: String, default: "" },
fiberRouter: { type: String, default: "" },
router: { type: String, default: "" },
foundryTokenAddress: { type: String, default: "" },
forgeContractAddress: { type: String, default: "" },
weth: { type: String, default: "" },

createdAt: { type: Date, default: new Date() },
updatedAt: { type: Date, default: new Date() },
},{ collection: 'multiswapNetworkFIBERInformations' });
createdAt: { type: Date, default: new Date() },
updatedAt: { type: Date, default: new Date() },
},
{ collection: "multiswapNetworkFIBERInformations" }
);

var multiswapNetworkFIBERInformationsModel = mongoose.model("multiswapNetworkFIBERInformations",schema);
var multiswapNetworkFIBERInformationsModel = mongoose.model(
"multiswapNetworkFIBERInformations",
schema
);
module.exports = multiswapNetworkFIBERInformationsModel;
12 changes: 12 additions & 0 deletions app/models/swapAndWithdrawTransactions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,18 @@ var schema = mongoose.Schema(
settledAmount: { type: String, default: "" },
sourceToken: { type: String, default: "" },
targetToken: { type: String, default: "" },
gasPrices: {
source: {
gasPrice: { type: String, default: "" },
gasPriceInUSD: { type: String, default: "" },
},
destination: {
gasPrice: { type: String, default: "" },
gasPriceInMachine: { type: String, default: "" },
gasPriceInUSD: { type: String, default: "" },
gasLimit: { type: String, default: "" },
},
},
},
{ collection: "swapAndWithdrawTransactions" }
);
Expand Down
Loading