Compare commits

..

10 Commits

Author SHA1 Message Date
Github Actions
c2aed76f2f Publish
- @0x/contracts-erc20@4.0.8
 - @0x/contracts-test-utils@5.4.54
 - @0x/contracts-treasury@1.4.48
 - @0x/contracts-utils@4.8.46
 - @0x/contracts-zero-ex@0.44.0
 - @0x/contract-addresses@8.7.0
 - @0x/contract-wrappers@13.23.2
 - @0x/protocol-utils@11.22.2
2023-05-10 20:03:48 +00:00
Github Actions
198d986fdc Updated CHANGELOGS & MD docs 2023-05-10 20:03:45 +00:00
Savarn Dontamsetti (Sav)
e2e1d1074c feat: Add TraderJoeV2 MixIn to Arbitrum BridgeAdapter (#723)
* Add TraderJoeV2 MixIn to ArbitrumBridgeAdapter
2023-05-10 15:40:36 -04:00
wonge97
6a15dc3f13 update link (#721) 2023-05-08 17:25:34 -05:00
Github Actions
fefa3c13f6 Publish
- @0x/contracts-erc20@4.0.7
 - @0x/governance@1.0.5
 - @0x/contracts-test-utils@5.4.53
 - @0x/contracts-treasury@1.4.47
 - @0x/contracts-utils@4.8.45
 - @0x/contracts-zero-ex@0.43.0
 - @0x/contract-addresses@8.6.0
 - @0x/contract-wrappers@13.23.1
 - @0x/protocol-utils@11.22.1
2023-05-01 21:25:50 +00:00
Github Actions
f1d096a8af Updated CHANGELOGS & MD docs 2023-05-01 21:25:47 +00:00
Savarn Dontamsetti (Sav)
394ccbdc24 feat: Update Trader Joe V2 MixIn to support V2.1 router (#717)
* Add Trader Joe V2.1 Router MixIn

* Update changelog and FQT address

* lowercasing Avalanche FQT
2023-05-01 15:33:35 -04:00
Savarn Dontamsetti (Sav)
5a47f04ffc fix: remove vm.stopPrank if vm.startPrank not present (#719)
* remove vm.stopPrank if vm.startPrank not present

* remove unnecessary vm.stopPrank from governance tests
2023-05-01 14:13:56 -04:00
wonge97
3c414c12e6 fix malformed table (#718)
table was missing one space :(
2023-04-27 13:19:52 -05:00
wonge97
d268a1136c update bounty page (#716) 2023-04-27 11:51:55 -05:00
40 changed files with 358 additions and 138 deletions

View File

@@ -1,4 +1,22 @@
[
{
"timestamp": 1683749017,
"version": "4.0.8",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1682976338,
"version": "4.0.7",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1681969282,
"version": "4.0.6",

View File

@@ -5,6 +5,14 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v4.0.8 - _May 10, 2023_
* Dependencies updated
## v4.0.7 - _May 1, 2023_
* Dependencies updated
## v4.0.6 - _April 20, 2023_
* Dependencies updated

View File

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

View File

@@ -39,7 +39,6 @@ contract WETH9V06Test is Test {
function testShouldConvertDepositedETHToWrappedETH() public {
vm.prank(user);
etherToken.deposit{value: 1e20}();
vm.stopPrank();
assertEq(etherToken.balanceOf(user), 1e20);
assertEq(address(etherToken).balance, 1e20);
@@ -58,7 +57,6 @@ contract WETH9V06Test is Test {
etherToken.deposit{value: 1e20}();
vm.prank(user);
etherToken.withdraw(100);
vm.stopPrank();
assertEq(etherToken.balanceOf(user), 1e20 - 100);
assertEq(address(etherToken).balance, 1e20 - 100);
@@ -68,7 +66,6 @@ contract WETH9V06Test is Test {
function testShouldConvertSentETHToWrappedETH() public {
vm.prank(user);
address(etherToken).call{value: 1e20}(new bytes(0));
vm.stopPrank();
assertEq(etherToken.balanceOf(user), 1e20);
assertEq(address(etherToken).balance, 1e20);

View File

@@ -34,7 +34,6 @@ contract ZRXTokenTest is Test {
assembly {
_address := create(0, add(_bytecode, 0x20), mload(_bytecode))
}
vm.stopPrank();
zrxToken = IERC20Token(address(_address));
}
@@ -73,7 +72,6 @@ contract ZRXTokenTest is Test {
function testShouldReturnFalseIfSenderHasInsufficientBalance() public {
vm.prank(owner);
zrxToken.approve(user, totalSupply + 1);
vm.stopPrank();
bool success = zrxToken.transferFrom(owner, user, totalSupply + 1);
assertEq(success, false);
@@ -82,7 +80,6 @@ contract ZRXTokenTest is Test {
function testShouldReturnFalseIfRecipientHasInsufficientAllowance() public {
vm.prank(owner);
zrxToken.approve(user, totalSupply - 1);
vm.stopPrank();
bool success = zrxToken.transferFrom(owner, user, totalSupply);
assertEq(success, false);
@@ -97,7 +94,6 @@ contract ZRXTokenTest is Test {
function testShouldNotModifySenderAllowanceIfSetToUINT256Max() public {
vm.prank(owner);
zrxToken.approve(user, type(uint256).max);
vm.stopPrank();
zrxToken.transferFrom(owner, user, 100);
assertEq(zrxToken.allowance(owner, user), type(uint256).max);
@@ -106,7 +102,6 @@ contract ZRXTokenTest is Test {
function testShouldTransferCorrectlyWhenSufficientAllowance() public {
vm.prank(owner);
zrxToken.approve(user, 1000 * 1e18);
vm.stopPrank();
vm.prank(user);
zrxToken.transferFrom(owner, user, 100 * 1e18);

View File

@@ -1,4 +1,13 @@
[
{
"timestamp": 1682976338,
"version": "1.0.5",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1681756154,
"version": "1.0.4",

View File

@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v1.0.5 - _May 1, 2023_
* Dependencies updated
## v1.0.4 - _April 17, 2023_
* Dependencies updated

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/governance",
"version": "1.0.4",
"version": "1.0.5",
"description": "Governance implementation for the 0x protocol and treasury",
"main": "index.js",
"directories": {

View File

@@ -90,7 +90,6 @@ abstract contract ZeroExGovernorBaseTest is BaseTest {
// Vote
vm.prank(account2);
governor.castVote(proposalId, 1); // Vote "for"
vm.stopPrank();
// Fast forward to vote end
vm.roll(governor.proposalDeadline(proposalId) + 1);
@@ -155,7 +154,6 @@ abstract contract ZeroExGovernorBaseTest is BaseTest {
// Vote
vm.prank(account2);
governor.castVote(proposalId, 1); // Vote "for"
vm.stopPrank();
// Fast forward to vote end
vm.roll(governor.proposalDeadline(proposalId) + 1);
@@ -266,7 +264,6 @@ abstract contract ZeroExGovernorBaseTest is BaseTest {
// Vote
vm.prank(account2);
governor.castVote(proposalId, 1); // Vote "for"
vm.stopPrank();
// Fast forward to vote end
vm.roll(governor.proposalDeadline(proposalId) + 1);
@@ -330,7 +327,6 @@ abstract contract ZeroExGovernorBaseTest is BaseTest {
// Vote
vm.prank(account2);
governor.castVote(proposalId, 1); // Vote "for"
vm.stopPrank();
// Fast forward to vote end
vm.roll(governor.proposalDeadline(proposalId) + 1);
@@ -366,7 +362,6 @@ abstract contract ZeroExGovernorBaseTest is BaseTest {
// Vote
vm.prank(account2);
governor.castVote(proposalId, 1); // Vote "for"
vm.stopPrank();
// Fast forward to vote end
vm.roll(governor.proposalDeadline(proposalId) + 1);
@@ -402,7 +397,6 @@ abstract contract ZeroExGovernorBaseTest is BaseTest {
// Vote
vm.prank(account2);
governor.castVote(proposalId, 1); // Vote "for"
vm.stopPrank();
// Fast forward to vote end
vm.roll(governor.proposalDeadline(proposalId) + 1);
@@ -438,7 +432,6 @@ abstract contract ZeroExGovernorBaseTest is BaseTest {
// Vote
vm.prank(account2);
governor.castVote(proposalId, 1); // Vote "for"
vm.stopPrank();
// Fast forward to vote end
vm.roll(governor.proposalDeadline(proposalId) + 1);

View File

@@ -70,13 +70,12 @@ contract ZeroExProtocolGovernorTest is ZeroExGovernorBaseTest {
// Vote
vm.prank(account2);
governor.castVote(proposalId, 1); // Vote "for"
vm.stopPrank();
vm.prank(account3);
governor.castVote(proposalId, 0); // Vote "against"
vm.stopPrank();
vm.prank(account4);
governor.castVote(proposalId, 2); // Vote "abstain"
vm.stopPrank();
// Fast forward to vote end
vm.roll(governor.proposalDeadline(proposalId) + 1);

View File

@@ -66,13 +66,12 @@ contract ZeroExTreasuryGovernorTest is ZeroExGovernorBaseTest {
// Vote
vm.prank(account2);
governor.castVote(proposalId, 1); // Vote "for"
vm.stopPrank();
vm.prank(account3);
governor.castVote(proposalId, 0); // Vote "against"
vm.stopPrank();
vm.prank(account4);
governor.castVote(proposalId, 2); // Vote "abstain"
vm.stopPrank();
// Fast forward to vote end
vm.roll(governor.proposalDeadline(proposalId) + 1);

View File

@@ -1,4 +1,22 @@
[
{
"timestamp": 1683749017,
"version": "5.4.54",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1682976338,
"version": "5.4.53",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1681969282,
"version": "5.4.52",

View File

@@ -5,6 +5,14 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v5.4.54 - _May 10, 2023_
* Dependencies updated
## v5.4.53 - _May 1, 2023_
* Dependencies updated
## v5.4.52 - _April 20, 2023_
* Dependencies updated

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/contracts-test-utils",
"version": "5.4.52",
"version": "5.4.54",
"engines": {
"node": ">=6.12"
},
@@ -41,7 +41,7 @@
"dependencies": {
"@0x/assert": "^3.0.36",
"@0x/base-contract": "^7.0.0",
"@0x/contract-addresses": "^8.5.0",
"@0x/contract-addresses": "^8.7.0",
"@0x/dev-utils": "^5.0.2",
"@0x/json-schemas": "^6.4.4",
"@0x/order-utils": "^10.4.28",

View File

@@ -1,4 +1,22 @@
[
{
"timestamp": 1683749017,
"version": "1.4.48",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1682976338,
"version": "1.4.47",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1682334742,
"version": "1.4.46",

View File

@@ -5,6 +5,14 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v1.4.48 - _May 10, 2023_
* Dependencies updated
## v1.4.47 - _May 1, 2023_
* Dependencies updated
## v1.4.46 - _April 24, 2023_
* Dependencies updated

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/contracts-treasury",
"version": "1.4.46",
"version": "1.4.48",
"engines": {
"node": ">=6.12"
},
@@ -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.5.0",
"@0x/contract-addresses": "^8.7.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.52",
"@0x/contracts-test-utils": "^5.4.54",
"@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.22.0",
"@0x/protocol-utils": "^11.22.2",
"@0x/subproviders": "^8.0.1",
"@0x/types": "^3.3.7",
"@0x/typescript-typings": "^5.3.1",

View File

@@ -1,4 +1,22 @@
[
{
"timestamp": 1683749017,
"version": "4.8.46",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1682976338,
"version": "4.8.45",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1681969282,
"version": "4.8.44",

View File

@@ -5,6 +5,14 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v4.8.46 - _May 10, 2023_
* Dependencies updated
## v4.8.45 - _May 1, 2023_
* Dependencies updated
## v4.8.44 - _April 20, 2023_
* Dependencies updated

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/contracts-utils",
"version": "4.8.44",
"version": "4.8.46",
"engines": {
"node": ">=6.12"
},
@@ -45,7 +45,7 @@
"devDependencies": {
"@0x/abi-gen": "^5.8.5",
"@0x/contracts-gen": "^2.0.50",
"@0x/contracts-test-utils": "^5.4.52",
"@0x/contracts-test-utils": "^5.4.54",
"@0x/dev-utils": "^5.0.2",
"@0x/order-utils": "^10.4.28",
"@0x/sol-compiler": "^4.8.2",

View File

@@ -1,4 +1,22 @@
[
{
"version": "0.44.0",
"changes": [
{
"note": "Add Trader Joe V2 MixIn to Arbitrum"
}
],
"timestamp": 1683749017
},
{
"version": "0.43.0",
"changes": [
{
"note": "Add Trader Joe V2.1 Router Support for MixIn"
}
],
"timestamp": 1682976338
},
{
"timestamp": 1682334742,
"version": "0.42.1",

View File

@@ -5,6 +5,14 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v0.44.0 - _May 10, 2023_
* Add Trader Joe V2 MixIn to Arbitrum
## v0.43.0 - _May 1, 2023_
* Add Trader Joe V2.1 Router Support for MixIn
## v0.42.1 - _April 24, 2023_
* Dependencies updated

View File

@@ -26,6 +26,7 @@ import "./mixins/MixinKyberDmm.sol";
import "./mixins/MixinKyberElastic.sol";
import "./mixins/MixinGMX.sol";
import "./mixins/MixinNerve.sol";
import "./mixins/MixinTraderJoeV2.sol";
import "./mixins/MixinUniswapV3.sol";
import "./mixins/MixinUniswapV2.sol";
import "./mixins/MixinWOOFi.sol";
@@ -42,6 +43,7 @@ contract ArbitrumBridgeAdapter is
MixinKyberElastic,
MixinGMX,
MixinNerve,
MixinTraderJoeV2,
MixinUniswapV3,
MixinUniswapV2,
MixinWOOFi,
@@ -97,6 +99,11 @@ contract ArbitrumBridgeAdapter is
return (0, true);
}
boughtAmount = _tradeUniswapV2(buyToken, sellAmount, order.bridgeData);
} else if (protocolId == BridgeProtocols.TRADERJOEV2) {
if (dryRun) {
return (0, true);
}
boughtAmount = _tradeTraderJoeV2(buyToken, sellAmount, order.bridgeData);
} else if (protocolId == BridgeProtocols.GMX) {
if (dryRun) {
return (0, true);

View File

@@ -20,19 +20,43 @@ import "@0x/contracts-erc20/src/IERC20Token.sol";
import "../IBridgeAdapter.sol";
interface ILBRouter {
/// @notice Swaps exact tokens for tokens while performing safety checks
/// @param amountIn The amount of token to send
/// @param amountOutMin The min amount of token to receive
/// @param pairBinSteps The bin step of the pairs (0: V1, other values will use V2)
/// @param tokenPath The swap path using the binSteps following `_pairBinSteps`
/// @param to The address of the recipient
/// @param deadline The deadline of the tx
/// @return amountOut Output amount of the swap
/**
* @dev This enum represents the version of the pair requested
* - V1: Joe V1 pair
* - V2: LB pair V2. Also called legacyPair
* - V2_1: LB pair V2.1 (current version)
*/
enum Version {
V1,
V2,
V2_1
}
/**
* @dev The path parameters, such as:
* - pairBinSteps: The list of bin steps of the pairs to go through
* - versions: The list of versions of the pairs to go through
* - tokenPath: The list of tokens in the path to go through
*/
struct Path {
uint256[] pairBinSteps;
Version[] versions;
IERC20Token[] tokenPath;
}
/**
* @notice Swaps exact tokens for tokens while performing safety checks
* @param amountIn The amount of token to send
* @param amountOutMin The min amount of token to receive
* @param path The path of the swap
* @param to The address of the recipient
* @param deadline The deadline of the tx
* @return amountOut Output amount of the swap
*/
function swapExactTokensForTokens(
uint256 amountIn,
uint256 amountOutMin,
uint256[] memory pairBinSteps,
IERC20Token[] memory tokenPath,
Path memory path,
address to,
uint256 deadline
) external returns (uint256 amountOut);
@@ -49,12 +73,16 @@ contract MixinTraderJoeV2 {
ILBRouter router;
IERC20Token[] memory tokenPath;
uint256[] memory pairBinSteps;
ILBRouter.Version[] memory versions;
{
address[] memory _path;
(router, _path, pairBinSteps) = abi.decode(bridgeData, (ILBRouter, address[], uint256[]));
address[] memory _tokenPath;
(router, _tokenPath, pairBinSteps, versions) = abi.decode(
bridgeData,
(ILBRouter, address[], uint256[], ILBRouter.Version[])
);
// To get around `abi.decode()` not supporting interface array types.
assembly {
tokenPath := _path
tokenPath := _tokenPath
}
}
@@ -63,6 +91,10 @@ contract MixinTraderJoeV2 {
tokenPath.length == pairBinSteps.length + 1,
"MixinTraderJoeV2/PAIR_BIN_STEPS_LENGTH_MUST_BE_ONE_LESS_THAN_TOKEN_PATH_LENGTH"
);
require(
versions.length == pairBinSteps.length,
"MixinTraderJoeV2/VERSIONS_LENGTH_MUST_BE_EQUAL_TO_PAIR_BIN_STEPS_LENGTH"
);
require(
tokenPath[tokenPath.length - 1] == buyToken,
"MixinTraderJoeV2/LAST_ELEMENT_OF_PATH_MUST_MATCH_OUTPUT_TOKEN"
@@ -70,13 +102,11 @@ contract MixinTraderJoeV2 {
// Grant the Trader Joe V2 router an allowance to sell the first token.
tokenPath[0].approveIfBelow(address(router), sellAmount);
boughtAmount = router.swapExactTokensForTokens(
sellAmount,
1,
pairBinSteps,
tokenPath,
address(this),
block.timestamp
);
ILBRouter.Path memory path = ILBRouter.Path({
pairBinSteps: pairBinSteps,
versions: versions,
tokenPath: tokenPath
});
boughtAmount = router.swapExactTokensForTokens(sellAmount, 1, path, address(this), block.timestamp);
}
}

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/contracts-zero-ex",
"version": "0.42.1",
"version": "0.44.0",
"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.5",
"@0x/contract-addresses": "^8.5.0",
"@0x/contract-addresses": "^8.7.0",
"@0x/contracts-erc20": "^3.3.57",
"@0x/contracts-gen": "^2.0.50",
"@0x/contracts-test-utils": "^5.4.52",
"@0x/contracts-test-utils": "^5.4.54",
"@0x/dev-utils": "^5.0.2",
"@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.22.0",
"@0x/protocol-utils": "^11.22.2",
"@0x/subproviders": "^8.0.1",
"@0x/types": "^3.3.7",
"@0x/typescript-typings": "^5.3.1",

View File

@@ -5,7 +5,7 @@
"KyberElasticQuoter": "0x0d125c15d54ca1f8a813c74a81aee34ebb508c1f",
"KyberElasticRouter": "0xc1e7dfe73e1598e3910ef4c7845b68a9ab6f4c83",
"KyberElasticPool": "0x952ffc4c47d66b454a8181f5c68b6248e18b66ec",
"TraderJoeV2Pool": "0x0000000000000000000000000000000000000000",
"TraderJoeV2Quoter": "0x0000000000000000000000000000000000000000",
"TraderJoeV2Router": "0x0000000000000000000000000000000000000000"
},
"56": {
@@ -14,7 +14,7 @@
"KyberElasticQuoter": "0x0d125c15d54ca1f8a813c74a81aee34ebb508c1f",
"KyberElasticRouter": "0xc1e7dfe73e1598e3910ef4c7845b68a9ab6f4c83",
"KyberElasticPool": "0xfbfab68ba077d099cd4b66fa76920572cc0b557c",
"TraderJoeV2Pool": "0x0000000000000000000000000000000000000000",
"TraderJoeV2Quoter": "0x0000000000000000000000000000000000000000",
"TraderJoeV2Router": "0x0000000000000000000000000000000000000000"
},
"137": {
@@ -23,7 +23,7 @@
"KyberElasticQuoter": "0x0d125c15d54ca1f8a813c74a81aee34ebb508c1f",
"KyberElasticRouter": "0xc1e7dfe73e1598e3910ef4c7845b68a9ab6f4c83",
"KyberElasticPool": "0xf9cc934753a127100585812181ac04d07158a4c2",
"TraderJoeV2Pool": "0x0000000000000000000000000000000000000000",
"TraderJoeV2Quoter": "0x0000000000000000000000000000000000000000",
"TraderJoeV2Router": "0x0000000000000000000000000000000000000000"
},
"43114": {
@@ -32,8 +32,8 @@
"KyberElasticQuoter": "0x0d125c15d54ca1f8a813c74a81aee34ebb508c1f",
"KyberElasticRouter": "0xc1e7dfe73e1598e3910ef4c7845b68a9ab6f4c83",
"KyberElasticPool": "0x6038373de7f64da99b2a31951628b7d778b2c3cf",
"TraderJoeV2Pool": "0x1D7A1a79e2b4Ef88D2323f3845246D24a3c20F1d",
"TraderJoeV2Router": "0xE3Ffc583dC176575eEA7FD9dF2A7c65F7E23f4C3"
"TraderJoeV2Quoter": "0x64b57F4249aA99a812212cee7DAEFEDC40B203cD",
"TraderJoeV2Router": "0xb4315e873dBcf96Ffd0acd8EA43f689D8c20fB30"
},
"250": {
"UniswapV2Router": "0x1b02da8cb0d097eb8d57a175b88c7d8b47997506",
@@ -41,7 +41,7 @@
"KyberElasticQuoter": "0x0d125c15d54ca1f8a813c74a81aee34ebb508c1f",
"KyberElasticRouter": "0xc1e7dfe73e1598e3910ef4c7845b68a9ab6f4c83",
"KyberElasticPool": "0x8dcf5fed6ae6bf0befb5e4f0c9414c2cb9a4ed01",
"TraderJoeV2Pool": "0x0000000000000000000000000000000000000000",
"TraderJoeV2Quoter": "0x0000000000000000000000000000000000000000",
"TraderJoeV2Router": "0x0000000000000000000000000000000000000000"
},
"10": {
@@ -50,7 +50,7 @@
"KyberElasticQuoter": "0x0d125c15d54ca1f8a813c74a81aee34ebb508c1f",
"KyberElasticRouter": "0xc1e7dfe73e1598e3910ef4c7845b68a9ab6f4c83",
"KyberElasticPool": "0x7e29ccaa4bf2894aca02c77e6b99cafc1d24b2f5",
"TraderJoeV2Pool": "0x0000000000000000000000000000000000000000",
"TraderJoeV2Quoter": "0x0000000000000000000000000000000000000000",
"TraderJoeV2Router": "0x0000000000000000000000000000000000000000"
},
"42161": {
@@ -59,7 +59,7 @@
"KyberElasticQuoter": "0x0d125c15d54ca1f8a813c74a81aee34ebb508c1f",
"KyberElasticRouter": "0xc1e7dfe73e1598e3910ef4c7845b68a9ab6f4c83",
"KyberElasticPool": "0x087abaab9cd85025a8b3916948c69fe173c837ea",
"TraderJoeV2Pool": "0x0000000000000000000000000000000000000000",
"TraderJoeV2Router": "0x0000000000000000000000000000000000000000"
"TraderJoeV2Quoter": "0x64b57F4249aA99a812212cee7DAEFEDC40B203cD",
"TraderJoeV2Router": "0xb4315e873dBcf96Ffd0acd8EA43f689D8c20fB30"
}
}

View File

@@ -56,8 +56,8 @@ contract SwapERC20ForERC20Test is Test, ForkUtils, TestUtils {
function test_swapERC20ForERC20OnTraderJoeV2() public {
for (uint256 i = 0; i < chains.length; i++) {
// TraderJoeV2 mixin only enabled on Avalanche
if (i != 3) {
// TraderJoeV2 mixin only enabled on Avalanche and Arbitrum
if (i != 3 && i != 6) {
continue;
}
vm.selectFork(forkIds[chains[i]]);
@@ -81,8 +81,8 @@ contract SwapERC20ForERC20Test is Test, ForkUtils, TestUtils {
emit log_string("TraderJoeV2Router not available on this chain");
return;
}
if (sources.TraderJoeV2Pool == address(0)) {
emit log_string("TraderJoeV2Pool not available on this chain");
if (sources.TraderJoeV2Quoter == address(0)) {
emit log_string("TraderJoeV2Quoter not available on this chain");
return;
}
@@ -94,12 +94,11 @@ contract SwapERC20ForERC20Test is Test, ForkUtils, TestUtils {
fqtData.fillSequence[0] = FillQuoteTransformer.OrderType.Bridge;
fqtData.fillAmount = 1e6;
(uint256 amountOut, uint256 binStep) = sampleTraderJoeV2(
(uint256 amountOut, uint256 binStep, uint256 version) = sampleTraderJoeV2(
fqtData.fillAmount,
address(fqtData.sellToken),
address(fqtData.buyToken),
sources.TraderJoeV2Router,
sources.TraderJoeV2Pool
sources.TraderJoeV2Quoter
);
log_named_uint("amountOut", amountOut);
@@ -110,7 +109,9 @@ contract SwapERC20ForERC20Test is Test, ForkUtils, TestUtils {
tokenPath[1] = address(fqtData.buyToken);
uint256[] memory binSteps = new uint256[](1);
binSteps[0] = binStep;
order.bridgeData = abi.encode(address(sources.TraderJoeV2Router), tokenPath, binSteps);
uint256[] memory versions = new uint256[](1);
versions[0] = version;
order.bridgeData = abi.encode(address(sources.TraderJoeV2Router), tokenPath, binSteps, versions);
}
order.source = bytes32(uint256(BridgeProtocols.TRADERJOEV2) << 128);
@@ -198,20 +199,23 @@ contract SwapERC20ForERC20Test is Test, ForkUtils, TestUtils {
uint256 amount,
address takerToken,
address makerToken,
address router,
address pool
) private returns (uint256 makerTokenAmount, uint256 binStep) {
address quoter
) private returns (uint256 makerTokenAmount, uint256 binStep, uint256 version) {
log_string("Sampling TraderJoeV2");
log_named_address("takerToken", takerToken);
log_named_address("makerToken", makerToken);
log_named_address("router", router);
log_named_address("pool", pool);
log_named_address("quoter", quoter);
bool swapForY = ITraderJoeV2Pool(pool).tokenY() == makerToken;
address[] memory tokenPath = new address[](2);
tokenPath[0] = takerToken;
tokenPath[1] = makerToken;
(makerTokenAmount, ) = ITraderJoeV2Router(router).getSwapOut(pool, amount, swapForY);
ITraderJoeV2Quoter.Quote memory quote = ITraderJoeV2Quoter(quoter).findBestPathFromAmountIn(
tokenPath,
uint128(amount)
);
binStep = ITraderJoeV2Pool(pool).feeParameters().binStep;
return (quote.amounts[1], quote.binSteps[0], uint256(quote.versions[0]));
}
function deployFQTAndGetDeploymentNonce(

View File

@@ -93,7 +93,7 @@ struct LiquiditySources {
address KyberElasticPool;
address KyberElasticQuoter;
address KyberElasticRouter;
address TraderJoeV2Pool;
address TraderJoeV2Quoter;
address TraderJoeV2Router;
address UniswapV2Router;
address UniswapV3Router;
@@ -103,35 +103,27 @@ interface IFQT {
function bridgeAdapter() external returns (address);
}
interface ITraderJoeV2Pool {
struct FeeParameters {
// 144 lowest bits in slot
uint16 binStep;
uint16 baseFactor;
uint16 filterPeriod;
uint16 decayPeriod;
uint16 reductionFactor;
uint24 variableFeeControl;
uint16 protocolShare;
uint24 maxVolatilityAccumulated;
// 112 highest bits in slot
uint24 volatilityAccumulated;
uint24 volatilityReference;
uint24 indexRef;
uint40 time;
interface ITraderJoeV2Quoter {
enum Version {
V1,
V2,
V2_1
}
function feeParameters() external view returns (FeeParameters memory);
struct Quote {
address[] route;
address[] pairs;
uint256[] binSteps;
Version[] versions;
uint128[] amounts;
uint128[] virtualAmountsWithoutSlippage;
uint128[] fees;
}
function tokenY() external view returns (address);
}
interface ITraderJoeV2Router {
function getSwapOut(
address pool,
uint256 amountIn,
bool swapForY
) external view returns (uint256 amountOut, uint256 feesIn);
function findBestPathFromAmountIn(
address[] calldata route,
uint128 amountIn
) external view returns (Quote memory quote);
}
interface IKyberElasticQuoter {

View File

@@ -19,14 +19,14 @@ The following contracts are in scope of the bug bounty. Please note that any bug
+------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+
| **Release** | **Contracts** | **Commit Hash** |
+------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+
| Exchange V4 | * Documentation at `https://protocol.0x.org/en/latest/ <https://protocol.0x.org/en/latest/>`__ | `c1177416f5 <https://github.com/0xProject/protocol/tree/c1177416f50c2465ee030dacc14ff996eebd4e74/contracts>`__ |
| | * `ZeroEx.sol <https://github.com/0xProject/protocol/tree/c1177416f50c2465ee030dacc14ff996eebd4e74/contracts/zero-ex/contracts/src/ZeroEx.sol>`__ | |
| | * `ZeroExOptimized.sol <https://github.com/0xProject/protocol/tree/c1177416f50c2465ee030dacc14ff996eebd4e74/contracts/zero-ex/contracts/src/ZeroExOptimized.sol>`__ | |
| | * `external/*.sol <https://github.com/0xProject/protocol/tree/c1177416f50c2465ee030dacc14ff996eebd4e74/contracts/zero-ex/contracts/src/external>`__ | |
| | * `features/**.sol <https://github.com/0xProject/protocol/tree/c1177416f50c2465ee030dacc14ff996eebd4e74/contracts/zero-ex/contracts/src/features>`__ | |
| | * `fixins/*.sol <https://github.com/0xProject/protocol/tree/c1177416f50c2465ee030dacc14ff996eebd4e74/contracts/zero-ex/contracts/src/fixins>`__ | |
| | * `migrations/*.sol <https://github.com/0xProject/protocol/tree/c1177416f50c2465ee030dacc14ff996eebd4e74/contracts/zero-ex/contracts/src/migrations>`__ | |
| | * `storage/*.sol <https://github.com/0xProject/protocol/tree/c1177416f50c2465ee030dacc14ff996eebd4e74/contracts/zero-ex/contracts/src/storage>`__ | |
| Exchange V4 | * Documentation at `https://docs.0xProtocol.org/en/latest/ <https://docs.0xProtocol.org/en/latest/>`__ | |
| | * `ZeroEx.sol <https://github.com/0xProject/protocol/tree/development/contracts/zero-ex/contracts/src/ZeroEx.sol>`__ | |
| | * `ZeroExOptimized.sol <https://github.com/0xProject/protocol/tree/development/contracts/zero-ex/contracts/src/ZeroExOptimized.sol>`__ | |
| | * `external/*.sol <https://github.com/0xProject/protocol/tree/development/contracts/zero-ex/contracts/src/external>`__ | |
| | * `features/*.sol <https://github.com/0xProject/protocol/tree/development/contracts/zero-ex/contracts/src/features>`__ | |
| | * `fixins/*.sol <https://github.com/0xProject/protocol/tree/development/contracts/zero-ex/contracts/src/fixins>`__ | |
| | * `migrations/*.sol <https://github.com/0xProject/protocol/tree/development/contracts/zero-ex/contracts/src/migrations>`__ | |
| | * `storage/*.sol <https://github.com/0xProject/protocol/tree/development/contracts/zero-ex/contracts/src/storage>`__ | |
+------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+
| Exchange V3 | * `ERC20BridgeProxy.sol <https://github.com/0xProject/0x-monorepo/blob/fb8360edfd4f42f2d2b127b95c156eb1b0daa02b/contracts/asset-proxy/contracts/src/ERC20BridgeProxy.sol>`_ (`spec <https://github.com/0xProject/0x-protocol-specification/blob/master/asset-proxy/erc20-bridge-proxy.md>`__) | `fb8360edfd <https://github.com/0xProject/0x-monorepo/tree/fb8360edfd4f42f2d2b127b95c156eb1b0daa02b/contracts>`__ |
| | * `Exchange.sol <https://github.com/0xProject/0x-monorepo/blob/fb8360edfd4f42f2d2b127b95c156eb1b0daa02b/contracts/exchange/contracts/src/Exchange.sol>`__ (`spec <https://github.com/0xProject/0x-protocol-specification/blob/master/v3/v3-specification.md>`__) | |
@@ -46,8 +46,6 @@ The following contracts are in scope of the bug bounty. Please note that any bug
+------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+
| ERC20BridgeProxy | * `ERC20BridgeProxy.sol <https://github.com/0xProject/0x-monorepo/blob/281658ba349a2c5088b40b503998bea5020284a6/contracts/asset-proxy/contracts/src/ERC20BridgeProxy.sol>`__ | `281658ba34 <https://github.com/0xProject/0x-monorepo/tree/281658ba349a2c5088b40b503998bea5020284a6/contracts>`_ |
+------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+
| ExchangeProxy | * `contracts/src <https://github.com/0xProject/protocol/tree/c1177416f50c2465ee030dacc14ff996eebd4e74/contracts/zero-ex/contracts/src>`__ | `c1177416f5 <https://github.com/0xProject/protocol/tree/c1177416f50c2465ee030dacc14ff996eebd4e74/contracts/zero-ex/contracts/src>`_ |
+------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+
Bounties
--------
@@ -67,19 +65,10 @@ The final reward amount is at the sole discretion of 0x Labs and will be paid in
| Low (CVSS 0.0 - 3.9) | up to $5,000 |
+----------------------------+---------------------+
Recent Inclusions
-----------------
+---------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------+
| **Change** | **** |
+---------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------+
| NFT feature | * Trade ERC721 and ERC1155 assets. See `ZEIP-93 <https://github.com/0xProject/ZEIPs/issues/93>`__ for more details |
+---------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------+
Disclosures
-----------
Please e-mail all submissions to security@0x.org with the subject "BUG BOUNTY". Your submission
should include any steps required to reproduce or exploit the vulnerability. Please allow time for
the vulnerability to be fixed before discussing any findings publicly. After receiving a submission,
we will contact you with expected timelines for a fix to be implemented.
we will contact you with expected timelines for a fix to be implemented.

View File

@@ -295,7 +295,7 @@ In both cases, the ``@0x/protocol-utils`` package simplifies generating these si
The Orderbook
=======================
Orders can be hosted by any server and are usually represented as a JSON object off-chain. For example, one off-chain way to post and discover orders is through `0x API <https://0x.org/api>`_.
Orders can be hosted by any server and are usually represented as a JSON object off-chain. For example, one off-chain way to post and discover orders is through `0x Orderbook API <https://0x.org/docs/category/orderbook-api>`_.
Below is a table represention and example of how orders should be formatted off-chain.

View File

@@ -1,4 +1,22 @@
[
{
"version": "8.7.0",
"changes": [
{
"note": "Add Trader Joe V2 MixIn to Arbitrum"
}
],
"timestamp": 1683749017
},
{
"version": "8.6.0",
"changes": [
{
"note": "Add Trader Joe V2.1 Router Support for MixIn"
}
],
"timestamp": 1682976338
},
{
"version": "8.5.0",
"changes": [

View File

@@ -6,6 +6,12 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v8.7.0 - _May 10, 2023_
* Add Trader Joe V2 MixIn to Arbitrum
## v8.6.0 - _May 1, 2023_
* Add Trader Joe V2.1 Router Support for MixIn
## v8.5.0 - _April 20, 2023_
* Add Trader Joe V2 support on Avalanche

View File

@@ -156,7 +156,7 @@
"wethTransformer": "0x9b8b52391071d71cd4ad1e61d7f273268fa34c6c",
"payTakerTransformer": "0xb9a4c32547bc3cdc2ee2fb13cc1a0717dac9888f",
"affiliateFeeTransformer": "0x105679f99d668001370b4621ad8648ac570c860f",
"fillQuoteTransformer": "0x540079df6023d39b2686fd9f6c06f1f8f66aca4a",
"fillQuoteTransformer": "0x886e4f97d7e06ab66dba574a7a861046dcf7ae4f",
"positiveSlippageFeeTransformer": "0xadbfdc58a24b6dbc16f21541800f43dd6e282250"
}
},
@@ -248,7 +248,7 @@
"wethTransformer": "0x10e968968f49dd66a5efeebbb2edcb9c49c4fc49",
"payTakerTransformer": "0xd81e65fc9bb7323bdbef8b2cdddd3b83fe41d630",
"affiliateFeeTransformer": "0x970e318b8f074c20bf0cee06970f01dc7a761e50",
"fillQuoteTransformer": "0x5d3a221bad31c3f3c07bea2f1de9b3ec17664b69",
"fillQuoteTransformer": "0x4a8815c2fc605e3b01aee52aade4d096c4e862c6",
"positiveSlippageFeeTransformer": "0x20f935b037e8490d8027f2751f9452725eee01ad"
}
}

View File

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

View File

@@ -1,4 +1,22 @@
[
{
"timestamp": 1683749017,
"version": "13.23.2",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1682976338,
"version": "13.23.1",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"version": "13.23.0",
"changes": [

View File

@@ -6,6 +6,12 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v13.23.2 - _May 10, 2023_
* Dependencies updated
## v13.23.1 - _May 1, 2023_
* Dependencies updated
## v13.23.0 - _April 24, 2023_
* Regenerate IZeroEx wrapper

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/contract-wrappers",
"version": "13.23.0",
"version": "13.23.2",
"engines": {
"node": ">=6.12"
},
@@ -59,7 +59,7 @@
"dependencies": {
"@0x/assert": "^3.0.36",
"@0x/base-contract": "^7.0.0",
"@0x/contract-addresses": "^8.5.0",
"@0x/contract-addresses": "^8.7.0",
"@0x/json-schemas": "^6.4.4",
"@0x/types": "^3.3.7",
"@0x/utils": "^7.0.0",

View File

@@ -1,4 +1,22 @@
[
{
"timestamp": 1683749017,
"version": "11.22.2",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1682976338,
"version": "11.22.1",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"version": "11.22.0",
"changes": [

View File

@@ -6,6 +6,12 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v11.22.2 - _May 10, 2023_
* Dependencies updated
## v11.22.1 - _May 1, 2023_
* Dependencies updated
## v11.22.0 - _April 24, 2023_
* Add MetaTransactionV2 utilities

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/protocol-utils",
"version": "11.22.0",
"version": "11.22.2",
"engines": {
"node": ">=6.12"
},
@@ -62,8 +62,8 @@
},
"dependencies": {
"@0x/assert": "^3.0.36",
"@0x/contract-addresses": "^8.5.0",
"@0x/contract-wrappers": "^13.23.0",
"@0x/contract-addresses": "^8.7.0",
"@0x/contract-wrappers": "^13.23.2",
"@0x/json-schemas": "^6.4.4",
"@0x/subproviders": "^8.0.1",
"@0x/utils": "^7.0.0",