aboutsummaryrefslogtreecommitdiffstats
path: root/packages/contracts/src
diff options
context:
space:
mode:
authorAmir Bandeali <abandeali1@gmail.com>2018-05-05 10:09:01 +0800
committerAmir Bandeali <abandeali1@gmail.com>2018-05-25 06:39:19 +0800
commit22ad9e1e1a0c6d2fa5c1b1249d02ef119ef4517e (patch)
tree3eae13e15b47bae477c56df31c4f690cc935316a /packages/contracts/src
parentcc44f5f75d8a1152be9fd49491a9c194cfa2b285 (diff)
downloaddexon-sol-tools-22ad9e1e1a0c6d2fa5c1b1249d02ef119ef4517e.tar
dexon-sol-tools-22ad9e1e1a0c6d2fa5c1b1249d02ef119ef4517e.tar.gz
dexon-sol-tools-22ad9e1e1a0c6d2fa5c1b1249d02ef119ef4517e.tar.bz2
dexon-sol-tools-22ad9e1e1a0c6d2fa5c1b1249d02ef119ef4517e.tar.lz
dexon-sol-tools-22ad9e1e1a0c6d2fa5c1b1249d02ef119ef4517e.tar.xz
dexon-sol-tools-22ad9e1e1a0c6d2fa5c1b1249d02ef119ef4517e.tar.zst
dexon-sol-tools-22ad9e1e1a0c6d2fa5c1b1249d02ef119ef4517e.zip
Address feedback, rename contract to AssetProxyOwner
Diffstat (limited to 'packages/contracts/src')
-rw-r--r--packages/contracts/src/contracts/current/protocol/AssetProxyOwner/AssetProxyOwner.sol (renamed from packages/contracts/src/contracts/current/multisig/MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddress/MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddress.sol)21
-rw-r--r--packages/contracts/src/utils/artifacts.ts4
-rw-r--r--packages/contracts/src/utils/multi_sig_wrapper.ts7
-rw-r--r--packages/contracts/src/utils/types.ts2
4 files changed, 19 insertions, 15 deletions
diff --git a/packages/contracts/src/contracts/current/multisig/MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddress/MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddress.sol b/packages/contracts/src/contracts/current/protocol/AssetProxyOwner/AssetProxyOwner.sol
index cc5808813..1b0f9c34f 100644
--- a/packages/contracts/src/contracts/current/multisig/MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddress/MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddress.sol
+++ b/packages/contracts/src/contracts/current/protocol/AssetProxyOwner/AssetProxyOwner.sol
@@ -18,16 +18,19 @@
pragma solidity ^0.4.10;
-import "../MultiSigWalletWithTimeLock/MultiSigWalletWithTimeLock.sol";
+import "../../multisig/MultiSigWalletWithTimeLock/MultiSigWalletWithTimeLock.sol";
-contract MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddress is
+contract AssetProxyOwner is
MultiSigWalletWithTimeLock
{
+
event AssetProxyRegistration(address assetProxyContract, bool isRegistered);
// Mapping of AssetProxy contract address => approved to execute removeAuthorizedAddress without time lock.
mapping (address => bool) public isAssetProxyRegistered;
+ bytes4 constant REMOVE_AUTHORIZED_ADDRESS_SELECTOR = bytes4(keccak256("removeAuthorizedAddress(address)"));
+
modifier validRemoveAuthorizedAddressTx(uint256 transactionId) {
Transaction storage tx = transactions[transactionId];
require(isAssetProxyRegistered[tx.destination]);
@@ -35,12 +38,13 @@ contract MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddress is
_;
}
- /// @dev Contract constructor sets initial owners, required number of confirmations, time lock, and tokenTransferProxy address.
+ /// @dev Contract constructor sets initial owners, required number of confirmations,
+ /// time lock, and list of AssetProxy addresses.
/// @param _owners List of initial owners.
/// @param _required Number of required confirmations.
/// @param _secondsTimeLocked Duration needed after a transaction is confirmed and before it becomes executable, in seconds.
/// @param _assetProxyContracts Array of AssetProxy contract addresses.
- function MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddress(
+ function AssetProxyOwner(
address[] memory _owners,
uint256 _required,
uint256 _secondsTimeLocked,
@@ -54,7 +58,8 @@ contract MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddress is
}
}
- /// @dev Sets approval for calling removeAuthorizedAddress on an AssetProxy contract without a timelock.
+ /// @dev Registers or deregisters an AssetProxy to be able to execute
+ /// removeAuthorizedAddress without a timelock.
/// @param assetProxyContract Address of AssetProxy contract.
/// @param isRegistered Status of approval for AssetProxy contract.
function registerAssetProxy(address assetProxyContract, bool isRegistered)
@@ -92,12 +97,14 @@ contract MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddress is
pure
returns (bool)
{
- bytes4 removeAuthorizedAddressSelector = bytes4(keccak256("removeAuthorizedAddress(address)"));
bytes4 first4Bytes = readFirst4(data);
- require(removeAuthorizedAddressSelector == first4Bytes);
+ require(REMOVE_AUTHORIZED_ADDRESS_SELECTOR == first4Bytes);
return true;
}
+ /// @dev Reads the first 4 bytes from a byte array of arbitrary length.
+ /// @param data Byte array to read first 4 bytes from.
+ /// @return First 4 bytes of data.
function readFirst4(bytes memory data)
public
pure
diff --git a/packages/contracts/src/utils/artifacts.ts b/packages/contracts/src/utils/artifacts.ts
index caf5b94fd..fe74ea072 100644
--- a/packages/contracts/src/utils/artifacts.ts
+++ b/packages/contracts/src/utils/artifacts.ts
@@ -1,5 +1,6 @@
import { ContractArtifact } from '@0xproject/sol-compiler';
+import * as AssetProxyOwner from '../artifacts/AssetProxyOwner.json';
import * as DummyERC20Token from '../artifacts/DummyERC20Token.json';
import * as DummyERC721Token from '../artifacts/DummyERC721Token.json';
import * as ERC20Proxy from '../artifacts/ERC20Proxy.json';
@@ -8,7 +9,6 @@ import * as Exchange from '../artifacts/Exchange.json';
import * as MixinAuthorizable from '../artifacts/MixinAuthorizable.json';
import * as MultiSigWallet from '../artifacts/MultiSigWallet.json';
import * as MultiSigWalletWithTimeLock from '../artifacts/MultiSigWalletWithTimeLock.json';
-import * as MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddress from '../artifacts/MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddress.json';
import * as TestAssetProxyDispatcher from '../artifacts/TestAssetProxyDispatcher.json';
import * as TestLibBytes from '../artifacts/TestLibBytes.json';
import * as TestLibs from '../artifacts/TestLibs.json';
@@ -18,6 +18,7 @@ import * as EtherToken from '../artifacts/WETH9.json';
import * as ZRX from '../artifacts/ZRXToken.json';
export const artifacts = {
+ AssetProxyOwner: (AssetProxyOwner as any) as ContractArtifact,
DummyERC20Token: (DummyERC20Token as any) as ContractArtifact,
DummyERC721Token: (DummyERC721Token as any) as ContractArtifact,
ERC20Proxy: (ERC20Proxy as any) as ContractArtifact,
@@ -27,7 +28,6 @@ export const artifacts = {
MixinAuthorizable: (MixinAuthorizable as any) as ContractArtifact,
MultiSigWallet: (MultiSigWallet as any) as ContractArtifact,
MultiSigWalletWithTimeLock: (MultiSigWalletWithTimeLock as any) as ContractArtifact,
- MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddress: (MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddress as any) as ContractArtifact,
TestAssetProxyDispatcher: (TestAssetProxyDispatcher as any) as ContractArtifact,
TestLibBytes: (TestLibBytes as any) as ContractArtifact,
TestLibs: (TestLibs as any) as ContractArtifact,
diff --git a/packages/contracts/src/utils/multi_sig_wrapper.ts b/packages/contracts/src/utils/multi_sig_wrapper.ts
index 9a2b26d77..c33e7bb47 100644
--- a/packages/contracts/src/utils/multi_sig_wrapper.ts
+++ b/packages/contracts/src/utils/multi_sig_wrapper.ts
@@ -3,8 +3,8 @@ import { BigNumber } from '@0xproject/utils';
import * as _ from 'lodash';
import * as Web3 from 'web3';
+import { AssetProxyOwnerContract } from '../contract_wrappers/generated/asset_proxy_owner';
import { MultiSigWalletContract } from '../contract_wrappers/generated/multi_sig_wallet';
-import { MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddressContract } from '../contract_wrappers/generated/multi_sig_wallet_with_time_lock_except_remove_authorized_address';
import { constants } from './constants';
import { LogDecoder } from './log_decoder';
@@ -45,10 +45,7 @@ export class MultiSigWrapper {
from: string,
): Promise<TransactionReceiptWithDecodedLogs> {
const txHash = await (this
- ._multiSig as MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddressContract).executeRemoveAuthorizedAddress.sendTransactionAsync(
- txId,
- { from },
- );
+ ._multiSig as AssetProxyOwnerContract).executeRemoveAuthorizedAddress.sendTransactionAsync(txId, { from });
const tx = await this._getTxWithDecodedMultiSigLogs(txHash);
return tx;
}
diff --git a/packages/contracts/src/utils/types.ts b/packages/contracts/src/utils/types.ts
index ef86b4f38..05cd7ec16 100644
--- a/packages/contracts/src/utils/types.ts
+++ b/packages/contracts/src/utils/types.ts
@@ -99,7 +99,7 @@ export enum ContractName {
ZRXToken = 'ZRXToken',
DummyERC20Token = 'DummyERC20Token',
EtherToken = 'WETH9',
- MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddress = 'MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddress',
+ AssetProxyOwner = 'AssetProxyOwner',
AccountLevels = 'AccountLevels',
EtherDelta = 'EtherDelta',
Arbitrage = 'Arbitrage',