Compare commits

...

5 Commits

Author SHA1 Message Date
Github Actions
03fc744bbd Publish
- @0x/contracts-erc20@4.0.2
 - @0x/contracts-test-utils@5.4.49
 - @0x/contracts-treasury@1.4.42
 - @0x/contracts-utils@4.8.40
 - @0x/contracts-zero-ex@0.39.1
 - @0x/contract-addresses@8.2.0
 - @0x/contract-wrappers@13.22.18
 - @0x/protocol-utils@11.18.1
2023-03-10 01:13:24 +00:00
Github Actions
a23143d1eb Updated CHANGELOGS & MD docs 2023-03-10 01:13:21 +00:00
Savarn Dontamsetti (Sav)
c0ef6fece3 chore: update addresses to reflect AaveV3 L2 encoding removal and KyberElastic Addition (#678)
* Update addresses to reflect AaveV3 L2Encoding removal
2023-03-09 18:35:01 -05:00
Kevin Liao
03ea4e3dba feat:Add Kyber Elastic mixins (#677)
* add kyber elastic mixins

* update changelog

* fix changelog
2023-03-09 12:33:14 -08:00
Savarn Dontamsetti (Sav)
3e939f7780 Removing L2 Encoding from AaveV3 MixIn (#676) 2023-03-09 12:02:36 -05:00
32 changed files with 147 additions and 78 deletions

View File

@@ -1,4 +1,13 @@
[
{
"timestamp": 1678410794,
"version": "4.0.2",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1677693479,
"version": "4.0.1",

View File

@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v4.0.2 - _March 10, 2023_
* Dependencies updated
## v4.0.1 - _March 1, 2023_
* Dependencies updated

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/contracts-erc20",
"version": "4.0.1",
"version": "4.0.2",
"engines": {
"node": ">=6.12"
},
@@ -24,7 +24,7 @@
},
"homepage": "https://github.com/0xProject/protocol",
"devDependencies": {
"@0x/contracts-utils": "^4.8.39",
"@0x/contracts-utils": "^4.8.40",
"@0x/ts-doc-gen": "^0.0.28",
"typedoc": "~0.16.11"
},

View File

@@ -1,4 +1,13 @@
[
{
"timestamp": 1678410794,
"version": "5.4.49",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1677693479,
"version": "5.4.48",

View File

@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v5.4.49 - _March 10, 2023_
* Dependencies updated
## v5.4.48 - _March 1, 2023_
* Dependencies updated

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/contracts-test-utils",
"version": "5.4.48",
"version": "5.4.49",
"engines": {
"node": ">=6.12"
},
@@ -41,7 +41,7 @@
"dependencies": {
"@0x/assert": "^3.0.35",
"@0x/base-contract": "^7.0.0",
"@0x/contract-addresses": "^8.1.0",
"@0x/contract-addresses": "^8.2.0",
"@0x/dev-utils": "^5.0.0",
"@0x/json-schemas": "^6.4.4",
"@0x/order-utils": "^10.4.28",

View File

@@ -1,4 +1,13 @@
[
{
"timestamp": 1678410794,
"version": "1.4.42",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1677693479,
"version": "1.4.41",

View File

@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v1.4.42 - _March 10, 2023_
* Dependencies updated
## v1.4.41 - _March 1, 2023_
* Dependencies updated

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/contracts-treasury",
"version": "1.4.41",
"version": "1.4.42",
"engines": {
"node": ">=6.12"
},
@@ -46,12 +46,12 @@
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/treasury",
"devDependencies": {
"@0x/abi-gen": "^5.8.1",
"@0x/contract-addresses": "^8.1.0",
"@0x/contract-addresses": "^8.2.0",
"@0x/contracts-asset-proxy": "^3.7.19",
"@0x/contracts-erc20": "3.3.57",
"@0x/contracts-gen": "^2.0.48",
"@0x/contracts-staking": "^2.0.45",
"@0x/contracts-test-utils": "^5.4.48",
"@0x/contracts-test-utils": "^5.4.49",
"@0x/sol-compiler": "^4.8.2",
"@0x/ts-doc-gen": "^0.0.28",
"@types/isomorphic-fetch": "^0.0.35",
@@ -73,7 +73,7 @@
},
"dependencies": {
"@0x/base-contract": "^7.0.0",
"@0x/protocol-utils": "^11.18.0",
"@0x/protocol-utils": "^11.18.1",
"@0x/subproviders": "^7.0.0",
"@0x/types": "^3.3.6",
"@0x/typescript-typings": "^5.3.1",

View File

@@ -1,4 +1,13 @@
[
{
"timestamp": 1678410794,
"version": "4.8.40",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1677693479,
"version": "4.8.39",

View File

@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v4.8.40 - _March 10, 2023_
* Dependencies updated
## v4.8.39 - _March 1, 2023_
* Dependencies updated

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/contracts-utils",
"version": "4.8.39",
"version": "4.8.40",
"engines": {
"node": ">=6.12"
},
@@ -46,7 +46,7 @@
"devDependencies": {
"@0x/abi-gen": "^5.8.1",
"@0x/contracts-gen": "^2.0.48",
"@0x/contracts-test-utils": "^5.4.48",
"@0x/contracts-test-utils": "^5.4.49",
"@0x/dev-utils": "^5.0.0",
"@0x/order-utils": "^10.4.28",
"@0x/sol-compiler": "^4.8.2",

View File

@@ -1,4 +1,13 @@
[
{
"version": "0.39.1",
"changes": [
{
"note": "Add KyberElastic mixin for Optimism and BSC"
}
],
"timestamp": 1678410794
},
{
"version": "0.39.0",
"changes": [

View File

@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v0.39.1 - _March 10, 2023_
* Add KyberElastic mixin for Optimism and BSC
## v0.39.0 - _March 1, 2023_
* Add KyberElastic mixin for Ethereum, Polygon, Arbitrum, Avalanche

View File

@@ -47,7 +47,7 @@ contract ArbitrumBridgeAdapter is
MixinWOOFi,
MixinZeroExBridge
{
constructor(IEtherToken weth) public MixinCurve(weth) MixinAaveV3(true) {}
constructor(IEtherToken weth) public MixinCurve(weth) {}
function _trade(
BridgeOrder memory order,

View File

@@ -45,7 +45,7 @@ contract AvalancheBridgeAdapter is
MixinWOOFi,
MixinZeroExBridge
{
constructor(IEtherToken weth) public MixinCurve(weth) MixinAaveV3(false) {}
constructor(IEtherToken weth) public MixinCurve(weth) {}
function _trade(
BridgeOrder memory order,

View File

@@ -21,6 +21,7 @@ import "./mixins/MixinCurve.sol";
import "./mixins/MixinDodo.sol";
import "./mixins/MixinDodoV2.sol";
import "./mixins/MixinKyberDmm.sol";
import "./mixins/MixinKyberElastic.sol";
import "./mixins/MixinMooniswap.sol";
import "./mixins/MixinNerve.sol";
import "./mixins/MixinUniswapV2.sol";
@@ -33,6 +34,7 @@ contract BSCBridgeAdapter is
MixinDodo,
MixinDodoV2,
MixinKyberDmm,
MixinKyberElastic,
MixinMooniswap,
MixinNerve,
MixinUniswapV2,
@@ -84,6 +86,11 @@ contract BSCBridgeAdapter is
return (0, true);
}
boughtAmount = _tradeKyberDmm(buyToken, sellAmount, order.bridgeData);
} else if (protocolId == BridgeProtocols.KYBERELASTIC) {
if (dryRun) {
return (0, true);
}
boughtAmount = _tradeKyberElastic(sellToken, sellAmount, order.bridgeData);
} else if (protocolId == BridgeProtocols.WOOFI) {
if (dryRun) {
return (0, true);

View File

@@ -21,6 +21,7 @@ import "./mixins/MixinAaveV3.sol";
import "./mixins/MixinBalancerV2Batch.sol";
import "./mixins/MixinCurve.sol";
import "./mixins/MixinCurveV2.sol";
import "./mixins/MixinKyberElastic.sol";
import "./mixins/MixinNerve.sol";
import "./mixins/MixinSolidly.sol";
import "./mixins/MixinSynthetix.sol";
@@ -34,6 +35,7 @@ contract OptimismBridgeAdapter is
MixinBalancerV2Batch,
MixinCurve,
MixinCurveV2,
MixinKyberElastic,
MixinNerve,
MixinSynthetix,
MixinUniswapV3,
@@ -41,7 +43,7 @@ contract OptimismBridgeAdapter is
MixinWOOFi,
MixinZeroExBridge
{
constructor(IEtherToken weth) public MixinCurve(weth) MixinAaveV3(true) {}
constructor(IEtherToken weth) public MixinCurve(weth) {}
/* solhint-disable function-max-lines */
function _trade(
@@ -102,6 +104,11 @@ contract OptimismBridgeAdapter is
return (0, true);
}
boughtAmount = _tradeWOOFi(sellToken, buyToken, sellAmount, order.bridgeData);
} else if (protocolId == BridgeProtocols.KYBERELASTIC) {
if (dryRun) {
return (0, true);
}
boughtAmount = _tradeKyberElastic(sellToken, sellAmount, order.bridgeData);
}
emit BridgeFill(order.source, sellToken, buyToken, sellAmount, boughtAmount);

View File

@@ -53,7 +53,7 @@ contract PolygonBridgeAdapter is
MixinWOOFi,
MixinZeroExBridge
{
constructor(IEtherToken weth) public MixinCurve(weth) MixinAaveV3(false) {}
constructor(IEtherToken weth) public MixinCurve(weth) {}
function _trade(
BridgeOrder memory order,

View File

@@ -47,63 +47,16 @@ interface IPool {
function withdraw(address asset, uint256 amount, address to) external returns (uint256);
}
// Minimal Aave V3 L2Pool interface
interface IL2Pool {
/**
* @notice Calldata efficient wrapper of the supply function on behalf of the caller
* @param args Arguments for the supply function packed in one bytes32
* 96 bits 16 bits 128 bits 16 bits
* | 0-padding | referralCode | shortenedAmount | assetId |
* @dev the shortenedAmount is cast to 256 bits at decode time, if type(uint128).max the value will be expanded to
* type(uint256).max
* @dev assetId is the index of the asset in the reservesList.
*/
function supply(bytes32 args) external;
/**
* @notice Calldata efficient wrapper of the withdraw function, withdrawing to the caller
* @param args Arguments for the withdraw function packed in one bytes32
* 112 bits 128 bits 16 bits
* | 0-padding | shortenedAmount | assetId |
* @dev the shortenedAmount is cast to 256 bits at decode time, if type(uint128).max the value will be expanded to
* type(uint256).max
* @dev assetId is the index of the asset in the reservesList.
*/
function withdraw(bytes32 args) external;
}
contract MixinAaveV3 {
using LibERC20TokenV06 for IERC20Token;
bool private immutable _isL2;
constructor(bool isL2) public {
_isL2 = isL2;
}
function _tradeAaveV3(
IERC20Token sellToken,
IERC20Token buyToken,
uint256 sellAmount,
bytes memory bridgeData
) internal returns (uint256) {
if (_isL2) {
(IL2Pool pool, address aToken, bytes32 l2Params) = abi.decode(bridgeData, (IL2Pool, address, bytes32));
sellToken.approveIfBelow(address(pool), sellAmount);
if (address(buyToken) == aToken) {
pool.supply(l2Params);
// 1:1 mapping token --> aToken and have the same number of decimals as the underlying token
return sellAmount;
} else if (address(sellToken) == aToken) {
pool.withdraw(l2Params);
return sellAmount;
}
revert("MixinAaveV3/UNSUPPORTED_TOKEN_PAIR");
}
(IPool pool, address aToken, ) = abi.decode(bridgeData, (IPool, address, bytes32));
(IPool pool, address aToken) = abi.decode(bridgeData, (IPool, address));
sellToken.approveIfBelow(address(pool), sellAmount);

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/contracts-zero-ex",
"version": "0.39.0",
"version": "0.39.1",
"engines": {
"node": ">=6.12"
},
@@ -51,10 +51,10 @@
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/zero-ex",
"devDependencies": {
"@0x/abi-gen": "^5.8.1",
"@0x/contract-addresses": "^8.1.0",
"@0x/contract-addresses": "^8.2.0",
"@0x/contracts-erc20": "^3.3.57",
"@0x/contracts-gen": "^2.0.48",
"@0x/contracts-test-utils": "^5.4.48",
"@0x/contracts-test-utils": "^5.4.49",
"@0x/dev-utils": "^5.0.0",
"@0x/order-utils": "^10.4.28",
"@0x/sol-compiler": "^4.8.2",
@@ -80,7 +80,7 @@
},
"dependencies": {
"@0x/base-contract": "^7.0.0",
"@0x/protocol-utils": "^11.18.0",
"@0x/protocol-utils": "^11.18.1",
"@0x/subproviders": "^7.0.0",
"@0x/types": "^3.3.6",
"@0x/typescript-typings": "^5.3.1",

View File

@@ -38,8 +38,8 @@ contract SwapERC20ForERC20Test is Test, ForkUtils, TestUtils {
function test_swapERC20ForERC20OnKyberElastic() public {
for (uint256 i = 0; i < chains.length; i++) {
// kyberelastic mixin not deployed to these chains yet (bsc, fantom, optimism)
if (i == 1 || i == 4 || i == 5) {
// kyberelastic mixin not added to fantom yet
if (i == 4) {
continue;
}
vm.selectFork(forkIds[chains[i]]);

View File

@@ -1,4 +1,14 @@
[
{
"version": "8.2.0",
"changes": [
{
"note": "Upgrade Polygon, Avalanche, Arbitrum, and Optimism FillQuoteTransformers to remove Aave V3 L2 Encoding and support KyberElastic",
"pr": 678
}
],
"timestamp": 1678410794
},
{
"version": "8.1.0",
"changes": [

View File

@@ -6,6 +6,9 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v8.2.0 - _March 10, 2023_
* Upgrade Polygon, Avalanche, Arbitrum, and Optimism FillQuoteTransformers to remove Aave V3 L2 Encoding and support KyberElastic (#678)
## v8.1.0 - _March 1, 2023_
* Upgrade Mainnet and Polygon FillQuoteTransformers to support KyberElastic (#669)

View File

@@ -110,7 +110,7 @@
"wethTransformer": "0xe309d011cc6f189a3e8dcba85922715a019fed38",
"payTakerTransformer": "0xed8932ca083e1ef1960dea875a132926e6b242ab",
"affiliateFeeTransformer": "0xf79071e2f860d48a08fd7e091d4b126a1d757148",
"fillQuoteTransformer": "0x5fe5885aedc42cd51073c7e5af841e3a11556653",
"fillQuoteTransformer": "0xcc46d6a09cbdc75f2f174493c33cab45492d868b",
"positiveSlippageFeeTransformer": "0x8f5e7188f443a9a8dc180f4618fd23915043ea15"
}
},
@@ -156,7 +156,7 @@
"wethTransformer": "0x9b8b52391071d71cd4ad1e61d7f273268fa34c6c",
"payTakerTransformer": "0xb9a4c32547bc3cdc2ee2fb13cc1a0717dac9888f",
"affiliateFeeTransformer": "0x105679f99d668001370b4621ad8648ac570c860f",
"fillQuoteTransformer": "0x3fad2c4a73b9a8f263b2749cd266e43c99b988fa",
"fillQuoteTransformer": "0x7991f2c35ab19472dbfb6f27593f7f6f38fb3eab",
"positiveSlippageFeeTransformer": "0xadbfdc58a24b6dbc16f21541800f43dd6e282250"
}
},
@@ -225,7 +225,7 @@
"wethTransformer": "0x02ce7af6520e2862f961f5d7eda746642865179c",
"payTakerTransformer": "0xa6c3ca183a67fcb4299fb4199c12ca74874ca489",
"affiliateFeeTransformer": "0x3102aea537ecb6f164550b094663c82a8c53a972",
"fillQuoteTransformer": "0xfead4c05220a8fddc74008ae43199badc3becaf9",
"fillQuoteTransformer": "0xd140adb61d4e3e3978d4f32ac6b92240ff6e3a6e",
"positiveSlippageFeeTransformer": "0x9a4947d3fb77a7afc2c9cd6714bbae96dddde059"
}
},
@@ -248,7 +248,7 @@
"wethTransformer": "0x10e968968f49dd66a5efeebbb2edcb9c49c4fc49",
"payTakerTransformer": "0xd81e65fc9bb7323bdbef8b2cdddd3b83fe41d630",
"affiliateFeeTransformer": "0x970e318b8f074c20bf0cee06970f01dc7a761e50",
"fillQuoteTransformer": "0x2142414a2c19b4dc4ec050eb1391d1d49d096da1",
"fillQuoteTransformer": "0x5d3a221bad31c3f3c07bea2f1de9b3ec17664b69",
"positiveSlippageFeeTransformer": "0x20f935b037e8490d8027f2751f9452725eee01ad"
}
}

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/contract-addresses",
"version": "8.1.0",
"version": "8.2.0",
"engines": {
"node": ">=6.12"
},

View File

@@ -1,4 +1,13 @@
[
{
"timestamp": 1678410794,
"version": "13.22.18",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1677693479,
"version": "13.22.17",

View File

@@ -6,6 +6,9 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v13.22.18 - _March 10, 2023_
* Dependencies updated
## v13.22.17 - _March 1, 2023_
* Dependencies updated

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/contract-wrappers",
"version": "13.22.17",
"version": "13.22.18",
"engines": {
"node": ">=6.12"
},
@@ -59,7 +59,7 @@
"dependencies": {
"@0x/assert": "^3.0.35",
"@0x/base-contract": "^7.0.0",
"@0x/contract-addresses": "^8.1.0",
"@0x/contract-addresses": "^8.2.0",
"@0x/json-schemas": "^6.4.4",
"@0x/types": "^3.3.6",
"@0x/utils": "^7.0.0",

View File

@@ -1,4 +1,13 @@
[
{
"timestamp": 1678410794,
"version": "11.18.1",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"version": "11.18.0",
"changes": [

View File

@@ -6,6 +6,9 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v11.18.1 - _March 10, 2023_
* Dependencies updated
## v11.18.0 - _March 1, 2023_
* Add KyberElastic support

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/protocol-utils",
"version": "11.18.0",
"version": "11.18.1",
"engines": {
"node": ">=6.12"
},
@@ -62,8 +62,8 @@
},
"dependencies": {
"@0x/assert": "^3.0.35",
"@0x/contract-addresses": "^8.1.0",
"@0x/contract-wrappers": "^13.22.17",
"@0x/contract-addresses": "^8.2.0",
"@0x/contract-wrappers": "^13.22.18",
"@0x/json-schemas": "^6.4.4",
"@0x/subproviders": "^7.0.0",
"@0x/utils": "^7.0.0",