Compare commits

...

6 Commits

Author SHA1 Message Date
abls
139330f58e add mtx fees as two sets of fee fields but with only one fee token 2022-11-28 09:52:00 -08:00
Github Actions
fe0676cec3 Publish
- @0x/contracts-erc20@3.3.53
 - @0x/contracts-test-utils@5.4.43
 - @0x/contracts-treasury@1.4.36
 - @0x/contracts-utils@4.8.34
 - @0x/contracts-zero-ex@0.38.2
 - @0x/contract-addresses@7.4.1
 - @0x/contract-artifacts@3.18.2
 - @0x/contract-wrappers@13.22.12
 - @0x/protocol-utils@11.17.2
2022-11-23 20:25:30 +00:00
Github Actions
b697202e19 Updated CHANGELOGS & MD docs 2022-11-23 20:25:26 +00:00
Savarn Dontamsetti (Sav)
09bc48671c feat: adding AAVE V3 to selected Bridge Adapters [TKR-659] (#624)
* adding AAVE V3 to selected Bridge Adapters

* prettier fix

* Adding L2 optimizations for Arbitrum and Optimism

* Adding l2 encoded parameters to Aave V3 MixIn

* Removing L2 Encoder interface from MixinAaveV3.sol

* Updating FQT addresses

* prettier fix for MixinAaveV3.sol
2022-11-23 15:09:18 -05:00
Savarn Dontamsetti (Sav)
d31cc43ed6 Revert "feat: adding AAVE V3 to selected Bridge Adapters [TKR-659] (#614)" (#623)
This reverts commit 372f23156b.
2022-11-23 14:49:38 -05:00
Savarn Dontamsetti (Sav)
372f23156b feat: adding AAVE V3 to selected Bridge Adapters [TKR-659] (#614)
* adding AAVE V3 to selected Bridge Adapters

* prettier fix

* Adding L2 optimizations for Arbitrum and Optimism

* Adding l2 encoded parameters to Aave V3 MixIn

* Removing L2 Encoder interface from MixinAaveV3.sol

* Updating FQT addresses
2022-11-23 11:34:55 -05:00
39 changed files with 452 additions and 39 deletions

View File

@@ -1,4 +1,13 @@
[
{
"timestamp": 1669235113,
"version": "3.3.53",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1668477029,
"version": "3.3.52",

View File

@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v3.3.53 - _November 23, 2022_
* Dependencies updated
## v3.3.52 - _November 15, 2022_
* Dependencies updated

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/contracts-erc20",
"version": "3.3.52",
"version": "3.3.53",
"engines": {
"node": ">=6.12"
},
@@ -52,8 +52,8 @@
"devDependencies": {
"@0x/abi-gen": "^5.8.1",
"@0x/contracts-gen": "^2.0.48",
"@0x/contracts-test-utils": "^5.4.42",
"@0x/contracts-utils": "^4.8.33",
"@0x/contracts-test-utils": "^5.4.43",
"@0x/contracts-utils": "^4.8.34",
"@0x/dev-utils": "^5.0.0",
"@0x/sol-compiler": "^4.8.2",
"@0x/ts-doc-gen": "^0.0.28",

View File

@@ -1,4 +1,13 @@
[
{
"timestamp": 1669235113,
"version": "5.4.43",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1668477029,
"version": "5.4.42",

View File

@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v5.4.43 - _November 23, 2022_
* Dependencies updated
## v5.4.42 - _November 15, 2022_
* Dependencies updated

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/contracts-test-utils",
"version": "5.4.42",
"version": "5.4.43",
"engines": {
"node": ">=6.12"
},
@@ -46,7 +46,7 @@
"dependencies": {
"@0x/assert": "^3.0.35",
"@0x/base-contract": "^7.0.0",
"@0x/contract-addresses": "^7.4.0",
"@0x/contract-addresses": "^7.4.1",
"@0x/dev-utils": "^5.0.0",
"@0x/json-schemas": "^6.4.4",
"@0x/order-utils": "^10.4.28",

View File

@@ -1,4 +1,13 @@
[
{
"timestamp": 1669235113,
"version": "1.4.36",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1668477029,
"version": "1.4.35",

View File

@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v1.4.36 - _November 23, 2022_
* Dependencies updated
## v1.4.35 - _November 15, 2022_
* Dependencies updated

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/contracts-treasury",
"version": "1.4.35",
"version": "1.4.36",
"engines": {
"node": ">=6.12"
},
@@ -46,12 +46,12 @@
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/treasury",
"devDependencies": {
"@0x/abi-gen": "^5.8.1",
"@0x/contract-addresses": "^7.4.0",
"@0x/contract-addresses": "^7.4.1",
"@0x/contracts-asset-proxy": "^3.7.19",
"@0x/contracts-erc20": "^3.3.52",
"@0x/contracts-erc20": "^3.3.53",
"@0x/contracts-gen": "^2.0.48",
"@0x/contracts-staking": "^2.0.45",
"@0x/contracts-test-utils": "^5.4.42",
"@0x/contracts-test-utils": "^5.4.43",
"@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.17.1",
"@0x/protocol-utils": "^11.17.2",
"@0x/subproviders": "^7.0.0",
"@0x/types": "^3.3.6",
"@0x/typescript-typings": "^5.3.1",

View File

@@ -1,4 +1,13 @@
[
{
"timestamp": 1669235113,
"version": "4.8.34",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1668477029,
"version": "4.8.33",

View File

@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v4.8.34 - _November 23, 2022_
* Dependencies updated
## v4.8.33 - _November 15, 2022_
* Dependencies updated

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/contracts-utils",
"version": "4.8.33",
"version": "4.8.34",
"engines": {
"node": ">=6.12"
},
@@ -51,7 +51,7 @@
"devDependencies": {
"@0x/abi-gen": "^5.8.1",
"@0x/contracts-gen": "^2.0.48",
"@0x/contracts-test-utils": "^5.4.42",
"@0x/contracts-test-utils": "^5.4.43",
"@0x/dev-utils": "^5.0.0",
"@0x/order-utils": "^10.4.28",
"@0x/sol-compiler": "^4.8.2",

View File

@@ -1,4 +1,13 @@
[
{
"timestamp": 1669235113,
"version": "0.38.2",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1668477029,
"version": "0.38.1",

View File

@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v0.38.2 - _November 23, 2022_
* Dependencies updated
## v0.38.1 - _November 15, 2022_
* Dependencies updated

View File

@@ -92,7 +92,10 @@ contract MetaTransactionsFeature is
"bytes callData,"
"uint256 value,"
"address feeToken,"
"uint256 feeAmount"
"uint256 feeAmountOne,"
"address feeRecipientOne,"
"uint256 feeAmountTwo,"
"address feeRecipientTwo"
")"
);
@@ -219,7 +222,10 @@ contract MetaTransactionsFeature is
keccak256(mtx.callData),
mtx.value,
mtx.feeToken,
mtx.feeAmount
mtx.feeAmountOne,
mtx.feeRecipientOne,
mtx.feeAmountTwo,
mtx.feeRecipientTwo
)
)
);
@@ -238,8 +244,11 @@ contract MetaTransactionsFeature is
LibMetaTransactionsStorage.getStorage().mtxHashToExecutedBlockNumber[state.hash] = block.number;
// Pay the fee to the sender.
if (state.mtx.feeAmount > 0) {
_transferERC20TokensFrom(state.mtx.feeToken, state.mtx.signer, state.sender, state.mtx.feeAmount);
if (state.mtx.feeAmountOne > 0) {
_transferERC20TokensFrom(state.mtx.feeToken, state.mtx.signer, state.mtx.feeRecipientOne, state.mtx.feeAmountOne);
}
if (state.mtx.feeAmountTwo > 0) {
_transferERC20TokensFrom(state.mtx.feeToken, state.mtx.signer, state.mtx.feeRecipientTwo, state.mtx.feeAmountTwo);
}
// Execute the call based on the selector.

View File

@@ -46,7 +46,13 @@ interface IMetaTransactionsFeature {
// ERC20 fee `signer` pays `sender`.
IERC20TokenV06 feeToken;
// ERC20 fee amount.
uint256 feeAmount;
uint256 feeAmountOne;
// ERC20 fee recipient.
address feeRecipientOne;
// ERC20 fee amount.
uint256 feeAmountTwo;
// ERC20 fee recipient.
address feeRecipientTwo;
}
/// @dev Emitted whenever a meta-transaction is executed via

View File

@@ -22,6 +22,7 @@ pragma experimental ABIEncoderV2;
import "./AbstractBridgeAdapter.sol";
import "./BridgeProtocols.sol";
import "./mixins/MixinAaveV3.sol";
import "./mixins/MixinBalancerV2.sol";
import "./mixins/MixinBalancerV2Batch.sol";
import "./mixins/MixinCurve.sol";
@@ -36,6 +37,7 @@ import "./mixins/MixinZeroExBridge.sol";
contract ArbitrumBridgeAdapter is
AbstractBridgeAdapter(42161, "Arbitrum"),
MixinAaveV3,
MixinBalancerV2,
MixinBalancerV2Batch,
MixinCurve,
@@ -48,7 +50,7 @@ contract ArbitrumBridgeAdapter is
MixinUniswapV2,
MixinZeroExBridge
{
constructor(IEtherTokenV06 weth) public MixinCurve(weth) {}
constructor(IEtherTokenV06 weth) public MixinCurve(weth) MixinAaveV3(true) {}
function _trade(
BridgeOrder memory order,
@@ -113,6 +115,11 @@ contract ArbitrumBridgeAdapter is
return (0, true);
}
boughtAmount = _tradeZeroExBridge(sellToken, buyToken, sellAmount, order.bridgeData);
} else if (protocolId == BridgeProtocols.AAVEV3) {
if (dryRun) {
return (0, true);
}
boughtAmount = _tradeAaveV3(sellToken, buyToken, sellAmount, order.bridgeData);
}
emit BridgeFill(order.source, sellToken, buyToken, sellAmount, boughtAmount);

View File

@@ -22,6 +22,7 @@ pragma experimental ABIEncoderV2;
import "./AbstractBridgeAdapter.sol";
import "./BridgeProtocols.sol";
import "./mixins/MixinAaveV3.sol";
import "./mixins/MixinCurve.sol";
import "./mixins/MixinCurveV2.sol";
import "./mixins/MixinGMX.sol";
@@ -35,6 +36,7 @@ import "./mixins/MixinZeroExBridge.sol";
contract AvalancheBridgeAdapter is
AbstractBridgeAdapter(43114, "Avalanche"),
MixinAaveV3,
MixinCurve,
MixinCurveV2,
MixinGMX,
@@ -46,7 +48,7 @@ contract AvalancheBridgeAdapter is
MixinWOOFi,
MixinZeroExBridge
{
constructor(IEtherTokenV06 weth) public MixinCurve(weth) {}
constructor(IEtherTokenV06 weth) public MixinCurve(weth) MixinAaveV3(false) {}
function _trade(
BridgeOrder memory order,
@@ -106,6 +108,11 @@ contract AvalancheBridgeAdapter is
return (0, true);
}
boughtAmount = _tradeZeroExBridge(sellToken, buyToken, sellAmount, order.bridgeData);
} else if (protocolId == BridgeProtocols.AAVEV3) {
if (dryRun) {
return (0, true);
}
boughtAmount = _tradeAaveV3(sellToken, buyToken, sellAmount, order.bridgeData);
}
emit BridgeFill(order.source, sellToken, buyToken, sellAmount, boughtAmount);

View File

@@ -58,4 +58,5 @@ library BridgeProtocols {
uint128 internal constant SOLIDLY = 29;
uint128 internal constant SYNTHETIX = 30;
uint128 internal constant WOOFI = 31;
uint128 internal constant AAVEV3 = 32;
}

View File

@@ -22,6 +22,7 @@ pragma experimental ABIEncoderV2;
import "./AbstractBridgeAdapter.sol";
import "./BridgeProtocols.sol";
import "./mixins/MixinAaveV3.sol";
import "./mixins/MixinAaveV2.sol";
import "./mixins/MixinBalancerV2.sol";
import "./mixins/MixinBalancerV2Batch.sol";
@@ -34,6 +35,7 @@ import "./mixins/MixinZeroExBridge.sol";
contract FantomBridgeAdapter is
AbstractBridgeAdapter(250, "Fantom"),
MixinAaveV3,
MixinAaveV2,
MixinBalancerV2,
MixinBalancerV2Batch,
@@ -44,7 +46,7 @@ contract FantomBridgeAdapter is
MixinWOOFi,
MixinZeroExBridge
{
constructor(IEtherTokenV06 weth) public MixinCurve(weth) {}
constructor(IEtherTokenV06 weth) public MixinCurve(weth) MixinAaveV3(false) {}
function _trade(
BridgeOrder memory order,
@@ -99,6 +101,11 @@ contract FantomBridgeAdapter is
return (0, true);
}
boughtAmount = _tradeZeroExBridge(sellToken, buyToken, sellAmount, order.bridgeData);
} else if (protocolId == BridgeProtocols.AAVEV3) {
if (dryRun) {
return (0, true);
}
boughtAmount = _tradeAaveV3(sellToken, buyToken, sellAmount, order.bridgeData);
}
emit BridgeFill(order.source, sellToken, buyToken, sellAmount, boughtAmount);

View File

@@ -17,6 +17,7 @@ pragma experimental ABIEncoderV2;
import "./AbstractBridgeAdapter.sol";
import "./BridgeProtocols.sol";
import "./mixins/MixinAaveV3.sol";
import "./mixins/MixinBalancerV2.sol";
import "./mixins/MixinBalancerV2Batch.sol";
import "./mixins/MixinCurve.sol";
@@ -29,6 +30,7 @@ import "./mixins/MixinZeroExBridge.sol";
contract OptimismBridgeAdapter is
AbstractBridgeAdapter(10, "Optimism"),
MixinAaveV3,
MixinBalancerV2,
MixinBalancerV2Batch,
MixinCurve,
@@ -39,7 +41,7 @@ contract OptimismBridgeAdapter is
MixinSolidly,
MixinZeroExBridge
{
constructor(IEtherTokenV06 weth) public MixinCurve(weth) {}
constructor(IEtherTokenV06 weth) public MixinCurve(weth) MixinAaveV3(true) {}
function _trade(
BridgeOrder memory order,
@@ -94,6 +96,11 @@ contract OptimismBridgeAdapter is
return (0, true);
}
boughtAmount = _tradeBalancerV2Batch(sellAmount, order.bridgeData);
} else if (protocolId == BridgeProtocols.AAVEV3) {
if (dryRun) {
return (0, true);
}
boughtAmount = _tradeAaveV3(sellToken, buyToken, sellAmount, order.bridgeData);
}
emit BridgeFill(order.source, sellToken, buyToken, sellAmount, boughtAmount);

View File

@@ -22,6 +22,7 @@ pragma experimental ABIEncoderV2;
import "./AbstractBridgeAdapter.sol";
import "./BridgeProtocols.sol";
import "./mixins/MixinAaveV3.sol";
import "./mixins/MixinAaveV2.sol";
import "./mixins/MixinBalancerV2.sol";
import "./mixins/MixinBalancerV2Batch.sol";
@@ -40,6 +41,7 @@ import "./mixins/MixinZeroExBridge.sol";
contract PolygonBridgeAdapter is
AbstractBridgeAdapter(137, "Polygon"),
MixinAaveV3,
MixinAaveV2,
MixinBalancerV2,
MixinBalancerV2Batch,
@@ -56,7 +58,7 @@ contract PolygonBridgeAdapter is
MixinWOOFi,
MixinZeroExBridge
{
constructor(IEtherTokenV06 weth) public MixinCurve(weth) {}
constructor(IEtherTokenV06 weth) public MixinCurve(weth) MixinAaveV3(false) {}
function _trade(
BridgeOrder memory order,
@@ -141,6 +143,11 @@ contract PolygonBridgeAdapter is
return (0, true);
}
boughtAmount = _tradeZeroExBridge(sellToken, buyToken, sellAmount, order.bridgeData);
} else if (protocolId == BridgeProtocols.AAVEV3) {
if (dryRun) {
return (0, true);
}
boughtAmount = _tradeAaveV3(sellToken, buyToken, sellAmount, order.bridgeData);
}
emit BridgeFill(order.source, sellToken, buyToken, sellAmount, boughtAmount);

View File

@@ -0,0 +1,125 @@
// SPDX-License-Identifier: Apache-2.0
/*
Copyright 2021 ZeroEx Intl.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
pragma solidity ^0.6.5;
pragma experimental ABIEncoderV2;
import "@0x/contracts-erc20/contracts/src/v06/LibERC20TokenV06.sol";
import "@0x/contracts-erc20/contracts/src/v06/IERC20TokenV06.sol";
// Minimal Aave V3 Pool interface
interface IPool {
/**
* @notice Supplies an `amount` of underlying asset into the reserve, receiving in return overlying aTokens.
* - E.g. User supplies 100 USDC and gets in return 100 aUSDC
* @param asset The address of the underlying asset to supply
* @param amount The amount to be supplied
* @param onBehalfOf The address that will receive the aTokens, same as msg.sender if the user
* wants to receive them on his own wallet, or a different address if the beneficiary of aTokens
* is a different wallet
* @param referralCode Code used to register the integrator originating the operation, for potential rewards.
* 0 if the action is executed directly by the user, without any middle-man
**/
function supply(address asset, uint256 amount, address onBehalfOf, uint16 referralCode) external;
/**
* @notice Withdraws an `amount` of underlying asset from the reserve, burning the equivalent aTokens owned
* E.g. User has 100 aUSDC, calls withdraw() and receives 100 USDC, burning the 100 aUSDC
* @param asset The address of the underlying asset to withdraw
* @param amount The underlying amount to be withdrawn
* - Send the value type(uint256).max in order to withdraw the whole aToken balance
* @param to The address that will receive the underlying, same as msg.sender if the user
* wants to receive it on his own wallet, or a different address if the beneficiary is a
* different wallet
* @return The final amount withdrawn
**/
function withdraw(address asset, uint256 amount, address to) external returns (uint256);
}
// Minimal Aave V3 L2Pool interface
interface IL2Pool {
/**
* @notice Calldata efficient wrapper of the supply function on behalf of the caller
* @param args Arguments for the supply function packed in one bytes32
* 96 bits 16 bits 128 bits 16 bits
* | 0-padding | referralCode | shortenedAmount | assetId |
* @dev the shortenedAmount is cast to 256 bits at decode time, if type(uint128).max the value will be expanded to
* type(uint256).max
* @dev assetId is the index of the asset in the reservesList.
*/
function supply(bytes32 args) external;
/**
* @notice Calldata efficient wrapper of the withdraw function, withdrawing to the caller
* @param args Arguments for the withdraw function packed in one bytes32
* 112 bits 128 bits 16 bits
* | 0-padding | shortenedAmount | assetId |
* @dev the shortenedAmount is cast to 256 bits at decode time, if type(uint128).max the value will be expanded to
* type(uint256).max
* @dev assetId is the index of the asset in the reservesList.
*/
function withdraw(bytes32 args) external;
}
contract MixinAaveV3 {
using LibERC20TokenV06 for IERC20TokenV06;
bool private immutable _isL2;
constructor(bool isL2) public {
_isL2 = isL2;
}
function _tradeAaveV3(
IERC20TokenV06 sellToken,
IERC20TokenV06 buyToken,
uint256 sellAmount,
bytes memory bridgeData
) internal returns (uint256) {
if (_isL2) {
(IL2Pool pool, address aToken, bytes32 l2Params) = abi.decode(bridgeData, (IL2Pool, address, bytes32));
sellToken.approveIfBelow(address(pool), sellAmount);
if (address(buyToken) == aToken) {
pool.supply(l2Params);
// 1:1 mapping token --> aToken and have the same number of decimals as the underlying token
return sellAmount;
} else if (address(sellToken) == aToken) {
pool.withdraw(l2Params);
return sellAmount;
}
revert("MixinAaveV3/UNSUPPORTED_TOKEN_PAIR");
}
(IPool pool, address aToken, ) = abi.decode(bridgeData, (IPool, address, bytes32));
sellToken.approveIfBelow(address(pool), sellAmount);
if (address(buyToken) == aToken) {
pool.supply(address(sellToken), sellAmount, address(this), 0);
// 1:1 mapping token -> aToken and have the same number of decimals as the underlying token
return sellAmount;
} else if (address(sellToken) == aToken) {
return pool.withdraw(address(buyToken), sellAmount, address(this));
}
revert("MixinAaveV3/UNSUPPORTED_TOKEN_PAIR");
}
}

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/contracts-zero-ex",
"version": "0.38.1",
"version": "0.38.2",
"engines": {
"node": ">=6.12"
},
@@ -56,10 +56,10 @@
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/zero-ex",
"devDependencies": {
"@0x/abi-gen": "^5.8.1",
"@0x/contract-addresses": "^7.4.0",
"@0x/contracts-erc20": "^3.3.52",
"@0x/contract-addresses": "^7.4.1",
"@0x/contracts-erc20": "^3.3.53",
"@0x/contracts-gen": "^2.0.48",
"@0x/contracts-test-utils": "^5.4.42",
"@0x/contracts-test-utils": "^5.4.43",
"@0x/dev-utils": "^5.0.0",
"@0x/order-utils": "^10.4.28",
"@0x/sol-compiler": "^4.8.2",
@@ -86,7 +86,7 @@
},
"dependencies": {
"@0x/base-contract": "^7.0.0",
"@0x/protocol-utils": "^11.17.1",
"@0x/protocol-utils": "^11.17.2",
"@0x/subproviders": "^7.0.0",
"@0x/types": "^3.3.6",
"@0x/typescript-typings": "^5.3.1",

View File

@@ -0,0 +1,119 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.6.5;
pragma experimental ABIEncoderV2;
import "forge-std/Script.sol";
import "src/IZeroEx.sol";
import "src/features/MetaTransactionsFeature.sol";
import "src/features/interfaces/IMetaTransactionsFeature.sol";
import "src/features/libs/LibSignature.sol";
import "src/transformers/FillQuoteTransformer.sol";
import "src/transformers/PayTakerTransformer.sol";
contract MetaTxScript is Script {
IZeroEx private constant exchangeProxy = IZeroEx(0xDef1C0ded9bec7F1a1670819833240f027b25EfF);
IERC20TokenV06 private constant wethToken = IERC20TokenV06(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2);
IERC20TokenV06 private constant usdcToken = IERC20TokenV06(0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48);
uint256 private constant oneEth = 1e18;
address private constant ZERO_ADDRESS = 0x0000000000000000000000000000000000000000;
address private constant USER_ADDRESS = 0x6dc3a54FeAE57B65d185A7B159c5d3FA7fD7FD0F;
uint256 private constant USER_KEY = 0x1fc1630343b31e60b7a197a53149ca571ed9d9791e2833337bbd8110c30710ec;
uint32 private constant PAYTAKER_TFM_NONCE = 7;
uint32 private constant FILLQUOTE_TFM_NONCE = 25;
function mtxCall(bytes memory callData) private returns (bytes memory) {
IMetaTransactionsFeature.MetaTransactionData memory mtx = IMetaTransactionsFeature.MetaTransactionData({
signer: payable(USER_ADDRESS),
sender: ZERO_ADDRESS,
minGasPrice: 0,
maxGasPrice: 100000000000,
expirationTimeSeconds: block.timestamp + 600,
salt: 123,
callData: callData,
value: 0,
feeToken: wethToken,
feeAmountOne: oneEth,
feeRecipientOne: address(123),
feeAmountTwo: 0,
feeRecipientTwo: address(0)
});
bytes32 mtxHash = exchangeProxy.getMetaTransactionHash(mtx);
(uint8 v, bytes32 r, bytes32 s) = vm.sign(USER_KEY, mtxHash);
LibSignature.Signature memory sig = LibSignature.Signature(LibSignature.SignatureType.EIP712, v, r, s);
return abi.encodeWithSelector(
exchangeProxy.executeMetaTransaction.selector,
mtx,
sig
);
}
function transformERC20Call() private pure returns (bytes memory) {
FillQuoteTransformer.OrderType[] memory fillSequence = new FillQuoteTransformer.OrderType[](1);
fillSequence[0] = FillQuoteTransformer.OrderType.Bridge;
FillQuoteTransformer.TransformData memory fillQuoteTransformData = FillQuoteTransformer.TransformData({
side: FillQuoteTransformer.Side.Sell,
sellToken: wethToken,
buyToken: usdcToken,
bridgeOrders: new IBridgeAdapter.BridgeOrder[](0),
limitOrders: new FillQuoteTransformer.LimitOrderInfo[](0),
rfqOrders: new FillQuoteTransformer.RfqOrderInfo[](0),
fillSequence: new FillQuoteTransformer.OrderType[](0),
fillAmount: 0,
refundReceiver: address(0),
otcOrders: new FillQuoteTransformer.OtcOrderInfo[](0)
});
IERC20TokenV06[] memory payTakerTokens = new IERC20TokenV06[](1);
payTakerTokens[0] = wethToken;
PayTakerTransformer.TransformData memory payTakerTransformData = PayTakerTransformer.TransformData(
payTakerTokens,
new uint256[](0)
);
ITransformERC20Feature.Transformation[] memory transformations = new ITransformERC20Feature.Transformation[](2);
transformations[0] = ITransformERC20Feature.Transformation(
FILLQUOTE_TFM_NONCE,
abi.encode(fillQuoteTransformData)
);
transformations[1] = ITransformERC20Feature.Transformation(
PAYTAKER_TFM_NONCE,
abi.encode(payTakerTransformData)
);
return abi.encodeWithSelector(
exchangeProxy.transformERC20.selector,
wethToken,
usdcToken,
0,
0,
transformations
);
}
function deploy() private {
address mtxFeature = address(new MetaTransactionsFeature(address(exchangeProxy)));
address owner = exchangeProxy.owner();
vm.prank(owner);
exchangeProxy.migrate(mtxFeature, abi.encodeWithSignature("migrate()"), owner);
}
function run() public {
deploy();
bytes memory transformCalldata = transformERC20Call();
bytes memory mtxCalldata = mtxCall(transformCalldata);
vm.prank(ZERO_ADDRESS);
wethToken.transfer(USER_ADDRESS, oneEth);
vm.prank(USER_ADDRESS);
wethToken.approve(address(exchangeProxy), oneEth);
vm.prank(USER_ADDRESS);
(address(exchangeProxy).call(mtxCalldata));
}
}

View File

@@ -1,4 +1,13 @@
[
{
"timestamp": 1669235113,
"version": "7.4.1",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"version": "7.4.0",
"changes": [

View File

@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v7.4.1 - _November 23, 2022_
* Dependencies updated
## v7.4.0 - _November 15, 2022_
* Upgrade Polygon FillQuoteTransformer to support Solidly (and its forks). (#616)

View File

@@ -133,7 +133,7 @@
"wethTransformer": "0xe309d011cc6f189a3e8dcba85922715a019fed38",
"payTakerTransformer": "0xed8932ca083e1ef1960dea875a132926e6b242ab",
"affiliateFeeTransformer": "0xf79071e2f860d48a08fd7e091d4b126a1d757148",
"fillQuoteTransformer": "0x854a632299c4304992aa30f4f192308c86fd1e89",
"fillQuoteTransformer": "0xccb88bc39a49a83db492dc1701d8fd7b680f9015",
"positiveSlippageFeeTransformer": "0x8f5e7188f443a9a8dc180f4618fd23915043ea15"
}
},
@@ -179,7 +179,7 @@
"wethTransformer": "0x9b8b52391071d71cd4ad1e61d7f273268fa34c6c",
"payTakerTransformer": "0xb9a4c32547bc3cdc2ee2fb13cc1a0717dac9888f",
"affiliateFeeTransformer": "0x105679f99d668001370b4621ad8648ac570c860f",
"fillQuoteTransformer": "0xcee9118bc14e1fe740c54c754b901629b322ee4f",
"fillQuoteTransformer": "0x40e9b95d4c389eb3e1f95b0ff1cc9d5e97d348dc",
"positiveSlippageFeeTransformer": "0xadbfdc58a24b6dbc16f21541800f43dd6e282250"
}
},
@@ -202,7 +202,7 @@
"wethTransformer": "0x9b6aa8f26a92108e7d1f66373d757bb955112703",
"payTakerTransformer": "0x62d688337db92a916c7edbcc0f16c895510ab195",
"affiliateFeeTransformer": "0xb7da46e42472ecc7ae277e04a16c92bdd51a2db7",
"fillQuoteTransformer": "0x3a1e9825c9966daab30db241a7ee51a8dd7ad74f",
"fillQuoteTransformer": "0x28a4a63c74a7acd044c7edf4684232fb553baf66",
"positiveSlippageFeeTransformer": "0x42e30820804fc55d9cc03de613587947391550ff"
}
},
@@ -248,7 +248,7 @@
"wethTransformer": "0x02ce7af6520e2862f961f5d7eda746642865179c",
"payTakerTransformer": "0xa6c3ca183a67fcb4299fb4199c12ca74874ca489",
"affiliateFeeTransformer": "0x3102aea537ecb6f164550b094663c82a8c53a972",
"fillQuoteTransformer": "0x845c75a791cceb1a451f4ca5778c011226dda95c",
"fillQuoteTransformer": "0x3f21d1ca2b1dd0744e8984f811d3dc251d2ff48d",
"positiveSlippageFeeTransformer": "0x9a4947d3fb77a7afc2c9cd6714bbae96dddde059"
}
},
@@ -294,7 +294,7 @@
"wethTransformer": "0x10e968968f49dd66a5efeebbb2edcb9c49c4fc49",
"payTakerTransformer": "0xd81e65fc9bb7323bdbef8b2cdddd3b83fe41d630",
"affiliateFeeTransformer": "0x970e318b8f074c20bf0cee06970f01dc7a761e50",
"fillQuoteTransformer": "0x466b00a77662245c2cc7b093a7102a687afc16f3",
"fillQuoteTransformer": "0xaec6610c9069d6b7d604a5b0b3c1f6661489d0e1",
"positiveSlippageFeeTransformer": "0x20f935b037e8490d8027f2751f9452725eee01ad"
}
}

View File

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

View File

@@ -1,4 +1,13 @@
[
{
"timestamp": 1669235113,
"version": "3.18.2",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1661145612,
"version": "3.18.1",

View File

@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v3.18.2 - _November 23, 2022_
* Dependencies updated
## v3.18.1 - _August 22, 2022_
* Dependencies updated

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/contract-artifacts",
"version": "3.18.1",
"version": "3.18.2",
"engines": {
"node": ">=6.12"
},

View File

@@ -1,4 +1,13 @@
[
{
"timestamp": 1669235113,
"version": "13.22.12",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1668477029,
"version": "13.22.11",

View File

@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v13.22.12 - _November 23, 2022_
* Dependencies updated
## v13.22.11 - _November 15, 2022_
* Dependencies updated

View File

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

View File

@@ -1,4 +1,13 @@
[
{
"timestamp": 1669235113,
"version": "11.17.2",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1668477029,
"version": "11.17.1",

View File

@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v11.17.2 - _November 23, 2022_
* Dependencies updated
## v11.17.1 - _November 15, 2022_
* Dependencies updated

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/protocol-utils",
"version": "11.17.1",
"version": "11.17.2",
"engines": {
"node": ">=6.12"
},
@@ -65,8 +65,8 @@
},
"dependencies": {
"@0x/assert": "^3.0.35",
"@0x/contract-addresses": "^7.4.0",
"@0x/contract-wrappers": "^13.22.11",
"@0x/contract-addresses": "^7.4.1",
"@0x/contract-wrappers": "^13.22.12",
"@0x/json-schemas": "^6.4.4",
"@0x/subproviders": "^7.0.0",
"@0x/utils": "^7.0.0",

View File

@@ -162,6 +162,7 @@ export enum BridgeProtocol {
Solidly,
Synthetix,
WOOFi,
AaveV3,
}
/**