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", "note": "Offboard Cream",
"pr": 546 "pr": 546
},
{
"note": "Change WooFi gas estimates",
"pr": 551
} }
] ]
}, },

View File

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

View File

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

View File

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