Skip to content

Commit

Permalink
Merge branch 'refs/heads/development'
Browse files Browse the repository at this point in the history
  • Loading branch information
Github Actions committed Aug 18, 2023
2 parents bd02e7b + ec336b9 commit 48cc9d2
Show file tree
Hide file tree
Showing 34 changed files with 292 additions and 23 deletions.
9 changes: 9 additions & 0 deletions contracts/erc20/CHANGELOG.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
[
{
"timestamp": 1692368658,
"version": "4.0.12",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1691617396,
"version": "4.0.11",
Expand Down
4 changes: 4 additions & 0 deletions contracts/erc20/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.

CHANGELOG

## v4.0.12 - _August 18, 2023_

* Dependencies updated

## v4.0.11 - _August 9, 2023_

* Dependencies updated
Expand Down
4 changes: 2 additions & 2 deletions contracts/erc20/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@0x/contracts-erc20",
"version": "4.0.11",
"version": "4.0.12",
"engines": {
"node": ">=6.12"
},
Expand All @@ -24,7 +24,7 @@
},
"homepage": "https://github.com/0xProject/protocol",
"devDependencies": {
"@0x/contracts-utils": "^4.8.49",
"@0x/contracts-utils": "^4.8.50",
"@0x/ts-doc-gen": "^0.0.28",
"typedoc": "~0.16.11"
},
Expand Down
9 changes: 9 additions & 0 deletions contracts/test-utils/CHANGELOG.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
[
{
"timestamp": 1692368658,
"version": "5.4.58",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1691617396,
"version": "5.4.57",
Expand Down
4 changes: 4 additions & 0 deletions contracts/test-utils/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.

CHANGELOG

## v5.4.58 - _August 18, 2023_

* Dependencies updated

## v5.4.57 - _August 9, 2023_

* Dependencies updated
Expand Down
4 changes: 2 additions & 2 deletions contracts/test-utils/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@0x/contracts-test-utils",
"version": "5.4.57",
"version": "5.4.58",
"engines": {
"node": ">=6.12"
},
Expand Down Expand Up @@ -41,7 +41,7 @@
"dependencies": {
"@0x/assert": "^3.0.36",
"@0x/base-contract": "^7.0.0",
"@0x/contract-addresses": "^8.10.0",
"@0x/contract-addresses": "^8.11.0",
"@0x/dev-utils": "^5.0.2",
"@0x/json-schemas": "^6.4.4",
"@0x/order-utils": "^10.4.28",
Expand Down
9 changes: 9 additions & 0 deletions contracts/treasury/CHANGELOG.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
[
{
"timestamp": 1692368658,
"version": "1.4.52",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1691617396,
"version": "1.4.51",
Expand Down
4 changes: 4 additions & 0 deletions contracts/treasury/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.

CHANGELOG

## v1.4.52 - _August 18, 2023_

* Dependencies updated

## v1.4.51 - _August 9, 2023_

* Dependencies updated
Expand Down
8 changes: 4 additions & 4 deletions contracts/treasury/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@0x/contracts-treasury",
"version": "1.4.51",
"version": "1.4.52",
"engines": {
"node": ">=6.12"
},
Expand Down Expand Up @@ -46,12 +46,12 @@
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/treasury",
"devDependencies": {
"@0x/abi-gen": "^5.8.5",
"@0x/contract-addresses": "^8.10.0",
"@0x/contract-addresses": "^8.11.0",
"@0x/contracts-asset-proxy": "^3.7.19",
"@0x/contracts-erc20": "3.3.57",
"@0x/contracts-gen": "^2.0.50",
"@0x/contracts-staking": "^2.0.45",
"@0x/contracts-test-utils": "^5.4.57",
"@0x/contracts-test-utils": "^5.4.58",
"@0x/sol-compiler": "^4.8.2",
"@0x/ts-doc-gen": "^0.0.28",
"@types/isomorphic-fetch": "^0.0.35",
Expand All @@ -73,7 +73,7 @@
},
"dependencies": {
"@0x/base-contract": "^7.0.0",
"@0x/protocol-utils": "^11.23.0",
"@0x/protocol-utils": "^11.24.0",
"@0x/subproviders": "^8.0.1",
"@0x/types": "^3.3.7",
"@0x/typescript-typings": "^5.3.1",
Expand Down
9 changes: 9 additions & 0 deletions contracts/utils/CHANGELOG.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
[
{
"timestamp": 1692368658,
"version": "4.8.50",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1691617396,
"version": "4.8.49",
Expand Down
4 changes: 4 additions & 0 deletions contracts/utils/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.

CHANGELOG

## v4.8.50 - _August 18, 2023_

* Dependencies updated

## v4.8.49 - _August 9, 2023_

* Dependencies updated
Expand Down
4 changes: 2 additions & 2 deletions contracts/utils/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@0x/contracts-utils",
"version": "4.8.49",
"version": "4.8.50",
"engines": {
"node": ">=6.12"
},
Expand Down Expand Up @@ -45,7 +45,7 @@
"devDependencies": {
"@0x/abi-gen": "^5.8.5",
"@0x/contracts-gen": "^2.0.50",
"@0x/contracts-test-utils": "^5.4.57",
"@0x/contracts-test-utils": "^5.4.58",
"@0x/dev-utils": "^5.0.2",
"@0x/order-utils": "^10.4.28",
"@0x/sol-compiler": "^4.8.2",
Expand Down
9 changes: 9 additions & 0 deletions contracts/zero-ex/CHANGELOG.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
[
{
"version": "0.47.0",
"changes": [
{
"note": "Add MaverickV1 support on Ethereum, BSC, and Base"
}
],
"timestamp": 1692368658
},
{
"version": "0.46.0",
"changes": [
Expand Down
4 changes: 4 additions & 0 deletions contracts/zero-ex/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.

CHANGELOG

## v0.47.0 - _August 18, 2023_

* Add MaverickV1 support on Ethereum, BSC, and Base

## v0.46.0 - _August 9, 2023_

* Add VelodromeV2 support on Optimism
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import "./mixins/MixinDodo.sol";
import "./mixins/MixinDodoV2.sol";
import "./mixins/MixinKyberDmm.sol";
import "./mixins/MixinKyberElastic.sol";
import "./mixins/MixinMaverickV1.sol";
import "./mixins/MixinMooniswap.sol";
import "./mixins/MixinNerve.sol";
import "./mixins/MixinUniswapV2.sol";
Expand All @@ -36,6 +37,7 @@ contract BSCBridgeAdapter is
MixinDodoV2,
MixinKyberDmm,
MixinKyberElastic,
MixinMaverickV1,
MixinMooniswap,
MixinNerve,
MixinUniswapV2,
Expand Down Expand Up @@ -103,6 +105,11 @@ contract BSCBridgeAdapter is
return (0, true);
}
boughtAmount = _tradeWOOFi(sellToken, buyToken, sellAmount, order.bridgeData);
} else if (protocolId == BridgeProtocols.MAVERICKV1) {
if (dryRun) {
return (0, true);
}
boughtAmount = _tradeMaverickV1(sellToken, buyToken, sellAmount, order.bridgeData);
} else if (protocolId == BridgeProtocols.UNKNOWN) {
if (dryRun) {
return (0, true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import "./mixins/MixinUniswapV2.sol";
import "./mixins/MixinBalancerV2Batch.sol";
import "./mixins/MixinCurve.sol";
import "./mixins/MixinCurveV2.sol";
import "./mixins/MixinMaverickV1.sol";
import "./mixins/MixinSolidly.sol";

contract BaseBridgeAdapter is
Expand All @@ -31,6 +32,7 @@ contract BaseBridgeAdapter is
MixinBalancerV2Batch,
MixinCurve,
MixinCurveV2,
MixinMaverickV1,
MixinSolidly
{
constructor(IEtherToken weth) public MixinCurve(weth) {}
Expand Down Expand Up @@ -73,6 +75,11 @@ contract BaseBridgeAdapter is
return (0, true);
}
boughtAmount = _tradeBalancerV2Batch(sellAmount, order.bridgeData);
} else if (protocolId == BridgeProtocols.MAVERICKV1) {
if (dryRun) {
return (0, true);
}
boughtAmount = _tradeMaverickV1(sellToken, buyToken, sellAmount, order.bridgeData);
}
emit BridgeFill(order.source, sellToken, buyToken, sellAmount, boughtAmount);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,5 @@ library BridgeProtocols {
uint128 internal constant BARTER = 34;
uint128 internal constant TRADERJOEV2 = 35;
uint128 internal constant VELODROMEV2 = 36;
uint128 internal constant MAVERICKV1 = 37;
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import "./mixins/MixinKyberDmm.sol";
import "./mixins/MixinKyberElastic.sol";
import "./mixins/MixinLido.sol";
import "./mixins/MixinMakerPSM.sol";
import "./mixins/MixinMaverickV1.sol";
import "./mixins/MixinNerve.sol";
import "./mixins/MixinSynthetix.sol";
import "./mixins/MixinUniswap.sol";
Expand All @@ -56,6 +57,7 @@ contract EthereumBridgeAdapter is
MixinKyberElastic,
MixinLido,
MixinMakerPSM,
MixinMaverickV1,
MixinNerve,
MixinSynthetix,
MixinUniswap,
Expand Down Expand Up @@ -175,6 +177,11 @@ contract EthereumBridgeAdapter is
return (0, true);
}
boughtAmount = _tradeBarter(sellToken, sellAmount, order.bridgeData);
} else if (protocolId == BridgeProtocols.MAVERICKV1) {
if (dryRun) {
return (0, true);
}
boughtAmount = _tradeMaverickV1(sellToken, buyToken, sellAmount, order.bridgeData);
} else if (protocolId == BridgeProtocols.UNKNOWN) {
if (dryRun) {
return (0, true);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
// SPDX-License-Identifier: Apache-2.0
/*
Copyright 2023 ZeroEx Intl.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

pragma solidity ^0.6.5;
pragma experimental ABIEncoderV2;

import "@0x/contracts-erc20/src/v06/LibERC20TokenV06.sol";
import "@0x/contracts-erc20/src/IERC20Token.sol";

interface IMaverickV1Router {
struct ExactInputSingleParams {
address tokenIn;
address tokenOut;
address pool;
address recipient;
uint256 deadline;
uint256 amountIn;
uint256 amountOutMinimum;
uint256 sqrtPriceLimitD18;
}

function exactInputSingle(ExactInputSingleParams calldata params) external payable returns (uint256 amountOut);
}

contract MixinMaverickV1 {
using LibERC20TokenV06 for IERC20Token;

function _tradeMaverickV1(
IERC20Token sellToken,
IERC20Token buyToken,
uint256 sellAmount,
bytes memory bridgeData
) internal returns (uint256 boughtAmount) {
(IMaverickV1Router router, address pool) = abi.decode(bridgeData, (IMaverickV1Router, address));

// Grant the MaverickV1 router an allowance to sell the sellToken
sellToken.approveIfBelow(address(router), sellAmount);

boughtAmount = router.exactInputSingle(
IMaverickV1Router.ExactInputSingleParams({
tokenIn: address(sellToken),
tokenOut: address(buyToken),
pool: pool,
recipient: address(this),
deadline: block.timestamp,
amountIn: sellAmount,
amountOutMinimum: 1,
sqrtPriceLimitD18: 0
})
);
}
}
8 changes: 4 additions & 4 deletions contracts/zero-ex/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@0x/contracts-zero-ex",
"version": "0.46.0",
"version": "0.47.0",
"engines": {
"node": ">=6.12"
},
Expand Down Expand Up @@ -51,10 +51,10 @@
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/zero-ex",
"devDependencies": {
"@0x/abi-gen": "^5.8.5",
"@0x/contract-addresses": "^8.10.0",
"@0x/contract-addresses": "^8.11.0",
"@0x/contracts-erc20": "^3.3.57",
"@0x/contracts-gen": "^2.0.50",
"@0x/contracts-test-utils": "^5.4.57",
"@0x/contracts-test-utils": "^5.4.58",
"@0x/dev-utils": "^5.0.2",
"@0x/order-utils": "^10.4.28",
"@0x/sol-compiler": "^4.8.2",
Expand All @@ -80,7 +80,7 @@
},
"dependencies": {
"@0x/base-contract": "^7.0.0",
"@0x/protocol-utils": "^11.23.0",
"@0x/protocol-utils": "^11.24.0",
"@0x/subproviders": "^8.0.1",
"@0x/types": "^3.3.7",
"@0x/typescript-typings": "^5.3.1",
Expand Down
Loading

0 comments on commit 48cc9d2

Please sign in to comment.