From 120ca5b1ec4c0bbda2cbbf684a4d535c9b3c1bab Mon Sep 17 00:00:00 2001 From: Amir Bandeali Date: Sat, 21 Apr 2018 16:12:39 -0700 Subject: Rename DummyToken => DummyERC20Token --- .../test/DummyERC20Token/DummyERC20Token.sol | 55 ++++++++++++++++++++++ .../current/test/DummyToken/DummyToken.sol | 55 ---------------------- .../current/test/MaliciousToken/MaliciousToken.sol | 49 ------------------- .../contracts/current/test/Mintable/Mintable.sol | 2 +- packages/contracts/src/utils/artifacts.ts | 6 +-- packages/contracts/src/utils/balances.ts | 6 +-- packages/contracts/src/utils/types.ts | 3 +- 7 files changed, 62 insertions(+), 114 deletions(-) create mode 100644 packages/contracts/src/contracts/current/test/DummyERC20Token/DummyERC20Token.sol delete mode 100644 packages/contracts/src/contracts/current/test/DummyToken/DummyToken.sol delete mode 100644 packages/contracts/src/contracts/current/test/MaliciousToken/MaliciousToken.sol (limited to 'packages/contracts/src') diff --git a/packages/contracts/src/contracts/current/test/DummyERC20Token/DummyERC20Token.sol b/packages/contracts/src/contracts/current/test/DummyERC20Token/DummyERC20Token.sol new file mode 100644 index 000000000..2626399c2 --- /dev/null +++ b/packages/contracts/src/contracts/current/test/DummyERC20Token/DummyERC20Token.sol @@ -0,0 +1,55 @@ +/* + + 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 "../Mintable/Mintable.sol"; +import "../../utils/Ownable/Ownable.sol"; + +contract DummyERC20Token is Mintable, Ownable { + string public name; + string public symbol; + uint256 public decimals; + + function DummyERC20Token( + string _name, + string _symbol, + uint256 _decimals, + uint256 _totalSupply) + public + { + name = _name; + symbol = _symbol; + decimals = _decimals; + totalSupply = _totalSupply; + balances[msg.sender] = _totalSupply; + } + + function setBalance(address _target, uint256 _value) + public + onlyOwner + { + uint256 currBalance = balanceOf(_target); + if (_value < currBalance) { + totalSupply = safeSub(totalSupply, safeSub(currBalance, _value)); + } else { + totalSupply = safeAdd(totalSupply, safeSub(_value, currBalance)); + } + balances[_target] = _value; + } +} diff --git a/packages/contracts/src/contracts/current/test/DummyToken/DummyToken.sol b/packages/contracts/src/contracts/current/test/DummyToken/DummyToken.sol deleted file mode 100644 index 8b29da919..000000000 --- a/packages/contracts/src/contracts/current/test/DummyToken/DummyToken.sol +++ /dev/null @@ -1,55 +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 "../Mintable/Mintable.sol"; -import "../../utils/Ownable/Ownable.sol"; - -contract DummyToken is Mintable, Ownable { - string public name; - string public symbol; - uint public decimals; - - function DummyToken( - string _name, - string _symbol, - uint _decimals, - uint _totalSupply) - public - { - name = _name; - symbol = _symbol; - decimals = _decimals; - totalSupply = _totalSupply; - balances[msg.sender] = _totalSupply; - } - - function setBalance(address _target, uint _value) - public - onlyOwner - { - uint currBalance = balanceOf(_target); - if (_value < currBalance) { - totalSupply = safeSub(totalSupply, safeSub(currBalance, _value)); - } else { - totalSupply = safeAdd(totalSupply, safeSub(_value, currBalance)); - } - balances[_target] = _value; - } -} diff --git a/packages/contracts/src/contracts/current/test/MaliciousToken/MaliciousToken.sol b/packages/contracts/src/contracts/current/test/MaliciousToken/MaliciousToken.sol deleted file mode 100644 index 3a0092276..000000000 --- a/packages/contracts/src/contracts/current/test/MaliciousToken/MaliciousToken.sol +++ /dev/null @@ -1,49 +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 "../../tokens/ERC20Token/ERC20Token.sol"; - -contract MaliciousToken is ERC20Token { - uint8 stateToUpdate = 1; // Not null so that change only requires 5000 gas - - function updateState() - internal - { - stateToUpdate++; - } - - function balanceOf(address _owner) - public - constant - returns (uint) - { - updateState(); - return balances[_owner]; - } - - function allowance(address _owner, address _spender) - public - constant - returns (uint) - { - updateState(); - return allowed[_owner][_spender]; - } -} diff --git a/packages/contracts/src/contracts/current/test/Mintable/Mintable.sol b/packages/contracts/src/contracts/current/test/Mintable/Mintable.sol index 81cbd39dd..305737b72 100644 --- a/packages/contracts/src/contracts/current/test/Mintable/Mintable.sol +++ b/packages/contracts/src/contracts/current/test/Mintable/Mintable.sol @@ -26,7 +26,7 @@ import "../../utils/SafeMath/SafeMath.sol"; * Base contract that creates a mintable UnlimitedAllowanceToken */ contract Mintable is UnlimitedAllowanceToken, SafeMath { - function mint(uint _value) + function mint(uint256 _value) public { require(_value <= 100000000000000000000); diff --git a/packages/contracts/src/utils/artifacts.ts b/packages/contracts/src/utils/artifacts.ts index 87cc73cff..db52ef0d8 100644 --- a/packages/contracts/src/utils/artifacts.ts +++ b/packages/contracts/src/utils/artifacts.ts @@ -1,6 +1,5 @@ -import * as DummyTokenArtifact from '../artifacts/DummyToken.json'; +import * as DummyERC20TokenArtifact from '../artifacts/DummyERC20Token.json'; import * as ExchangeArtifact from '../artifacts/Exchange.json'; -import * as MaliciousTokenArtifact from '../artifacts/MaliciousToken.json'; import * as MultiSigWalletWithTimeLockArtifact from '../artifacts/MultiSigWalletWithTimeLock.json'; import * as MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddressArtifact from '../artifacts/MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddress.json'; import * as TokenArtifact from '../artifacts/Token.json'; @@ -12,12 +11,11 @@ import { Artifact } from './types'; export const artifacts = { ZRXArtifact: (ZRXArtifact as any) as Artifact, - DummyTokenArtifact: (DummyTokenArtifact as any) as Artifact, + DummyERC20TokenArtifact: (DummyERC20TokenArtifact as any) as Artifact, TokenArtifact: (TokenArtifact as any) as Artifact, ExchangeArtifact: (ExchangeArtifact as any) as Artifact, EtherTokenArtifact: (EtherTokenArtifact as any) as Artifact, TokenRegistryArtifact: (TokenRegistryArtifact as any) as Artifact, - MaliciousTokenArtifact: (MaliciousTokenArtifact as any) as Artifact, MultiSigWalletWithTimeLockArtifact: (MultiSigWalletWithTimeLockArtifact as any) as Artifact, MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddressArtifact: (MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddressArtifact as any) as Artifact, }; diff --git a/packages/contracts/src/utils/balances.ts b/packages/contracts/src/utils/balances.ts index 2ebc10313..40a59e815 100644 --- a/packages/contracts/src/utils/balances.ts +++ b/packages/contracts/src/utils/balances.ts @@ -2,14 +2,14 @@ import { BigNumber } from '@0xproject/utils'; import * as _ from 'lodash'; import * as Web3 from 'web3'; -import { DummyTokenContract } from '../contract_wrappers/generated/dummy_token'; +import { DummyERC20TokenContract } from '../contract_wrappers/generated/dummy_e_r_c20_token'; import { BalancesByOwner } from './types'; export class Balances { - private _tokenContractInstances: DummyTokenContract[]; + private _tokenContractInstances: DummyERC20TokenContract[]; private _ownerAddresses: string[]; - constructor(tokenContractInstances: DummyTokenContract[], ownerAddresses: string[]) { + constructor(tokenContractInstances: DummyERC20TokenContract[], ownerAddresses: string[]) { this._tokenContractInstances = tokenContractInstances; this._ownerAddresses = ownerAddresses; } diff --git a/packages/contracts/src/utils/types.ts b/packages/contracts/src/utils/types.ts index 7de167f27..69792b846 100644 --- a/packages/contracts/src/utils/types.ts +++ b/packages/contracts/src/utils/types.ts @@ -100,10 +100,9 @@ export enum ContractName { MultiSigWalletWithTimeLock = 'MultiSigWalletWithTimeLock', Exchange = 'Exchange', ZRXToken = 'ZRXToken', - DummyToken = 'DummyToken', + DummyERC20Token = 'DummyERC20Token', EtherToken = 'WETH9', MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddress = 'MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddress', - MaliciousToken = 'MaliciousToken', AccountLevels = 'AccountLevels', EtherDelta = 'EtherDelta', Arbitrage = 'Arbitrage', -- cgit v1.2.3