diff --git a/app/interfaces/forgeInterface.ts b/app/interfaces/forgeInterface.ts new file mode 100644 index 0000000..d995d56 --- /dev/null +++ b/app/interfaces/forgeInterface.ts @@ -0,0 +1,30 @@ +export interface Contract { + rpcUrl: string; + contractAddress: string; +} + +export interface WithdrawSigned { + targetTokenAddress: string; + destinationWalletAddress: string; + destinationAmountIn: string; + salt: string; + signatureExpiry: number; + signature: string; +} + +export interface WithdrawSignedAndSwapOneInch { + destinationWalletAddress: string; + destinationAmountIn: string; + destinationAmountOut: string; + targetFoundryTokenAddress: string; + targetTokenAddress: string; + destinationOneInchData: string; + salt: string; + signatureExpiry: number; + signature: string; +} + +export interface DestinationGasEstimationResponse { + gasPriceInNumber: string; + gasPriceInMachine: string; +} diff --git a/app/lib/middlewares/helpers/gasFeeHelpers/gasEstimationHelper.ts b/app/lib/middlewares/helpers/gasFeeHelpers/gasEstimationHelper.ts index 6f37387..7f2c220 100644 --- a/app/lib/middlewares/helpers/gasFeeHelpers/gasEstimationHelper.ts +++ b/app/lib/middlewares/helpers/gasFeeHelpers/gasEstimationHelper.ts @@ -66,7 +66,19 @@ export const isAllowedDynamicGasValues = async ( return item?.isAllowedDynamicGasLimit ? true : false; }; -export const addBuffer = (amount: any): any => { +export const addBuffer = (amount: any, buffer: number): any => { console.log("beForBufferGasLimit", amount?.toString()); - return amount.mul(110).div(100); + buffer = 100 + buffer; + amount = amount.mul(buffer).div(100); + amount = parseInt(amount?.toString()); + console.log("afterBufferGasLimit", amount?.toString(), "buffer", buffer); + return amount; +}; + +export const addBuffer_ = (amount: any, buffer: number): any => { + console.log("beForBufferGasLimit", amount?.toString()); + buffer = 100 + buffer; + amount = amount.mul(buffer).div(100); + console.log("afterBufferGasLimit", amount?.toString(), "buffer", buffer); + return amount; }; diff --git a/app/models/configurations.ts b/app/models/configurations.ts index e6486d6..7b684a2 100644 --- a/app/models/configurations.ts +++ b/app/models/configurations.ts @@ -8,6 +8,8 @@ var schema = mongoose.Schema( slippage: { type: Number, default: 0 }, nativeTokens: [ { + chainId: { type: String, default: "" }, + symbol: { type: String, default: "" }, address: { type: String, default: "" }, wrappedAddress: { type: String, default: "" }, oneInchAddress: { type: String, default: "" },