Compare commits
14 Commits
@0x/contra
...
protocol@c
Author | SHA1 | Date | |
---|---|---|---|
|
c2aed76f2f | ||
|
198d986fdc | ||
|
e2e1d1074c | ||
|
6a15dc3f13 | ||
|
fefa3c13f6 | ||
|
f1d096a8af | ||
|
394ccbdc24 | ||
|
5a47f04ffc | ||
|
3c414c12e6 | ||
|
d268a1136c | ||
|
f8dd7168ee | ||
|
527ccf2ae5 | ||
|
a7acf2951d | ||
|
e57fc60a76 |
@@ -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",
|
||||
|
@@ -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
|
||||
|
@@ -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"
|
||||
},
|
||||
|
@@ -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);
|
||||
|
@@ -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);
|
||||
|
@@ -1,4 +1,13 @@
|
||||
[
|
||||
{
|
||||
"timestamp": 1682976338,
|
||||
"version": "1.0.5",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"timestamp": 1681756154,
|
||||
"version": "1.0.4",
|
||||
|
@@ -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
|
||||
|
@@ -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": {
|
||||
|
@@ -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);
|
||||
|
@@ -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);
|
||||
|
@@ -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);
|
||||
|
@@ -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",
|
||||
|
@@ -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
|
||||
|
@@ -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",
|
||||
|
@@ -1,4 +1,31 @@
|
||||
[
|
||||
{
|
||||
"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",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"timestamp": 1681969282,
|
||||
"version": "1.4.45",
|
||||
|
@@ -5,6 +5,18 @@ 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
|
||||
|
||||
## v1.4.45 - _April 20, 2023_
|
||||
|
||||
* Dependencies updated
|
||||
|
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@0x/contracts-treasury",
|
||||
"version": "1.4.45",
|
||||
"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.21.0",
|
||||
"@0x/protocol-utils": "^11.22.2",
|
||||
"@0x/subproviders": "^8.0.1",
|
||||
"@0x/types": "^3.3.7",
|
||||
"@0x/typescript-typings": "^5.3.1",
|
||||
|
@@ -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",
|
||||
|
@@ -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
|
||||
|
@@ -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",
|
||||
|
@@ -1,4 +1,31 @@
|
||||
[
|
||||
{
|
||||
"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",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"version": "0.42.0",
|
||||
"changes": [
|
||||
|
@@ -5,6 +5,18 @@ 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
|
||||
|
||||
## v0.42.0 - _April 20, 2023_
|
||||
|
||||
* Add Trader Joe V2 support on Avalanche
|
||||
|
@@ -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);
|
||||
|
@@ -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);
|
||||
}
|
||||
}
|
||||
|
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@0x/contracts-zero-ex",
|
||||
"version": "0.42.0",
|
||||
"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.21.0",
|
||||
"@0x/protocol-utils": "^11.22.2",
|
||||
"@0x/subproviders": "^8.0.1",
|
||||
"@0x/types": "^3.3.7",
|
||||
"@0x/typescript-typings": "^5.3.1",
|
||||
|
@@ -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"
|
||||
}
|
||||
}
|
||||
|
@@ -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(
|
||||
|
@@ -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 {
|
||||
|
@@ -4,28 +4,34 @@ Audits
|
||||
|
||||
Below are links to our third-party audit reports.
|
||||
|
||||
+----------------------+---------------------------------------------------------------------------------------------------------------------------+
|
||||
| **Release** | **Reports** |
|
||||
+----------------------+---------------------------------------------------------------------------------------------------------------------------+
|
||||
| ERC721OrdersFeature | * `ABDK Consulting <https://s3.us-east-2.amazonaws.com/zeips.0x.org/audits/abdk-consulting/ABDK_0x_Solidity_v_1_0.pdf>`__ |
|
||||
| | |
|
||||
| | |
|
||||
| ERC1155OrdersFeature | |
|
||||
+----------------------+---------------------------------------------------------------------------------------------------------------------------+
|
||||
| Exchange V4 | * `Consensys Diligence (December 2020) <https://consensys.net/diligence/audits/2020/12/0x-exchange-v4/>`__ |
|
||||
+----------------------+---------------------------------------------------------------------------------------------------------------------------+
|
||||
| Exchange V3 | * `Trail of Bits <http://zeips.0x.org.s3-website.us-east-2.amazonaws.com/audits/56/trail-of-bits/audit.pdf>`__ |
|
||||
| | * `Consensys Diligence (Exchange) <https://diligence.consensys.net/audits/2019/09/0x-v3-exchange/>`__ |
|
||||
| | * `Consensys Diligence (Staking) <https://diligence.consensys.net/audits/2019/10/0x-v3-staking/>`__ |
|
||||
+----------------------+---------------------------------------------------------------------------------------------------------------------------+
|
||||
| Exchange V2.1 | * `First <https://docs.google.com/document/d/1jYv6V21MfCSwCS5fxD6ZyaLWGzkpRSUO0lZpST94XsA/edit>`_ |
|
||||
| | * `Consensys Diligence <https://github.com/ConsenSys/0x_audit_report_2018-07-23>`_ |
|
||||
+----------------------+---------------------------------------------------------------------------------------------------------------------------+
|
||||
| MultiAssetProxy | * `Consensys Diligence <https://github.com/ConsenSys/0x-audit-report-2018-12>`__ |
|
||||
+----------------------+---------------------------------------------------------------------------------------------------------------------------+
|
||||
| ERC1155Proxy | * `Consensys Diligence <https://github.com/ConsenSys/0x-audit-report-2019-05>`__ |
|
||||
+----------------------+---------------------------------------------------------------------------------------------------------------------------+
|
||||
| StaticCallProxy | * No third-party audit. |
|
||||
+----------------------+---------------------------------------------------------------------------------------------------------------------------+
|
||||
| ERC20BridgeProxy | * No third-party audit. |
|
||||
+----------------------+---------------------------------------------------------------------------------------------------------------------------+
|
||||
+----------------------+--------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| **Release** | **Reports** |
|
||||
+----------------------+--------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| Governance | * `Ourovoros <https://github.com/0xProject/protocol/blob/development/contracts/governance/audits/0xProtocol-06-04-2023-Final.pdf>`__ |
|
||||
+----------------------+--------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| MultiplexFeature | * `ABDK Consulting <https://github.com/0xProject/ZEIPs/blob/master/zeip96_images/ABDK_0x_MetaTransaction_v_1_0.pdf>`__ |
|
||||
| | |
|
||||
| MetaTransactions | |
|
||||
+----------------------+--------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| ERC721OrdersFeature | * `ABDK Consulting <https://s3.us-east-2.amazonaws.com/zeips.0x.org/audits/abdk-consulting/ABDK_0x_Solidity_v_1_0.pdf>`__ |
|
||||
| | |
|
||||
| | |
|
||||
| ERC1155OrdersFeature | |
|
||||
+----------------------+--------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| Exchange V4 | * `Consensys Diligence (December 2020) <https://consensys.net/diligence/audits/2020/12/0x-exchange-v4/>`__ |
|
||||
+----------------------+--------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| Exchange V3 | * `Trail of Bits <http://zeips.0x.org.s3-website.us-east-2.amazonaws.com/audits/56/trail-of-bits/audit.pdf>`__ |
|
||||
| | * `Consensys Diligence (Exchange) <https://diligence.consensys.net/audits/2019/09/0x-v3-exchange/>`__ |
|
||||
| | * `Consensys Diligence (Staking) <https://diligence.consensys.net/audits/2019/10/0x-v3-staking/>`__ |
|
||||
+----------------------+--------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| Exchange V2.1 | * `First <https://docs.google.com/document/d/1jYv6V21MfCSwCS5fxD6ZyaLWGzkpRSUO0lZpST94XsA/edit>`_ |
|
||||
| | * `Consensys Diligence <https://github.com/ConsenSys/0x_audit_report_2018-07-23>`_ |
|
||||
+----------------------+--------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| MultiAssetProxy | * `Consensys Diligence <https://github.com/ConsenSys/0x-audit-report-2018-12>`__ |
|
||||
+----------------------+--------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| ERC1155Proxy | * `Consensys Diligence <https://github.com/ConsenSys/0x-audit-report-2019-05>`__ |
|
||||
+----------------------+--------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| StaticCallProxy | * No third-party audit. |
|
||||
+----------------------+--------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| ERC20BridgeProxy | * No third-party audit. |
|
||||
+----------------------+--------------------------------------------------------------------------------------------------------------------------------------+
|
||||
|
@@ -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.
|
||||
|
@@ -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.
|
||||
|
||||
|
@@ -9,7 +9,7 @@ This documentation is aimed to serve as the canonical technical documentation fo
|
||||
- Subsections will provide a deep dive into each contracts
|
||||
- Tutorial and tools to get started building with/on top of 0x Protocol
|
||||
|
||||
To learn more about why 0x Protocol was created, read the whitepaper `here <https://github.com/0xProject/whitepaper/blob/master/0x_white_paper.pdf>`_ and at `0xProtocol.org <httpsL//0xProtocol.org>`_.
|
||||
To learn more about why 0x Protocol was created, read the whitepaper `here <https://github.com/0xProject/whitepaper/blob/master/0x_white_paper.pdf>`_ and at `0xProtocol.org <https://0xProtocol.org>`_.
|
||||
|
||||
All code is open sourced on `GitHub <https://github.com/0xProject/protocol>`_.
|
||||
|
||||
|
@@ -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": [
|
||||
|
@@ -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
|
||||
|
@@ -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"
|
||||
}
|
||||
}
|
||||
|
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@0x/contract-addresses",
|
||||
"version": "8.5.0",
|
||||
"version": "8.7.0",
|
||||
"engines": {
|
||||
"node": ">=6.12"
|
||||
},
|
||||
|
@@ -1,4 +1,13 @@
|
||||
[
|
||||
{
|
||||
"version": "3.19.0",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Regenerate IZeroEx artifact"
|
||||
}
|
||||
],
|
||||
"timestamp": 1682334742
|
||||
},
|
||||
{
|
||||
"timestamp": 1674517560,
|
||||
"version": "3.18.3",
|
||||
|
@@ -6,6 +6,9 @@ Edit the package's CHANGELOG.json file only.
|
||||
|
||||
CHANGELOG
|
||||
|
||||
## v3.19.0 - _April 24, 2023_
|
||||
|
||||
* Regenerate IZeroEx artifact
|
||||
## v3.18.3 - _January 23, 2023_
|
||||
|
||||
* Dependencies updated
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@0x/contract-artifacts",
|
||||
"version": "3.18.3",
|
||||
"version": "3.19.0",
|
||||
"engines": {
|
||||
"node": ">=6.12"
|
||||
},
|
||||
|
@@ -1,4 +1,31 @@
|
||||
[
|
||||
{
|
||||
"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": [
|
||||
{
|
||||
"note": "Regenerate IZeroEx wrapper"
|
||||
}
|
||||
],
|
||||
"timestamp": 1682334742
|
||||
},
|
||||
{
|
||||
"timestamp": 1681969282,
|
||||
"version": "13.22.21",
|
||||
|
@@ -6,6 +6,15 @@ 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
|
||||
## v13.22.21 - _April 20, 2023_
|
||||
|
||||
* Dependencies updated
|
||||
|
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@0x/contract-wrappers",
|
||||
"version": "13.22.21",
|
||||
"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",
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -1,4 +1,31 @@
|
||||
[
|
||||
{
|
||||
"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": [
|
||||
{
|
||||
"note": "Add MetaTransactionV2 utilities"
|
||||
}
|
||||
],
|
||||
"timestamp": 1682334742
|
||||
},
|
||||
{
|
||||
"version": "11.21.0",
|
||||
"changes": [
|
||||
|
@@ -6,6 +6,15 @@ 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
|
||||
## v11.21.0 - _April 20, 2023_
|
||||
|
||||
* Add Trader Joe V2 support on Avalanche
|
||||
|
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@0x/protocol-utils",
|
||||
"version": "11.21.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.22.21",
|
||||
"@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",
|
||||
|
@@ -12,6 +12,7 @@ export const NFTOrder = {
|
||||
export * from './eip712_utils';
|
||||
export * from './orders';
|
||||
export * from './meta_transactions';
|
||||
export * from './meta_transactions_v2';
|
||||
export * from './signature_utils';
|
||||
export * from './transformer_utils';
|
||||
export * from './constants';
|
||||
|
143
packages/protocol-utils/src/meta_transactions_v2.ts
Normal file
143
packages/protocol-utils/src/meta_transactions_v2.ts
Normal file
@@ -0,0 +1,143 @@
|
||||
import { getContractAddressesForChainOrThrow } from '@0x/contract-addresses';
|
||||
import { EIP712TypedData } from '@0x/types';
|
||||
import { BigNumber, hexUtils, NULL_ADDRESS } from '@0x/utils';
|
||||
import { ZERO } from './constants';
|
||||
import {
|
||||
createExchangeProxyEIP712Domain,
|
||||
EIP712_DOMAIN_PARAMETERS,
|
||||
getExchangeProxyEIP712Hash,
|
||||
getTypeHash,
|
||||
} from './eip712_utils';
|
||||
|
||||
export interface MetaTransactionV2Fee {
|
||||
recipient: string,
|
||||
amount: BigNumber,
|
||||
}
|
||||
|
||||
const MTX_DEFAULT_VALUES = {
|
||||
signer: NULL_ADDRESS,
|
||||
sender: NULL_ADDRESS,
|
||||
expirationTimeSeconds: ZERO,
|
||||
salt: ZERO,
|
||||
callData: hexUtils.leftPad(0),
|
||||
feeToken: NULL_ADDRESS,
|
||||
fees: [] as MetaTransactionV2Fee[],
|
||||
chainId: 1,
|
||||
verifyingContract: getContractAddressesForChainOrThrow(1).exchangeProxy,
|
||||
};
|
||||
|
||||
export type MetaTransactionV2Fields = typeof MTX_DEFAULT_VALUES;
|
||||
|
||||
export class MetaTransactionV2 {
|
||||
public static readonly FEE_STRUCT_NAME = 'MetaTransactionFeeData';
|
||||
public static readonly FEE_STRUCT_ABI = [
|
||||
{ type: 'address', name: 'recipient' },
|
||||
{ type: 'uint256', name: 'amount' },
|
||||
];
|
||||
public static readonly FEE_TYPE_HASH = getTypeHash(MetaTransactionV2.FEE_STRUCT_NAME, MetaTransactionV2.FEE_STRUCT_ABI);
|
||||
|
||||
public static readonly MTX_STRUCT_NAME = 'MetaTransactionDataV2';
|
||||
public static readonly MTX_STRUCT_ABI = [
|
||||
{ type: 'address', name: 'signer' },
|
||||
{ type: 'address', name: 'sender' },
|
||||
{ type: 'uint256', name: 'expirationTimeSeconds' },
|
||||
{ type: 'uint256', name: 'salt' },
|
||||
{ type: 'bytes', name: 'callData' },
|
||||
{ type: 'address', name: 'feeToken' },
|
||||
{ type: `${MetaTransactionV2.FEE_STRUCT_NAME}[]`, name: 'fees' },
|
||||
];
|
||||
public static readonly MTX_TYPE_HASH = getTypeHash(
|
||||
MetaTransactionV2.MTX_STRUCT_NAME,
|
||||
MetaTransactionV2.MTX_STRUCT_ABI,
|
||||
{ [MetaTransactionV2.FEE_STRUCT_NAME]: MetaTransactionV2.FEE_STRUCT_ABI }
|
||||
);
|
||||
|
||||
public signer: string;
|
||||
public sender: string;
|
||||
public expirationTimeSeconds: BigNumber;
|
||||
public salt: BigNumber;
|
||||
public callData: string;
|
||||
public feeToken: string;
|
||||
public fees: MetaTransactionV2Fee[];
|
||||
public chainId: number;
|
||||
public verifyingContract: string;
|
||||
|
||||
public constructor(fields: Partial<MetaTransactionV2Fields> = {}) {
|
||||
const _fields = { ...MTX_DEFAULT_VALUES, ...fields };
|
||||
this.signer = _fields.signer;
|
||||
this.sender = _fields.sender;
|
||||
this.expirationTimeSeconds = _fields.expirationTimeSeconds;
|
||||
this.salt = _fields.salt;
|
||||
this.callData = _fields.callData;
|
||||
this.feeToken = _fields.feeToken;
|
||||
this.fees = _fields.fees;
|
||||
this.chainId = _fields.chainId;
|
||||
this.verifyingContract = _fields.verifyingContract;
|
||||
}
|
||||
|
||||
public clone(fields: Partial<MetaTransactionV2Fields> = {}): MetaTransactionV2 {
|
||||
return new MetaTransactionV2({
|
||||
signer: this.signer,
|
||||
sender: this.sender,
|
||||
expirationTimeSeconds: this.expirationTimeSeconds,
|
||||
salt: this.salt,
|
||||
callData: this.callData,
|
||||
feeToken: this.feeToken,
|
||||
fees: this.fees,
|
||||
chainId: this.chainId,
|
||||
verifyingContract: this.verifyingContract,
|
||||
...fields,
|
||||
});
|
||||
}
|
||||
|
||||
public getStructHash(): string {
|
||||
const feesHash = hexUtils.hash(hexUtils.concat(
|
||||
...this.fees.map((fee) => hexUtils.hash(hexUtils.concat(
|
||||
hexUtils.leftPad(MetaTransactionV2.FEE_TYPE_HASH),
|
||||
hexUtils.leftPad(fee.recipient),
|
||||
hexUtils.leftPad(fee.amount),
|
||||
)))
|
||||
));
|
||||
|
||||
return hexUtils.hash(
|
||||
hexUtils.concat(
|
||||
hexUtils.leftPad(MetaTransactionV2.MTX_TYPE_HASH),
|
||||
hexUtils.leftPad(this.signer),
|
||||
hexUtils.leftPad(this.sender),
|
||||
hexUtils.leftPad(this.expirationTimeSeconds),
|
||||
hexUtils.leftPad(this.salt),
|
||||
hexUtils.hash(this.callData),
|
||||
hexUtils.leftPad(this.feeToken),
|
||||
hexUtils.leftPad(feesHash),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
public getEIP712TypedData(): EIP712TypedData {
|
||||
return {
|
||||
types: {
|
||||
EIP712Domain: EIP712_DOMAIN_PARAMETERS,
|
||||
[MetaTransactionV2.MTX_STRUCT_NAME]: MetaTransactionV2.MTX_STRUCT_ABI,
|
||||
[MetaTransactionV2.FEE_STRUCT_NAME]: MetaTransactionV2.FEE_STRUCT_ABI,
|
||||
},
|
||||
domain: createExchangeProxyEIP712Domain(this.chainId, this.verifyingContract) as any,
|
||||
primaryType: MetaTransactionV2.MTX_STRUCT_NAME,
|
||||
message: {
|
||||
signer: this.signer,
|
||||
sender: this.sender,
|
||||
expirationTimeSeconds: this.expirationTimeSeconds.toString(10),
|
||||
salt: this.salt.toString(10),
|
||||
callData: this.callData,
|
||||
feeToken: this.feeToken,
|
||||
fees: this.fees.map(({recipient, amount}) => ({
|
||||
recipient,
|
||||
amount: amount.toString(10),
|
||||
})) as any,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
public getHash(): string {
|
||||
return getExchangeProxyEIP712Hash(this.getStructHash(), this.chainId, this.verifyingContract);
|
||||
}
|
||||
}
|
66
packages/protocol-utils/test/meta_transactions_v2_test.ts
Normal file
66
packages/protocol-utils/test/meta_transactions_v2_test.ts
Normal file
@@ -0,0 +1,66 @@
|
||||
import { chaiSetup, } from '@0x/dev-utils';
|
||||
import { BigNumber } from '@0x/utils';
|
||||
import { expect } from 'chai';
|
||||
import { MetaTransactionV2 } from '../src/meta_transactions_v2';
|
||||
|
||||
chaiSetup.configure();
|
||||
|
||||
describe('mtxs v2', () => {
|
||||
describe('MetaTransactionV2 (no fees)', () => {
|
||||
const mtx = new MetaTransactionV2({
|
||||
signer: '0x349e8d89e8b37214d9ce3949fc5754152c525bc3',
|
||||
sender: '0x83c62b2e67dea0df2a27be0def7a22bd7102642c',
|
||||
expirationTimeSeconds: new BigNumber(9101112),
|
||||
salt: new BigNumber(2001),
|
||||
callData: '0x12345678',
|
||||
feeToken: '0xcc3c7ea403427154ec908203ba6c418bd699f7ce',
|
||||
fees: [] as any,
|
||||
chainId: 8008,
|
||||
verifyingContract: '0x6701704d2421c64ee9aa93ec7f96ede81c4be77d',
|
||||
});
|
||||
|
||||
it('can get the struct hash', () => {
|
||||
const actual = mtx.getStructHash();
|
||||
const expected = '0x57db4055edfed82a6d86103197c21390bf29412fb4585e08c708454e03d92516';
|
||||
expect(actual).to.eq(expected);
|
||||
});
|
||||
|
||||
it('can get the EIP712 hash', () => {
|
||||
const actual = mtx.getHash();
|
||||
const expected = '0x05fc975cb9f37cc442a2975bc479502ce33d2d068fe8a1d6f50dbb11c1499137';
|
||||
expect(actual).to.eq(expected);
|
||||
});
|
||||
});
|
||||
|
||||
describe('MetaTransactionV2 (two fees)', () => {
|
||||
const mtx = new MetaTransactionV2({
|
||||
signer: '0x349e8d89e8b37214d9ce3949fc5754152c525bc3',
|
||||
sender: '0x83c62b2e67dea0df2a27be0def7a22bd7102642c',
|
||||
expirationTimeSeconds: new BigNumber(9101112),
|
||||
salt: new BigNumber(2001),
|
||||
callData: '0x12345678',
|
||||
feeToken: '0xcc3c7ea403427154ec908203ba6c418bd699f7ce',
|
||||
fees: [{
|
||||
recipient: '0xaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
|
||||
amount: new BigNumber(1000000),
|
||||
}, {
|
||||
recipient: '0xbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb',
|
||||
amount: new BigNumber(1000),
|
||||
}] as any,
|
||||
chainId: 8008,
|
||||
verifyingContract: '0x6701704d2421c64ee9aa93ec7f96ede81c4be77d',
|
||||
});
|
||||
|
||||
it('can get the struct hash', () => {
|
||||
const actual = mtx.getStructHash();
|
||||
const expected = '0x441c8b8a8f25c1716f2880326d008d07d0b8eb9606623c0a81dd5d9fa14dd12e';
|
||||
expect(actual).to.eq(expected);
|
||||
});
|
||||
|
||||
it('can get the EIP712 hash', () => {
|
||||
const actual = mtx.getHash();
|
||||
const expected = '0xfc85ef2149bd49fcc8fee2571ed8f0ecd671dec03845637ab1ded3d891ac3386';
|
||||
expect(actual).to.eq(expected);
|
||||
});
|
||||
});
|
||||
});
|
Reference in New Issue
Block a user