aboutsummaryrefslogtreecommitdiffstats
path: root/packages/contracts/src
diff options
context:
space:
mode:
authorGreg Hysen <greg.hysen@gmail.com>2018-04-17 08:33:55 +0800
committerAmir Bandeali <abandeali1@gmail.com>2018-04-21 04:56:18 +0800
commitc19fb1dffcca820e1e82b5baad4b126abda8d112 (patch)
treeb899bd223172aed975e0fc3f5aca9e4b5a17c8bc /packages/contracts/src
parent436a6605fb990d4c7aaea5688aefad73dee4d748 (diff)
downloaddexon-sol-tools-c19fb1dffcca820e1e82b5baad4b126abda8d112.tar
dexon-sol-tools-c19fb1dffcca820e1e82b5baad4b126abda8d112.tar.gz
dexon-sol-tools-c19fb1dffcca820e1e82b5baad4b126abda8d112.tar.bz2
dexon-sol-tools-c19fb1dffcca820e1e82b5baad4b126abda8d112.tar.lz
dexon-sol-tools-c19fb1dffcca820e1e82b5baad4b126abda8d112.tar.xz
dexon-sol-tools-c19fb1dffcca820e1e82b5baad4b126abda8d112.tar.zst
dexon-sol-tools-c19fb1dffcca820e1e82b5baad4b126abda8d112.zip
Removed ERC20 V1 Proxy + TokenTransferProxy
Diffstat (limited to 'packages/contracts/src')
-rw-r--r--packages/contracts/src/contracts/current/protocol/AssetProxyDispatcher/proxies/ERC20Proxy_v1.sol90
-rw-r--r--packages/contracts/src/contracts/current/protocol/Exchange/Exchange.sol1
-rw-r--r--packages/contracts/src/contracts/current/protocol/Exchange/IExchange.sol4
-rw-r--r--packages/contracts/src/contracts/current/protocol/TokenTransferProxy/ITokenTransferProxy.sol72
-rw-r--r--packages/contracts/src/contracts/current/protocol/TokenTransferProxy/TokenTransferProxy.sol115
-rw-r--r--packages/contracts/src/contracts/current/utils/Authorizable/IAuthorizable.sol1
-rw-r--r--packages/contracts/src/utils/artifacts.ts2
-rw-r--r--packages/contracts/src/utils/asset_proxy_utils.ts8
-rw-r--r--packages/contracts/src/utils/types.ts3
9 files changed, 0 insertions, 296 deletions
diff --git a/packages/contracts/src/contracts/current/protocol/AssetProxyDispatcher/proxies/ERC20Proxy_v1.sol b/packages/contracts/src/contracts/current/protocol/AssetProxyDispatcher/proxies/ERC20Proxy_v1.sol
deleted file mode 100644
index 161362edb..000000000
--- a/packages/contracts/src/contracts/current/protocol/AssetProxyDispatcher/proxies/ERC20Proxy_v1.sol
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
-
- Copyright 2018 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.4.21;
-
-import "../IAssetProxy.sol";
-import "../../../utils/LibBytes/LibBytes.sol";
-import "../../../utils/Authorizable/Authorizable.sol";
-import { ITokenTransferProxy as ITokenTransferProxy_v1 } from "../../TokenTransferProxy/ITokenTransferProxy.sol";
-
-contract ERC20Proxy_v1 is
- LibBytes,
- Authorizable,
- IAssetProxy
-{
- ITokenTransferProxy_v1 TRANSFER_PROXY;
-
- /// @dev Contract constructor.
- /// @param tokenTransferProxyContract erc20 token transfer proxy contract.
- function ERC20Proxy_v1(ITokenTransferProxy_v1 tokenTransferProxyContract)
- public
- {
- // TODO: Hardcode this address for production.
- TRANSFER_PROXY = tokenTransferProxyContract;
- }
-
- /// @dev Transfers ERC20 tokens via the v1 TokenTransferProxy. Either succeeds or throws.
- /// @param assetMetadata Byte array encoded for the respective asset proxy.
- /// @param from Address to transfer token from.
- /// @param to Address to transfer token to.
- /// @param amount Amount of token to transfer.
- function transferFrom(
- bytes assetMetadata,
- address from,
- address to,
- uint256 amount)
- external
- onlyAuthorized
- {
- address token = decodeMetadata(assetMetadata);
- bool success = TRANSFER_PROXY.transferFrom(token, from, to, amount);
- require(success == true);
- }
-
- /// @dev Decodes ERC20-encoded byte array.
- /// @param assetMetadata ERC20-encoded byte array.
- /// @return tokenAddress Address of ERC20 token.
- function decodeMetadata(bytes memory assetMetadata)
- public pure
- returns (address tokenAddress)
- {
- require(assetMetadata.length == 21);
- return readAddress(assetMetadata, 1);
- }
-
- /// @dev Encodes ERC20 byte array.
- /// @param assetProxyId Id of the asset proxy.
- /// @param tokenAddress Address of the asset.
- /// @return assetMetadata ERC20-encoded byte.
- function encodeMetadata(
- uint8 assetProxyId,
- address tokenAddress)
- public pure
- returns (bytes memory assetMetadata)
- {
- // 0 is reserved as invalid proxy id
- require(assetProxyId != 0);
-
- // Encode fields into a byte array
- assetMetadata = new bytes(21);
- assetMetadata[0] = byte(assetProxyId);
- writeAddress(assetMetadata, 1, tokenAddress);
- return assetMetadata;
- }
-}
diff --git a/packages/contracts/src/contracts/current/protocol/Exchange/Exchange.sol b/packages/contracts/src/contracts/current/protocol/Exchange/Exchange.sol
index 9abc19b86..91136b29f 100644
--- a/packages/contracts/src/contracts/current/protocol/Exchange/Exchange.sol
+++ b/packages/contracts/src/contracts/current/protocol/Exchange/Exchange.sol
@@ -24,7 +24,6 @@ import "./MixinSignatureValidator.sol";
import "./MixinSettlementProxy.sol";
import "./MixinWrapperFunctions.sol";
import "../AssetProxyDispatcher/IAssetProxyDispatcher.sol";
-import "../TokenTransferProxy/ITokenTransferProxy.sol";
contract Exchange is
MixinExchangeCore,
diff --git a/packages/contracts/src/contracts/current/protocol/Exchange/IExchange.sol b/packages/contracts/src/contracts/current/protocol/Exchange/IExchange.sol
index 083966425..3af51e915 100644
--- a/packages/contracts/src/contracts/current/protocol/Exchange/IExchange.sol
+++ b/packages/contracts/src/contracts/current/protocol/Exchange/IExchange.sol
@@ -58,10 +58,6 @@ contract IExchange {
public view
returns (address);
- function TOKEN_TRANSFER_PROXY_CONTRACT()
- public view
- returns (address);
-
function EXTERNAL_QUERY_GAS_LIMIT()
public view
returns (uint16);
diff --git a/packages/contracts/src/contracts/current/protocol/TokenTransferProxy/ITokenTransferProxy.sol b/packages/contracts/src/contracts/current/protocol/TokenTransferProxy/ITokenTransferProxy.sol
deleted file mode 100644
index 456f7065b..000000000
--- a/packages/contracts/src/contracts/current/protocol/TokenTransferProxy/ITokenTransferProxy.sol
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
-
- Copyright 2018 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.4.21;
-
-import { IOwnable_v1 as IOwnable } from "../../../previous/Ownable/IOwnable_v1.sol";
-
-/// @title TokenTransferProxy - Transfers tokens on behalf of contracts that have been approved via decentralized governance.
-/// @author Amir Bandeali - <amir@0xProject.com>, Will Warren - <will@0xProject.com>
-contract ITokenTransferProxy is IOwnable {
-
- function authorized(address addr)
- public view
- returns (bool);
-
- function authorities(uint256 index)
- public view
- returns (address);
-
- /// @dev Gets all authorized addresses.
- /// @return Array of authorized addresses.
- function getAuthorizedAddresses()
- public view
- returns (address[]);
-
- /// @dev Authorizes an address.
- /// @param target Address to authorize.
- function addAuthorizedAddress(address target)
- public;
-
- /// @dev Removes authorizion of an address.
- /// @param target Address to remove authorization from.
- function removeAuthorizedAddress(address target)
- public;
-
- /// @dev Calls into ERC20 Token contract, invoking transferFrom.
- /// @param token Address of token to transfer.
- /// @param from Address to transfer token from.
- /// @param to Address to transfer token to.
- /// @param value Amount of token to transfer.
- /// @return Success of transfer.
- function transferFrom(
- address token,
- address from,
- address to,
- uint value)
- public
- returns (bool);
-
- event LogAuthorizedAddressAdded(
- address indexed target,
- address indexed caller);
-
- event LogAuthorizedAddressRemoved(
- address indexed target,
- address indexed caller);
-}
diff --git a/packages/contracts/src/contracts/current/protocol/TokenTransferProxy/TokenTransferProxy.sol b/packages/contracts/src/contracts/current/protocol/TokenTransferProxy/TokenTransferProxy.sol
deleted file mode 100644
index 6c4d5fbcf..000000000
--- a/packages/contracts/src/contracts/current/protocol/TokenTransferProxy/TokenTransferProxy.sol
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
-
- Copyright 2018 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.4.11;
-
-import { Token_v1 as Token } from "../../../previous/Token/Token_v1.sol";
-import { Ownable_v1 as Ownable } from "../../../previous/Ownable/Ownable_v1.sol";
-
-/// @title TokenTransferProxy - Transfers tokens on behalf of contracts that have been approved via decentralized governance.
-/// @author Amir Bandeali - <amir@0xProject.com>, Will Warren - <will@0xProject.com>
-contract TokenTransferProxy is Ownable {
-
- /// @dev Only authorized addresses can invoke functions with this modifier.
- modifier onlyAuthorized {
- require(authorized[msg.sender]);
- _;
- }
-
- modifier targetAuthorized(address target) {
- require(authorized[target]);
- _;
- }
-
- modifier targetNotAuthorized(address target) {
- require(!authorized[target]);
- _;
- }
-
- mapping (address => bool) public authorized;
- address[] public authorities;
-
- event LogAuthorizedAddressAdded(address indexed target, address indexed caller);
- event LogAuthorizedAddressRemoved(address indexed target, address indexed caller);
-
- /*
- * Public functions
- */
-
- /// @dev Authorizes an address.
- /// @param target Address to authorize.
- function addAuthorizedAddress(address target)
- public
- onlyOwner
- targetNotAuthorized(target)
- {
- authorized[target] = true;
- authorities.push(target);
- LogAuthorizedAddressAdded(target, msg.sender);
- }
-
- /// @dev Removes authorizion of an address.
- /// @param target Address to remove authorization from.
- function removeAuthorizedAddress(address target)
- public
- onlyOwner
- targetAuthorized(target)
- {
- delete authorized[target];
- for (uint i = 0; i < authorities.length; i++) {
- if (authorities[i] == target) {
- authorities[i] = authorities[authorities.length - 1];
- authorities.length -= 1;
- break;
- }
- }
- LogAuthorizedAddressRemoved(target, msg.sender);
- }
-
- /// @dev Calls into ERC20 Token contract, invoking transferFrom.
- /// @param token Address of token to transfer.
- /// @param from Address to transfer token from.
- /// @param to Address to transfer token to.
- /// @param value Amount of token to transfer.
- /// @return Success of transfer.
- function transferFrom(
- address token,
- address from,
- address to,
- uint value)
- public
- onlyAuthorized
- returns (bool)
- {
- return Token(token).transferFrom(from, to, value);
- }
-
- /*
- * Public constant functions
- */
-
- /// @dev Gets all authorized addresses.
- /// @return Array of authorized addresses.
- function getAuthorizedAddresses()
- public
- constant
- returns (address[])
- {
- return authorities;
- }
-}
diff --git a/packages/contracts/src/contracts/current/utils/Authorizable/IAuthorizable.sol b/packages/contracts/src/contracts/current/utils/Authorizable/IAuthorizable.sol
index 1fdea562c..10c01c6fe 100644
--- a/packages/contracts/src/contracts/current/utils/Authorizable/IAuthorizable.sol
+++ b/packages/contracts/src/contracts/current/utils/Authorizable/IAuthorizable.sol
@@ -18,7 +18,6 @@
pragma solidity ^0.4.21;
-/// @title TokenTransferProxy - Transfers tokens on behalf of contracts that have been approved via decentralized governance.
contract IAuthorizable {
/// @dev Gets all authorized addresses.
diff --git a/packages/contracts/src/utils/artifacts.ts b/packages/contracts/src/utils/artifacts.ts
index fd9380d1d..87cc73cff 100644
--- a/packages/contracts/src/utils/artifacts.ts
+++ b/packages/contracts/src/utils/artifacts.ts
@@ -5,7 +5,6 @@ import * as MultiSigWalletWithTimeLockArtifact from '../artifacts/MultiSigWallet
import * as MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddressArtifact from '../artifacts/MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddress.json';
import * as TokenArtifact from '../artifacts/Token.json';
import * as TokenRegistryArtifact from '../artifacts/TokenRegistry.json';
-import * as TokenTransferProxyArtifact from '../artifacts/TokenTransferProxy.json';
import * as EtherTokenArtifact from '../artifacts/WETH9.json';
import * as ZRXArtifact from '../artifacts/ZRXToken.json';
@@ -19,7 +18,6 @@ export const artifacts = {
EtherTokenArtifact: (EtherTokenArtifact as any) as Artifact,
TokenRegistryArtifact: (TokenRegistryArtifact as any) as Artifact,
MaliciousTokenArtifact: (MaliciousTokenArtifact as any) as Artifact,
- TokenTransferProxyArtifact: (TokenTransferProxyArtifact as any) as Artifact,
MultiSigWalletWithTimeLockArtifact: (MultiSigWalletWithTimeLockArtifact as any) as Artifact,
MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddressArtifact: (MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddressArtifact as any) as Artifact,
};
diff --git a/packages/contracts/src/utils/asset_proxy_utils.ts b/packages/contracts/src/utils/asset_proxy_utils.ts
index 8c14b2847..da610cbcc 100644
--- a/packages/contracts/src/utils/asset_proxy_utils.ts
+++ b/packages/contracts/src/utils/asset_proxy_utils.ts
@@ -22,14 +22,6 @@ export function encodeUint256(value: BigNumber): Buffer {
return encodedValue;
}
-export function encodeERC20V1ProxyData(tokenAddress: string): string {
- const encodedAssetProxyId = encodeAssetProxyId(AssetProxyId.ERC20V1);
- const encodedAddress = encodeAddress(tokenAddress);
- const encodedMetadata = Buffer.concat([encodedAssetProxyId, encodedAddress]);
- const encodedMetadataHex = ethUtil.bufferToHex(encodedMetadata);
- return encodedMetadataHex;
-}
-
export function encodeERC20ProxyData(tokenAddress: string): string {
const encodedAssetProxyId = encodeAssetProxyId(AssetProxyId.ERC20);
const encodedAddress = encodeAddress(tokenAddress);
diff --git a/packages/contracts/src/utils/types.ts b/packages/contracts/src/utils/types.ts
index d692bed61..5bb1a36d4 100644
--- a/packages/contracts/src/utils/types.ts
+++ b/packages/contracts/src/utils/types.ts
@@ -39,7 +39,6 @@ export interface CancelOrdersBefore {
export enum AssetProxyId {
INVALID,
- ERC20V1,
ERC20,
ERC721,
}
@@ -97,7 +96,6 @@ export enum ExchangeContractErrs {
}
export enum ContractName {
- TokenTransferProxy = 'TokenTransferProxy',
TokenRegistry = 'TokenRegistry',
MultiSigWalletWithTimeLock = 'MultiSigWalletWithTimeLock',
Exchange = 'Exchange',
@@ -111,7 +109,6 @@ export enum ContractName {
Arbitrage = 'Arbitrage',
AssetProxyDispatcher = 'AssetProxyDispatcher',
ERC20Proxy = 'ERC20Proxy',
- ERC20V1Proxy = 'ERC20Proxy_v1',
ERC721Proxy = 'ERC721Proxy',
DummyERC721Token = 'DummyERC721Token',
}