@justin-gee/uniswap-tokamak-hardhat-v3-deploy
Version:
Hardhat plugin for Uniswap V3 solc ver 0.8 deployment
13 lines (10 loc) • 466 B
text/typescript
/* https://github.com/Uniswap/uniswap-v3-periphery/blob/710d51dca94e1feeee9b039a9bc4428ff80f7232/test/shared/tokenSort.ts */
export function compareToken(a: { address: string }, b: { address: string }): -1 | 1 {
return a.address.toLowerCase() < b.address.toLowerCase() ? -1 : 1
}
export function sortedTokens(
a: { address: string },
b: { address: string }
): [typeof a, typeof b] | [typeof b, typeof a] {
return compareToken(a, b) < 0 ? [a, b] : [b, a]
}