Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adding gas quote tests and bump sor #40

Merged
merged 2 commits into from
Mar 7, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
adding gas quote tests and bump sor
  • Loading branch information
snreynolds committed Mar 4, 2022
commit dc7360faa57bfbabcc3e43979b0c4486f612978a
14 changes: 7 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@
"@types/stats-lite": "^2.2.0",
"@uniswap/router-sdk": "^1.0.5",
"@uniswap/sdk-core": "^3.0.1",
"@uniswap/smart-order-router": "^2.5.19",
"@uniswap/smart-order-router": "^2.5.20",
"@uniswap/token-lists": "^1.0.0-beta.24",
"@uniswap/v3-periphery": "^1.1.0",
"@uniswap/v3-sdk": "^3.7.1",
Expand Down
31 changes: 31 additions & 0 deletions test/integ/quote.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1175,6 +1175,37 @@ describe('quote', function () {
fail(JSON.stringify(err.response.data))
}
})
it(`has quoteGasAdjusted values`, async () => {
const quoteReq: QuoteQueryParams = {
tokenInAddress: erc1.address,
tokenInChainId: chain,
tokenOutAddress: erc2.address,
tokenOutChainId: chain,
amount: await getAmountFromToken(type, erc1, erc2, '1'),
type,
}

const queryParams = qs.stringify(quoteReq)

try {
const response: AxiosResponse<QuoteResponse> = await axios.get<QuoteResponse>(`${API}?${queryParams}`)
const {
data: { quoteDecimals, quoteGasAdjustedDecimals },
status,
} = response

expect(status).to.equal(200)

// check for quotes to be gas adjusted
if (type == 'exactIn') {
expect(parseFloat(quoteGasAdjustedDecimals)).to.be.lessThanOrEqual(parseFloat(quoteDecimals))
} else {
expect(parseFloat(quoteGasAdjustedDecimals)).to.be.greaterThanOrEqual(parseFloat(quoteDecimals))
}
} catch (err) {
fail(JSON.stringify(err.response.data))
}
})
})
}
}
Expand Down