Compare commits
8 Commits
@0x/protoc
...
@0x/contra
Author | SHA1 | Date | |
---|---|---|---|
|
7a59b7eafe | ||
|
9e59d41e44 | ||
|
475e6c7bca | ||
|
dbc5a5293e | ||
|
f4bd2bd0d8 | ||
|
f1782a83ba | ||
|
cbade0d558 | ||
|
fe0c26387c |
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@0x/contracts-integrations",
|
||||
"version": "2.7.37",
|
||||
"version": "2.7.39",
|
||||
"private": true,
|
||||
"engines": {
|
||||
"node": ">=6.12"
|
||||
@@ -65,7 +65,7 @@
|
||||
"@0x/contracts-utils": "^4.7.7",
|
||||
"@0x/coordinator-server": "^1.0.5",
|
||||
"@0x/dev-utils": "^4.2.6",
|
||||
"@0x/migrations": "^8.0.3",
|
||||
"@0x/migrations": "^8.0.5",
|
||||
"@0x/order-utils": "^10.4.20",
|
||||
"@0x/protocol-utils": "^1.5.1",
|
||||
"@0x/sol-compiler": "^4.7.2",
|
||||
@@ -93,7 +93,7 @@
|
||||
"typescript": "4.2.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"@0x/asset-swapper": "^6.8.0",
|
||||
"@0x/asset-swapper": "^6.9.1",
|
||||
"@0x/base-contract": "^6.3.2",
|
||||
"@0x/contracts-asset-proxy": "^3.7.10",
|
||||
"@0x/contracts-erc1155": "^2.1.28",
|
||||
@@ -103,7 +103,7 @@
|
||||
"@0x/contracts-multisig": "^4.1.29",
|
||||
"@0x/contracts-staking": "^2.0.36",
|
||||
"@0x/contracts-test-utils": "^5.3.25",
|
||||
"@0x/contracts-zero-ex": "^0.22.1",
|
||||
"@0x/contracts-zero-ex": "^0.22.3",
|
||||
"@0x/subproviders": "^6.5.2",
|
||||
"@0x/types": "^3.3.3",
|
||||
"@0x/typescript-typings": "^5.2.0",
|
||||
|
@@ -1,4 +1,14 @@
|
||||
[
|
||||
{
|
||||
"version": "1.1.5",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Patched votingPower logic",
|
||||
"pr": 214
|
||||
}
|
||||
],
|
||||
"timestamp": 1619825976
|
||||
},
|
||||
{
|
||||
"timestamp": 1619596077,
|
||||
"version": "1.1.4",
|
||||
|
@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
|
||||
|
||||
CHANGELOG
|
||||
|
||||
## v1.1.5 - _April 30, 2021_
|
||||
|
||||
* Patched votingPower logic (#214)
|
||||
|
||||
## v1.1.4 - _April 28, 2021_
|
||||
|
||||
* Dependencies updated
|
||||
|
@@ -30,6 +30,7 @@ interface IZrxTreasury {
|
||||
uint256 votingPeriod;
|
||||
uint256 proposalThreshold;
|
||||
uint256 quorumThreshold;
|
||||
bytes32 defaultPoolId;
|
||||
}
|
||||
|
||||
struct ProposedAction {
|
||||
|
@@ -20,8 +20,6 @@
|
||||
pragma solidity ^0.6.12;
|
||||
pragma experimental ABIEncoderV2;
|
||||
|
||||
import "@0x/contracts-erc20/contracts/src/v06/IERC20TokenV06.sol";
|
||||
import "@0x/contracts-erc20/contracts/src/v06/LibERC20TokenV06.sol";
|
||||
import "@0x/contracts-utils/contracts/src/v06/LibBytesV06.sol";
|
||||
import "@0x/contracts-utils/contracts/src/v06/LibSafeMathV06.sol";
|
||||
import "@0x/contracts-utils/contracts/src/v06/errors/LibRichErrorsV06.sol";
|
||||
@@ -32,7 +30,6 @@ import "./IZrxTreasury.sol";
|
||||
contract ZrxTreasury is
|
||||
IZrxTreasury
|
||||
{
|
||||
using LibERC20TokenV06 for IERC20TokenV06;
|
||||
using LibSafeMathV06 for uint256;
|
||||
using LibRichErrorsV06 for bytes;
|
||||
using LibBytesV06 for bytes;
|
||||
@@ -52,11 +49,9 @@ contract ZrxTreasury is
|
||||
/// @dev Initializes the ZRX treasury and creates the default
|
||||
/// staking pool.
|
||||
/// @param stakingProxy_ The 0x staking proxy contract.
|
||||
/// @param weth_ The WETH token contract.
|
||||
/// @param params Immutable treasury parameters.
|
||||
constructor(
|
||||
IStaking stakingProxy_,
|
||||
IERC20TokenV06 weth_,
|
||||
TreasuryParameters memory params
|
||||
)
|
||||
public
|
||||
@@ -66,15 +61,12 @@ contract ZrxTreasury is
|
||||
"VOTING_PERIOD_TOO_LONG"
|
||||
);
|
||||
stakingProxy = stakingProxy_;
|
||||
DefaultPoolOperator defaultPoolOperator_ = new DefaultPoolOperator(
|
||||
stakingProxy_,
|
||||
weth_
|
||||
);
|
||||
defaultPoolOperator = defaultPoolOperator_;
|
||||
defaultPoolId = defaultPoolOperator_.poolId();
|
||||
votingPeriod = params.votingPeriod;
|
||||
proposalThreshold = params.proposalThreshold;
|
||||
quorumThreshold = params.quorumThreshold;
|
||||
defaultPoolId = params.defaultPoolId;
|
||||
IStaking.Pool memory defaultPool = stakingProxy_.getStakingPool(params.defaultPoolId);
|
||||
defaultPoolOperator = DefaultPoolOperator(defaultPool.operator);
|
||||
}
|
||||
|
||||
// solhint-disable
|
||||
@@ -286,6 +278,12 @@ contract ZrxTreasury is
|
||||
|
||||
// Add voting power for operated staking pools.
|
||||
for (uint256 i = 0; i != operatedPoolIds.length; i++) {
|
||||
for (uint256 j = 0; j != i; j++) {
|
||||
require(
|
||||
operatedPoolIds[i] != operatedPoolIds[j],
|
||||
"getVotingPower/DUPLICATE_POOL_ID"
|
||||
);
|
||||
}
|
||||
IStaking.Pool memory pool = stakingProxy.getStakingPool(operatedPoolIds[i]);
|
||||
require(
|
||||
pool.operator == account,
|
||||
|
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@0x/contracts-treasury",
|
||||
"version": "1.1.4",
|
||||
"version": "1.1.5",
|
||||
"engines": {
|
||||
"node": ">=6.12"
|
||||
},
|
||||
|
@@ -28,6 +28,7 @@ blockchainTests.resets('Treasury governance', env => {
|
||||
votingPeriod: new BigNumber(3).times(stakingConstants.ONE_DAY_IN_SECONDS),
|
||||
proposalThreshold: new BigNumber(100),
|
||||
quorumThreshold: new BigNumber(1000),
|
||||
defaultPoolId: stakingConstants.INITIAL_POOL_ID,
|
||||
};
|
||||
const PROPOSAL_DESCRIPTION = 'A very compelling proposal!';
|
||||
const TREASURY_BALANCE = constants.INITIAL_ERC20_BALANCE;
|
||||
@@ -135,6 +136,16 @@ blockchainTests.resets('Treasury governance', env => {
|
||||
.approve(erc20ProxyContract.address, constants.INITIAL_ERC20_ALLOWANCE)
|
||||
.awaitTransactionSuccessAsync({ from: delegator });
|
||||
|
||||
defaultPoolOperator = await DefaultPoolOperatorContract.deployFrom0xArtifactAsync(
|
||||
artifacts.DefaultPoolOperator,
|
||||
env.provider,
|
||||
env.txDefaults,
|
||||
{ ...artifacts, ...erc20Artifacts },
|
||||
staking.address,
|
||||
weth.address,
|
||||
);
|
||||
defaultPoolId = stakingConstants.INITIAL_POOL_ID;
|
||||
|
||||
const createStakingPoolTx = staking.createStakingPool(stakingConstants.PPM, false);
|
||||
nonDefaultPoolId = await createStakingPoolTx.callAsync({ from: poolOperator });
|
||||
await createStakingPoolTx.awaitTransactionSuccessAsync({ from: poolOperator });
|
||||
@@ -145,9 +156,9 @@ blockchainTests.resets('Treasury governance', env => {
|
||||
env.txDefaults,
|
||||
{ ...artifacts, ...erc20Artifacts },
|
||||
staking.address,
|
||||
weth.address,
|
||||
TREASURY_PARAMS,
|
||||
);
|
||||
|
||||
await zrx.mint(TREASURY_BALANCE).awaitTransactionSuccessAsync();
|
||||
await zrx.transfer(treasury.address, TREASURY_BALANCE).awaitTransactionSuccessAsync();
|
||||
actions = [
|
||||
@@ -166,10 +177,6 @@ blockchainTests.resets('Treasury governance', env => {
|
||||
value: constants.ZERO_AMOUNT,
|
||||
},
|
||||
];
|
||||
|
||||
defaultPoolId = await treasury.defaultPoolId().callAsync();
|
||||
const defaultPoolOperatorAddress = await treasury.defaultPoolOperator().callAsync();
|
||||
defaultPoolOperator = new DefaultPoolOperatorContract(defaultPoolOperatorAddress, env.provider, env.txDefaults);
|
||||
});
|
||||
describe('getVotingPower()', () => {
|
||||
it('Unstaked ZRX has no voting power', async () => {
|
||||
@@ -222,6 +229,19 @@ blockchainTests.resets('Treasury governance', env => {
|
||||
const operatorVotingPower = await treasury.getVotingPower(poolOperator, [nonDefaultPoolId]).callAsync();
|
||||
expect(operatorVotingPower).to.bignumber.equal(TREASURY_PARAMS.proposalThreshold.dividedBy(2));
|
||||
});
|
||||
it('Reverts if given duplicate pool IDs', async () => {
|
||||
await staking.stake(TREASURY_PARAMS.proposalThreshold).awaitTransactionSuccessAsync({ from: delegator });
|
||||
await staking
|
||||
.moveStake(
|
||||
new StakeInfo(StakeStatus.Undelegated),
|
||||
new StakeInfo(StakeStatus.Delegated, nonDefaultPoolId),
|
||||
TREASURY_PARAMS.proposalThreshold,
|
||||
)
|
||||
.awaitTransactionSuccessAsync({ from: delegator });
|
||||
await fastForwardToNextEpochAsync();
|
||||
const tx = treasury.getVotingPower(poolOperator, [nonDefaultPoolId, nonDefaultPoolId]).callAsync();
|
||||
return expect(tx).to.revertWith('getVotingPower/DUPLICATE_POOL_ID');
|
||||
});
|
||||
it('Correctly sums voting power delegated to multiple pools', async () => {
|
||||
await staking
|
||||
.stake(TREASURY_PARAMS.proposalThreshold.times(2))
|
||||
|
@@ -1,4 +1,22 @@
|
||||
[
|
||||
{
|
||||
"timestamp": 1619830995,
|
||||
"version": "0.22.3",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"timestamp": 1619825976,
|
||||
"version": "0.22.2",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"version": "0.22.1",
|
||||
"changes": [
|
||||
@@ -25,6 +43,10 @@
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
},
|
||||
{
|
||||
"note": "BSC Uniswap clones (ApeSwap, CafeSwap, CheeseSwap, JulSwap)",
|
||||
"pr": 208
|
||||
}
|
||||
]
|
||||
},
|
||||
|
@@ -5,6 +5,14 @@ Edit the package's CHANGELOG.json file only.
|
||||
|
||||
CHANGELOG
|
||||
|
||||
## v0.22.3 - _May 1, 2021_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v0.22.2 - _April 30, 2021_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v0.22.1 - _April 28, 2021_
|
||||
|
||||
* bump feature version to 1.2 (#213)
|
||||
@@ -16,6 +24,7 @@ CHANGELOG
|
||||
## v0.21.1 - _April 12, 2021_
|
||||
|
||||
* Dependencies updated
|
||||
* BSC Uniswap clones (ApeSwap, CafeSwap, CheeseSwap, JulSwap) (#208)
|
||||
|
||||
## v0.21.0 - _April 1, 2021_
|
||||
|
||||
|
@@ -37,22 +37,44 @@ contract PancakeSwapFeature is
|
||||
/// @dev Name of this feature.
|
||||
string public constant override FEATURE_NAME = "PancakeSwapFeature";
|
||||
/// @dev Version of this feature.
|
||||
uint256 public immutable override FEATURE_VERSION = _encodeVersion(1, 0, 1);
|
||||
uint256 public immutable override FEATURE_VERSION = _encodeVersion(1, 0, 2);
|
||||
/// @dev WBNB contract.
|
||||
IEtherTokenV06 private immutable WBNB;
|
||||
|
||||
// 0xFF + address of the PancakeSwap factory contract.
|
||||
uint256 constant private FF_PANCAKESWAP_FACTORY = 0xffbcfccbde45ce874adcb698cc183debcf179528120000000000000000000000;
|
||||
// 0xFF + address of the PancakeSwapV2 factory contract.
|
||||
uint256 constant private FF_PANCAKESWAPV2_FACTORY = 0xffca143ce32fe78f1f7019d7d551a6402fc5350c730000000000000000000000;
|
||||
// 0xFF + address of the BakerySwap factory contract.
|
||||
uint256 constant private FF_BAKERYSWAP_FACTORY = 0xff01bf7c66c6bd861915cdaae475042d3c4bae16a70000000000000000000000;
|
||||
// 0xFF + address of the SushiSwap factory contract.
|
||||
uint256 constant private FF_SUSHISWAP_FACTORY = 0xffc35DADB65012eC5796536bD9864eD8773aBc74C40000000000000000000000;
|
||||
// 0xFF + address of the ApeSwap factory contract.
|
||||
uint256 constant private FF_APESWAP_FACTORY = 0xff0841bd0b734e4f5853f0dd8d7ea041c241fb0da60000000000000000000000;
|
||||
// 0xFF + address of the CafeSwap factory contract.
|
||||
uint256 constant private FF_CAFESWAP_FACTORY = 0xff3e708fdbe3ada63fc94f8f61811196f1302137ad0000000000000000000000;
|
||||
// 0xFF + address of the CheeseSwap factory contract.
|
||||
uint256 constant private FF_CHEESESWAP_FACTORY = 0xffdd538e4fd1b69b7863e1f741213276a6cf1efb3b0000000000000000000000;
|
||||
// 0xFF + address of the JulSwap factory contract.
|
||||
uint256 constant private FF_JULSWAP_FACTORY = 0xff553990f2cba90272390f62c5bdb1681ffc8996750000000000000000000000;
|
||||
|
||||
// Init code hash of the PancakeSwap pair contract.
|
||||
uint256 constant private PANCAKESWAP_PAIR_INIT_CODE_HASH = 0xd0d4c4cd0848c93cb4fd1f498d7013ee6bfb25783ea21593d5834f5d250ece66;
|
||||
// Init code hash of the PancakeSwapV2 pair contract.
|
||||
uint256 constant private PANCAKESWAPV2_PAIR_INIT_CODE_HASH = 0x00fb7f630766e6a796048ea87d01acd3068e8ff67d078148a3fa3f4a84f69bd5;
|
||||
// Init code hash of the BakerySwap pair contract.
|
||||
uint256 constant private BAKERYSWAP_PAIR_INIT_CODE_HASH = 0xe2e87433120e32c4738a7d8f3271f3d872cbe16241d67537139158d90bac61d3;
|
||||
// Init code hash of the SushiSwap pair contract.
|
||||
uint256 constant private SUSHISWAP_PAIR_INIT_CODE_HASH = 0xe18a34eb0e04b04f7a0ac29a6e80748dca96319b42c54d679cb821dca90c6303;
|
||||
// Init code hash of the ApeSwap pair contract.
|
||||
uint256 constant private APESWAP_PAIR_INIT_CODE_HASH = 0xf4ccce374816856d11f00e4069e7cada164065686fbef53c6167a63ec2fd8c5b;
|
||||
// Init code hash of the CafeSwap pair contract.
|
||||
uint256 constant private CAFESWAP_PAIR_INIT_CODE_HASH = 0x90bcdb5d0bf0e8db3852b0b7d7e05cc8f7c6eb6d511213c5ba02d1d1dbeda8d3;
|
||||
// Init code hash of the CheeseSwap pair contract.
|
||||
uint256 constant private CHEESESWAP_PAIR_INIT_CODE_HASH = 0xf52c5189a89e7ca2ef4f19f2798e3900fba7a316de7cef6c5a9446621ba86286;
|
||||
// Init code hash of the JulSwap pair contract.
|
||||
uint256 constant private JULSWAP_PAIR_INIT_CODE_HASH = 0xb1e98e21a5335633815a8cfb3b580071c2e4561c50afd57a8746def9ed890b18;
|
||||
|
||||
// Mask of the lower 20 bytes of a bytes32.
|
||||
uint256 constant private ADDRESS_MASK = 0x000000000000000000000000ffffffffffffffffffffffffffffffffffffffff;
|
||||
// BNB pseudo-token address.
|
||||
@@ -258,7 +280,7 @@ contract PancakeSwapFeature is
|
||||
|
||||
// Call pair.swap()
|
||||
switch mload(0xA20) // fork
|
||||
case 1 {
|
||||
case 2 {
|
||||
mstore(0xB00, BAKERYSWAP_PAIR_SWAP_CALL_SELECTOR_32)
|
||||
}
|
||||
default {
|
||||
@@ -352,15 +374,40 @@ contract PancakeSwapFeature is
|
||||
mstore(0xB35, PANCAKESWAP_PAIR_INIT_CODE_HASH)
|
||||
}
|
||||
case 1 {
|
||||
mstore(0xB00, FF_PANCAKESWAPV2_FACTORY)
|
||||
mstore(0xB15, salt)
|
||||
mstore(0xB35, PANCAKESWAPV2_PAIR_INIT_CODE_HASH)
|
||||
}
|
||||
case 2 {
|
||||
mstore(0xB00, FF_BAKERYSWAP_FACTORY)
|
||||
mstore(0xB15, salt)
|
||||
mstore(0xB35, BAKERYSWAP_PAIR_INIT_CODE_HASH)
|
||||
}
|
||||
default {
|
||||
case 3 {
|
||||
mstore(0xB00, FF_SUSHISWAP_FACTORY)
|
||||
mstore(0xB15, salt)
|
||||
mstore(0xB35, SUSHISWAP_PAIR_INIT_CODE_HASH)
|
||||
}
|
||||
case 4 {
|
||||
mstore(0xB00, FF_APESWAP_FACTORY)
|
||||
mstore(0xB15, salt)
|
||||
mstore(0xB35, APESWAP_PAIR_INIT_CODE_HASH)
|
||||
}
|
||||
case 5 {
|
||||
mstore(0xB00, FF_CAFESWAP_FACTORY)
|
||||
mstore(0xB15, salt)
|
||||
mstore(0xB35, CAFESWAP_PAIR_INIT_CODE_HASH)
|
||||
}
|
||||
case 6 {
|
||||
mstore(0xB00, FF_CHEESESWAP_FACTORY)
|
||||
mstore(0xB15, salt)
|
||||
mstore(0xB35, CHEESESWAP_PAIR_INIT_CODE_HASH)
|
||||
}
|
||||
default {
|
||||
mstore(0xB00, FF_JULSWAP_FACTORY)
|
||||
mstore(0xB15, salt)
|
||||
mstore(0xB35, JULSWAP_PAIR_INIT_CODE_HASH)
|
||||
}
|
||||
pair := and(ADDRESS_MASK, keccak256(0xB00, 0x55))
|
||||
}
|
||||
|
||||
|
@@ -23,16 +23,21 @@ pragma experimental ABIEncoderV2;
|
||||
import "@0x/contracts-erc20/contracts/src/v06/IERC20TokenV06.sol";
|
||||
|
||||
|
||||
/// @dev VIP PancakeSwap/BakerySwap/SushiSwap fill functions.
|
||||
/// @dev VIP PancakeSwap (and forks) fill functions.
|
||||
interface IPancakeSwapFeature {
|
||||
|
||||
enum ProtocolFork {
|
||||
PancakeSwap,
|
||||
PancakeSwapV2,
|
||||
BakerySwap,
|
||||
SushiSwap
|
||||
SushiSwap,
|
||||
ApeSwap,
|
||||
CafeSwap,
|
||||
CheeseSwap,
|
||||
JulSwap
|
||||
}
|
||||
|
||||
/// @dev Efficiently sell directly to PancakeSwap/BakerySwap/Sushiswap.
|
||||
/// @dev Efficiently sell directly to PancakeSwap (and forks).
|
||||
/// @param tokens Sell path.
|
||||
/// @param sellAmount of `tokens[0]` Amount to sell.
|
||||
/// @param minBuyAmount Minimum amount of `tokens[-1]` to buy.
|
||||
|
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@0x/contracts-zero-ex",
|
||||
"version": "0.22.1",
|
||||
"version": "0.22.3",
|
||||
"engines": {
|
||||
"node": ">=6.12"
|
||||
},
|
||||
|
@@ -1,4 +1,23 @@
|
||||
[
|
||||
{
|
||||
"version": "6.9.1",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Temporarily remove PancakeV2 and BakerySwap from VIP"
|
||||
}
|
||||
],
|
||||
"timestamp": 1619830995
|
||||
},
|
||||
{
|
||||
"version": "6.9.0",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Remove conflicting Kyber reserve",
|
||||
"pr": 216
|
||||
}
|
||||
],
|
||||
"timestamp": 1619825976
|
||||
},
|
||||
{
|
||||
"version": "6.8.0",
|
||||
"changes": [
|
||||
@@ -38,6 +57,10 @@
|
||||
{
|
||||
"note": "Support `Ropsten` network",
|
||||
"pr": 203
|
||||
},
|
||||
{
|
||||
"note": "BSC Uniswap clones (ApeSwap, CafeSwap, CheeseSwap, JulSwap), Saddle BTC pool, Curve gas schedule",
|
||||
"pr": 208
|
||||
}
|
||||
],
|
||||
"timestamp": 1618592834
|
||||
|
@@ -5,6 +5,14 @@ Edit the package's CHANGELOG.json file only.
|
||||
|
||||
CHANGELOG
|
||||
|
||||
## v6.9.1 - _May 1, 2021_
|
||||
|
||||
* Temporarily remove PancakeV2 and BakerySwap from VIP
|
||||
|
||||
## v6.9.0 - _April 30, 2021_
|
||||
|
||||
* Remove conflicting Kyber reserve (#216)
|
||||
|
||||
## v6.8.0 - _April 28, 2021_
|
||||
|
||||
* Prune paths which cannot improve the best path (#183)
|
||||
@@ -21,6 +29,7 @@ CHANGELOG
|
||||
## v6.6.0 - _April 16, 2021_
|
||||
|
||||
* Support `Ropsten` network (#203)
|
||||
* BSC Uniswap clones (ApeSwap, CafeSwap, CheeseSwap, JulSwap), Saddle BTC pool, Curve gas schedule (#208)
|
||||
|
||||
## v6.5.3 - _April 14, 2021_
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@0x/asset-swapper",
|
||||
"version": "6.8.0",
|
||||
"version": "6.9.1",
|
||||
"engines": {
|
||||
"node": ">=6.12"
|
||||
},
|
||||
@@ -62,7 +62,7 @@
|
||||
"@0x/contract-addresses": "^6.0.0",
|
||||
"@0x/contract-wrappers": "^13.16.0",
|
||||
"@0x/contracts-erc20": "^3.3.7",
|
||||
"@0x/contracts-zero-ex": "^0.22.1",
|
||||
"@0x/contracts-zero-ex": "^0.22.3",
|
||||
"@0x/dev-utils": "^4.2.6",
|
||||
"@0x/json-schemas": "^6.1.2",
|
||||
"@0x/protocol-utils": "^1.5.1",
|
||||
@@ -97,7 +97,7 @@
|
||||
"@0x/contracts-test-utils": "^5.3.25",
|
||||
"@0x/contracts-utils": "^4.7.7",
|
||||
"@0x/mesh-rpc-client": "^9.4.2",
|
||||
"@0x/migrations": "^8.0.3",
|
||||
"@0x/migrations": "^8.0.5",
|
||||
"@0x/sol-compiler": "^4.7.2",
|
||||
"@0x/subproviders": "^6.5.2",
|
||||
"@0x/ts-doc-gen": "^0.0.28",
|
||||
|
@@ -65,7 +65,18 @@ import {
|
||||
// tslint:disable-next-line:custom-no-magic-numbers
|
||||
const MAX_UINT256 = new BigNumber(2).pow(256).minus(1);
|
||||
const { NULL_ADDRESS, NULL_BYTES, ZERO_AMOUNT } = constants;
|
||||
const PANCAKE_SWAP_FORKS = [ERC20BridgeSource.PancakeSwap, ERC20BridgeSource.BakerySwap, ERC20BridgeSource.SushiSwap];
|
||||
|
||||
// use the same order in IPancakeSwapFeature.sol
|
||||
const PANCAKE_SWAP_FORKS = [
|
||||
ERC20BridgeSource.PancakeSwap,
|
||||
ERC20BridgeSource.PancakeSwapV2,
|
||||
ERC20BridgeSource.BakerySwap,
|
||||
ERC20BridgeSource.SushiSwap,
|
||||
ERC20BridgeSource.ApeSwap,
|
||||
ERC20BridgeSource.CafeSwap,
|
||||
ERC20BridgeSource.CheeseSwap,
|
||||
ERC20BridgeSource.JulSwap,
|
||||
];
|
||||
const DUMMY_WETH_CONTRACT = new WETH9Contract(NULL_ADDRESS, {
|
||||
sendAsync(): void {
|
||||
return;
|
||||
@@ -186,8 +197,14 @@ export class ExchangeProxySwapQuoteConsumer implements SwapQuoteConsumerBase {
|
||||
this.chainId === ChainId.BSC &&
|
||||
isDirectSwapCompatible(quote, optsWithDefaults, [
|
||||
ERC20BridgeSource.PancakeSwap,
|
||||
ERC20BridgeSource.BakerySwap,
|
||||
// Temporarily removed until latest PancakeSwap VIP has been deployed
|
||||
// ERC20BridgeSource.PancakeSwapV2,
|
||||
// ERC20BridgeSource.BakerySwap,
|
||||
ERC20BridgeSource.SushiSwap,
|
||||
ERC20BridgeSource.ApeSwap,
|
||||
ERC20BridgeSource.CafeSwap,
|
||||
ERC20BridgeSource.CheeseSwap,
|
||||
ERC20BridgeSource.JulSwap,
|
||||
])
|
||||
) {
|
||||
const source = slippedOrders[0].source;
|
||||
|
@@ -2,12 +2,17 @@ import { ChainId } from '@0x/contract-addresses';
|
||||
import { BigNumber, NULL_BYTES } from '@0x/utils';
|
||||
|
||||
import {
|
||||
APESWAP_ROUTER_BY_CHAIN_ID,
|
||||
BAKERYSWAP_ROUTER_BY_CHAIN_ID,
|
||||
BELT_BSC_INFOS,
|
||||
CAFESWAP_ROUTER_BY_CHAIN_ID,
|
||||
CHEESESWAP_ROUTER_BY_CHAIN_ID,
|
||||
COMPONENT_POOLS_BY_CHAIN_ID,
|
||||
CRYPTO_COM_ROUTER_BY_CHAIN_ID,
|
||||
CURVE_MAINNET_INFOS,
|
||||
ELLIPSIS_BSC_INFOS,
|
||||
JULSWAP_ROUTER_BY_CHAIN_ID,
|
||||
KYBER_BANNED_RESERVES,
|
||||
KYBER_BRIDGED_LIQUIDITY_PREFIX,
|
||||
KYBER_DMM_ROUTER_BY_CHAIN_ID,
|
||||
MAX_DODOV2_POOLS_QUERIED,
|
||||
@@ -15,7 +20,7 @@ import {
|
||||
NERVE_BSC_INFOS,
|
||||
NULL_ADDRESS,
|
||||
PANCAKESWAP_ROUTER_BY_CHAIN_ID,
|
||||
PANCAKESWAP_V2_ROUTER_BY_CHAIN_ID,
|
||||
PANCAKESWAPV2_ROUTER_BY_CHAIN_ID,
|
||||
SADDLE_MAINNET_INFOS,
|
||||
SHELL_POOLS_BY_CHAIN_ID,
|
||||
SMOOTHY_BSC_INFOS,
|
||||
@@ -32,7 +37,11 @@ import { CurveInfo, ERC20BridgeSource } from './types';
|
||||
* @param reserveId Kyber reserveId
|
||||
*/
|
||||
export function isAllowedKyberReserveId(reserveId: string): boolean {
|
||||
return reserveId !== NULL_BYTES && !reserveId.startsWith(KYBER_BRIDGED_LIQUIDITY_PREFIX);
|
||||
return (
|
||||
reserveId !== NULL_BYTES &&
|
||||
!reserveId.startsWith(KYBER_BRIDGED_LIQUIDITY_PREFIX) &&
|
||||
!KYBER_BANNED_RESERVES.includes(reserveId)
|
||||
);
|
||||
}
|
||||
|
||||
// tslint:disable-next-line: completed-docs ban-types
|
||||
@@ -253,9 +262,13 @@ export function uniswapV2LikeRouterAddress(
|
||||
| ERC20BridgeSource.SushiSwap
|
||||
| ERC20BridgeSource.CryptoCom
|
||||
| ERC20BridgeSource.PancakeSwap
|
||||
| ERC20BridgeSource.PancakeSwapV2
|
||||
| ERC20BridgeSource.BakerySwap
|
||||
| ERC20BridgeSource.KyberDmm
|
||||
| ERC20BridgeSource.PancakeSwapV2,
|
||||
| ERC20BridgeSource.ApeSwap
|
||||
| ERC20BridgeSource.CafeSwap
|
||||
| ERC20BridgeSource.CheeseSwap
|
||||
| ERC20BridgeSource.JulSwap,
|
||||
): string {
|
||||
switch (source) {
|
||||
case ERC20BridgeSource.UniswapV2:
|
||||
@@ -266,12 +279,20 @@ export function uniswapV2LikeRouterAddress(
|
||||
return CRYPTO_COM_ROUTER_BY_CHAIN_ID[chainId];
|
||||
case ERC20BridgeSource.PancakeSwap:
|
||||
return PANCAKESWAP_ROUTER_BY_CHAIN_ID[chainId];
|
||||
case ERC20BridgeSource.PancakeSwapV2:
|
||||
return PANCAKESWAPV2_ROUTER_BY_CHAIN_ID[chainId];
|
||||
case ERC20BridgeSource.BakerySwap:
|
||||
return BAKERYSWAP_ROUTER_BY_CHAIN_ID[chainId];
|
||||
case ERC20BridgeSource.KyberDmm:
|
||||
return KYBER_DMM_ROUTER_BY_CHAIN_ID[chainId];
|
||||
case ERC20BridgeSource.PancakeSwapV2:
|
||||
return PANCAKESWAP_V2_ROUTER_BY_CHAIN_ID[chainId];
|
||||
case ERC20BridgeSource.ApeSwap:
|
||||
return APESWAP_ROUTER_BY_CHAIN_ID[chainId];
|
||||
case ERC20BridgeSource.CafeSwap:
|
||||
return CAFESWAP_ROUTER_BY_CHAIN_ID[chainId];
|
||||
case ERC20BridgeSource.CheeseSwap:
|
||||
return CHEESESWAP_ROUTER_BY_CHAIN_ID[chainId];
|
||||
case ERC20BridgeSource.JulSwap:
|
||||
return JULSWAP_ROUTER_BY_CHAIN_ID[chainId];
|
||||
default:
|
||||
throw new Error(`Unknown UniswapV2 like source ${source}`);
|
||||
}
|
||||
|
@@ -107,9 +107,13 @@ export const SELL_SOURCE_FILTER_BY_CHAIN_ID = valueByChainId<SourceFilters>(
|
||||
ERC20BridgeSource.MultiHop,
|
||||
ERC20BridgeSource.Nerve,
|
||||
ERC20BridgeSource.PancakeSwap,
|
||||
ERC20BridgeSource.PancakeSwapV2,
|
||||
ERC20BridgeSource.SushiSwap,
|
||||
ERC20BridgeSource.Smoothy,
|
||||
ERC20BridgeSource.PancakeSwapV2,
|
||||
ERC20BridgeSource.ApeSwap,
|
||||
ERC20BridgeSource.CafeSwap,
|
||||
ERC20BridgeSource.CheeseSwap,
|
||||
ERC20BridgeSource.JulSwap,
|
||||
]),
|
||||
},
|
||||
|
||||
@@ -169,9 +173,13 @@ export const BUY_SOURCE_FILTER_BY_CHAIN_ID = valueByChainId<SourceFilters>(
|
||||
ERC20BridgeSource.MultiHop,
|
||||
ERC20BridgeSource.Nerve,
|
||||
ERC20BridgeSource.PancakeSwap,
|
||||
ERC20BridgeSource.PancakeSwapV2,
|
||||
ERC20BridgeSource.SushiSwap,
|
||||
ERC20BridgeSource.Smoothy,
|
||||
ERC20BridgeSource.PancakeSwapV2,
|
||||
ERC20BridgeSource.ApeSwap,
|
||||
ERC20BridgeSource.CafeSwap,
|
||||
ERC20BridgeSource.CheeseSwap,
|
||||
ERC20BridgeSource.JulSwap,
|
||||
]),
|
||||
},
|
||||
new SourceFilters([]),
|
||||
@@ -478,147 +486,147 @@ export const CURVE_MAINNET_INFOS: { [name: string]: CurveInfo } = {
|
||||
[CURVE_POOLS.compound]: createCurveExchangeUnderlyingPool({
|
||||
tokens: [MAINNET_TOKENS.DAI, MAINNET_TOKENS.USDC],
|
||||
pool: CURVE_POOLS.compound,
|
||||
gasSchedule: 597e3,
|
||||
gasSchedule: 587e3,
|
||||
}),
|
||||
[CURVE_POOLS.PAX]: createCurveExchangeUnderlyingPool({
|
||||
tokens: [MAINNET_TOKENS.DAI, MAINNET_TOKENS.USDC, MAINNET_TOKENS.USDT, MAINNET_TOKENS.PAX],
|
||||
pool: CURVE_POOLS.PAX,
|
||||
gasSchedule: 752e3,
|
||||
gasSchedule: 742e3,
|
||||
}),
|
||||
[CURVE_POOLS.sUSD]: createCurveExchangeUnderlyingPool({
|
||||
tokens: [MAINNET_TOKENS.DAI, MAINNET_TOKENS.USDC, MAINNET_TOKENS.USDT, MAINNET_TOKENS.sUSD],
|
||||
pool: CURVE_POOLS.sUSD,
|
||||
gasSchedule: 312e3,
|
||||
gasSchedule: 302e3,
|
||||
}),
|
||||
[CURVE_POOLS.renBTC]: createCurveExchangePool({
|
||||
tokens: [MAINNET_TOKENS.RenBTC, MAINNET_TOKENS.WBTC],
|
||||
pool: CURVE_POOLS.renBTC,
|
||||
gasSchedule: 181e3,
|
||||
gasSchedule: 171e3,
|
||||
}),
|
||||
[CURVE_POOLS.sBTC]: createCurveExchangePool({
|
||||
tokens: [MAINNET_TOKENS.RenBTC, MAINNET_TOKENS.WBTC, MAINNET_TOKENS.sBTC],
|
||||
pool: CURVE_POOLS.sBTC,
|
||||
gasSchedule: 337e3,
|
||||
gasSchedule: 327e3,
|
||||
}),
|
||||
[CURVE_POOLS.HBTC]: createCurveExchangePool({
|
||||
tokens: [MAINNET_TOKENS.hBTC, MAINNET_TOKENS.WBTC],
|
||||
pool: CURVE_POOLS.HBTC,
|
||||
gasSchedule: 220e3,
|
||||
gasSchedule: 210e3,
|
||||
}),
|
||||
[CURVE_POOLS.TRI]: createCurveExchangePool({
|
||||
tokens: [MAINNET_TOKENS.DAI, MAINNET_TOKENS.USDC, MAINNET_TOKENS.USDT],
|
||||
pool: CURVE_POOLS.TRI,
|
||||
gasSchedule: 186e3,
|
||||
gasSchedule: 176e3,
|
||||
}),
|
||||
[CURVE_POOLS.GUSD]: createCurveMetaTriPool({
|
||||
token: MAINNET_TOKENS.GUSD,
|
||||
pool: CURVE_POOLS.GUSD,
|
||||
gasSchedule: 421e3,
|
||||
gasSchedule: 411e3,
|
||||
}),
|
||||
[CURVE_POOLS.HUSD]: createCurveMetaTriPool({
|
||||
token: MAINNET_TOKENS.HUSD,
|
||||
pool: CURVE_POOLS.HUSD,
|
||||
gasSchedule: 406e3,
|
||||
gasSchedule: 396e3,
|
||||
}),
|
||||
[CURVE_POOLS.USDN]: createCurveMetaTriPool({
|
||||
token: MAINNET_TOKENS.USDN,
|
||||
pool: CURVE_POOLS.USDN,
|
||||
gasSchedule: 408e3,
|
||||
gasSchedule: 398e3,
|
||||
}),
|
||||
[CURVE_POOLS.mUSD]: createCurveMetaTriPool({
|
||||
token: MAINNET_TOKENS.mUSD,
|
||||
pool: CURVE_POOLS.mUSD,
|
||||
gasSchedule: 395e3,
|
||||
gasSchedule: 385e3,
|
||||
}),
|
||||
[CURVE_POOLS.dUSD]: createCurveMetaTriPool({
|
||||
token: MAINNET_TOKENS.dUSD,
|
||||
pool: CURVE_POOLS.dUSD,
|
||||
gasSchedule: 381e3,
|
||||
gasSchedule: 371e3,
|
||||
}),
|
||||
[CURVE_POOLS.tBTC]: createCurveMetaTriBtcPool({
|
||||
token: MAINNET_TOKENS.tBTC,
|
||||
pool: CURVE_POOLS.tBTC,
|
||||
gasSchedule: 492e3,
|
||||
gasSchedule: 482e3,
|
||||
}),
|
||||
[CURVE_POOLS.pBTC]: createCurveMetaTriBtcPool({
|
||||
token: MAINNET_TOKENS.pBTC,
|
||||
pool: CURVE_POOLS.pBTC,
|
||||
gasSchedule: 513e3,
|
||||
gasSchedule: 503e3,
|
||||
}),
|
||||
[CURVE_POOLS.bBTC]: createCurveMetaTriBtcPool({
|
||||
token: MAINNET_TOKENS.bBTC,
|
||||
pool: CURVE_POOLS.bBTC,
|
||||
gasSchedule: 507e3,
|
||||
gasSchedule: 497e3,
|
||||
}),
|
||||
[CURVE_POOLS.oBTC]: createCurveMetaTriBtcPool({
|
||||
token: MAINNET_TOKENS.oBTC,
|
||||
pool: CURVE_POOLS.oBTC,
|
||||
gasSchedule: 498e3,
|
||||
gasSchedule: 488e3,
|
||||
}),
|
||||
[CURVE_POOLS.UST]: createCurveMetaTriPool({
|
||||
token: MAINNET_TOKENS.UST,
|
||||
pool: CURVE_POOLS.UST,
|
||||
gasSchedule: 350e3,
|
||||
gasSchedule: 340e3,
|
||||
}),
|
||||
[CURVE_POOLS.eurs]: createCurveExchangePool({
|
||||
tokens: [MAINNET_TOKENS.EURS, MAINNET_TOKENS.sEUR],
|
||||
pool: CURVE_POOLS.eurs,
|
||||
gasSchedule: 330e3,
|
||||
gasSchedule: 320e3,
|
||||
}),
|
||||
[CURVE_POOLS.aave]: createCurveExchangeUnderlyingPool({
|
||||
tokens: [MAINNET_TOKENS.DAI, MAINNET_TOKENS.USDC, MAINNET_TOKENS.USDT],
|
||||
pool: CURVE_POOLS.aave,
|
||||
gasSchedule: 590e3,
|
||||
gasSchedule: 580e3,
|
||||
}),
|
||||
[CURVE_POOLS.aave]: createCurveExchangePool({
|
||||
tokens: [MAINNET_TOKENS.aDAI, MAINNET_TOKENS.aUSDC, MAINNET_TOKENS.aUSDT],
|
||||
pool: CURVE_POOLS.aave,
|
||||
gasSchedule: 590e3,
|
||||
gasSchedule: 580e3,
|
||||
}),
|
||||
[CURVE_POOLS.saave]: createCurveExchangeUnderlyingPool({
|
||||
tokens: [MAINNET_TOKENS.DAI, MAINNET_TOKENS.sUSD],
|
||||
pool: CURVE_POOLS.saave,
|
||||
gasSchedule: 590e3,
|
||||
gasSchedule: 580e3,
|
||||
}),
|
||||
[CURVE_POOLS.saave]: createCurveExchangePool({
|
||||
tokens: [MAINNET_TOKENS.aDAI, MAINNET_TOKENS.aSUSD],
|
||||
pool: CURVE_POOLS.saave,
|
||||
gasSchedule: 590e3,
|
||||
gasSchedule: 580e3,
|
||||
}),
|
||||
[CURVE_POOLS.USDP]: createCurveMetaTriPool({
|
||||
token: MAINNET_TOKENS.USDP,
|
||||
pool: CURVE_POOLS.USDP,
|
||||
gasSchedule: 384e3,
|
||||
gasSchedule: 374e3,
|
||||
}),
|
||||
[CURVE_POOLS.ib]: createCurveExchangeUnderlyingPool({
|
||||
tokens: [MAINNET_TOKENS.DAI, MAINNET_TOKENS.USDC, MAINNET_TOKENS.USDT],
|
||||
pool: CURVE_POOLS.ib,
|
||||
gasSchedule: 656e3,
|
||||
gasSchedule: 646e3,
|
||||
}),
|
||||
[CURVE_POOLS.link]: createCurveExchangePool({
|
||||
tokens: [MAINNET_TOKENS.LINK, MAINNET_TOKENS.sLINK],
|
||||
pool: CURVE_POOLS.link,
|
||||
gasSchedule: 329e3,
|
||||
gasSchedule: 319e3,
|
||||
}),
|
||||
[CURVE_POOLS.TUSD]: createCurveMetaTriPool({
|
||||
token: MAINNET_TOKENS.TUSD,
|
||||
pool: CURVE_POOLS.TUSD,
|
||||
gasSchedule: 414e3,
|
||||
gasSchedule: 404e3,
|
||||
}),
|
||||
[CURVE_POOLS.STABLEx]: createCurveMetaTriPool({
|
||||
token: MAINNET_TOKENS.STABLEx,
|
||||
pool: CURVE_POOLS.STABLEx,
|
||||
gasSchedule: 407e3,
|
||||
gasSchedule: 397e3,
|
||||
}),
|
||||
[CURVE_POOLS.alUSD]: createCurveMetaTriPool({
|
||||
token: MAINNET_TOKENS.alUSD,
|
||||
pool: CURVE_POOLS.alUSD,
|
||||
gasSchedule: 397e3,
|
||||
gasSchedule: 387e3,
|
||||
}),
|
||||
[CURVE_POOLS.FRAX]: createCurveMetaTriPool({
|
||||
token: MAINNET_TOKENS.FRAX,
|
||||
pool: CURVE_POOLS.FRAX,
|
||||
gasSchedule: 397e3,
|
||||
gasSchedule: 387e3,
|
||||
}),
|
||||
};
|
||||
|
||||
@@ -626,7 +634,7 @@ export const SWERVE_MAINNET_INFOS: { [name: string]: CurveInfo } = {
|
||||
[SWERVE_POOLS.y]: createCurveExchangePool({
|
||||
tokens: [MAINNET_TOKENS.DAI, MAINNET_TOKENS.USDC, MAINNET_TOKENS.USDT, MAINNET_TOKENS.TUSD],
|
||||
pool: SWERVE_POOLS.y,
|
||||
gasSchedule: 150e3,
|
||||
gasSchedule: 140e3,
|
||||
}),
|
||||
};
|
||||
|
||||
@@ -634,22 +642,22 @@ export const SNOWSWAP_MAINNET_INFOS: { [name: string]: CurveInfo } = {
|
||||
[SNOWSWAP_POOLS.yUSD]: createCurveExchangePool({
|
||||
tokens: [MAINNET_TOKENS.yUSD, MAINNET_TOKENS.ybCRV],
|
||||
pool: SNOWSWAP_POOLS.yUSD,
|
||||
gasSchedule: 1000e3,
|
||||
gasSchedule: 990e3,
|
||||
}),
|
||||
[SNOWSWAP_POOLS.yUSD]: createCurveExchangeUnderlyingPool({
|
||||
tokens: [MAINNET_TOKENS.yCRV, MAINNET_TOKENS.bCRV],
|
||||
pool: SNOWSWAP_POOLS.yUSD,
|
||||
gasSchedule: 1000e3,
|
||||
gasSchedule: 990e3,
|
||||
}),
|
||||
[SNOWSWAP_POOLS.yVault]: createCurveExchangePool({
|
||||
tokens: [MAINNET_TOKENS.yDAI, MAINNET_TOKENS.yUSDC, MAINNET_TOKENS.yUSDT, MAINNET_TOKENS.yTUSD],
|
||||
pool: SNOWSWAP_POOLS.yVault,
|
||||
gasSchedule: 1500e3,
|
||||
gasSchedule: 1490e3,
|
||||
}),
|
||||
[SNOWSWAP_POOLS.eth]: createCurveExchangePool({
|
||||
tokens: [MAINNET_TOKENS.WETH, MAINNET_TOKENS.vETH, MAINNET_TOKENS.ankrETH, MAINNET_TOKENS.crETH],
|
||||
pool: SNOWSWAP_POOLS.eth,
|
||||
gasSchedule: 1000e3,
|
||||
gasSchedule: 990e3,
|
||||
}),
|
||||
};
|
||||
|
||||
@@ -657,7 +665,7 @@ export const BELT_BSC_INFOS: { [name: string]: CurveInfo } = {
|
||||
[BELT_POOLS.vPool]: createCurveExchangeUnderlyingPool({
|
||||
tokens: [BSC_TOKENS.DAI, BSC_TOKENS.USDC, BSC_TOKENS.USDT, BSC_TOKENS.BUSD],
|
||||
pool: BELT_POOLS.vPool,
|
||||
gasSchedule: 4500e3,
|
||||
gasSchedule: 4490e3,
|
||||
}),
|
||||
};
|
||||
|
||||
@@ -665,7 +673,7 @@ export const ELLIPSIS_BSC_INFOS: { [name: string]: CurveInfo } = {
|
||||
[ELLIPSIS_POOLS.threePool]: createCurveExchangePool({
|
||||
tokens: [BSC_TOKENS.BUSD, BSC_TOKENS.USDC, BSC_TOKENS.USDT],
|
||||
pool: ELLIPSIS_POOLS.threePool,
|
||||
gasSchedule: 150e3,
|
||||
gasSchedule: 140e3,
|
||||
}),
|
||||
};
|
||||
|
||||
@@ -678,18 +686,17 @@ export const SADDLE_MAINNET_INFOS: { [name: string]: CurveInfo } = {
|
||||
poolAddress: SADDLE_POOLS.stables,
|
||||
tokens: [MAINNET_TOKENS.DAI, MAINNET_TOKENS.USDC, MAINNET_TOKENS.USDT],
|
||||
metaToken: undefined,
|
||||
gasSchedule: 220e3,
|
||||
gasSchedule: 150e3,
|
||||
},
|
||||
[SADDLE_POOLS.bitcoins]: {
|
||||
exchangeFunctionSelector: CurveFunctionSelectors.swap,
|
||||
sellQuoteFunctionSelector: CurveFunctionSelectors.calculateSwap,
|
||||
buyQuoteFunctionSelector: CurveFunctionSelectors.None,
|
||||
poolAddress: SADDLE_POOLS.bitcoins,
|
||||
tokens: [MAINNET_TOKENS.tBTC, MAINNET_TOKENS.WBTC, MAINNET_TOKENS.RenBTC, MAINNET_TOKENS.sBTC],
|
||||
metaToken: undefined,
|
||||
gasSchedule: 150e3,
|
||||
},
|
||||
// TODO:Romain having "Cannot swap more than you own" error when running simbot
|
||||
// [SADDLE_POOLS.bitcoins]: {
|
||||
// exchangeFunctionSelector: CurveFunctionSelectors.swap,
|
||||
// sellQuoteFunctionSelector: CurveFunctionSelectors.calculateSwap,
|
||||
// buyQuoteFunctionSelector: CurveFunctionSelectors.None,
|
||||
// poolAddress: SADDLE_POOLS.stables,
|
||||
// tokens: [MAINNET_TOKENS.tBTC, MAINNET_TOKENS.WBTC, MAINNET_TOKENS.RenBTC, MAINNET_TOKENS.sBTC],
|
||||
// metaToken: undefined,
|
||||
// gasSchedule: 220e3,
|
||||
// },
|
||||
};
|
||||
|
||||
export const SMOOTHY_MAINNET_INFOS: { [name: string]: CurveInfo } = {
|
||||
@@ -709,7 +716,7 @@ export const SMOOTHY_MAINNET_INFOS: { [name: string]: CurveInfo } = {
|
||||
MAINNET_TOKENS.GUSD,
|
||||
],
|
||||
metaToken: undefined,
|
||||
gasSchedule: 200e3,
|
||||
gasSchedule: 190e3,
|
||||
},
|
||||
};
|
||||
|
||||
@@ -721,7 +728,7 @@ export const SMOOTHY_BSC_INFOS: { [name: string]: CurveInfo } = {
|
||||
poolAddress: SMOOTHY_POOLS.syUSD,
|
||||
tokens: [BSC_TOKENS.BUSD, BSC_TOKENS.USDT, BSC_TOKENS.USDC, BSC_TOKENS.DAI, BSC_TOKENS.PAX, BSC_TOKENS.UST],
|
||||
metaToken: undefined,
|
||||
gasSchedule: 100e3,
|
||||
gasSchedule: 90e3,
|
||||
},
|
||||
};
|
||||
|
||||
@@ -733,7 +740,7 @@ export const NERVE_BSC_INFOS: { [name: string]: CurveInfo } = {
|
||||
poolAddress: NERVE_POOLS.threePool,
|
||||
tokens: [BSC_TOKENS.BUSD, BSC_TOKENS.USDT, BSC_TOKENS.USDC],
|
||||
metaToken: undefined,
|
||||
gasSchedule: 150e3,
|
||||
gasSchedule: 140e3,
|
||||
},
|
||||
};
|
||||
|
||||
@@ -744,6 +751,7 @@ export const NERVE_BSC_INFOS: { [name: string]: CurveInfo } = {
|
||||
* 0xbb Bridged price reserve (i.e Uniswap/Curve)
|
||||
*/
|
||||
export const KYBER_BRIDGED_LIQUIDITY_PREFIX = '0xbb';
|
||||
export const KYBER_BANNED_RESERVES = ['0xff4f6e65426974205175616e7400000000000000000000000000000000000000'];
|
||||
export const MAX_KYBER_RESERVES_QUERIED = 5;
|
||||
export const KYBER_CONFIG_BY_CHAIN_ID = valueByChainId<KyberSamplerOpts>(
|
||||
{
|
||||
@@ -992,7 +1000,7 @@ export const PANCAKESWAP_ROUTER_BY_CHAIN_ID = valueByChainId<string>(
|
||||
NULL_ADDRESS,
|
||||
);
|
||||
|
||||
export const PANCAKESWAP_V2_ROUTER_BY_CHAIN_ID = valueByChainId<string>(
|
||||
export const PANCAKESWAPV2_ROUTER_BY_CHAIN_ID = valueByChainId<string>(
|
||||
{
|
||||
[ChainId.BSC]: '0x10ed43c718714eb63d5aa57b78b54704e256024e',
|
||||
},
|
||||
@@ -1006,6 +1014,34 @@ export const BAKERYSWAP_ROUTER_BY_CHAIN_ID = valueByChainId<string>(
|
||||
NULL_ADDRESS,
|
||||
);
|
||||
|
||||
export const APESWAP_ROUTER_BY_CHAIN_ID = valueByChainId<string>(
|
||||
{
|
||||
[ChainId.BSC]: '0xc0788a3ad43d79aa53b09c2eacc313a787d1d607',
|
||||
},
|
||||
NULL_ADDRESS,
|
||||
);
|
||||
|
||||
export const CAFESWAP_ROUTER_BY_CHAIN_ID = valueByChainId<string>(
|
||||
{
|
||||
[ChainId.BSC]: '0x933daea3a5995fb94b14a7696a5f3ffd7b1e385a',
|
||||
},
|
||||
NULL_ADDRESS,
|
||||
);
|
||||
|
||||
export const CHEESESWAP_ROUTER_BY_CHAIN_ID = valueByChainId<string>(
|
||||
{
|
||||
[ChainId.BSC]: '0x3047799262d8d2ef41ed2a222205968bc9b0d895',
|
||||
},
|
||||
NULL_ADDRESS,
|
||||
);
|
||||
|
||||
export const JULSWAP_ROUTER_BY_CHAIN_ID = valueByChainId<string>(
|
||||
{
|
||||
[ChainId.BSC]: '0xbd67d157502a23309db761c41965600c2ec788b2',
|
||||
},
|
||||
NULL_ADDRESS,
|
||||
);
|
||||
|
||||
/**
|
||||
* Calculated gross gas cost of the underlying exchange.
|
||||
* The cost of switching from one source to another, assuming
|
||||
@@ -1136,6 +1172,15 @@ export const DEFAULT_GAS_SCHEDULE: Required<FeeSchedule> = {
|
||||
}
|
||||
return gas;
|
||||
},
|
||||
[ERC20BridgeSource.PancakeSwapV2]: (fillData?: FillData) => {
|
||||
// TODO: Different base cost if to/from ETH.
|
||||
let gas = 90e3;
|
||||
const path = (fillData as UniswapV2FillData).tokenAddressPath;
|
||||
if (path.length > 2) {
|
||||
gas += (path.length - 2) * 60e3; // +60k for each hop.
|
||||
}
|
||||
return gas;
|
||||
},
|
||||
[ERC20BridgeSource.BakerySwap]: (fillData?: FillData) => {
|
||||
// TODO: Different base cost if to/from ETH.
|
||||
let gas = 90e3;
|
||||
@@ -1145,7 +1190,34 @@ export const DEFAULT_GAS_SCHEDULE: Required<FeeSchedule> = {
|
||||
}
|
||||
return gas;
|
||||
},
|
||||
[ERC20BridgeSource.PancakeSwapV2]: (fillData?: FillData) => {
|
||||
[ERC20BridgeSource.ApeSwap]: (fillData?: FillData) => {
|
||||
// TODO: Different base cost if to/from ETH.
|
||||
let gas = 90e3;
|
||||
const path = (fillData as UniswapV2FillData).tokenAddressPath;
|
||||
if (path.length > 2) {
|
||||
gas += (path.length - 2) * 60e3; // +60k for each hop.
|
||||
}
|
||||
return gas;
|
||||
},
|
||||
[ERC20BridgeSource.CafeSwap]: (fillData?: FillData) => {
|
||||
// TODO: Different base cost if to/from ETH.
|
||||
let gas = 90e3;
|
||||
const path = (fillData as UniswapV2FillData).tokenAddressPath;
|
||||
if (path.length > 2) {
|
||||
gas += (path.length - 2) * 60e3; // +60k for each hop.
|
||||
}
|
||||
return gas;
|
||||
},
|
||||
[ERC20BridgeSource.CheeseSwap]: (fillData?: FillData) => {
|
||||
// TODO: Different base cost if to/from ETH.
|
||||
let gas = 90e3;
|
||||
const path = (fillData as UniswapV2FillData).tokenAddressPath;
|
||||
if (path.length > 2) {
|
||||
gas += (path.length - 2) * 60e3; // +60k for each hop.
|
||||
}
|
||||
return gas;
|
||||
},
|
||||
[ERC20BridgeSource.JulSwap]: (fillData?: FillData) => {
|
||||
// TODO: Different base cost if to/from ETH.
|
||||
let gas = 90e3;
|
||||
const path = (fillData as UniswapV2FillData).tokenAddressPath;
|
||||
|
@@ -120,6 +120,8 @@ export function getErc20BridgeSourceToBridgeSource(source: ERC20BridgeSource): s
|
||||
return encodeBridgeSourceId(BridgeProtocol.UniswapV2, 'Linkswap');
|
||||
case ERC20BridgeSource.PancakeSwap:
|
||||
return encodeBridgeSourceId(BridgeProtocol.UniswapV2, 'PancakeSwap');
|
||||
case ERC20BridgeSource.PancakeSwapV2:
|
||||
return encodeBridgeSourceId(BridgeProtocol.UniswapV2, 'PancakeSwapV2');
|
||||
case ERC20BridgeSource.BakerySwap:
|
||||
return encodeBridgeSourceId(BridgeProtocol.UniswapV2, 'BakerySwap');
|
||||
case ERC20BridgeSource.Nerve:
|
||||
@@ -134,8 +136,14 @@ export function getErc20BridgeSourceToBridgeSource(source: ERC20BridgeSource): s
|
||||
return encodeBridgeSourceId(BridgeProtocol.Curve, 'Smoothy');
|
||||
case ERC20BridgeSource.Saddle:
|
||||
return encodeBridgeSourceId(BridgeProtocol.Nerve, 'Saddle');
|
||||
case ERC20BridgeSource.PancakeSwapV2:
|
||||
return encodeBridgeSourceId(BridgeProtocol.UniswapV2, 'PancakeSwapV2');
|
||||
case ERC20BridgeSource.ApeSwap:
|
||||
return encodeBridgeSourceId(BridgeProtocol.UniswapV2, 'ApeSwap');
|
||||
case ERC20BridgeSource.CafeSwap:
|
||||
return encodeBridgeSourceId(BridgeProtocol.UniswapV2, 'CafeSwap');
|
||||
case ERC20BridgeSource.CheeseSwap:
|
||||
return encodeBridgeSourceId(BridgeProtocol.UniswapV2, 'CheeseSwap');
|
||||
case ERC20BridgeSource.JulSwap:
|
||||
return encodeBridgeSourceId(BridgeProtocol.UniswapV2, 'JulSwap');
|
||||
default:
|
||||
throw new Error(AggregationError.NoBridgeForSource);
|
||||
}
|
||||
@@ -187,9 +195,13 @@ export function createBridgeDataForBridgeOrder(order: OptimizedMarketBridgeOrder
|
||||
case ERC20BridgeSource.CryptoCom:
|
||||
case ERC20BridgeSource.Linkswap:
|
||||
case ERC20BridgeSource.PancakeSwap:
|
||||
case ERC20BridgeSource.PancakeSwapV2:
|
||||
case ERC20BridgeSource.BakerySwap:
|
||||
case ERC20BridgeSource.KyberDmm:
|
||||
case ERC20BridgeSource.PancakeSwapV2:
|
||||
case ERC20BridgeSource.ApeSwap:
|
||||
case ERC20BridgeSource.CafeSwap:
|
||||
case ERC20BridgeSource.CheeseSwap:
|
||||
case ERC20BridgeSource.JulSwap:
|
||||
const uniswapV2FillData = (order as OptimizedMarketBridgeOrder<UniswapV2FillData>).fillData;
|
||||
bridgeData = encoder.encode([uniswapV2FillData.router, uniswapV2FillData.tokenAddressPath]);
|
||||
break;
|
||||
@@ -323,6 +335,14 @@ export const BRIDGE_ENCODERS: {
|
||||
[ERC20BridgeSource.CryptoCom]: routerAddressPathEncoder,
|
||||
[ERC20BridgeSource.Linkswap]: routerAddressPathEncoder,
|
||||
[ERC20BridgeSource.KyberDmm]: routerAddressPathEncoder,
|
||||
// BSC
|
||||
[ERC20BridgeSource.PancakeSwap]: routerAddressPathEncoder,
|
||||
[ERC20BridgeSource.PancakeSwapV2]: routerAddressPathEncoder,
|
||||
[ERC20BridgeSource.BakerySwap]: routerAddressPathEncoder,
|
||||
[ERC20BridgeSource.ApeSwap]: routerAddressPathEncoder,
|
||||
[ERC20BridgeSource.CafeSwap]: routerAddressPathEncoder,
|
||||
[ERC20BridgeSource.CheeseSwap]: routerAddressPathEncoder,
|
||||
[ERC20BridgeSource.JulSwap]: routerAddressPathEncoder,
|
||||
// Generic pools
|
||||
[ERC20BridgeSource.Shell]: poolEncoder,
|
||||
[ERC20BridgeSource.Component]: poolEncoder,
|
||||
@@ -334,10 +354,6 @@ export const BRIDGE_ENCODERS: {
|
||||
[ERC20BridgeSource.Uniswap]: poolEncoder,
|
||||
// Custom integrations
|
||||
[ERC20BridgeSource.MakerPsm]: makerPsmEncoder,
|
||||
// BSC
|
||||
[ERC20BridgeSource.PancakeSwap]: routerAddressPathEncoder,
|
||||
[ERC20BridgeSource.BakerySwap]: routerAddressPathEncoder,
|
||||
[ERC20BridgeSource.PancakeSwapV2]: routerAddressPathEncoder,
|
||||
};
|
||||
|
||||
function getFillTokenAmounts(fill: CollapsedFill, side: MarketOperation): [BigNumber, BigNumber] {
|
||||
|
@@ -1100,9 +1100,13 @@ export class SamplerOperations {
|
||||
case ERC20BridgeSource.SushiSwap:
|
||||
case ERC20BridgeSource.CryptoCom:
|
||||
case ERC20BridgeSource.PancakeSwap:
|
||||
case ERC20BridgeSource.PancakeSwapV2:
|
||||
case ERC20BridgeSource.BakerySwap:
|
||||
case ERC20BridgeSource.KyberDmm:
|
||||
case ERC20BridgeSource.PancakeSwapV2:
|
||||
case ERC20BridgeSource.ApeSwap:
|
||||
case ERC20BridgeSource.CafeSwap:
|
||||
case ERC20BridgeSource.CheeseSwap:
|
||||
case ERC20BridgeSource.JulSwap:
|
||||
const uniLikeRouter = uniswapV2LikeRouterAddress(this.chainId, source);
|
||||
if (!isValidAddress(uniLikeRouter)) {
|
||||
return [];
|
||||
@@ -1310,9 +1314,13 @@ export class SamplerOperations {
|
||||
case ERC20BridgeSource.SushiSwap:
|
||||
case ERC20BridgeSource.CryptoCom:
|
||||
case ERC20BridgeSource.PancakeSwap:
|
||||
case ERC20BridgeSource.PancakeSwapV2:
|
||||
case ERC20BridgeSource.BakerySwap:
|
||||
case ERC20BridgeSource.KyberDmm:
|
||||
case ERC20BridgeSource.PancakeSwapV2:
|
||||
case ERC20BridgeSource.ApeSwap:
|
||||
case ERC20BridgeSource.CafeSwap:
|
||||
case ERC20BridgeSource.CheeseSwap:
|
||||
case ERC20BridgeSource.JulSwap:
|
||||
const uniLikeRouter = uniswapV2LikeRouterAddress(this.chainId, source);
|
||||
if (!isValidAddress(uniLikeRouter)) {
|
||||
return [];
|
||||
|
@@ -65,11 +65,15 @@ export enum ERC20BridgeSource {
|
||||
Saddle = 'Saddle',
|
||||
// BSC only
|
||||
PancakeSwap = 'PancakeSwap',
|
||||
PancakeSwapV2 = 'PancakeSwap_V2',
|
||||
BakerySwap = 'BakerySwap',
|
||||
Nerve = 'Nerve',
|
||||
Belt = 'Belt',
|
||||
Ellipsis = 'Ellipsis',
|
||||
PancakeSwapV2 = 'PancakeSwap_V2',
|
||||
ApeSwap = 'ApeSwap',
|
||||
CafeSwap = 'CafeSwap',
|
||||
CheeseSwap = 'CheeseSwap',
|
||||
JulSwap = 'JulSwap',
|
||||
}
|
||||
|
||||
// tslint:disable: enum-naming
|
||||
|
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@0x/contract-wrappers-test",
|
||||
"version": "12.2.42",
|
||||
"version": "12.2.44",
|
||||
"engines": {
|
||||
"node": ">=6.12"
|
||||
},
|
||||
@@ -34,7 +34,7 @@
|
||||
"@0x/contract-wrappers": "^13.16.0",
|
||||
"@0x/contracts-test-utils": "^5.3.25",
|
||||
"@0x/dev-utils": "^4.2.6",
|
||||
"@0x/migrations": "^8.0.3",
|
||||
"@0x/migrations": "^8.0.5",
|
||||
"@0x/order-utils": "^10.4.20",
|
||||
"@0x/subproviders": "^6.5.2",
|
||||
"@0x/ts-doc-gen": "^0.0.28",
|
||||
|
@@ -1,4 +1,22 @@
|
||||
[
|
||||
{
|
||||
"timestamp": 1619830995,
|
||||
"version": "8.0.5",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"timestamp": 1619825976,
|
||||
"version": "8.0.4",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"timestamp": 1619596077,
|
||||
"version": "8.0.3",
|
||||
|
@@ -5,6 +5,14 @@ Edit the package's CHANGELOG.json file only.
|
||||
|
||||
CHANGELOG
|
||||
|
||||
## v8.0.5 - _May 1, 2021_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v8.0.4 - _April 30, 2021_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v8.0.3 - _April 28, 2021_
|
||||
|
||||
* Dependencies updated
|
||||
|
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@0x/migrations",
|
||||
"version": "8.0.3",
|
||||
"version": "8.0.5",
|
||||
"engines": {
|
||||
"node": ">=6.12"
|
||||
},
|
||||
@@ -81,7 +81,7 @@
|
||||
"@0x/contracts-multisig": "^4.1.29",
|
||||
"@0x/contracts-staking": "^2.0.36",
|
||||
"@0x/contracts-utils": "^4.7.7",
|
||||
"@0x/contracts-zero-ex": "^0.22.1",
|
||||
"@0x/contracts-zero-ex": "^0.22.3",
|
||||
"@0x/sol-compiler": "^4.7.2",
|
||||
"@0x/subproviders": "^6.5.2",
|
||||
"@0x/typescript-typings": "^5.2.0",
|
||||
|
Reference in New Issue
Block a user