Skip to content

Commit

Permalink
WooFi Gas Estimates (#551)
Browse files Browse the repository at this point in the history
* change gas estimates

* changelog

* remove comments

* fix lerna run lint error
  • Loading branch information
eobbad committed Aug 16, 2022
1 parent 46a7a2e commit 9058839
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 8 deletions.
4 changes: 4 additions & 0 deletions packages/asset-swapper/CHANGELOG.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
{
"note": "Offboard Cream",
"pr": 546
},
{
"note": "Change WooFi gas estimates",
"pr": 551
}
]
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
},
//
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 9058839

Please sign in to comment.