Skip to content

Commit

Permalink
Merge pull request #410 from zikriya/develop
Browse files Browse the repository at this point in the history
dynamicDecimals for cabns
  • Loading branch information
zikriya authored May 22, 2024
2 parents a621a24 + 849e3f9 commit 87baef6
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions app/controllers/api/v1/super-admin/currencies.ts
Original file line number Diff line number Diff line change
Expand Up @@ -466,6 +466,7 @@ module.exports = function (router: any) {

let body: any = {};
body.decimals = req.body.decimals;
body.dynamicDecimals = req.body.decimals;
body.updatedAt = new Date();

let cabn = await db.CurrencyAddressesByNetwork.findOneAndUpdate(
Expand Down
1 change: 1 addition & 0 deletions app/helpers/currencyHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ module.exports = {
currency = await db.Currencies.create(currencyBody);
}
req.body.cabns[i].currency = currency._id;
req.body.cabns[i].dynamicDecimals = req.body.cabns[i].decimals;
}
return req;
},
Expand Down
3 changes: 3 additions & 0 deletions app/helpers/multiSwapHelpers/cabnsHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ export const createUserCabn = async (req: any): Promise<any> => {
req.body.isAllowedOnMultiSwap = true;
req.body.isDefault = false;
req.body.priority = 1;
if (req.body.decimals) {
req.body.dynamicDecimals = req.body.decimals;
}
req.body.createdAt = new Date();
req.body.updatedAt = new Date();
return await db.CurrencyAddressesByNetwork.create(req.body);
Expand Down
1 change: 1 addition & 0 deletions app/models/currencyAddressesByNetwork.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ var schema = mongoose.Schema(
isActive: { type: Boolean, default: true },
isNonEVM: { type: Boolean, default: false },
decimals: { type: Number, default: 0 },
dynamicDecimals: { type: Number, default: 0 },
priority: { type: Number, default: 0 },
isNative: { type: Boolean, default: false },
oneInchAddress: { type: String, default: "" },
Expand Down

0 comments on commit 87baef6

Please sign in to comment.