Compare commits

..

18 Commits

Author SHA1 Message Date
Github Actions
9c821dbfc3 Publish
- @0x/contracts-asset-proxy@3.6.1
 - @0x/contracts-broker@1.1.9
 - @0x/contracts-coordinator@3.1.10
 - @0x/contracts-dev-utils@1.3.8
 - @0x/contracts-erc1155@2.1.10
 - @0x/contracts-erc20@3.2.4
 - @0x/contracts-erc721@3.1.10
 - @0x/contracts-exchange-forwarder@4.2.10
 - @0x/contracts-exchange-libs@4.3.10
 - @0x/contracts-exchange@3.2.10
 - @0x/contracts-extensions@6.2.4
 - @0x/contracts-integrations@2.7.3
 - @0x/contracts-multisig@4.1.10
 - @0x/contracts-staking@2.0.17
 - @0x/contracts-test-utils@5.3.7
 - @0x/contracts-utils@4.5.4
 - @0x/contracts-zero-ex@0.5.1
 - @0x/asset-swapper@4.8.1
 - @0x/contract-addresses@5.0.1
 - @0x/contract-wrappers-test@12.2.20
 - @0x/contract-wrappers@13.9.2
 - @0x/migrations@6.4.4
 - @0x/order-utils@10.4.2
