Remove HasNoEther, HasNoTokens, HasNoContracts, and NoOwner (#1254)
* remove HasNoEther, HasNoTokens, HasNoContracts, and NoOwner * remove unused ERC223TokenMock * remove Contactable * remove TokenDestructible * remove DeprecatedERC721 * inline Destructible#destroy in Bounty * remove Destructible
This commit is contained in:
committed by
GitHub
parent
2441fd7d17
commit
bd994a88de
@ -1,22 +0,0 @@
|
||||
pragma solidity ^0.4.24;
|
||||
|
||||
import "./Ownable.sol";
|
||||
|
||||
|
||||
/**
|
||||
* @title Contactable token
|
||||
* @dev Basic version of a contactable contract, allowing the owner to provide a string with their
|
||||
* contact information.
|
||||
*/
|
||||
contract Contactable is Ownable {
|
||||
|
||||
string public contactInformation;
|
||||
|
||||
/**
|
||||
* @dev Allows the owner to set a string with their contact information.
|
||||
* @param _info The contact information to attach to the contract.
|
||||
*/
|
||||
function setContactInformation(string _info) public onlyOwner {
|
||||
contactInformation = _info;
|
||||
}
|
||||
}
|
||||
@ -1,22 +0,0 @@
|
||||
pragma solidity ^0.4.24;
|
||||
|
||||
import "./Ownable.sol";
|
||||
|
||||
|
||||
/**
|
||||
* @title Contracts that should not own Contracts
|
||||
* @author Remco Bloemen <remco@2π.com>
|
||||
* @dev Should contracts (anything Ownable) end up being owned by this contract, it allows the owner
|
||||
* of this contract to reclaim ownership of the contracts.
|
||||
*/
|
||||
contract HasNoContracts is Ownable {
|
||||
|
||||
/**
|
||||
* @dev Reclaim ownership of Ownable contracts
|
||||
* @param _contractAddr The address of the Ownable to be reclaimed.
|
||||
*/
|
||||
function reclaimContract(address _contractAddr) external onlyOwner {
|
||||
Ownable contractInst = Ownable(_contractAddr);
|
||||
contractInst.transferOwnership(owner);
|
||||
}
|
||||
}
|
||||
@ -1,41 +0,0 @@
|
||||
pragma solidity ^0.4.24;
|
||||
|
||||
import "./Ownable.sol";
|
||||
|
||||
|
||||
/**
|
||||
* @title Contracts that should not own Ether
|
||||
* @author Remco Bloemen <remco@2π.com>
|
||||
* @dev This tries to block incoming ether to prevent accidental loss of Ether. Should Ether end up
|
||||
* in the contract, it will allow the owner to reclaim this Ether.
|
||||
* @notice Ether can still be sent to this contract by:
|
||||
* calling functions labeled `payable`
|
||||
* `selfdestruct(contract_address)`
|
||||
* mining directly to the contract address
|
||||
*/
|
||||
contract HasNoEther is Ownable {
|
||||
|
||||
/**
|
||||
* @dev Constructor that rejects incoming Ether
|
||||
* The `payable` flag is added so we can access `msg.value` without compiler warning. If we
|
||||
* leave out payable, then Solidity will allow inheriting contracts to implement a payable
|
||||
* constructor. By doing it this way we prevent a payable constructor from working. Alternatively
|
||||
* we could use assembly to access msg.value.
|
||||
*/
|
||||
constructor() public payable {
|
||||
require(msg.value == 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dev Disallows direct send by setting a default function without the `payable` flag.
|
||||
*/
|
||||
function() external {
|
||||
}
|
||||
|
||||
/**
|
||||
* @dev Transfer all Ether held by the contract to the owner.
|
||||
*/
|
||||
function reclaimEther() external onlyOwner {
|
||||
owner.transfer(address(this).balance);
|
||||
}
|
||||
}
|
||||
@ -1,35 +0,0 @@
|
||||
pragma solidity ^0.4.24;
|
||||
|
||||
import "./CanReclaimToken.sol";
|
||||
|
||||
|
||||
/**
|
||||
* @title Contracts that should not own Tokens
|
||||
* @author Remco Bloemen <remco@2π.com>
|
||||
* @dev This blocks incoming ERC223 tokens to prevent accidental loss of tokens.
|
||||
* Should tokens (any ERC20 compatible) end up in the contract, it allows the
|
||||
* owner to reclaim the tokens.
|
||||
*/
|
||||
contract HasNoTokens is CanReclaimToken {
|
||||
|
||||
/**
|
||||
* @dev Reject all ERC223 compatible tokens
|
||||
* @param _from address The address that is transferring the tokens
|
||||
* @param _value uint256 the amount of the specified token
|
||||
* @param _data Bytes The data passed from the caller.
|
||||
*/
|
||||
function tokenFallback(
|
||||
address _from,
|
||||
uint256 _value,
|
||||
bytes _data
|
||||
)
|
||||
external
|
||||
pure
|
||||
{
|
||||
_from;
|
||||
_value;
|
||||
_data;
|
||||
revert();
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,15 +0,0 @@
|
||||
pragma solidity ^0.4.24;
|
||||
|
||||
import "./HasNoEther.sol";
|
||||
import "./HasNoTokens.sol";
|
||||
import "./HasNoContracts.sol";
|
||||
|
||||
|
||||
/**
|
||||
* @title Base contract for contracts that should not own things.
|
||||
* @author Remco Bloemen <remco@2π.com>
|
||||
* @dev Solves a class of errors where a contract accidentally becomes owner of Ether, Tokens or
|
||||
* Owned contracts. See respective base contracts for details.
|
||||
*/
|
||||
contract NoOwner is HasNoEther, HasNoTokens, HasNoContracts {
|
||||
}
|
||||
Reference in New Issue
Block a user