Fix/erc20 sampler/uniswap v2 buys (#2603)
* `@0x/contracts-erc20-bridge-sampler`: Fix `sampleBuysFromUniswapV2()` * fix uniswapV2 buys * redeploy ERC20BridgeSampler to fix Uniswap buys * fix changelog, move artifact to correct dir Co-authored-by: Lawrence Forman <lawrence@0xproject.com>
This commit is contained in:
parent
4fced276c4
commit
f14b6f2ba2
@ -759,7 +759,7 @@ contract ERC20BridgeSampler is
|
||||
uint256 sellAmount = 0;
|
||||
if (didSucceed) {
|
||||
// solhint-disable-next-line indent
|
||||
sellAmount = abi.decode(resultData, (uint256[]))[path.length - 1];
|
||||
sellAmount = abi.decode(resultData, (uint256[]))[0];
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
|
@ -231,12 +231,12 @@ contract TestERC20BridgeSamplerUniswapV2Router01 is
|
||||
require(path.length >= 2, "PATH_TOO_SHORT");
|
||||
_revertIfShouldFail();
|
||||
amounts = new uint256[](path.length);
|
||||
amounts[0] = amountOut;
|
||||
for (uint256 i = 0; i < path.length - 1; ++i) {
|
||||
amounts[i + 1] = LibDeterministicQuotes.getDeterministicBuyQuote(
|
||||
amounts[path.length - 1] = amountOut;
|
||||
for (uint256 i = path.length - 1; i > 0; --i) {
|
||||
amounts[i - 1] = LibDeterministicQuotes.getDeterministicBuyQuote(
|
||||
SALT,
|
||||
path[i - 1],
|
||||
path[i],
|
||||
path[i + 1],
|
||||
amounts[i]
|
||||
);
|
||||
}
|
||||
|
@ -202,8 +202,8 @@ blockchainTests('erc20-bridge-sampler', env => {
|
||||
|
||||
function getDeterministicUniswapV2BuyQuote(path: string[], buyAmount: BigNumber): BigNumber {
|
||||
let sold = buyAmount;
|
||||
for (let i = 0; i < path.length - 1; ++i) {
|
||||
sold = getDeterministicBuyQuote(UNISWAP_V2_SALT, path[i], path[i + 1], sold);
|
||||
for (let i = path.length - 1; i > 0; --i) {
|
||||
sold = getDeterministicBuyQuote(UNISWAP_V2_SALT, path[i - 1], path[i], sold);
|
||||
}
|
||||
return sold;
|
||||
}
|
||||
|
@ -21,7 +21,7 @@
|
||||
"erc20BridgeProxy": "0x8ed95d1746bf1e4dab58d8ed4724f1ef95b20db0",
|
||||
"uniswapBridge": "0x36691c4f426eb8f42f150ebde43069a31cb080ad",
|
||||
"uniswapV2Bridge": "0xdcd6011f4c6b80e470d9487f5871a0cba7c93f48",
|
||||
"erc20BridgeSampler": "0xdfec429f7d87bd9911211bbb3b8b83df0f37ebc7",
|
||||
"erc20BridgeSampler": "0xd8c38704c9937ea3312de29f824b4ad3450a5e61",
|
||||
"kyberBridge": "0x1c29670f7a77f1052d30813a0a4f632c78a02610",
|
||||
"eth2DaiBridge": "0x991c745401d5b5e469b8c3e2cb02c748f08754f1",
|
||||
"chaiBridge": "0x77c31eba23043b9a72d13470f3a3a311344d7438",
|
||||
@ -154,7 +154,7 @@
|
||||
"uniswapBridge": "0x0e85f89f29998df65402391478e5924700c0079d",
|
||||
"uniswapV2Bridge": "0x0000000000000000000000000000000000000000",
|
||||
"eth2DaiBridge": "0x2d47147429b474d2e4f83e658015858a1312ed5b",
|
||||
"erc20BridgeSampler": "0x26215b52c57317b5ce7380d3e289b51c7d237084",
|
||||
"erc20BridgeSampler": "0xccc9769c1a58766e79423a34b2cc5052d65c1983",
|
||||
"kyberBridge": "0xaecfa25920f892b6eb496e1f6e84037f59da7f44",
|
||||
"chaiBridge": "0x0000000000000000000000000000000000000000",
|
||||
"dydxBridge": "0x3be8e59038d8c4e8d8776ca40ef2f024bad95ad1",
|
||||
|
File diff suppressed because one or more lines are too long
Loading…
x
Reference in New Issue
Block a user