2020-10-28 02:10:57 +00:00
Github Actions
af1b890423 Updated CHANGELOGS & MD docs 2020-10-28 02:10:51 +00:00
Romain Butteaud
673835d2de fix: update kovan erc20BridgeSampler (#14)
* fix: update kovan erc20BridgeSampler

* fix update CHANGELOG
2020-10-27 17:51:51 -07:00
Greg Hysz
500b57e935 Adds Template for Specs (#12)
* Adds `docs` directory, along with boilerplate code and templates for readthedocs.org.

* docs: update orders spec

Co-authored-by: Lawrence Forman <me@merklejerk.com>
2020-10-27 16:31:15 -07:00
Jacob Evans
3f7d0580c1 Set the FeeSchedule to Required (#15) 2020-10-28 09:26:14 +10:00
Github Actions
a71c356bba Publish
- @0x/contracts-asset-proxy@3.6.0
 - @0x/contracts-broker@1.1.8
 - @0x/contracts-coordinator@3.1.9
 - @0x/contracts-dev-utils@1.3.7
 - @0x/contracts-erc1155@2.1.9
 - @0x/contracts-erc20@3.2.3
 - @0x/contracts-erc721@3.1.9
 - @0x/contracts-exchange-forwarder@4.2.9
 - @0x/contracts-exchange-libs@4.3.9
 - @0x/contracts-exchange@3.2.9
 - @0x/contracts-extensions@6.2.3
 - @0x/contracts-integrations@2.7.2
 - @0x/contracts-multisig@4.1.9
 - @0x/contracts-staking@2.0.16
 - @0x/contracts-test-utils@5.3.6
 - @0x/contracts-utils@4.5.3
 - @0x/contracts-zero-ex@0.5.0
 - @0x/asset-swapper@4.8.0
 - @0x/contract-addresses@5.0.0
 - @0x/contract-wrappers-test@12.2.19
 - @0x/contract-wrappers@13.9.1
 - @0x/migrations@6.4.3
 - @0x/order-utils@10.4.1
2020-10-27 21:13:56 +00:00
Github Actions
c3a95b7fb1 Updated CHANGELOGS & MD docs 2020-10-27 21:13:47 +00:00
Lawrence Forman
f01540fb35 fix publish 2020-10-27 16:42:30 -04:00
Daniel Pyrathon
689a8881c2 fix: Changed price-aware RFQ flag to be a argument parameter (#13)
* Changed price-aware RFQ flag to be a argument parameter

* prettified tests

* lint
2020-10-27 12:56:26 -07:00
Jacob Evans
99f5be8378 chore: [asset swapper] sampler Solidity 0.6 + Bridge addresses in AS (#4)
* Refactor excess interfaces

* Compiles on 0.6

* Refactored into try/catch

* Rebase and Refactored to v06

* Handle invalid registry in LP

* Update packages/asset-swapper/contracts/src/LiquidityProviderSampler.sol

Co-authored-by: Lawrence Forman <lawrence@0xproject.com>

* chore: [asset-swapper] Move Bridge Addresses and Gas schedule

* curve->pool

* lint

* Refactor to fix module load order

* Move FEE Schedule

* rollup: Swerve/Sushi/SnowSwap/DODO (#7)

* rollup: Swerve/Sushi

* DODO Rollup + Snowswap Swerve

* hardcode addresses temporarily

* rebase

* rename to SUSHISWAP_ROUTER

* CHANGELOGs

* CHANGELOGs

Co-authored-by: Lawrence Forman <lawrence@0xproject.com>
2020-10-27 15:16:09 +10:00
Lawrence Forman
8de0282d92 fix run:publish:gha package script 2020-10-23 17:11:56 -04:00
Github Actions
f99804d56a Publish
- @0x/contracts-integrations@2.7.1
 - @0x/contracts-zero-ex@0.4.0
 - @0x/asset-swapper@4.7.1
 - @0x/contract-wrappers-test@12.2.18
 - @0x/migrations@6.4.2
2020-10-23 21:08:02 +00:00
Github Actions
f13d27b749 Updated CHANGELOGS & MD docs 2020-10-23 21:07:56 +00:00
Lawrence Forman
465fd59cbc add publish github action 2020-10-23 16:56:36 -04:00
F. Eugene Aumson
5fdabe6612 Change contracts/integrations to use LOCAL a-s (#9)
Change contracts/integrations/package.json to refer to the LOCAL
asset-swapper, not a gitpkg one, since asset-swapper does live in this
same repo now.
2020-10-23 13:21:25 -04:00
Steve Marx
861871134b add LibTokenSpender and convert to using that (#3)
add LibTokenSpender and convert to using that

This skips the allowance target. Allowances are instead just set on the
exchange proxy itself. There is a fallback, though, to try spending from
the allowance target if the original transfer fails.
2020-10-23 10:45:46 -04:00
Daniel Pyrathon
c246d98093 Merge pull request #1 from 0xProject/asset-swapper-update-lockfile
updated lockfile
2020-10-21 10:20:01 -07:00
Daniel Pyrathon
02076dba1b updated lockfile 2020-10-21 10:07:56 -07:00
185 changed files with 4767 additions and 1267 deletions

48
.github/workflows/publish.yml vendored Normal file
View File

@@ -0,0 +1,48 @@
name: publish
on:
workflow_dispatch:
inputs:
ci_status:
description: 'required CI status'
default: 'success'
required: true
jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: 'check successful status'
run: |
REF_STATUS=$(curl -s \
'https://api.github.com/repos/${{ github.repository }}/commits/${{ github.ref }}/status' \
| jq .state)
[[ "${REF_STATUS}" == '"${{ github.event.inputs.ci_status }}"' ]] || \
(echo "::error ::${{ github.ref }} does not have a successful CI status" && false)
- uses: actions/checkout@v2
with:
ref: 'development'
fetch-depth: 0
- uses: actions/setup-node@v1
with:
node-version: 10
- uses: actions/setup-python@v2
- name: 'configure git'
run: |
git config --global user.email "github-actions@github.com"
git config --global user.name "Github Actions"
- name: 'install dependencies'
run: |
yarn -D
- name: 'build and publish'
run: |
echo '//registry.npmjs.org/:_authToken=${NPM_TOKEN}' > .npmrc
npm run run:publish:gha
env:
NPM_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}
GITHUB_TOKEN: ${{ github.token }}
- name: 'merge into main branch'
run: |
git checkout main && \
git merge ${{ github.ref }} && \
git push

View File

@@ -82,4 +82,5 @@ lib
/packages/asset-swapper/test/generated-wrappers
package.json
packages/*/docs
docs/
*.sol

View File

@@ -1,4 +1,23 @@
[
{
"timestamp": 1603851023,
"version": "3.6.1",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"version": "3.6.0",
"changes": [
{
"note": "Add `SwerveBridge` and `SnowSwapBridge` (duplicate of `CurveBridge`)",
"pr": 2707
}
],
"timestamp": 1603833198
},
{
"version": "3.5.0",
"changes": [

View File

@@ -5,6 +5,14 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v3.6.1 - _October 28, 2020_
* Dependencies updated
## v3.6.0 - _October 27, 2020_
* Add `SwerveBridge` and `SnowSwapBridge` (duplicate of `CurveBridge`) (#2707)
## v3.5.0 - _October 21, 2020_
* Update `CurveBridge` to support more varied curves (#2633)

View File

@@ -0,0 +1,119 @@
/*
Copyright 2019 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.5.9;
pragma experimental ABIEncoderV2;
import "@0x/contracts-erc20/contracts/src/interfaces/IERC20Token.sol";
import "@0x/contracts-erc20/contracts/src/LibERC20Token.sol";
import "@0x/contracts-exchange-libs/contracts/src/IWallet.sol";
import "@0x/contracts-utils/contracts/src/DeploymentConstants.sol";
import "../interfaces/IERC20Bridge.sol";
import "../interfaces/ICurve.sol";
// solhint-disable not-rely-on-time
// solhint-disable space-after-comma
contract SnowSwapBridge is
IERC20Bridge,
IWallet,
DeploymentConstants
{
struct SnowSwapBridgeData {
address curveAddress;
bytes4 exchangeFunctionSelector;
address fromTokenAddress;
int128 fromCoinIdx;
int128 toCoinIdx;
}
/// @dev Callback for `ICurve`. Tries to buy `amount` of
/// `toTokenAddress` tokens by selling the entirety of the opposing asset
/// (DAI, USDC) to the Curve contract, then transfers the bought
/// tokens to `to`.
/// @param toTokenAddress The token to give to `to` (i.e DAI, USDC, USDT).
/// @param from The maker (this contract).
/// @param to The recipient of the bought tokens.
/// @param amount Minimum amount of `toTokenAddress` tokens to buy.
/// @param bridgeData The abi-encoeded "from" token address.
/// @return success The magic bytes if successful.
function bridgeTransferFrom(
address toTokenAddress,
address from,
address to,
uint256 amount,
bytes calldata bridgeData
)
external
returns (bytes4 success)
{
// Decode the bridge data to get the SnowSwap metadata.
SnowSwapBridgeData memory data = abi.decode(bridgeData, (SnowSwapBridgeData));
require(toTokenAddress != data.fromTokenAddress, "SnowSwapBridge/INVALID_PAIR");
uint256 fromTokenBalance = IERC20Token(data.fromTokenAddress).balanceOf(address(this));
// Grant an allowance to the exchange to spend `fromTokenAddress` token.
LibERC20Token.approveIfBelow(data.fromTokenAddress, data.curveAddress, fromTokenBalance);
// Try to sell all of this contract's `fromTokenAddress` token balance.
{
(bool didSucceed, bytes memory resultData) =
data.curveAddress.call(abi.encodeWithSelector(
data.exchangeFunctionSelector,
data.fromCoinIdx,
data.toCoinIdx,
// dx
fromTokenBalance,
// min dy
amount
));
if (!didSucceed) {
assembly { revert(add(resultData, 32), mload(resultData)) }
}
}
uint256 toTokenBalance = IERC20Token(toTokenAddress).balanceOf(address(this));
// Transfer the converted `toToken`s to `to`.
LibERC20Token.transfer(toTokenAddress, to, toTokenBalance);
emit ERC20BridgeTransfer(
data.fromTokenAddress,
toTokenAddress,
fromTokenBalance,
toTokenBalance,
from,
to
);
return BRIDGE_SUCCESS;
}
/// @dev `SignatureType.Wallet` callback, so that this bridge can be the maker
/// and sign for itself in orders. Always succeeds.
/// @return magicValue Magic success bytes, always.
function isValidSignature(
bytes32,
bytes calldata
)
external
view
returns (bytes4 magicValue)
{
return LEGACY_WALLET_MAGIC_VALUE;
}
}

View File

@@ -0,0 +1,119 @@
/*
Copyright 2019 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.5.9;
pragma experimental ABIEncoderV2;
import "@0x/contracts-erc20/contracts/src/interfaces/IERC20Token.sol";
import "@0x/contracts-erc20/contracts/src/LibERC20Token.sol";
import "@0x/contracts-exchange-libs/contracts/src/IWallet.sol";
import "@0x/contracts-utils/contracts/src/DeploymentConstants.sol";
import "../interfaces/IERC20Bridge.sol";
import "../interfaces/ICurve.sol";
// solhint-disable not-rely-on-time
// solhint-disable space-after-comma
contract SwerveBridge is
IERC20Bridge,
IWallet,
DeploymentConstants
{
struct SwerveBridgeData {
address curveAddress;
bytes4 exchangeFunctionSelector;
address fromTokenAddress;
int128 fromCoinIdx;
int128 toCoinIdx;
}
/// @dev Callback for `ICurve`. Tries to buy `amount` of
/// `toTokenAddress` tokens by selling the entirety of the opposing asset
/// (DAI, USDC) to the Curve contract, then transfers the bought
/// tokens to `to`.
/// @param toTokenAddress The token to give to `to` (i.e DAI, USDC, USDT).
/// @param from The maker (this contract).
/// @param to The recipient of the bought tokens.
/// @param amount Minimum amount of `toTokenAddress` tokens to buy.
/// @param bridgeData The abi-encoeded "from" token address.
/// @return success The magic bytes if successful.
function bridgeTransferFrom(
address toTokenAddress,
address from,
address to,
uint256 amount,
bytes calldata bridgeData
)
external
returns (bytes4 success)
{
// Decode the bridge data to get the SwerveBridgeData metadata.
SwerveBridgeData memory data = abi.decode(bridgeData, (SwerveBridgeData));
require(toTokenAddress != data.fromTokenAddress, "SwerveBridge/INVALID_PAIR");
uint256 fromTokenBalance = IERC20Token(data.fromTokenAddress).balanceOf(address(this));
// Grant an allowance to the exchange to spend `fromTokenAddress` token.
LibERC20Token.approveIfBelow(data.fromTokenAddress, data.curveAddress, fromTokenBalance);
// Try to sell all of this contract's `fromTokenAddress` token balance.
{
(bool didSucceed, bytes memory resultData) =
data.curveAddress.call(abi.encodeWithSelector(
data.exchangeFunctionSelector,
data.fromCoinIdx,
data.toCoinIdx,
// dx
fromTokenBalance,
// min dy
amount
));
if (!didSucceed) {
assembly { revert(add(resultData, 32), mload(resultData)) }
}
}
uint256 toTokenBalance = IERC20Token(toTokenAddress).balanceOf(address(this));
// Transfer the converted `toToken`s to `to`.
LibERC20Token.transfer(toTokenAddress, to, toTokenBalance);
emit ERC20BridgeTransfer(
data.fromTokenAddress,
toTokenAddress,
fromTokenBalance,
toTokenBalance,
from,
to
);
return BRIDGE_SUCCESS;
}
/// @dev `SignatureType.Wallet` callback, so that this bridge can be the maker
/// and sign for itself in orders. Always succeeds.
/// @return magicValue Magic success bytes, always.
function isValidSignature(
bytes32,
bytes calldata
)
external
view
returns (bytes4 magicValue)
{
return LEGACY_WALLET_MAGIC_VALUE;
}
}

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/contracts-asset-proxy",
"version": "3.5.0",
"version": "3.6.1",
"engines": {
"node": ">=6.12"
},
@@ -38,7 +38,7 @@
"docs:json": "typedoc --excludePrivate --excludeExternals --excludeProtected --ignoreCompilerErrors --target ES5 --tsconfig typedoc-tsconfig.json --json $JSON_FILE_PATH $PROJECT_FILES"
},
"config": {
"abis": "./test/generated-artifacts/@(BalancerBridge|BancorBridge|ChaiBridge|CreamBridge|CurveBridge|DODOBridge|DexForwarderBridge|DydxBridge|ERC1155Proxy|ERC20BridgeProxy|ERC20Proxy|ERC721Proxy|Eth2DaiBridge|IAssetData|IAssetProxy|IAssetProxyDispatcher|IAuthorizable|IBalancerPool|IBancorNetwork|IChai|ICurve|IDydx|IDydxBridge|IERC20Bridge|IEth2Dai|IGasToken|IKyberNetworkProxy|IMStable|IMooniswap|IShell|IUniswapExchange|IUniswapExchangeFactory|IUniswapV2Router01|KyberBridge|MStableBridge|MixinAssetProxyDispatcher|MixinAuthorizable|MixinGasToken|MooniswapBridge|MultiAssetProxy|Ownable|ShellBridge|StaticCallProxy|SushiSwapBridge|TestBancorBridge|TestChaiBridge|TestDexForwarderBridge|TestDydxBridge|TestERC20Bridge|TestEth2DaiBridge|TestKyberBridge|TestStaticCallTarget|TestUniswapBridge|TestUniswapV2Bridge|UniswapBridge|UniswapV2Bridge).json",
"abis": "./test/generated-artifacts/@(BalancerBridge|BancorBridge|ChaiBridge|CreamBridge|CurveBridge|DODOBridge|DexForwarderBridge|DydxBridge|ERC1155Proxy|ERC20BridgeProxy|ERC20Proxy|ERC721Proxy|Eth2DaiBridge|IAssetData|IAssetProxy|IAssetProxyDispatcher|IAuthorizable|IBalancerPool|IBancorNetwork|IChai|ICurve|IDydx|IDydxBridge|IERC20Bridge|IEth2Dai|IGasToken|IKyberNetworkProxy|IMStable|IMooniswap|IShell|IUniswapExchange|IUniswapExchangeFactory|IUniswapV2Router01|KyberBridge|MStableBridge|MixinAssetProxyDispatcher|MixinAuthorizable|MixinGasToken|MooniswapBridge|MultiAssetProxy|Ownable|ShellBridge|SnowSwapBridge|StaticCallProxy|SushiSwapBridge|SwerveBridge|TestBancorBridge|TestChaiBridge|TestDexForwarderBridge|TestDydxBridge|TestERC20Bridge|TestEth2DaiBridge|TestKyberBridge|TestStaticCallTarget|TestUniswapBridge|TestUniswapV2Bridge|UniswapBridge|UniswapV2Bridge).json",
"abis:comment": "This list is auto-generated by contracts-gen. Don't edit manually."
},
"repository": {
@@ -52,10 +52,10 @@
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/protocol",
"devDependencies": {
"@0x/abi-gen": "^5.4.3",
"@0x/contract-wrappers": "^13.9.0",
"@0x/contract-wrappers": "^13.9.2",
"@0x/contracts-gen": "2.0.13",
"@0x/contracts-test-utils": "^5.3.5",
"@0x/contracts-utils": "^4.5.2",
"@0x/contracts-test-utils": "^5.3.7",
"@0x/contracts-utils": "^4.5.4",
"@0x/dev-utils": "^3.3.4",
"@0x/sol-compiler": "^4.2.3",
"@0x/ts-doc-gen": "^0.0.28",
@@ -80,11 +80,11 @@
},
"dependencies": {
"@0x/base-contract": "^6.2.7",
"@0x/contracts-erc1155": "^2.1.8",
"@0x/contracts-erc20": "^3.2.2",
"@0x/contracts-erc721": "^3.1.8",
"@0x/contracts-exchange-libs": "^4.3.8",
"@0x/order-utils": "^10.4.0",
"@0x/contracts-erc1155": "^2.1.10",
"@0x/contracts-erc20": "^3.2.4",
"@0x/contracts-erc721": "^3.1.10",
"@0x/contracts-exchange-libs": "^4.3.10",
"@0x/order-utils": "^10.4.2",
"@0x/types": "^3.2.4",
"@0x/typescript-typings": "^5.1.5",
"@0x/utils": "^5.6.3",

View File

@@ -47,8 +47,10 @@ import * as MStableBridge from '../generated-artifacts/MStableBridge.json';
import * as MultiAssetProxy from '../generated-artifacts/MultiAssetProxy.json';
import * as Ownable from '../generated-artifacts/Ownable.json';
import * as ShellBridge from '../generated-artifacts/ShellBridge.json';
import * as SnowSwapBridge from '../generated-artifacts/SnowSwapBridge.json';
import * as StaticCallProxy from '../generated-artifacts/StaticCallProxy.json';
import * as SushiSwapBridge from '../generated-artifacts/SushiSwapBridge.json';
import * as SwerveBridge from '../generated-artifacts/SwerveBridge.json';
import * as TestBancorBridge from '../generated-artifacts/TestBancorBridge.json';
import * as TestChaiBridge from '../generated-artifacts/TestChaiBridge.json';
import * as TestDexForwarderBridge from '../generated-artifacts/TestDexForwarderBridge.json';
@@ -85,7 +87,9 @@ export const artifacts = {
MixinGasToken: MixinGasToken as ContractArtifact,
MooniswapBridge: MooniswapBridge as ContractArtifact,
ShellBridge: ShellBridge as ContractArtifact,
SnowSwapBridge: SnowSwapBridge as ContractArtifact,
SushiSwapBridge: SushiSwapBridge as ContractArtifact,
SwerveBridge: SwerveBridge as ContractArtifact,
UniswapBridge: UniswapBridge as ContractArtifact,
UniswapV2Bridge: UniswapV2Bridge as ContractArtifact,
IAssetData: IAssetData as ContractArtifact,

View File

@@ -45,8 +45,10 @@ export * from '../generated-wrappers/mooniswap_bridge';
export * from '../generated-wrappers/multi_asset_proxy';
export * from '../generated-wrappers/ownable';
export * from '../generated-wrappers/shell_bridge';
export * from '../generated-wrappers/snow_swap_bridge';
export * from '../generated-wrappers/static_call_proxy';
export * from '../generated-wrappers/sushi_swap_bridge';
export * from '../generated-wrappers/swerve_bridge';
export * from '../generated-wrappers/test_bancor_bridge';
export * from '../generated-wrappers/test_chai_bridge';
export * from '../generated-wrappers/test_dex_forwarder_bridge';

View File

@@ -47,8 +47,10 @@ import * as MStableBridge from '../test/generated-artifacts/MStableBridge.json';
import * as MultiAssetProxy from '../test/generated-artifacts/MultiAssetProxy.json';
import * as Ownable from '../test/generated-artifacts/Ownable.json';
import * as ShellBridge from '../test/generated-artifacts/ShellBridge.json';
import * as SnowSwapBridge from '../test/generated-artifacts/SnowSwapBridge.json';
import * as StaticCallProxy from '../test/generated-artifacts/StaticCallProxy.json';
import * as SushiSwapBridge from '../test/generated-artifacts/SushiSwapBridge.json';
import * as SwerveBridge from '../test/generated-artifacts/SwerveBridge.json';
import * as TestBancorBridge from '../test/generated-artifacts/TestBancorBridge.json';
import * as TestChaiBridge from '../test/generated-artifacts/TestChaiBridge.json';
import * as TestDexForwarderBridge from '../test/generated-artifacts/TestDexForwarderBridge.json';
@@ -85,7 +87,9 @@ export const artifacts = {
MixinGasToken: MixinGasToken as ContractArtifact,
MooniswapBridge: MooniswapBridge as ContractArtifact,
ShellBridge: ShellBridge as ContractArtifact,
SnowSwapBridge: SnowSwapBridge as ContractArtifact,
SushiSwapBridge: SushiSwapBridge as ContractArtifact,
SwerveBridge: SwerveBridge as ContractArtifact,
UniswapBridge: UniswapBridge as ContractArtifact,
UniswapV2Bridge: UniswapV2Bridge as ContractArtifact,
IAssetData: IAssetData as ContractArtifact,

View File

@@ -45,8 +45,10 @@ export * from '../test/generated-wrappers/mooniswap_bridge';
export * from '../test/generated-wrappers/multi_asset_proxy';
export * from '../test/generated-wrappers/ownable';
export * from '../test/generated-wrappers/shell_bridge';
export * from '../test/generated-wrappers/snow_swap_bridge';
export * from '../test/generated-wrappers/static_call_proxy';
export * from '../test/generated-wrappers/sushi_swap_bridge';
export * from '../test/generated-wrappers/swerve_bridge';
export * from '../test/generated-wrappers/test_bancor_bridge';
export * from '../test/generated-wrappers/test_chai_bridge';
export * from '../test/generated-wrappers/test_dex_forwarder_bridge';

View File

@@ -45,8 +45,10 @@
"generated-artifacts/MultiAssetProxy.json",
"generated-artifacts/Ownable.json",
"generated-artifacts/ShellBridge.json",
"generated-artifacts/SnowSwapBridge.json",
"generated-artifacts/StaticCallProxy.json",
"generated-artifacts/SushiSwapBridge.json",
"generated-artifacts/SwerveBridge.json",
"generated-artifacts/TestBancorBridge.json",
"generated-artifacts/TestChaiBridge.json",
"generated-artifacts/TestDexForwarderBridge.json",
@@ -101,8 +103,10 @@
"test/generated-artifacts/MultiAssetProxy.json",
"test/generated-artifacts/Ownable.json",
"test/generated-artifacts/ShellBridge.json",
"test/generated-artifacts/SnowSwapBridge.json",
"test/generated-artifacts/StaticCallProxy.json",
"test/generated-artifacts/SushiSwapBridge.json",
"test/generated-artifacts/SwerveBridge.json",
"test/generated-artifacts/TestBancorBridge.json",
"test/generated-artifacts/TestChaiBridge.json",
"test/generated-artifacts/TestDexForwarderBridge.json",

View File

@@ -1,4 +1,22 @@
[
{
"timestamp": 1603851023,
"version": "1.1.9",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1603833198,
"version": "1.1.8",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1603265572,
"version": "1.1.7",

View File

@@ -5,6 +5,14 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v1.1.9 - _October 28, 2020_
* Dependencies updated
## v1.1.8 - _October 27, 2020_
* Dependencies updated
## v1.1.7 - _October 21, 2020_
* Dependencies updated

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/contracts-broker",
"version": "1.1.7",
"version": "1.1.9",
"engines": {
"node": ">=6.12"
},
@@ -52,14 +52,14 @@
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/extensions",
"devDependencies": {
"@0x/abi-gen": "^5.4.3",
"@0x/contracts-asset-proxy": "^3.5.0",
"@0x/contracts-erc20": "^3.2.2",
"@0x/contracts-erc721": "^3.1.8",
"@0x/contracts-exchange": "^3.2.8",
"@0x/contracts-exchange-libs": "^4.3.8",
"@0x/contracts-asset-proxy": "^3.6.1",
"@0x/contracts-erc20": "^3.2.4",
"@0x/contracts-erc721": "^3.1.10",
"@0x/contracts-exchange": "^3.2.10",
"@0x/contracts-exchange-libs": "^4.3.10",
"@0x/contracts-gen": "2.0.13",
"@0x/contracts-test-utils": "^5.3.5",
"@0x/contracts-utils": "^4.5.2",
"@0x/contracts-test-utils": "^5.3.7",
"@0x/contracts-utils": "^4.5.4",
"@0x/sol-compiler": "^4.2.3",
"@0x/ts-doc-gen": "^0.0.28",
"@0x/tslint-config": "^4.1.3",
@@ -85,7 +85,7 @@
},
"dependencies": {
"@0x/base-contract": "^6.2.7",
"@0x/order-utils": "^10.4.0",
"@0x/order-utils": "^10.4.2",
"@0x/typescript-typings": "^5.1.5",
"@0x/utils": "^5.6.3",
"ethereum-types": "^3.3.3"

View File

@@ -1,4 +1,22 @@
[
{
"timestamp": 1603851023,
"version": "3.1.10",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1603833198,
"version": "3.1.9",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1603265572,
"version": "3.1.8",

View File

@@ -5,6 +5,14 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v3.1.10 - _October 28, 2020_
* Dependencies updated
## v3.1.9 - _October 27, 2020_
* Dependencies updated
## v3.1.8 - _October 21, 2020_
* Dependencies updated

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/contracts-coordinator",
"version": "3.1.8",
"version": "3.1.10",
"engines": {
"node": ">=6.12"
},
@@ -53,12 +53,12 @@
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/extensions",
"devDependencies": {
"@0x/abi-gen": "^5.4.3",
"@0x/contracts-asset-proxy": "^3.5.0",
"@0x/contracts-dev-utils": "^1.3.6",
"@0x/contracts-erc20": "^3.2.2",
"@0x/contracts-asset-proxy": "^3.6.1",
"@0x/contracts-dev-utils": "^1.3.8",
"@0x/contracts-erc20": "^3.2.4",
"@0x/contracts-gen": "2.0.13",
"@0x/dev-utils": "^3.3.4",
"@0x/order-utils": "^10.4.0",
"@0x/order-utils": "^10.4.2",
"@0x/sol-compiler": "^4.2.3",
"@0x/ts-doc-gen": "^0.0.28",
"@0x/tslint-config": "^4.1.3",
@@ -84,10 +84,10 @@
"dependencies": {
"@0x/assert": "^3.0.13",
"@0x/base-contract": "^6.2.7",
"@0x/contract-addresses": "^4.12.0",
"@0x/contracts-exchange": "^3.2.8",
"@0x/contracts-test-utils": "^5.3.5",
"@0x/contracts-utils": "^4.5.2",
"@0x/contract-addresses": "^5.0.1",
"@0x/contracts-exchange": "^3.2.10",
"@0x/contracts-test-utils": "^5.3.7",
"@0x/contracts-utils": "^4.5.4",
"@0x/json-schemas": "^5.2.3",
"@0x/types": "^3.2.4",
"@0x/typescript-typings": "^5.1.5",

View File

@@ -1,4 +1,22 @@
[
{
"timestamp": 1603851023,
"version": "1.3.8",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1603833198,
"version": "1.3.7",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1603265572,
"version": "1.3.6",

View File

@@ -5,6 +5,14 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v1.3.8 - _October 28, 2020_
* Dependencies updated
## v1.3.7 - _October 27, 2020_
* Dependencies updated
## v1.3.6 - _October 21, 2020_
* Dependencies updated

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/contracts-dev-utils",
"version": "1.3.6",
"version": "1.3.8",
"engines": {
"node": ">=6.12"
},
@@ -43,10 +43,10 @@
"devDependencies": {
"@0x/abi-gen": "^5.4.3",
"@0x/assert": "^3.0.13",
"@0x/contracts-asset-proxy": "^3.5.0",
"@0x/contracts-erc20": "^3.2.2",
"@0x/contracts-asset-proxy": "^3.6.1",
"@0x/contracts-erc20": "^3.2.4",
"@0x/contracts-gen": "2.0.13",
"@0x/contracts-test-utils": "^5.3.5",
"@0x/contracts-test-utils": "^5.3.7",
"@0x/sol-compiler": "^4.2.3",
"@0x/ts-doc-gen": "^0.0.28",
"@0x/tslint-config": "^4.1.3",

View File

@@ -1,4 +1,22 @@
[
{
"timestamp": 1603851023,
"version": "2.1.10",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1603833198,
"version": "2.1.9",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1603265572,
"version": "2.1.8",

View File

@@ -5,6 +5,14 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v2.1.10 - _October 28, 2020_
* Dependencies updated
## v2.1.9 - _October 27, 2020_
* Dependencies updated
## v2.1.8 - _October 21, 2020_
* Dependencies updated

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/contracts-erc1155",
"version": "2.1.8",
"version": "2.1.10",
"engines": {
"node": ">=6.12"
},
@@ -54,7 +54,7 @@
"devDependencies": {
"@0x/abi-gen": "^5.4.3",
"@0x/contracts-gen": "2.0.13",
"@0x/contracts-utils": "^4.5.2",
"@0x/contracts-utils": "^4.5.4",
"@0x/dev-utils": "^3.3.4",
"@0x/sol-compiler": "^4.2.3",
"@0x/ts-doc-gen": "^0.0.28",
@@ -81,7 +81,7 @@
},
"dependencies": {
"@0x/base-contract": "^6.2.7",
"@0x/contracts-test-utils": "^5.3.5",
"@0x/contracts-test-utils": "^5.3.7",
"@0x/utils": "^5.6.3",
"@0x/web3-wrapper": "^7.2.4",
"lodash": "^4.17.11"

View File

@@ -1,4 +1,22 @@
[
{
"timestamp": 1603851023,
"version": "3.2.4",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1603833198,
"version": "3.2.3",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1603265572,
"version": "3.2.2",

View File

@@ -5,6 +5,14 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v3.2.4 - _October 28, 2020_
* Dependencies updated
## v3.2.3 - _October 27, 2020_
* Dependencies updated
## v3.2.2 - _October 21, 2020_
* Dependencies updated

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/contracts-erc20",
"version": "3.2.2",
"version": "3.2.4",
"engines": {
"node": ">=6.12"
},
@@ -53,8 +53,8 @@
"devDependencies": {
"@0x/abi-gen": "^5.4.3",
"@0x/contracts-gen": "2.0.13",
"@0x/contracts-test-utils": "^5.3.5",
"@0x/contracts-utils": "^4.5.2",
"@0x/contracts-test-utils": "^5.3.7",
"@0x/contracts-utils": "^4.5.4",
"@0x/dev-utils": "^3.3.4",
"@0x/sol-compiler": "^4.2.3",
"@0x/ts-doc-gen": "^0.0.28",

View File

@@ -1,4 +1,22 @@
[
{
"timestamp": 1603851023,
"version": "3.1.10",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1603833198,
"version": "3.1.9",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1603265572,
"version": "3.1.8",

View File

@@ -5,6 +5,14 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v3.1.10 - _October 28, 2020_
* Dependencies updated
## v3.1.9 - _October 27, 2020_
* Dependencies updated
## v3.1.8 - _October 21, 2020_
* Dependencies updated

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/contracts-erc721",
"version": "3.1.8",
"version": "3.1.10",
"engines": {
"node": ">=6.12"
},
@@ -54,8 +54,8 @@
"devDependencies": {
"@0x/abi-gen": "^5.4.3",
"@0x/contracts-gen": "2.0.13",
"@0x/contracts-test-utils": "^5.3.5",
"@0x/contracts-utils": "^4.5.2",
"@0x/contracts-test-utils": "^5.3.7",
"@0x/contracts-utils": "^4.5.4",
"@0x/dev-utils": "^3.3.4",
"@0x/sol-compiler": "^4.2.3",
"@0x/ts-doc-gen": "^0.0.28",

View File

@@ -1,4 +1,22 @@
[
{
"timestamp": 1603851023,
"version": "4.2.10",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1603833198,
"version": "4.2.9",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1603265572,
"version": "4.2.8",

View File

@@ -5,6 +5,14 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v4.2.10 - _October 28, 2020_
* Dependencies updated
## v4.2.9 - _October 27, 2020_
* Dependencies updated
## v4.2.8 - _October 21, 2020_
* Dependencies updated

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/contracts-exchange-forwarder",
"version": "4.2.8",
"version": "4.2.10",
"engines": {
"node": ">=6.12"
},
@@ -53,18 +53,18 @@
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/extensions",
"devDependencies": {
"@0x/abi-gen": "^5.4.3",
"@0x/contracts-asset-proxy": "^3.5.0",
"@0x/contracts-dev-utils": "^1.3.6",
"@0x/contracts-erc1155": "^2.1.8",
"@0x/contracts-erc20": "^3.2.2",
"@0x/contracts-erc721": "^3.1.8",
"@0x/contracts-exchange": "^3.2.8",
"@0x/contracts-exchange-libs": "^4.3.8",
"@0x/contracts-asset-proxy": "^3.6.1",
"@0x/contracts-dev-utils": "^1.3.8",
"@0x/contracts-erc1155": "^2.1.10",
"@0x/contracts-erc20": "^3.2.4",
"@0x/contracts-erc721": "^3.1.10",
"@0x/contracts-exchange": "^3.2.10",
"@0x/contracts-exchange-libs": "^4.3.10",
"@0x/contracts-gen": "2.0.13",
"@0x/contracts-test-utils": "^5.3.5",
"@0x/contracts-utils": "^4.5.2",
"@0x/contracts-test-utils": "^5.3.7",
"@0x/contracts-utils": "^4.5.4",
"@0x/dev-utils": "^3.3.4",
"@0x/order-utils": "^10.4.0",
"@0x/order-utils": "^10.4.2",
"@0x/sol-compiler": "^4.2.3",
"@0x/ts-doc-gen": "^0.0.28",
"@0x/tslint-config": "^4.1.3",

View File

@@ -1,4 +1,22 @@
[
{
"timestamp": 1603851023,
"version": "4.3.10",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1603833198,
"version": "4.3.9",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1603265572,
"version": "4.3.8",

View File

@@ -5,6 +5,14 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v4.3.10 - _October 28, 2020_
* Dependencies updated
## v4.3.9 - _October 27, 2020_
* Dependencies updated
## v4.3.8 - _October 21, 2020_
* Dependencies updated

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/contracts-exchange-libs",
"version": "4.3.8",
"version": "4.3.10",
"engines": {
"node": ">=6.12"
},
@@ -81,9 +81,9 @@
},
"dependencies": {
"@0x/base-contract": "^6.2.7",
"@0x/contracts-test-utils": "^5.3.5",
"@0x/contracts-utils": "^4.5.2",
"@0x/order-utils": "^10.4.0",
"@0x/contracts-test-utils": "^5.3.7",
"@0x/contracts-utils": "^4.5.4",
"@0x/order-utils": "^10.4.2",
"@0x/types": "^3.2.4",
"@0x/typescript-typings": "^5.1.5",
"@0x/utils": "^5.6.3",

View File

@@ -1,4 +1,22 @@
[
{
"timestamp": 1603851023,
"version": "3.2.10",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1603833198,
"version": "3.2.9",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1603265572,
"version": "3.2.8",

View File

@@ -5,6 +5,14 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v3.2.10 - _October 28, 2020_
* Dependencies updated
## v3.2.9 - _October 27, 2020_
* Dependencies updated
## v3.2.8 - _October 21, 2020_
* Dependencies updated

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/contracts-exchange",
"version": "3.2.8",
"version": "3.2.10",
"engines": {
"node": ">=6.12"
},
@@ -53,13 +53,13 @@
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/protocol",
"devDependencies": {
"@0x/abi-gen": "^5.4.3",
"@0x/contracts-asset-proxy": "^3.5.0",
"@0x/contracts-exchange-libs": "^4.3.8",
"@0x/contracts-asset-proxy": "^3.6.1",
"@0x/contracts-exchange-libs": "^4.3.10",
"@0x/contracts-gen": "2.0.13",
"@0x/contracts-multisig": "^4.1.8",
"@0x/contracts-staking": "^2.0.15",
"@0x/contracts-test-utils": "^5.3.5",
"@0x/contracts-utils": "^4.5.2",
"@0x/contracts-multisig": "^4.1.10",
"@0x/contracts-staking": "^2.0.17",
"@0x/contracts-test-utils": "^5.3.7",
"@0x/contracts-utils": "^4.5.4",
"@0x/dev-utils": "^3.3.4",
"@0x/sol-compiler": "^4.2.3",
"@0x/ts-doc-gen": "^0.0.28",
@@ -89,11 +89,11 @@
},
"dependencies": {
"@0x/base-contract": "^6.2.7",
"@0x/contracts-dev-utils": "^1.3.6",
"@0x/contracts-erc1155": "^2.1.8",
"@0x/contracts-erc20": "^3.2.2",
"@0x/contracts-erc721": "^3.1.8",
"@0x/order-utils": "^10.4.0",
"@0x/contracts-dev-utils": "^1.3.8",
"@0x/contracts-erc1155": "^2.1.10",
"@0x/contracts-erc20": "^3.2.4",
"@0x/contracts-erc721": "^3.1.10",
"@0x/order-utils": "^10.4.2",
"@0x/utils": "^5.6.3",
"lodash": "^4.17.11"
},

View File

@@ -1,4 +1,22 @@
[
{
"timestamp": 1603851023,
"version": "6.2.4",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1603833198,
"version": "6.2.3",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1603265572,
"version": "6.2.2",

View File

@@ -5,6 +5,14 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v6.2.4 - _October 28, 2020_
* Dependencies updated
## v6.2.3 - _October 27, 2020_
* Dependencies updated
## v6.2.2 - _October 21, 2020_
* Dependencies updated

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/contracts-extensions",
"version": "6.2.2",
"version": "6.2.4",
"engines": {
"node": ">=6.12"
},
@@ -53,16 +53,16 @@
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/extensions",
"devDependencies": {
"@0x/abi-gen": "^5.4.3",
"@0x/contracts-asset-proxy": "^3.5.0",
"@0x/contracts-dev-utils": "^1.3.6",
"@0x/contracts-erc20": "^3.2.2",
"@0x/contracts-erc721": "^3.1.8",
"@0x/contracts-exchange": "^3.2.8",
"@0x/contracts-exchange-libs": "^4.3.8",
"@0x/contracts-asset-proxy": "^3.6.1",
"@0x/contracts-dev-utils": "^1.3.8",
"@0x/contracts-erc20": "^3.2.4",
"@0x/contracts-erc721": "^3.1.10",
"@0x/contracts-exchange": "^3.2.10",
"@0x/contracts-exchange-libs": "^4.3.10",
"@0x/contracts-gen": "2.0.13",
"@0x/contracts-utils": "^4.5.2",
"@0x/contracts-utils": "^4.5.4",
"@0x/dev-utils": "^3.3.4",
"@0x/order-utils": "^10.4.0",
"@0x/order-utils": "^10.4.2",
"@0x/sol-compiler": "^4.2.3",
"@0x/ts-doc-gen": "^0.0.28",
"@0x/tslint-config": "^4.1.3",
@@ -91,7 +91,7 @@
},
"dependencies": {
"@0x/base-contract": "^6.2.7",
"@0x/contracts-test-utils": "^5.3.5",
"@0x/contracts-test-utils": "^5.3.7",
"@0x/typescript-typings": "^5.1.5",
"ethereum-types": "^3.3.3"
},

View File

@@ -1,4 +1,31 @@
[
{
"timestamp": 1603851023,
"version": "2.7.3",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1603833198,
"version": "2.7.2",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1603487270,
"version": "2.7.1",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"version": "2.7.0",
"changes": [

View File

@@ -5,6 +5,18 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v2.7.3 - _October 28, 2020_
* Dependencies updated
## v2.7.2 - _October 27, 2020_
* Dependencies updated
## v2.7.1 - _October 23, 2020_
* Dependencies updated
## v2.7.0 - _October 21, 2020_
* Update curveBridge tests (#2633)

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/contracts-integrations",
"version": "2.7.0",
"version": "2.7.3",
"engines": {
"node": ">=6.12"
},
@@ -52,20 +52,20 @@
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/extensions",
"devDependencies": {
"@0x/abi-gen": "^5.4.3",
"@0x/contract-addresses": "^4.12.0",
"@0x/contract-wrappers": "^13.9.0",
"@0x/contracts-broker": "^1.1.7",
"@0x/contracts-coordinator": "^3.1.8",
"@0x/contracts-dev-utils": "^1.3.6",
"@0x/contracts-exchange-forwarder": "^4.2.8",
"@0x/contracts-exchange-libs": "^4.3.8",
"@0x/contracts-extensions": "^6.2.2",
"@0x/contract-addresses": "^5.0.1",
"@0x/contract-wrappers": "^13.9.2",
"@0x/contracts-broker": "^1.1.9",
"@0x/contracts-coordinator": "^3.1.10",
"@0x/contracts-dev-utils": "^1.3.8",
"@0x/contracts-exchange-forwarder": "^4.2.10",
"@0x/contracts-exchange-libs": "^4.3.10",
"@0x/contracts-extensions": "^6.2.4",
"@0x/contracts-gen": "2.0.13",
"@0x/contracts-utils": "^4.5.2",
"@0x/contracts-utils": "^4.5.4",
"@0x/coordinator-server": "^1.0.5",
"@0x/dev-utils": "^3.3.4",
"@0x/migrations": "^6.4.1",
"@0x/order-utils": "^10.4.0",
"@0x/migrations": "^6.4.4",
"@0x/order-utils": "^10.4.2",
"@0x/sol-compiler": "^4.2.3",
"@0x/tslint-config": "^4.1.3",
"@0x/web3-wrapper": "^7.2.4",
@@ -91,17 +91,17 @@
"typescript": "3.0.1"
},
"dependencies": {
"@0x/asset-swapper": "0xProject/gitpkg-registry#0x-asset-swapper-v4.6.0-36546480b",
"@0x/asset-swapper": "^4.8.1",
"@0x/base-contract": "^6.2.7",
"@0x/contracts-asset-proxy": "^3.5.0",
"@0x/contracts-erc1155": "^2.1.8",
"@0x/contracts-erc20": "^3.2.2",
"@0x/contracts-erc721": "^3.1.8",
"@0x/contracts-exchange": "^3.2.8",
"@0x/contracts-multisig": "^4.1.8",
"@0x/contracts-staking": "^2.0.15",
"@0x/contracts-test-utils": "^5.3.5",
"@0x/contracts-zero-ex": "^0.3.0",
"@0x/contracts-asset-proxy": "^3.6.1",
"@0x/contracts-erc1155": "^2.1.10",
"@0x/contracts-erc20": "^3.2.4",
"@0x/contracts-erc721": "^3.1.10",
"@0x/contracts-exchange": "^3.2.10",
"@0x/contracts-multisig": "^4.1.10",
"@0x/contracts-staking": "^2.0.17",
"@0x/contracts-test-utils": "^5.3.7",
"@0x/contracts-zero-ex": "^0.5.1",
"@0x/subproviders": "^6.1.5",
"@0x/types": "^3.2.4",
"@0x/typescript-typings": "^5.1.5",

View File

@@ -1,4 +1,22 @@
[
{
"timestamp": 1603851023,
"version": "4.1.10",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1603833198,
"version": "4.1.9",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1603265572,
"version": "4.1.8",

View File

@@ -5,6 +5,14 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v4.1.10 - _October 28, 2020_
* Dependencies updated
## v4.1.9 - _October 27, 2020_
* Dependencies updated
## v4.1.8 - _October 21, 2020_
* Dependencies updated

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/contracts-multisig",
"version": "4.1.8",
"version": "4.1.10",
"engines": {
"node": ">=6.12"
},
@@ -50,11 +50,11 @@
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/multisig",
"devDependencies": {
"@0x/abi-gen": "^5.4.3",
"@0x/contracts-asset-proxy": "^3.5.0",
"@0x/contracts-erc20": "^3.2.2",
"@0x/contracts-asset-proxy": "^3.6.1",
"@0x/contracts-erc20": "^3.2.4",
"@0x/contracts-gen": "2.0.13",
"@0x/contracts-test-utils": "^5.3.5",
"@0x/contracts-utils": "^4.5.2",
"@0x/contracts-test-utils": "^5.3.7",
"@0x/contracts-utils": "^4.5.4",
"@0x/dev-utils": "^3.3.4",
"@0x/sol-compiler": "^4.2.3",
"@0x/tslint-config": "^4.1.3",

View File

@@ -1,4 +1,22 @@
[
{
"timestamp": 1603851023,
"version": "2.0.17",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1603833198,
"version": "2.0.16",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1603265572,
"version": "2.0.15",

View File

@@ -5,6 +5,14 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v2.0.17 - _October 28, 2020_
* Dependencies updated
## v2.0.16 - _October 27, 2020_
* Dependencies updated
## v2.0.15 - _October 21, 2020_
* Dependencies updated

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/contracts-staking",
"version": "2.0.15",
"version": "2.0.17",
"engines": {
"node": ">=6.12"
},
@@ -54,14 +54,14 @@
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/tokens",
"devDependencies": {
"@0x/abi-gen": "^5.4.3",
"@0x/contracts-asset-proxy": "^3.5.0",
"@0x/contracts-dev-utils": "^1.3.6",
"@0x/contracts-erc20": "^3.2.2",
"@0x/contracts-exchange-libs": "^4.3.8",
"@0x/contracts-asset-proxy": "^3.6.1",
"@0x/contracts-dev-utils": "^1.3.8",
"@0x/contracts-erc20": "^3.2.4",
"@0x/contracts-exchange-libs": "^4.3.10",
"@0x/contracts-gen": "2.0.13",
"@0x/contracts-utils": "^4.5.2",
"@0x/contracts-utils": "^4.5.4",
"@0x/dev-utils": "^3.3.4",
"@0x/order-utils": "^10.4.0",
"@0x/order-utils": "^10.4.2",
"@0x/sol-compiler": "^4.2.3",
"@0x/ts-doc-gen": "^0.0.28",
"@0x/tslint-config": "^4.1.3",
@@ -88,7 +88,7 @@
},
"dependencies": {
"@0x/base-contract": "^6.2.7",
"@0x/contracts-test-utils": "^5.3.5",
"@0x/contracts-test-utils": "^5.3.7",
"@0x/typescript-typings": "^5.1.5",
"@0x/utils": "^5.6.3",
"ethereum-types": "^3.3.3",

View File

@@ -1,4 +1,22 @@
[
{
"timestamp": 1603851023,
"version": "5.3.7",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1603833198,
"version": "5.3.6",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1603265572,
"version": "5.3.5",

View File

@@ -5,6 +5,14 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v5.3.7 - _October 28, 2020_
* Dependencies updated
## v5.3.6 - _October 27, 2020_
* Dependencies updated
## v5.3.5 - _October 21, 2020_
* Dependencies updated

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/contracts-test-utils",
"version": "5.3.5",
"version": "5.3.7",
"engines": {
"node": ">=6.12"
},
@@ -44,10 +44,10 @@
"dependencies": {
"@0x/assert": "^3.0.13",
"@0x/base-contract": "^6.2.7",
"@0x/contract-addresses": "^4.12.0",
"@0x/contract-addresses": "^5.0.1",
"@0x/dev-utils": "^3.3.4",
"@0x/json-schemas": "^5.2.3",
"@0x/order-utils": "^10.4.0",
"@0x/order-utils": "^10.4.2",
"@0x/sol-coverage": "^4.0.14",
"@0x/sol-profiler": "^4.1.4",
"@0x/sol-trace": "^3.0.14",

View File

@@ -1,4 +1,22 @@
[
{
"timestamp": 1603851023,
"version": "4.5.4",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1603833198,
"version": "4.5.3",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"version": "4.5.2",
"changes": [

View File

@@ -5,6 +5,14 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v4.5.4 - _October 28, 2020_
* Dependencies updated
## v4.5.3 - _October 27, 2020_
* Dependencies updated
## v4.5.2 - _October 21, 2020_
* Add Ropsten and Rinkeby addresses to `DeploymentConstants` (#2656)

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/contracts-utils",
"version": "4.5.2",
"version": "4.5.4",
"engines": {
"node": ">=6.12"
},
@@ -52,9 +52,9 @@
"devDependencies": {
"@0x/abi-gen": "^5.4.3",
"@0x/contracts-gen": "2.0.13",
"@0x/contracts-test-utils": "^5.3.5",
"@0x/contracts-test-utils": "^5.3.7",
"@0x/dev-utils": "^3.3.4",
"@0x/order-utils": "^10.4.0",
"@0x/order-utils": "^10.4.2",
"@0x/sol-compiler": "^4.2.3",
"@0x/tslint-config": "^4.1.3",
"@0x/types": "^3.2.4",

View File

@@ -1,4 +1,33 @@
[
{
"timestamp": 1603851023,
"version": "0.5.1",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"version": "0.5.0",
"changes": [
{
"note": "Add `Swerve`, `SnowSwap`, `DODO` and `SushiSwap` into FQT",
"pr": 7
}
],
"timestamp": 1603833198
},
{
"version": "0.4.0",
"changes": [
{
"note": "Use the exchange proxy as the primary allowance target",
"pr": 3
}
],
"timestamp": 1603487270
},
{
"version": "0.3.0",
"changes": [

View File

@@ -5,6 +5,18 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v0.5.1 - _October 28, 2020_
* Dependencies updated
## v0.5.0 - _October 27, 2020_
* Add `Swerve`, `SnowSwap`, `DODO` and `SushiSwap` into FQT (#7)
## v0.4.0 - _October 23, 2020_
* Use the exchange proxy as the primary allowance target (#3)
## v0.3.0 - _October 21, 2020_
* Internal audit fixes (#2657)

View File

@@ -31,7 +31,7 @@ import "../storage/LibLiquidityProviderStorage.sol";
import "../vendor/v3/IERC20Bridge.sol";
import "./IFeature.sol";
import "./ILiquidityProviderFeature.sol";
import "./ITokenSpenderFeature.sol";
import "./libs/LibTokenSpender.sol";
contract LiquidityProviderFeature is
@@ -97,7 +97,7 @@ contract LiquidityProviderFeature is
weth.deposit{value: sellAmount}();
weth.transfer(providerAddress, sellAmount);
} else {
ITokenSpenderFeature(address(this))._spendERC20Tokens(
LibTokenSpender.spendERC20Tokens(
IERC20TokenV06(takerToken),
msg.sender,
providerAddress,

View File

@@ -32,8 +32,8 @@ import "./libs/LibSignedCallData.sol";
import "./IMetaTransactionsFeature.sol";
import "./ITransformERC20Feature.sol";
import "./ISignatureValidatorFeature.sol";
import "./ITokenSpenderFeature.sol";
import "./IFeature.sol";
import "./libs/LibTokenSpender.sol";
/// @dev MetaTransactions feature.
@@ -279,10 +279,10 @@ contract MetaTransactionsFeature is
// Pay the fee to the sender.
if (mtx.feeAmount > 0) {
ITokenSpenderFeature(address(this))._spendERC20Tokens(
LibTokenSpender.spendERC20Tokens(
mtx.feeToken,
mtx.signer, // From the signer.
sender, // To the sender.
mtx.signer,
sender,
mtx.feeAmount
);
}

View File

@@ -33,9 +33,9 @@ import "../transformers/IERC20Transformer.sol";
import "../transformers/LibERC20Transformer.sol";
import "./libs/LibSignedCallData.sol";
import "./ITransformERC20Feature.sol";
import "./ITokenSpenderFeature.sol";
import "./IFeature.sol";
import "./ISignatureValidatorFeature.sol";
import "./libs/LibTokenSpender.sol";
/// @dev Feature to composably transform between ERC20 tokens.
@@ -211,8 +211,10 @@ contract TransformERC20Feature is
// If the input token amount is -1, transform the taker's entire
// spendable balance.
if (args.inputTokenAmount == uint256(-1)) {
args.inputTokenAmount = ITokenSpenderFeature(address(this))
.getSpendableERC20BalanceOf(args.inputToken, args.taker);
args.inputTokenAmount = LibTokenSpender.getSpendableERC20BalanceOf(
args.inputToken,
args.taker
);
}
TransformERC20PrivateState memory state;
@@ -315,12 +317,7 @@ contract TransformERC20Feature is
// Transfer input tokens.
if (!LibERC20Transformer.isTokenETH(inputToken)) {
// Token is not ETH, so pull ERC20 tokens.
ITokenSpenderFeature(address(this))._spendERC20Tokens(
inputToken,
from,
to,
amount
);
LibTokenSpender.spendERC20Tokens(inputToken, from, to, amount);
} else if (msg.value < amount) {
// Token is ETH, so the caller must attach enough ETH to the call.
LibTransformERC20RichErrors.InsufficientEthAttachedError(

View File

@@ -157,17 +157,49 @@ contract UniswapFeature is
switch eq(sellToken, ETH_TOKEN_ADDRESS_32)
case 0 {
// For the first pair we need to transfer sellTokens into the
// pair contract using `AllowanceTarget.executeCall()`
mstore(0xB00, ALLOWANCE_TARGET_EXECUTE_CALL_SELECTOR_32)
mstore(0xB04, sellToken)
mstore(0xB24, 0x40)
mstore(0xB44, 0x64)
mstore(0xB64, TRANSFER_FROM_CALL_SELECTOR_32)
mstore(0xB68, caller())
mstore(0xB88, pair)
mstore(0xBA8, sellAmount)
if iszero(call(gas(), mload(0xA60), 0, 0xB00, 0xC8, 0x00, 0x0)) {
bubbleRevert()
// pair contract.
mstore(0xB00, TRANSFER_FROM_CALL_SELECTOR_32)
mstore(0xB04, caller())
mstore(0xB24, pair)
mstore(0xB44, sellAmount)
// Copy only the first 32 bytes of return data. We
// only care about reading a boolean in the success
// case, and we discard the return data in the
// failure case.
let success := call(gas(), sellToken, 0, 0xB00, 0x64, 0xC00, 0x20)
let rdsize := returndatasize()
// Check for ERC20 success. ERC20 tokens should
// return a boolean, but some return nothing or
// extra data. We accept 0-length return data as
// success, or at least 32 bytes that starts with
// a 32-byte boolean true.
success := and(
success, // call itself succeeded
or(
iszero(rdsize), // no return data, or
and(
iszero(lt(rdsize, 32)), // at least 32 bytes
eq(mload(0xC00), 1) // starts with uint256(1)
)
)
)
if iszero(success) {
// Try to fall back to the allowance target.
mstore(0xB00, ALLOWANCE_TARGET_EXECUTE_CALL_SELECTOR_32)
mstore(0xB04, sellToken)
mstore(0xB24, 0x40)
mstore(0xB44, 0x64)
mstore(0xB64, TRANSFER_FROM_CALL_SELECTOR_32)
mstore(0xB68, caller())
mstore(0xB88, pair)
mstore(0xBA8, sellAmount)
if iszero(call(gas(), mload(0xA60), 0, 0xB00, 0xC8, 0x00, 0x0)) {
bubbleRevert()
}
}
}
default {

View File

@@ -0,0 +1,128 @@
/*
Copyright 2020 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/IERC20TokenV06.sol";
import "@0x/contracts-utils/contracts/src/v06/LibSafeMathV06.sol";
import "../../errors/LibSpenderRichErrors.sol";
import "../ITokenSpenderFeature.sol";
library LibTokenSpender {
using LibRichErrorsV06 for bytes;
/// @dev Transfers ERC20 tokens from `owner` to `to`.
/// @param token The token to spend.
/// @param owner The owner of the tokens.
/// @param to The recipient of the tokens.
/// @param amount The amount of `token` to transfer.
function spendERC20Tokens(
IERC20TokenV06 token,
address owner,
address to,
uint256 amount
)
internal
{
bool success;
bytes memory revertData;
require(address(token) != address(this), "LibTokenSpender/CANNOT_INVOKE_SELF");
assembly {
let ptr := mload(0x40) // free memory pointer
// selector for transferFrom(address,address,uint256)
mstore(ptr, 0x23b872dd00000000000000000000000000000000000000000000000000000000)
mstore(add(ptr, 0x04), owner)
mstore(add(ptr, 0x24), to)
mstore(add(ptr, 0x44), amount)
success := call(gas(), token, 0, ptr, 0x64, 0, 0)
let rdsize := returndatasize()
returndatacopy(add(ptr, 0x20), 0, rdsize) // reuse memory
// Check for ERC20 success. ERC20 tokens should return a boolean,
// but some don't. We accept 0-length return data as success, or at
// least 32 bytes that starts with a 32-byte boolean true.
success := and(
success, // call itself succeeded
or(
iszero(rdsize), // no return data, or
and(
iszero(lt(rdsize, 32)), // at least 32 bytes
eq(mload(add(ptr, 0x20)), 1) // starts with uint256(1)
)
)
)
if iszero(success) {
// revertData is a bytes, so length-prefixed data
mstore(ptr, rdsize)
revertData := ptr
// update free memory pointer (ptr + 32-byte length + return data)
mstore(0x40, add(add(ptr, 0x20), rdsize))
}
}
if (!success) {
// Try the old AllowanceTarget.
try ITokenSpenderFeature(address(this))._spendERC20Tokens(
token,
owner,
to,
amount
) {
} catch {
// Bubble up the first error message. (In general, the fallback to the
// allowance target is opportunistic. We ignore the specific error
// message if it fails.)
LibSpenderRichErrors.SpenderERC20TransferFromFailedError(
address(token),
owner,
to,
amount,
revertData
).rrevert();
}
}
}
/// @dev Gets the maximum amount of an ERC20 token `token` that can be
/// pulled from `owner` by this address.
/// @param token The token to spend.
/// @param owner The owner of the tokens.
/// @return amount The amount of tokens that can be pulled.
function getSpendableERC20BalanceOf(
IERC20TokenV06 token,
address owner
)
internal
view
returns (uint256)
{
return LibSafeMathV06.min256(
token.allowance(owner, address(this)),
token.balanceOf(owner)
);
}
}

View File

@@ -22,11 +22,13 @@ pragma experimental ABIEncoderV2;
import "./mixins/MixinAdapterAddresses.sol";
import "./mixins/MixinBalancer.sol";
import "./mixins/MixinCurve.sol";
import "./mixins/MixinDodo.sol";
import "./mixins/MixinKyber.sol";
import "./mixins/MixinMooniswap.sol";
import "./mixins/MixinMStable.sol";
import "./mixins/MixinOasis.sol";
import "./mixins/MixinShell.sol";
import "./mixins/MixinSushiswap.sol";
import "./mixins/MixinUniswap.sol";
import "./mixins/MixinUniswapV2.sol";
import "./mixins/MixinZeroExBridge.sol";
@@ -35,11 +37,13 @@ contract BridgeAdapter is
MixinAdapterAddresses,
MixinBalancer,
MixinCurve,
MixinDodo,
MixinKyber,
MixinMooniswap,
MixinMStable,
MixinOasis,
MixinShell,
MixinSushiswap,
MixinUniswap,
MixinUniswapV2,
MixinZeroExBridge
@@ -48,11 +52,15 @@ contract BridgeAdapter is
address private immutable BALANCER_BRIDGE_ADDRESS;
address private immutable CREAM_BRIDGE_ADDRESS;
address private immutable CURVE_BRIDGE_ADDRESS;
address private immutable DODO_BRIDGE_ADDRESS;
address private immutable KYBER_BRIDGE_ADDRESS;
address private immutable MOONISWAP_BRIDGE_ADDRESS;
address private immutable MSTABLE_BRIDGE_ADDRESS;
address private immutable OASIS_BRIDGE_ADDRESS;
address private immutable SHELL_BRIDGE_ADDRESS;
address private immutable SNOW_SWAP_BRIDGE_ADDRESS;
address private immutable SUSHISWAP_BRIDGE_ADDRESS;
address private immutable SWERVE_BRIDGE_ADDRESS;
address private immutable UNISWAP_BRIDGE_ADDRESS;
address private immutable UNISWAP_V2_BRIDGE_ADDRESS;
@@ -76,11 +84,13 @@ contract BridgeAdapter is
public
MixinBalancer()
MixinCurve()
MixinDodo(addresses)
MixinKyber(addresses)
MixinMooniswap(addresses)
MixinMStable(addresses)
MixinOasis(addresses)
MixinShell(addresses)
MixinSushiswap(addresses)
MixinUniswap(addresses)
MixinUniswapV2(addresses)
MixinZeroExBridge()
@@ -92,9 +102,13 @@ contract BridgeAdapter is
MSTABLE_BRIDGE_ADDRESS = addresses.mStableBridge;
OASIS_BRIDGE_ADDRESS = addresses.oasisBridge;
SHELL_BRIDGE_ADDRESS = addresses.shellBridge;
SUSHISWAP_BRIDGE_ADDRESS = addresses.sushiswapBridge;
SWERVE_BRIDGE_ADDRESS = addresses.swerveBridge;
UNISWAP_BRIDGE_ADDRESS = addresses.uniswapBridge;
UNISWAP_V2_BRIDGE_ADDRESS = addresses.uniswapV2Bridge;
CREAM_BRIDGE_ADDRESS = addresses.creamBridge;
SNOW_SWAP_BRIDGE_ADDRESS = addresses.snowSwapBridge;
DODO_BRIDGE_ADDRESS = addresses.dodoBridge;
}
function trade(
@@ -118,12 +132,20 @@ contract BridgeAdapter is
"BridgeAdapter/INVALID_BRIDGE_ADDRESS"
);
if (bridgeAddress == CURVE_BRIDGE_ADDRESS) {
if (bridgeAddress == CURVE_BRIDGE_ADDRESS ||
bridgeAddress == SWERVE_BRIDGE_ADDRESS ||
bridgeAddress == SNOW_SWAP_BRIDGE_ADDRESS) {
boughtAmount = _tradeCurve(
buyToken,
sellAmount,
bridgeData
);
} else if (bridgeAddress == SUSHISWAP_BRIDGE_ADDRESS) {
boughtAmount = _tradeSushiswap(
buyToken,
sellAmount,
bridgeData
);
} else if (bridgeAddress == UNISWAP_V2_BRIDGE_ADDRESS) {
boughtAmount = _tradeUniswapV2(
buyToken,
@@ -136,7 +158,8 @@ contract BridgeAdapter is
sellAmount,
bridgeData
);
} else if (bridgeAddress == BALANCER_BRIDGE_ADDRESS || bridgeAddress == CREAM_BRIDGE_ADDRESS) {
} else if (bridgeAddress == BALANCER_BRIDGE_ADDRESS ||
bridgeAddress == CREAM_BRIDGE_ADDRESS) {
boughtAmount = _tradeBalancer(
buyToken,
sellAmount,
@@ -172,6 +195,12 @@ contract BridgeAdapter is
sellAmount,
bridgeData
);
} else if (bridgeAddress == DODO_BRIDGE_ADDRESS) {
boughtAmount = _tradeDodo(
buyToken,
sellAmount,
bridgeData
);
} else {
boughtAmount = _tradeZeroExBridge(
bridgeAddress,

View File

@@ -26,20 +26,26 @@ contract MixinAdapterAddresses
address balancerBridge;
address creamBridge;
address curveBridge;
address dodoBridge;
address kyberBridge;
address mooniswapBridge;
address mStableBridge;
address oasisBridge;
address shellBridge;
address snowSwapBridge;
address swerveBridge;
address sushiswapBridge;
address uniswapBridge;
address uniswapV2Bridge;
// Exchanges
address kyberNetworkProxy;
address oasis;
address sushiswapRouter;
address uniswapV2Router;
address uniswapExchangeFactory;
address mStable;
address shell;
address dodoHelper;
// Other
address weth;
}

View File

@@ -0,0 +1,97 @@
/*
Copyright 2020 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";
import "./MixinAdapterAddresses.sol";
interface IDODOHelper {
function querySellQuoteToken(address dodo, uint256 amount) external view returns (uint256);
}
interface IDODO {
function sellBaseToken(uint256 amount, uint256 minReceiveQuote, bytes calldata data) external returns (uint256);
function buyBaseToken(uint256 amount, uint256 maxPayQuote, bytes calldata data) external returns (uint256);
}
contract MixinDodo is
MixinAdapterAddresses
{
using LibERC20TokenV06 for IERC20TokenV06;
/// @dev Mainnet address of the `DOODO Helper` contract.
IDODOHelper private immutable DODO_HELPER;
constructor(AdapterAddresses memory addresses)
public
{
DODO_HELPER = IDODOHelper(addresses.dodoHelper);
}
function _tradeDodo(
IERC20TokenV06 /* buyToken */,
uint256 sellAmount,
bytes memory bridgeData
)
internal
returns (uint256 boughtAmount)
{
(address fromTokenAddress,
address pool,
bool isSellBase) = abi.decode(bridgeData, (address, address, bool));
// Grant the Dodo pool contract an allowance to sell the first token.
IERC20TokenV06(fromTokenAddress).approveIfBelow(pool, sellAmount);
if (isSellBase) {
// Sell the Base token directly against the contract
boughtAmount = IDODO(pool).sellBaseToken(
// amount to sell
sellAmount,
// min receive amount
1,
new bytes(0)
);
} else {
// Need to re-calculate the sell quote amount into buyBase
boughtAmount = DODO_HELPER.querySellQuoteToken(
pool,
sellAmount
);
IDODO(pool).buyBaseToken(
// amount to buy
boughtAmount,
// max pay amount
sellAmount,
new bytes(0)
);
}
return boughtAmount;
}
}

View File

@@ -69,7 +69,7 @@ contract MixinShell is
sellAmount
);
uint256 buyAmount = SHELL.originSwap(
boughtAmount = SHELL.originSwap(
fromTokenAddress,
address(buyToken),
// Sell all tokens we hold.
@@ -79,6 +79,6 @@ contract MixinShell is
// deadline
block.timestamp + 1
);
return buyAmount;
return boughtAmount;
}
}

View File

@@ -0,0 +1,79 @@
/*
Copyright 2020 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";
import "./MixinAdapterAddresses.sol";
import "./MixinUniswapV2.sol";
contract MixinSushiswap is
MixinAdapterAddresses
{
using LibERC20TokenV06 for IERC20TokenV06;
/// @dev Mainnet address of the `SushiswapRouter` contract.
IUniswapV2Router02 private immutable SUSHISWAP_ROUTER;
constructor(AdapterAddresses memory addresses)
public
{
SUSHISWAP_ROUTER = IUniswapV2Router02(addresses.sushiswapRouter);
}
function _tradeSushiswap(
IERC20TokenV06 buyToken,
uint256 sellAmount,
bytes memory bridgeData
)
internal
returns (uint256 boughtAmount)
{
// solhint-disable indent
address[] memory path = abi.decode(bridgeData, (address[]));
// solhint-enable indent
require(path.length >= 2, "SushiswapBridge/PATH_LENGTH_MUST_BE_AT_LEAST_TWO");
require(
path[path.length - 1] == address(buyToken),
"SushiswapBridge/LAST_ELEMENT_OF_PATH_MUST_MATCH_OUTPUT_TOKEN"
);
// Grant the Uniswap router an allowance to sell the first token.
IERC20TokenV06(path[0]).approveIfBelow(
address(SUSHISWAP_ROUTER),
sellAmount
);
uint[] memory amounts = SUSHISWAP_ROUTER.swapExactTokensForTokens(
// Sell all tokens we hold.
sellAmount,
// Minimum buy amount.
1,
// Convert to `buyToken` along this path.
path,
// Recipient is `this`.
address(this),
// Expires after this block.
block.timestamp
);
return amounts[amounts.length-1];
}
}

View File

@@ -0,0 +1,72 @@
/*
Copyright 2020 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/IERC20TokenV06.sol";
import "../src/features/libs/LibTokenSpender.sol";
contract TestLibTokenSpender {
uint256 constant private TRIGGER_FALLBACK_SUCCESS_AMOUNT = 1340;
function spendERC20Tokens(
IERC20TokenV06 token,
address owner,
address to,
uint256 amount
)
external
{
LibTokenSpender.spendERC20Tokens(token, owner, to, amount);
}
event FallbackCalled(
address token,
address owner,
address to,
uint256 amount
);
// This is called as a fallback when the original transferFrom() fails.
function _spendERC20Tokens(
IERC20TokenV06 token,
address owner,
address to,
uint256 amount
)
external
{
require(amount == TRIGGER_FALLBACK_SUCCESS_AMOUNT,
"TokenSpenderFallback/FAILURE_AMOUNT");
emit FallbackCalled(address(token), owner, to, amount);
}
function getSpendableERC20BalanceOf(
IERC20TokenV06 token,
address owner
)
external
view
returns (uint256)
{
return LibTokenSpender.getSpendableERC20BalanceOf(token, owner);
}
}

View File

@@ -37,6 +37,9 @@ contract TestTokenSpenderERC20Token is
uint256 constant private EMPTY_RETURN_AMOUNT = 1337;
uint256 constant private FALSE_RETURN_AMOUNT = 1338;
uint256 constant private REVERT_RETURN_AMOUNT = 1339;
uint256 constant private TRIGGER_FALLBACK_SUCCESS_AMOUNT = 1340;
uint256 constant private EXTRA_RETURN_TRUE_AMOUNT = 1341;
uint256 constant private EXTRA_RETURN_FALSE_AMOUNT = 1342;
function transferFrom(address from, address to, uint256 amount)
public
@@ -53,6 +56,19 @@ contract TestTokenSpenderERC20Token is
if (amount == REVERT_RETURN_AMOUNT) {
revert("TestTokenSpenderERC20Token/Revert");
}
if (amount == TRIGGER_FALLBACK_SUCCESS_AMOUNT) {
return false;
}
if (amount == EXTRA_RETURN_TRUE_AMOUNT
|| amount == EXTRA_RETURN_FALSE_AMOUNT) {
bool ret = amount == EXTRA_RETURN_TRUE_AMOUNT;
assembly {
mstore(0x00, ret)
mstore(0x20, amount) // just something extra to return
return(0, 0x40)
}
}
return true;
}

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/contracts-zero-ex",
"version": "0.3.0",
"version": "0.5.1",
"engines": {
"node": ">=6.12"
},
@@ -41,7 +41,7 @@
"config": {
"publicInterfaceContracts": "IZeroEx,ZeroEx,FullMigration,InitialMigration,IFlashWallet,IAllowanceTarget,IERC20Transformer,IOwnableFeature,ISimpleFunctionRegistryFeature,ITokenSpenderFeature,ITransformERC20Feature,FillQuoteTransformer,PayTakerTransformer,WethTransformer,OwnableFeature,SimpleFunctionRegistryFeature,TransformERC20Feature,TokenSpenderFeature,AffiliateFeeTransformer,SignatureValidatorFeature,MetaTransactionsFeature,LogMetadataTransformer,BridgeAdapter,LiquidityProviderFeature",
"abis:comment": "This list is auto-generated by contracts-gen. Don't edit manually.",
"abis": "./test/generated-artifacts/@(AffiliateFeeTransformer|AllowanceTarget|BootstrapFeature|BridgeAdapter|FillQuoteTransformer|FixinCommon|FixinEIP712|FixinReentrancyGuard|FlashWallet|FullMigration|IAllowanceTarget|IBootstrapFeature|IBridgeAdapter|IERC20Bridge|IERC20Transformer|IExchange|IFeature|IFlashWallet|IGasToken|ILiquidityProviderFeature|IMetaTransactionsFeature|IOwnableFeature|ISignatureValidatorFeature|ISimpleFunctionRegistryFeature|ITestSimpleFunctionRegistryFeature|ITokenSpenderFeature|ITransformERC20Feature|IUniswapFeature|IZeroEx|InitialMigration|LibBootstrap|LibCommonRichErrors|LibERC20Transformer|LibLiquidityProviderRichErrors|LibLiquidityProviderStorage|LibMetaTransactionsRichErrors|LibMetaTransactionsStorage|LibMigrate|LibOwnableRichErrors|LibOwnableStorage|LibProxyRichErrors|LibProxyStorage|LibReentrancyGuardStorage|LibSignatureRichErrors|LibSignedCallData|LibSimpleFunctionRegistryRichErrors|LibSimpleFunctionRegistryStorage|LibSpenderRichErrors|LibStorage|LibTokenSpenderStorage|LibTransformERC20RichErrors|LibTransformERC20Storage|LibWalletRichErrors|LiquidityProviderFeature|LogMetadataTransformer|MetaTransactionsFeature|MixinAdapterAddresses|MixinBalancer|MixinCurve|MixinKyber|MixinMStable|MixinMooniswap|MixinOasis|MixinShell|MixinUniswap|MixinUniswapV2|MixinZeroExBridge|OwnableFeature|PayTakerTransformer|SignatureValidatorFeature|SimpleFunctionRegistryFeature|TestBridge|TestCallTarget|TestDelegateCaller|TestFillQuoteTransformerBridge|TestFillQuoteTransformerExchange|TestFillQuoteTransformerHost|TestFullMigration|TestInitialMigration|TestMetaTransactionsTransformERC20Feature|TestMigrator|TestMintTokenERC20Transformer|TestMintableERC20Token|TestSimpleFunctionRegistryFeatureImpl1|TestSimpleFunctionRegistryFeatureImpl2|TestTokenSpender|TestTokenSpenderERC20Token|TestTransformERC20|TestTransformerBase|TestTransformerDeployerTransformer|TestTransformerHost|TestWeth|TestWethTransformerHost|TestZeroExFeature|TokenSpenderFeature|TransformERC20Feature|Transformer|TransformerDeployer|UniswapFeature|WethTransformer|ZeroEx).json"
"abis": "./test/generated-artifacts/@(AffiliateFeeTransformer|AllowanceTarget|BootstrapFeature|BridgeAdapter|FillQuoteTransformer|FixinCommon|FixinEIP712|FixinReentrancyGuard|FlashWallet|FullMigration|IAllowanceTarget|IBootstrapFeature|IBridgeAdapter|IERC20Bridge|IERC20Transformer|IExchange|IFeature|IFlashWallet|IGasToken|ILiquidityProviderFeature|IMetaTransactionsFeature|IOwnableFeature|ISignatureValidatorFeature|ISimpleFunctionRegistryFeature|ITestSimpleFunctionRegistryFeature|ITokenSpenderFeature|ITransformERC20Feature|IUniswapFeature|IZeroEx|InitialMigration|LibBootstrap|LibCommonRichErrors|LibERC20Transformer|LibLiquidityProviderRichErrors|LibLiquidityProviderStorage|LibMetaTransactionsRichErrors|LibMetaTransactionsStorage|LibMigrate|LibOwnableRichErrors|LibOwnableStorage|LibProxyRichErrors|LibProxyStorage|LibReentrancyGuardStorage|LibSignatureRichErrors|LibSignedCallData|LibSimpleFunctionRegistryRichErrors|LibSimpleFunctionRegistryStorage|LibSpenderRichErrors|LibStorage|LibTokenSpender|LibTokenSpenderStorage|LibTransformERC20RichErrors|LibTransformERC20Storage|LibWalletRichErrors|LiquidityProviderFeature|LogMetadataTransformer|MetaTransactionsFeature|MixinAdapterAddresses|MixinBalancer|MixinCurve|MixinDodo|MixinKyber|MixinMStable|MixinMooniswap|MixinOasis|MixinShell|MixinSushiswap|MixinUniswap|MixinUniswapV2|MixinZeroExBridge|OwnableFeature|PayTakerTransformer|SignatureValidatorFeature|SimpleFunctionRegistryFeature|TestBridge|TestCallTarget|TestDelegateCaller|TestFillQuoteTransformerBridge|TestFillQuoteTransformerExchange|TestFillQuoteTransformerHost|TestFullMigration|TestInitialMigration|TestLibTokenSpender|TestMetaTransactionsTransformERC20Feature|TestMigrator|TestMintTokenERC20Transformer|TestMintableERC20Token|TestSimpleFunctionRegistryFeatureImpl1|TestSimpleFunctionRegistryFeatureImpl2|TestTokenSpender|TestTokenSpenderERC20Token|TestTransformERC20|TestTransformerBase|TestTransformerDeployerTransformer|TestTransformerHost|TestWeth|TestWethTransformerHost|TestZeroExFeature|TokenSpenderFeature|TransformERC20Feature|Transformer|TransformerDeployer|UniswapFeature|WethTransformer|ZeroEx).json"
},
"repository": {
"type": "git",
@@ -54,11 +54,11 @@
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/zero-ex",
"devDependencies": {
"@0x/abi-gen": "^5.4.3",
"@0x/contracts-erc20": "^3.2.2",
"@0x/contracts-erc20": "^3.2.4",
"@0x/contracts-gen": "2.0.13",
"@0x/contracts-test-utils": "^5.3.5",
"@0x/contracts-test-utils": "^5.3.7",
"@0x/dev-utils": "^3.3.4",
"@0x/order-utils": "^10.4.0",
"@0x/order-utils": "^10.4.2",
"@0x/sol-compiler": "^4.2.3",
"@0x/ts-doc-gen": "^0.0.28",
"@0x/tslint-config": "^4.1.3",

View File

@@ -54,6 +54,7 @@ import * as LibSimpleFunctionRegistryRichErrors from '../test/generated-artifact
import * as LibSimpleFunctionRegistryStorage from '../test/generated-artifacts/LibSimpleFunctionRegistryStorage.json';
import * as LibSpenderRichErrors from '../test/generated-artifacts/LibSpenderRichErrors.json';
import * as LibStorage from '../test/generated-artifacts/LibStorage.json';
import * as LibTokenSpender from '../test/generated-artifacts/LibTokenSpender.json';
import * as LibTokenSpenderStorage from '../test/generated-artifacts/LibTokenSpenderStorage.json';
import * as LibTransformERC20RichErrors from '../test/generated-artifacts/LibTransformERC20RichErrors.json';
import * as LibTransformERC20Storage from '../test/generated-artifacts/LibTransformERC20Storage.json';
@@ -64,11 +65,13 @@ import * as MetaTransactionsFeature from '../test/generated-artifacts/MetaTransa
import * as MixinAdapterAddresses from '../test/generated-artifacts/MixinAdapterAddresses.json';
import * as MixinBalancer from '../test/generated-artifacts/MixinBalancer.json';
import * as MixinCurve from '../test/generated-artifacts/MixinCurve.json';
import * as MixinDodo from '../test/generated-artifacts/MixinDodo.json';
import * as MixinKyber from '../test/generated-artifacts/MixinKyber.json';
import * as MixinMooniswap from '../test/generated-artifacts/MixinMooniswap.json';
import * as MixinMStable from '../test/generated-artifacts/MixinMStable.json';
import * as MixinOasis from '../test/generated-artifacts/MixinOasis.json';
import * as MixinShell from '../test/generated-artifacts/MixinShell.json';
import * as MixinSushiswap from '../test/generated-artifacts/MixinSushiswap.json';
import * as MixinUniswap from '../test/generated-artifacts/MixinUniswap.json';
import * as MixinUniswapV2 from '../test/generated-artifacts/MixinUniswapV2.json';
import * as MixinZeroExBridge from '../test/generated-artifacts/MixinZeroExBridge.json';
@@ -84,6 +87,7 @@ import * as TestFillQuoteTransformerExchange from '../test/generated-artifacts/T
import * as TestFillQuoteTransformerHost from '../test/generated-artifacts/TestFillQuoteTransformerHost.json';
import * as TestFullMigration from '../test/generated-artifacts/TestFullMigration.json';
import * as TestInitialMigration from '../test/generated-artifacts/TestInitialMigration.json';
import * as TestLibTokenSpender from '../test/generated-artifacts/TestLibTokenSpender.json';
import * as TestMetaTransactionsTransformERC20Feature from '../test/generated-artifacts/TestMetaTransactionsTransformERC20Feature.json';
import * as TestMigrator from '../test/generated-artifacts/TestMigrator.json';
import * as TestMintableERC20Token from '../test/generated-artifacts/TestMintableERC20Token.json';
@@ -144,6 +148,7 @@ export const artifacts = {
TransformERC20Feature: TransformERC20Feature as ContractArtifact,
UniswapFeature: UniswapFeature as ContractArtifact,
LibSignedCallData: LibSignedCallData as ContractArtifact,
LibTokenSpender: LibTokenSpender as ContractArtifact,
FixinCommon: FixinCommon as ContractArtifact,
FixinEIP712: FixinEIP712 as ContractArtifact,
FixinReentrancyGuard: FixinReentrancyGuard as ContractArtifact,
@@ -173,11 +178,13 @@ export const artifacts = {
MixinAdapterAddresses: MixinAdapterAddresses as ContractArtifact,
MixinBalancer: MixinBalancer as ContractArtifact,
MixinCurve: MixinCurve as ContractArtifact,
MixinDodo: MixinDodo as ContractArtifact,
MixinKyber: MixinKyber as ContractArtifact,
MixinMStable: MixinMStable as ContractArtifact,
MixinMooniswap: MixinMooniswap as ContractArtifact,
MixinOasis: MixinOasis as ContractArtifact,
MixinShell: MixinShell as ContractArtifact,
MixinSushiswap: MixinSushiswap as ContractArtifact,
MixinUniswap: MixinUniswap as ContractArtifact,
MixinUniswapV2: MixinUniswapV2 as ContractArtifact,
MixinZeroExBridge: MixinZeroExBridge as ContractArtifact,
@@ -193,6 +200,7 @@ export const artifacts = {
TestFillQuoteTransformerHost: TestFillQuoteTransformerHost as ContractArtifact,
TestFullMigration: TestFullMigration as ContractArtifact,
TestInitialMigration: TestInitialMigration as ContractArtifact,
TestLibTokenSpender: TestLibTokenSpender as ContractArtifact,
TestMetaTransactionsTransformERC20Feature: TestMetaTransactionsTransformERC20Feature as ContractArtifact,
TestMigrator: TestMigrator as ContractArtifact,
TestMintTokenERC20Transformer: TestMintTokenERC20Transformer as ContractArtifact,

View File

@@ -2,12 +2,7 @@ import { artifacts as erc20Artifacts, DummyERC20TokenContract } from '@0x/contra
import { blockchainTests, constants, expect, randomAddress, verifyEventsFromLogs } from '@0x/contracts-test-utils';
import { BigNumber, OwnableRevertErrors, ZeroExRevertErrors } from '@0x/utils';
import {
IOwnableFeatureContract,
IZeroExContract,
LiquidityProviderFeatureContract,
TokenSpenderFeatureContract,
} from '../../src/wrappers';
import { IOwnableFeatureContract, IZeroExContract, LiquidityProviderFeatureContract } from '../../src/wrappers';
import { artifacts } from '../artifacts';
import { abis } from '../utils/abis';
import { fullMigrateAsync } from '../utils/migration';
@@ -23,16 +18,7 @@ blockchainTests('LiquidityProvider feature', env => {
before(async () => {
[owner, taker] = await env.getAccountAddressesAsync();
zeroEx = await fullMigrateAsync(owner, env.provider, env.txDefaults, {
tokenSpender: (await TokenSpenderFeatureContract.deployFrom0xArtifactAsync(
artifacts.TestTokenSpender,
env.provider,
env.txDefaults,
artifacts,
)).address,
});
const tokenSpender = new TokenSpenderFeatureContract(zeroEx.address, env.provider, env.txDefaults, abis);
const allowanceTarget = await tokenSpender.getAllowanceTarget().callAsync();
zeroEx = await fullMigrateAsync(owner, env.provider, env.txDefaults, {});
token = await DummyERC20TokenContract.deployFrom0xArtifactAsync(
erc20Artifacts.DummyERC20Token,
@@ -52,7 +38,7 @@ blockchainTests('LiquidityProvider feature', env => {
artifacts,
);
await token
.approve(allowanceTarget, constants.INITIAL_ERC20_ALLOWANCE)
.approve(zeroEx.address, constants.INITIAL_ERC20_ALLOWANCE)
.awaitTransactionSuccessAsync({ from: taker });
feature = new LiquidityProviderFeatureContract(zeroEx.address, env.provider, env.txDefaults, abis);

View File

@@ -17,7 +17,6 @@ import { artifacts } from '../artifacts';
import { abis } from '../utils/abis';
import { fullMigrateAsync } from '../utils/migration';
import {
ITokenSpenderFeatureContract,
TestMetaTransactionsTransformERC20FeatureContract,
TestMetaTransactionsTransformERC20FeatureEvents,
TestMintableERC20TokenContract,
@@ -33,7 +32,6 @@ blockchainTests.resets('MetaTransactions feature', env => {
let feature: MetaTransactionsFeatureContract;
let feeToken: TestMintableERC20TokenContract;
let transformERC20Feature: TestMetaTransactionsTransformERC20FeatureContract;
let allowanceTarget: string;
const MAX_FEE_AMOUNT = new BigNumber('1e18');
const TRANSFORM_ERC20_FAILING_VALUE = new BigNumber(666);
@@ -64,14 +62,11 @@ blockchainTests.resets('MetaTransactions feature', env => {
env.txDefaults,
{},
);
allowanceTarget = await new ITokenSpenderFeatureContract(zeroEx.address, env.provider, env.txDefaults)
.getAllowanceTarget()
.callAsync();
// Fund signers with fee tokens.
await Promise.all(
signers.map(async signer => {
await feeToken.mint(signer, MAX_FEE_AMOUNT).awaitTransactionSuccessAsync();
await feeToken.approve(allowanceTarget, MAX_FEE_AMOUNT).awaitTransactionSuccessAsync({ from: signer });
await feeToken.approve(zeroEx.address, MAX_FEE_AMOUNT).awaitTransactionSuccessAsync({ from: signer });
}),
);
});

View File

@@ -20,7 +20,6 @@ import { abis } from '../utils/abis';
import { fullMigrateAsync } from '../utils/migration';
import {
FlashWalletContract,
ITokenSpenderFeatureContract,
TestMintableERC20TokenContract,
TestMintTokenERC20TransformerContract,
TestMintTokenERC20TransformerEvents,
@@ -42,7 +41,6 @@ blockchainTests.resets('TransformERC20 feature', env => {
let zeroEx: IZeroExContract;
let feature: TransformERC20FeatureContract;
let wallet: FlashWalletContract;
let allowanceTarget: string;
before(async () => {
[owner, taker, sender, transformerDeployer] = await env.getAccountAddressesAsync();
@@ -67,9 +65,6 @@ blockchainTests.resets('TransformERC20 feature', env => {
abis,
);
wallet = new FlashWalletContract(await feature.getTransformWallet().callAsync(), env.provider, env.txDefaults);
allowanceTarget = await new ITokenSpenderFeatureContract(zeroEx.address, env.provider, env.txDefaults)
.getAllowanceTarget()
.callAsync();
await feature.setQuoteSigner(callDataSigner).awaitTransactionSuccessAsync({ from: owner });
});
@@ -173,7 +168,7 @@ blockchainTests.resets('TransformERC20 feature', env => {
},
artifacts,
);
await inputToken.approve(allowanceTarget, MAX_UINT256).awaitTransactionSuccessAsync({ from: taker });
await inputToken.approve(zeroEx.address, MAX_UINT256).awaitTransactionSuccessAsync({ from: taker });
});
interface Transformation {

View File

@@ -0,0 +1,210 @@
import {
blockchainTests,
expect,
getRandomInteger,
randomAddress,
verifyEventsFromLogs,
} from '@0x/contracts-test-utils';
import { BigNumber, hexUtils, StringRevertError, ZeroExRevertErrors } from '@0x/utils';
import { artifacts } from './artifacts';
import {
TestLibTokenSpenderContract,
TestLibTokenSpenderEvents,
TestTokenSpenderERC20TokenContract,
TestTokenSpenderERC20TokenEvents,
} from './wrappers';
blockchainTests.resets('LibTokenSpender library', env => {
let tokenSpender: TestLibTokenSpenderContract;
let token: TestTokenSpenderERC20TokenContract;
before(async () => {
tokenSpender = await TestLibTokenSpenderContract.deployFrom0xArtifactAsync(
artifacts.TestLibTokenSpender,
env.provider,
env.txDefaults,
artifacts,
);
token = await TestTokenSpenderERC20TokenContract.deployFrom0xArtifactAsync(
artifacts.TestTokenSpenderERC20Token,
env.provider,
env.txDefaults,
artifacts,
);
});
describe('spendERC20Tokens()', () => {
const EMPTY_RETURN_AMOUNT = 1337;
const FALSE_RETURN_AMOUNT = 1338;
const REVERT_RETURN_AMOUNT = 1339;
const TRIGGER_FALLBACK_SUCCESS_AMOUNT = 1340;
const EXTRA_RETURN_TRUE_AMOUNT = 1341;
const EXTRA_RETURN_FALSE_AMOUNT = 1342;
it('spendERC20Tokens() successfully calls compliant ERC20 token', async () => {
const tokenFrom = randomAddress();
const tokenTo = randomAddress();
const tokenAmount = new BigNumber(123456);
const receipt = await tokenSpender
.spendERC20Tokens(token.address, tokenFrom, tokenTo, tokenAmount)
.awaitTransactionSuccessAsync();
verifyEventsFromLogs(
receipt.logs,
[
{
sender: tokenSpender.address,
from: tokenFrom,
to: tokenTo,
amount: tokenAmount,
},
],
TestTokenSpenderERC20TokenEvents.TransferFromCalled,
);
});
it('spendERC20Tokens() successfully calls non-compliant ERC20 token', async () => {
const tokenFrom = randomAddress();
const tokenTo = randomAddress();
const tokenAmount = new BigNumber(EMPTY_RETURN_AMOUNT);
const receipt = await tokenSpender
.spendERC20Tokens(token.address, tokenFrom, tokenTo, tokenAmount)
.awaitTransactionSuccessAsync();
verifyEventsFromLogs(
receipt.logs,
[
{
sender: tokenSpender.address,
from: tokenFrom,
to: tokenTo,
amount: tokenAmount,
},
],
TestTokenSpenderERC20TokenEvents.TransferFromCalled,
);
});
it('spendERC20Tokens() reverts if ERC20 token reverts', async () => {
const tokenFrom = randomAddress();
const tokenTo = randomAddress();
const tokenAmount = new BigNumber(REVERT_RETURN_AMOUNT);
const tx = tokenSpender
.spendERC20Tokens(token.address, tokenFrom, tokenTo, tokenAmount)
.awaitTransactionSuccessAsync();
const expectedError = new ZeroExRevertErrors.Spender.SpenderERC20TransferFromFailedError(
token.address,
tokenFrom,
tokenTo,
tokenAmount,
new StringRevertError('TestTokenSpenderERC20Token/Revert').encode(),
);
return expect(tx).to.revertWith(expectedError);
});
it('spendERC20Tokens() reverts if ERC20 token returns false', async () => {
const tokenFrom = randomAddress();
const tokenTo = randomAddress();
const tokenAmount = new BigNumber(FALSE_RETURN_AMOUNT);
const tx = tokenSpender
.spendERC20Tokens(token.address, tokenFrom, tokenTo, tokenAmount)
.awaitTransactionSuccessAsync();
return expect(tx).to.revertWith(
new ZeroExRevertErrors.Spender.SpenderERC20TransferFromFailedError(
token.address,
tokenFrom,
tokenTo,
tokenAmount,
hexUtils.leftPad(0),
),
);
});
it('spendERC20Tokens() falls back successfully to TokenSpender._spendERC20Tokens()', async () => {
const tokenFrom = randomAddress();
const tokenTo = randomAddress();
const tokenAmount = new BigNumber(TRIGGER_FALLBACK_SUCCESS_AMOUNT);
const receipt = await tokenSpender
.spendERC20Tokens(token.address, tokenFrom, tokenTo, tokenAmount)
.awaitTransactionSuccessAsync();
verifyEventsFromLogs(
receipt.logs,
[
{
token: token.address,
owner: tokenFrom,
to: tokenTo,
amount: tokenAmount,
},
],
TestLibTokenSpenderEvents.FallbackCalled,
);
});
it('spendERC20Tokens() allows extra data after true', async () => {
const tokenFrom = randomAddress();
const tokenTo = randomAddress();
const tokenAmount = new BigNumber(EXTRA_RETURN_TRUE_AMOUNT);
const receipt = await tokenSpender
.spendERC20Tokens(token.address, tokenFrom, tokenTo, tokenAmount)
.awaitTransactionSuccessAsync();
verifyEventsFromLogs(
receipt.logs,
[
{
sender: tokenSpender.address,
from: tokenFrom,
to: tokenTo,
amount: tokenAmount,
},
],
TestTokenSpenderERC20TokenEvents.TransferFromCalled,
);
});
it("spendERC20Tokens() reverts when there's extra data after false", async () => {
const tokenFrom = randomAddress();
const tokenTo = randomAddress();
const tokenAmount = new BigNumber(EXTRA_RETURN_FALSE_AMOUNT);
const tx = tokenSpender
.spendERC20Tokens(token.address, tokenFrom, tokenTo, tokenAmount)
.awaitTransactionSuccessAsync();
return expect(tx).to.revertWith(
new ZeroExRevertErrors.Spender.SpenderERC20TransferFromFailedError(
token.address,
tokenFrom,
tokenTo,
tokenAmount,
hexUtils.leftPad(EXTRA_RETURN_FALSE_AMOUNT, 64),
),
);
});
it('spendERC20Tokens() cannot call self', async () => {
const tokenFrom = randomAddress();
const tokenTo = randomAddress();
const tokenAmount = new BigNumber(123456);
const tx = tokenSpender
.spendERC20Tokens(tokenSpender.address, tokenFrom, tokenTo, tokenAmount)
.awaitTransactionSuccessAsync();
return expect(tx).to.revertWith('LibTokenSpender/CANNOT_INVOKE_SELF');
});
});
describe('getSpendableERC20BalanceOf()', () => {
it("returns the minimum of the owner's balance and allowance", async () => {
const balance = getRandomInteger(1, '1e18');
const allowance = getRandomInteger(1, '1e18');
const tokenOwner = randomAddress();
await token
.setBalanceAndAllowanceOf(tokenOwner, balance, tokenSpender.address, allowance)
.awaitTransactionSuccessAsync();
const spendableBalance = await tokenSpender
.getSpendableERC20BalanceOf(token.address, tokenOwner)
.callAsync();
expect(spendableBalance).to.bignumber.eq(BigNumber.min(balance, allowance));
});
});
});

View File

@@ -65,10 +65,13 @@ blockchainTests.resets('FillQuoteTransformer', env => {
mooniswapBridge: NULL_ADDRESS,
mStableBridge: NULL_ADDRESS,
oasisBridge: NULL_ADDRESS,
sushiswapBridge: NULL_ADDRESS,
swerveBridge: NULL_ADDRESS,
uniswapBridge: NULL_ADDRESS,
uniswapV2Bridge: NULL_ADDRESS,
kyberNetworkProxy: NULL_ADDRESS,
oasis: NULL_ADDRESS,
sushiswapRouter: NULL_ADDRESS,
uniswapV2Router: NULL_ADDRESS,
uniswapExchangeFactory: NULL_ADDRESS,
mStable: NULL_ADDRESS,
@@ -76,6 +79,9 @@ blockchainTests.resets('FillQuoteTransformer', env => {
shellBridge: NULL_ADDRESS,
shell: NULL_ADDRESS,
creamBridge: NULL_ADDRESS,
dodoBridge: NULL_ADDRESS,
dodoHelper: NULL_ADDRESS,
snowSwapBridge: NULL_ADDRESS,
},
);
transformer = await FillQuoteTransformerContract.deployFrom0xArtifactAsync(

View File

@@ -52,6 +52,7 @@ export * from '../test/generated-wrappers/lib_simple_function_registry_rich_erro
export * from '../test/generated-wrappers/lib_simple_function_registry_storage';
export * from '../test/generated-wrappers/lib_spender_rich_errors';
export * from '../test/generated-wrappers/lib_storage';
export * from '../test/generated-wrappers/lib_token_spender';
export * from '../test/generated-wrappers/lib_token_spender_storage';
export * from '../test/generated-wrappers/lib_transform_erc20_rich_errors';
export * from '../test/generated-wrappers/lib_transform_erc20_storage';
@@ -62,11 +63,13 @@ export * from '../test/generated-wrappers/meta_transactions_feature';
export * from '../test/generated-wrappers/mixin_adapter_addresses';
export * from '../test/generated-wrappers/mixin_balancer';
export * from '../test/generated-wrappers/mixin_curve';
export * from '../test/generated-wrappers/mixin_dodo';
export * from '../test/generated-wrappers/mixin_kyber';
export * from '../test/generated-wrappers/mixin_m_stable';
export * from '../test/generated-wrappers/mixin_mooniswap';
export * from '../test/generated-wrappers/mixin_oasis';
export * from '../test/generated-wrappers/mixin_shell';
export * from '../test/generated-wrappers/mixin_sushiswap';
export * from '../test/generated-wrappers/mixin_uniswap';
export * from '../test/generated-wrappers/mixin_uniswap_v2';
export * from '../test/generated-wrappers/mixin_zero_ex_bridge';
@@ -82,6 +85,7 @@ export * from '../test/generated-wrappers/test_fill_quote_transformer_exchange';
export * from '../test/generated-wrappers/test_fill_quote_transformer_host';
export * from '../test/generated-wrappers/test_full_migration';
export * from '../test/generated-wrappers/test_initial_migration';
export * from '../test/generated-wrappers/test_lib_token_spender';
export * from '../test/generated-wrappers/test_meta_transactions_transform_erc20_feature';
export * from '../test/generated-wrappers/test_migrator';
export * from '../test/generated-wrappers/test_mint_token_erc20_transformer';

View File

@@ -76,6 +76,7 @@
"test/generated-artifacts/LibSimpleFunctionRegistryStorage.json",
"test/generated-artifacts/LibSpenderRichErrors.json",
"test/generated-artifacts/LibStorage.json",
"test/generated-artifacts/LibTokenSpender.json",
"test/generated-artifacts/LibTokenSpenderStorage.json",
"test/generated-artifacts/LibTransformERC20RichErrors.json",
"test/generated-artifacts/LibTransformERC20Storage.json",
@@ -86,11 +87,13 @@
"test/generated-artifacts/MixinAdapterAddresses.json",
"test/generated-artifacts/MixinBalancer.json",
"test/generated-artifacts/MixinCurve.json",
"test/generated-artifacts/MixinDodo.json",
"test/generated-artifacts/MixinKyber.json",
"test/generated-artifacts/MixinMStable.json",
"test/generated-artifacts/MixinMooniswap.json",
"test/generated-artifacts/MixinOasis.json",
"test/generated-artifacts/MixinShell.json",
"test/generated-artifacts/MixinSushiswap.json",
"test/generated-artifacts/MixinUniswap.json",
"test/generated-artifacts/MixinUniswapV2.json",
"test/generated-artifacts/MixinZeroExBridge.json",
@@ -106,6 +109,7 @@
"test/generated-artifacts/TestFillQuoteTransformerHost.json",
"test/generated-artifacts/TestFullMigration.json",
"test/generated-artifacts/TestInitialMigration.json",
"test/generated-artifacts/TestLibTokenSpender.json",
"test/generated-artifacts/TestMetaTransactionsTransformERC20Feature.json",
"test/generated-artifacts/TestMigrator.json",
"test/generated-artifacts/TestMintTokenERC20Transformer.json",

1
docs/.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
_build*

177
docs/Makefile Normal file
View File

@@ -0,0 +1,177 @@
# Makefile for Sphinx documentation
#
# You can set these variables from the command line.
SPHINXOPTS =
SPHINXBUILD = sphinx-build
PAPER =
BUILDDIR = _build
# User-friendly check for sphinx-build
ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $$?), 1)
$(error The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed, then set the SPHINXBUILD environment variable to point to the full path of the '$(SPHINXBUILD)' executable. Alternatively you can add the directory with the executable to your PATH. If you don't have Sphinx installed, grab it from http://sphinx-doc.org/)
endif
# Internal variables.
PAPEROPT_a4 = -D latex_paper_size=a4
PAPEROPT_letter = -D latex_paper_size=letter
ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
# the i18n builder cannot share the environment and doctrees with the others
I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest gettext
help:
@echo "Please use \`make <target>' where <target> is one of"
@echo " html to make standalone HTML files"
@echo " dirhtml to make HTML files named index.html in directories"
@echo " singlehtml to make a single large HTML file"
@echo " pickle to make pickle files"
@echo " json to make JSON files"
@echo " htmlhelp to make HTML files and a HTML help project"
@echo " qthelp to make HTML files and a qthelp project"
@echo " devhelp to make HTML files and a Devhelp project"
@echo " epub to make an epub"
@echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
@echo " latexpdf to make LaTeX files and run them through pdflatex"
@echo " latexpdfja to make LaTeX files and run them through platex/dvipdfmx"
@echo " text to make text files"
@echo " man to make manual pages"
@echo " texinfo to make Texinfo files"
@echo " info to make Texinfo files and run them through makeinfo"
@echo " gettext to make PO message catalogs"
@echo " changes to make an overview of all changed/added/deprecated items"
@echo " xml to make Docutils-native XML files"
@echo " pseudoxml to make pseudoxml-XML files for display purposes"
@echo " linkcheck to check all external links for integrity"
@echo " doctest to run all doctests embedded in the documentation (if enabled)"
clean:
rm -rf $(BUILDDIR)/*
html:
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
@echo
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
dirhtml:
$(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
@echo
@echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."
singlehtml:
$(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml
@echo
@echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml."
pickle:
$(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle
@echo
@echo "Build finished; now you can process the pickle files."
json:
$(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json
@echo
@echo "Build finished; now you can process the JSON files."
htmlhelp:
$(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp
@echo
@echo "Build finished; now you can run HTML Help Workshop with the" \
".hhp project file in $(BUILDDIR)/htmlhelp."
qthelp:
$(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp
@echo
@echo "Build finished; now you can run "qcollectiongenerator" with the" \
".qhcp project file in $(BUILDDIR)/qthelp, like this:"
@echo "# qcollectiongenerator $(BUILDDIR)/qthelp/ReadtheDocsTemplate.qhcp"
@echo "To view the help file:"
@echo "# assistant -collectionFile $(BUILDDIR)/qthelp/ReadtheDocsTemplate.qhc"
devhelp:
$(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp
@echo
@echo "Build finished."
@echo "To view the help file:"
@echo "# mkdir -p $$HOME/.local/share/devhelp/ReadtheDocsTemplate"
@echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/ReadtheDocsTemplate"
@echo "# devhelp"
epub:
$(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub
@echo
@echo "Build finished. The epub file is in $(BUILDDIR)/epub."
latex:
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
@echo
@echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."
@echo "Run \`make' in that directory to run these through (pdf)latex" \
"(use \`make latexpdf' here to do that automatically)."
latexpdf:
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
@echo "Running LaTeX files through pdflatex..."
$(MAKE) -C $(BUILDDIR)/latex all-pdf
@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
latexpdfja:
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
@echo "Running LaTeX files through platex and dvipdfmx..."
$(MAKE) -C $(BUILDDIR)/latex all-pdf-ja
@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
text:
$(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text
@echo
@echo "Build finished. The text files are in $(BUILDDIR)/text."
man:
$(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man
@echo
@echo "Build finished. The manual pages are in $(BUILDDIR)/man."
texinfo:
$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
@echo
@echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo."
@echo "Run \`make' in that directory to run these through makeinfo" \
"(use \`make info' here to do that automatically)."
info:
$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
@echo "Running Texinfo files through makeinfo..."
make -C $(BUILDDIR)/texinfo info
@echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo."
gettext:
$(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale
@echo
@echo "Build finished. The message catalogs are in $(BUILDDIR)/locale."
changes:
$(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes
@echo
@echo "The overview file is in $(BUILDDIR)/changes."
linkcheck:
$(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
@echo
@echo "Link check complete; look for any errors in the above output " \
"or in $(BUILDDIR)/linkcheck/output.txt."
doctest:
$(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest
@echo "Testing of doctests in the sources finished, look at the " \
"results in $(BUILDDIR)/doctest/output.txt."
xml:
$(SPHINXBUILD) -b xml $(ALLSPHINXOPTS) $(BUILDDIR)/xml
@echo
@echo "Build finished. The XML files are in $(BUILDDIR)/xml."
pseudoxml:
$(SPHINXBUILD) -b pseudoxml $(ALLSPHINXOPTS) $(BUILDDIR)/pseudoxml
@echo
@echo "Build finished. The pseudo-XML files are in $(BUILDDIR)/pseudoxml."

18
docs/README.md Normal file
View File

@@ -0,0 +1,18 @@
### Dependencies
```bash
pip3 install sphinx recommonmark
```
### Syntax
Documentation can be written in [Markdown](https://en.wikipedia.org/wiki/Markdown) (.md) or [Restructured Text](https://en.wikipedia.org/wiki/ReStructuredText) (.rst).
### Build and Test
```bash
cd docs
make html
open _build/html/index.html
```
### Tips
* Generate RST tables [here](https://www.tablesgenerator.com/text_tables#).
* Set your editor's ruler to `100` characters.

13
docs/_static/theme_overrides.css vendored Normal file
View File

@@ -0,0 +1,13 @@
/* override table width restrictions */
@media screen and (min-width: 767px) {
.wy-table-responsive table td {
/* !important prevents the common CSS stylesheets from overriding
this as on RTD they are loaded after this stylesheet */
white-space: normal !important;
}
.wy-table-responsive {
overflow: visible !important;
}
}

View File

@@ -0,0 +1,3 @@
###############################
Audits
###############################

View File

@@ -0,0 +1,3 @@
###############################
Bounties
###############################

View File

@@ -0,0 +1,3 @@
###############################
Contributing
###############################

View File

@@ -0,0 +1,3 @@
###############################
Aggregation
###############################

View File

@@ -0,0 +1,3 @@
###############################
ERC20 Transformations
###############################

View File

@@ -0,0 +1,3 @@
###############################
Private Liquidity Poools
###############################

View File

@@ -0,0 +1,3 @@
###############################
Request for Quote
###############################

View File

@@ -0,0 +1,3 @@
###############################
VIP Paths
###############################

View File

@@ -0,0 +1,3 @@
###############################
WETH Wrapping
###############################

View File

@@ -0,0 +1,3 @@
###############################
Features
###############################

View File

@@ -0,0 +1,3 @@
###############################
Flash Wallet
###############################

View File

@@ -0,0 +1,3 @@
###############################
Overview
###############################

View File

@@ -0,0 +1,3 @@
###############################
Proxy
###############################

View File

@@ -0,0 +1,3 @@
###############################
Transformers
###############################

View File

@@ -0,0 +1,12 @@
###############################
Allowances
###############################
.. _Allowance Target Address: https://github.com/0xProject/protocol/blob/development/packages/contract-addresses/addresses.json#L40
After the official release, allowances will be set directly on the Exchange V4 Proxy contract.
Presently, while we are in beta, allowances should be set on the `Allowance Target Address`_.
The motivation for eliminating the separate Allowance Target in the official release is
to reduce transaction costs. Depending on the operational overhead for our integrators,
we may support allowances on both the Exchange V4 & the Allowance Target after the officual relase.

3
docs/basics/events.rst Normal file
View File

@@ -0,0 +1,3 @@
###############################
Events
###############################

Some files were not shown because too many files have changed in this diff Show More