WooFi Gas Estimates (#551)

* change gas estimates

* changelog

* remove comments

* fix lerna run lint error
This commit is contained in:
eobbad 2022-08-16 14:10:53 -04:00 committed by GitHub
parent 46a7a2e620
commit 9058839645
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 36 additions and 8 deletions

View File

@ -5,6 +5,10 @@
{
"note": "Offboard Cream",
"pr": 546
},
{
"note": "Change WooFi gas estimates",
"pr": 551
}
]
},

View File

@ -2657,14 +2657,34 @@ export const DEFAULT_GAS_SCHEDULE: Required<GasSchedule> = {
[ERC20BridgeSource.WOOFi]: (fillData?: FillData) => {
const woofiFillData = fillData as WOOFiFillData;
const quoteTokenAddresses = [BSC_TOKENS.USDT, AVALANCHE_TOKENS.nUSDC, FANTOM_TOKENS.USDC, POLYGON_TOKENS.USDC];
if (
const hasQuoteToken =
quoteTokenAddresses.includes(woofiFillData.takerToken) ||
quoteTokenAddresses.includes(woofiFillData.makerToken)
) {
return 500e3;
quoteTokenAddresses.includes(woofiFillData.makerToken);
if (woofiFillData.chainId === ChainId.BSC) {
if (hasQuoteToken) {
return 550e3;
} else {
return 100e4;
}
} else if (woofiFillData.chainId === ChainId.Avalanche) {
if (hasQuoteToken) {
return 300e3;
} else {
return 550e3;
}
} else if (woofiFillData.chainId === ChainId.Polygon) {
if (hasQuoteToken) {
return 500e3;
} else {
return 700e3;
}
} else {
return 100e4;
// Fantom
if (hasQuoteToken) {
return 400e3;
} else {
return 600e3;
}
}
},
//

View File

@ -1371,8 +1371,9 @@ export class SamplerOperations {
makerToken: string,
makerFillAmounts: BigNumber[],
): SourceQuoteOperation<WOOFiFillData> {
const chainId = this.chainId;
return new SamplerContractOperation({
fillData: { poolAddress, takerToken, makerToken },
fillData: { poolAddress, takerToken, makerToken, chainId },
source: ERC20BridgeSource.WOOFi,
contract: this._samplerContract,
function: this._samplerContract.sampleSellsFromWooPP,
@ -1386,8 +1387,9 @@ export class SamplerOperations {
makerToken: string,
makerFillAmounts: BigNumber[],
): SourceQuoteOperation<WOOFiFillData> {
const chainId = this.chainId;
return new SamplerContractOperation({
fillData: { poolAddress, takerToken, makerToken },
fillData: { poolAddress, takerToken, makerToken, chainId },
source: ERC20BridgeSource.WOOFi,
contract: this._samplerContract,
function: this._samplerContract.sampleBuysFromWooPP,

View File

@ -377,6 +377,8 @@ export interface WOOFiFillData extends FillData {
poolAddress: string;
takerToken: string;
makerToken: string;
// Only needed for gas estimation
chainId: ChainId;
}
export interface VelodromeFillData extends FillData {