diff options
author | F. Eugene Aumson <gene@aumson.org> | 2018-09-14 01:56:10 +0800 |
---|---|---|
committer | F. Eugene Aumson <gene@aumson.org> | 2018-09-18 05:49:14 +0800 |
commit | a75981da148c8a300544a559bc01be1770d443cf (patch) | |
tree | 4f6955ae7abf14ad1b6b7d393bf46d4a29e1c4b1 /packages/sol-doc/test/fixtures/contracts | |
parent | d5f964b58e755ccf1e63a61a97da1c161cf22b22 (diff) | |
download | dexon-0x-contracts-a75981da148c8a300544a559bc01be1770d443cf.tar dexon-0x-contracts-a75981da148c8a300544a559bc01be1770d443cf.tar.gz dexon-0x-contracts-a75981da148c8a300544a559bc01be1770d443cf.tar.bz2 dexon-0x-contracts-a75981da148c8a300544a559bc01be1770d443cf.tar.lz dexon-0x-contracts-a75981da148c8a300544a559bc01be1770d443cf.tar.xz dexon-0x-contracts-a75981da148c8a300544a559bc01be1770d443cf.tar.zst dexon-0x-contracts-a75981da148c8a300544a559bc01be1770d443cf.zip |
test w/&w/out devdoc content in contract
Diffstat (limited to 'packages/sol-doc/test/fixtures/contracts')
-rw-r--r-- | packages/sol-doc/test/fixtures/contracts/TokenTransferProxyNoDevdoc.sol | 100 |
1 files changed, 100 insertions, 0 deletions
diff --git a/packages/sol-doc/test/fixtures/contracts/TokenTransferProxyNoDevdoc.sol b/packages/sol-doc/test/fixtures/contracts/TokenTransferProxyNoDevdoc.sol new file mode 100644 index 000000000..cc45a79e9 --- /dev/null +++ b/packages/sol-doc/test/fixtures/contracts/TokenTransferProxyNoDevdoc.sol @@ -0,0 +1,100 @@ +/* + + 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.14; + +import { Ownable } from "zeppelin-solidity/contracts/ownership/Ownable.sol"; +import { ERC20 as Token } from "zeppelin-solidity/contracts/token/ERC20/ERC20.sol"; + +contract TokenTransferProxyNoDevdoc is Ownable { + + 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 + */ + + function addAuthorizedAddress(address target) + public + onlyOwner + targetNotAuthorized(target) + { + authorized[target] = true; + authorities.push(target); + LogAuthorizedAddressAdded(target, msg.sender); + } + + 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); + } + + function transferFrom( + address token, + address from, + address to, + uint value) + public + onlyAuthorized + returns (bool) + { + return Token(token).transferFrom(from, to, value); + } + + /* + * Public constant functions + */ + + function getAuthorizedAddresses() + public + constant + returns (address[]) + { + return authorities; + } +} |