Compare commits
33 Commits
v2.3.0-rc.
...
docs-org
| Author | SHA1 | Date | |
|---|---|---|---|
| 009b0fd69c | |||
| 8b78244019 | |||
| ed69b0b470 | |||
| 7cafa2f78d | |||
| aa878d8b69 | |||
| 5fd011d93e | |||
| 7a2dfd151d | |||
| 894afb9a1a | |||
| 132e442c1f | |||
| d957b880fa | |||
| fd3f2421b7 | |||
| c589256203 | |||
| d95f5e2e50 | |||
| e41daba7b4 | |||
| 96fbe823ff | |||
| ca922c8fed | |||
| ee7ff81728 | |||
| b7b8fa947e | |||
| a289314426 | |||
| 9ab93f8ae4 | |||
| f7ff3e7e67 | |||
| 74ef942bd1 | |||
| b6b2aea212 | |||
| 81d04101ff | |||
| 1292b6abab | |||
| 44590fe0b6 | |||
| 6c2b7c260d | |||
| 835c23d6f7 | |||
| 6782f91425 | |||
| 2d467268e5 | |||
| 31bc231c2c | |||
| 4b2229783d | |||
| ae919629cd |
@ -2,10 +2,11 @@
|
||||
"extends": "default",
|
||||
"rules": {
|
||||
"indent": ["error", 4],
|
||||
|
||||
"func-order": false,
|
||||
"bracket-align": false,
|
||||
"compiler-fixed": false,
|
||||
"no-simple-event-func-name": false,
|
||||
"separate-by-one-line-in-contract": false,
|
||||
"two-lines-top-level-separator": false
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,17 +1,18 @@
|
||||
# Changelog
|
||||
|
||||
## 2.3.0 (unreleased)
|
||||
## 2.3.0 (2019-05-27)
|
||||
|
||||
### New features:
|
||||
* `ERC1820`: added support for interacting with the [ERC1820](https://eips.ethereum.org/EIPS/eip-1820) registry contract (`IERC1820Registry`), as well as base contracts that can be registered as implementers there. ([#1677](https://github.com/OpenZeppelin/openzeppelin-solidity/pull/1677))
|
||||
* `ERC777`: initial support for the [ERC777 token](https://eips.ethereum.org/EIPS/eip-777), which has multiple improvements over `ERC20` such as built-in burning, a more straightforward permission system, and optional sender and receiver hooks on transfer (mandatory for contracts!). ([#1684](https://github.com/OpenZeppelin/openzeppelin-solidity/pull/1684))
|
||||
* `ERC777`: support for the [ERC777 token](https://eips.ethereum.org/EIPS/eip-777), which has multiple improvements over `ERC20` (but is backwards compatible with it) such as built-in burning, a more straightforward permission system, and optional sender and receiver hooks on transfer (mandatory for contracts!). ([#1684](https://github.com/OpenZeppelin/openzeppelin-solidity/pull/1684))
|
||||
* All contracts now have revert reason strings, which give insight into error conditions, and help debug failing transactions. ([#1704](https://github.com/OpenZeppelin/openzeppelin-solidity/pull/1704))
|
||||
|
||||
### Improvements:
|
||||
* Upgraded the minimum compiler version to v0.5.7: this prevents users from encountering compiler bugs that were fixed in this version. ([#1724](https://github.com/OpenZeppelin/openzeppelin-solidity/pull/1724))
|
||||
* Reverted the Solidity version bump done in v2.2.0, setting the minimum compiler version to v0.5.0, to prevent unexpected build breakage. Users are encouraged however to stay on top of new compiler releases, which usually include bugfixes. ([#1729](https://github.com/OpenZeppelin/openzeppelin-solidity/pull/1729))
|
||||
|
||||
### Bugfixes:
|
||||
* `PostDeliveryCrowdsale`: some validations where skipped when paired with other crowdsale flavors, such as `AllowanceCrowdsale`, or `MintableCrowdsale` and `ERC20Capped`, which could cause buyers to not be able to claim their purchased tokens. ([#1721](https://github.com/OpenZeppelin/openzeppelin-solidity/pull/1721))
|
||||
* `ERC20._transfer`: the `from` argument was allowed to be the zero address, so it was possible to internally trigger a transfer of 0 tokens from the zero address. This address is not a valid destinatary of transfers, nor can it give or receive allowance, so this behavior was inconsistent. It now reverts. ([#1752](https://github.com/OpenZeppelin/openzeppelin-solidity/pull/1752))
|
||||
|
||||
## 2.2.0 (2019-03-14)
|
||||
|
||||
|
||||
@ -1,2 +0,0 @@
|
||||
mocks
|
||||
examples
|
||||
@ -5,3 +5,5 @@ sections:
|
||||
- Roles
|
||||
- subdirectory: roles
|
||||
---
|
||||
|
||||
> This page is incomplete. We're working to improve it for the next release. Stay tuned!
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
pragma solidity ^0.5.7;
|
||||
pragma solidity ^0.5.0;
|
||||
|
||||
/**
|
||||
* @title Roles
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
pragma solidity ^0.5.7;
|
||||
pragma solidity ^0.5.0;
|
||||
|
||||
import "../Roles.sol";
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
pragma solidity ^0.5.7;
|
||||
pragma solidity ^0.5.0;
|
||||
|
||||
import "../Roles.sol";
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
pragma solidity ^0.5.7;
|
||||
pragma solidity ^0.5.0;
|
||||
|
||||
import "../Roles.sol";
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
pragma solidity ^0.5.7;
|
||||
pragma solidity ^0.5.0;
|
||||
|
||||
import "../Roles.sol";
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
pragma solidity ^0.5.7;
|
||||
pragma solidity ^0.5.0;
|
||||
|
||||
import "../Roles.sol";
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
pragma solidity ^0.5.7;
|
||||
pragma solidity ^0.5.0;
|
||||
|
||||
import "../Roles.sol";
|
||||
import "./WhitelistAdminRole.sol";
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
pragma solidity ^0.5.7;
|
||||
pragma solidity ^0.5.0;
|
||||
|
||||
import "../token/ERC20/IERC20.sol";
|
||||
import "../math/SafeMath.sol";
|
||||
|
||||
@ -9,3 +9,5 @@ sections:
|
||||
- subdirectory: validation
|
||||
- subdirectory: distribution
|
||||
---
|
||||
|
||||
> This page is incomplete. We're working to improve it for the next release. Stay tuned!
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
pragma solidity ^0.5.7;
|
||||
pragma solidity ^0.5.0;
|
||||
|
||||
import "../../math/SafeMath.sol";
|
||||
import "../validation/TimedCrowdsale.sol";
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
pragma solidity ^0.5.7;
|
||||
pragma solidity ^0.5.0;
|
||||
|
||||
import "../validation/TimedCrowdsale.sol";
|
||||
import "../../math/SafeMath.sol";
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
pragma solidity ^0.5.7;
|
||||
pragma solidity ^0.5.0;
|
||||
|
||||
import "../../math/SafeMath.sol";
|
||||
import "./FinalizableCrowdsale.sol";
|
||||
@ -6,10 +6,10 @@ import "../../payment/escrow/RefundEscrow.sol";
|
||||
|
||||
/**
|
||||
* @title RefundableCrowdsale
|
||||
* @dev Extension of FinalizableCrowdsale contract that adds a funding goal, and the possibility of users
|
||||
* @dev Extension of `FinalizableCrowdsale` contract that adds a funding goal, and the possibility of users
|
||||
* getting a refund if goal is not met.
|
||||
*
|
||||
* Deprecated, use RefundablePostDeliveryCrowdsale instead. Note that if you allow tokens to be traded before the goal
|
||||
* Deprecated, use `RefundablePostDeliveryCrowdsale` instead. Note that if you allow tokens to be traded before the goal
|
||||
* is met, then an attack is possible in which the attacker purchases tokens from the crowdsale and when they sees that
|
||||
* the goal is unlikely to be met, they sell their tokens (possibly at a discount). The attacker will be refunded when
|
||||
* the crowdsale is finalized, and the users that purchased from them will be left with worthless tokens.
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
pragma solidity ^0.5.7;
|
||||
pragma solidity ^0.5.0;
|
||||
|
||||
import "./RefundableCrowdsale.sol";
|
||||
import "./PostDeliveryCrowdsale.sol";
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
pragma solidity ^0.5.7;
|
||||
pragma solidity ^0.5.0;
|
||||
|
||||
import "../Crowdsale.sol";
|
||||
import "../../token/ERC20/IERC20.sol";
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
pragma solidity ^0.5.7;
|
||||
pragma solidity ^0.5.0;
|
||||
|
||||
import "../Crowdsale.sol";
|
||||
import "../../token/ERC20/ERC20Mintable.sol";
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
pragma solidity ^0.5.7;
|
||||
pragma solidity ^0.5.0;
|
||||
|
||||
import "../validation/TimedCrowdsale.sol";
|
||||
import "../../math/SafeMath.sol";
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
pragma solidity ^0.5.7;
|
||||
pragma solidity ^0.5.0;
|
||||
|
||||
import "../../math/SafeMath.sol";
|
||||
import "../Crowdsale.sol";
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
pragma solidity ^0.5.7;
|
||||
pragma solidity ^0.5.0;
|
||||
|
||||
import "../../math/SafeMath.sol";
|
||||
import "../Crowdsale.sol";
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
pragma solidity ^0.5.7;
|
||||
pragma solidity ^0.5.0;
|
||||
|
||||
import "../Crowdsale.sol";
|
||||
import "../../lifecycle/Pausable.sol";
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
pragma solidity ^0.5.7;
|
||||
pragma solidity ^0.5.0;
|
||||
|
||||
import "../../math/SafeMath.sol";
|
||||
import "../Crowdsale.sol";
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
pragma solidity ^0.5.7;
|
||||
pragma solidity ^0.5.0;
|
||||
import "../Crowdsale.sol";
|
||||
import "../../access/roles/WhitelistedRole.sol";
|
||||
|
||||
|
||||
@ -1,17 +1,29 @@
|
||||
pragma solidity ^0.5.7;
|
||||
pragma solidity ^0.5.0;
|
||||
|
||||
/**
|
||||
* @title Elliptic curve signature operations
|
||||
* @dev Based on https://gist.github.com/axic/5b33912c6f61ae6fd96d6c4a47afde6d
|
||||
* TODO Remove this library once solidity supports passing a signature to ecrecover.
|
||||
* See https://github.com/ethereum/solidity/issues/864
|
||||
* @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.
|
||||
*
|
||||
* These functions can be used to verify that a message was signed by the holder
|
||||
* of the private keys of a given address.
|
||||
*/
|
||||
|
||||
library ECDSA {
|
||||
/**
|
||||
* @dev Recover signer address from a message by using their signature.
|
||||
* @param hash bytes32 message, the hash is the signed message. What is recovered is the signer address.
|
||||
* @param signature bytes signature, the signature is generated using web3.eth.sign()
|
||||
* @dev Returns the address that signed a hashed message (`hash`) with
|
||||
* `signature`. This address can then be used for verification purposes.
|
||||
*
|
||||
* The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:
|
||||
* this function rejects them by requiring the `s` value to be in the lower
|
||||
* half order, and the `v` value to be either 27 or 28.
|
||||
*
|
||||
* (.note) This call _does not revert_ if the signature is invalid, or
|
||||
* if the signer is otherwise unable to be retrieved. In those scenarios,
|
||||
* the zero address is returned.
|
||||
*
|
||||
* (.warning) `hash` _must_ be the result of a hash operation for the
|
||||
* verification to be secure: it is possible to craft signatures that
|
||||
* recover to arbitrary addresses for non-hashed data. A safe way to ensure
|
||||
* this is by receiving a hash of the original message (which may otherwise)
|
||||
* be too long), and then calling `toEthSignedMessageHash` on it.
|
||||
*/
|
||||
function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {
|
||||
// Check the signature length
|
||||
@ -55,9 +67,12 @@ library ECDSA {
|
||||
}
|
||||
|
||||
/**
|
||||
* toEthSignedMessageHash
|
||||
* @dev Prefix a bytes32 value with "\x19Ethereum Signed Message:"
|
||||
* and hash the result.
|
||||
* @dev Returns an Ethereum Signed Message, created from a `hash`. This
|
||||
* replicates the behavior of the
|
||||
* [`eth_sign`](https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_sign)
|
||||
* JSON-RPC method.
|
||||
*
|
||||
* See `recover`.
|
||||
*/
|
||||
function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) {
|
||||
// 32 is the length in bytes of hash,
|
||||
|
||||
@ -1,17 +1,14 @@
|
||||
pragma solidity ^0.5.7;
|
||||
pragma solidity ^0.5.0;
|
||||
|
||||
/**
|
||||
* @title MerkleProof
|
||||
* @dev Merkle proof verification based on
|
||||
* https://github.com/ameensol/merkle-tree-solidity/blob/master/src/MerkleProof.sol
|
||||
* @dev These functions deal with verification of Merkle trees (hash trees),
|
||||
*/
|
||||
library MerkleProof {
|
||||
/**
|
||||
* @dev Verifies a Merkle proof proving the existence of a leaf in a Merkle tree. Assumes that each pair of leaves
|
||||
* and each pair of pre-images are sorted.
|
||||
* @param proof Merkle proof containing sibling hashes on the branch from the leaf to the root of the Merkle tree
|
||||
* @param root Merkle root
|
||||
* @param leaf Leaf of Merkle tree
|
||||
* @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree
|
||||
* defined by `root`. For this, a `proof` must be provided, containing
|
||||
* sibling hashes on the branch from the leaf to the root of the tree. Each
|
||||
* pair of leaves and each pair of pre-images are assumed to be sorted.
|
||||
*/
|
||||
function verify(bytes32[] memory proof, bytes32 root, bytes32 leaf) internal pure returns (bool) {
|
||||
bytes32 computedHash = leaf;
|
||||
|
||||
9
contracts/cryptography/README.md
Normal file
9
contracts/cryptography/README.md
Normal file
@ -0,0 +1,9 @@
|
||||
---
|
||||
sections:
|
||||
- title: Libraries
|
||||
contracts:
|
||||
- ECDSA
|
||||
- MerkleProof
|
||||
---
|
||||
|
||||
This collection of libraries provides simple and safe ways to use different cryptographic primitives.
|
||||
@ -1,4 +1,4 @@
|
||||
pragma solidity ^0.5.7;
|
||||
pragma solidity ^0.5.0;
|
||||
|
||||
import "../math/SafeMath.sol";
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
pragma solidity ^0.5.7;
|
||||
pragma solidity ^0.5.0;
|
||||
|
||||
import "../../token/ERC20/IERC20.sol";
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
pragma solidity ^0.5.7;
|
||||
pragma solidity ^0.5.0;
|
||||
|
||||
import "../token/ERC20/IERC20.sol";
|
||||
import "../token/ERC20/ERC20Mintable.sol";
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
pragma solidity ^0.5.7;
|
||||
pragma solidity ^0.5.0;
|
||||
|
||||
import "../math/SafeMath.sol";
|
||||
import "../utils/Arrays.sol";
|
||||
|
||||
@ -1,357 +0,0 @@
|
||||
pragma solidity ^0.5.7;
|
||||
|
||||
import "./IERC777.sol";
|
||||
import "./IERC777Recipient.sol";
|
||||
import "./IERC777Sender.sol";
|
||||
import "../../math/SafeMath.sol";
|
||||
import "../../utils/Address.sol";
|
||||
import "../IERC1820Registry.sol";
|
||||
|
||||
/**
|
||||
* @title ERC777 token implementation
|
||||
* @author etsvigun <utgarda@gmail.com>, Bertrand Masius <github@catageeks.tk>
|
||||
*/
|
||||
contract ERC777 is IERC777 {
|
||||
using SafeMath for uint256;
|
||||
using Address for address;
|
||||
|
||||
IERC1820Registry private _erc1820 = IERC1820Registry(0x1820a4B7618BdE71Dce8cdc73aAB6C95905faD24);
|
||||
|
||||
string private _name;
|
||||
|
||||
string private _symbol;
|
||||
|
||||
mapping(address => uint256) private _balances;
|
||||
|
||||
uint256 private _totalSupply;
|
||||
|
||||
uint256 private _granularity;
|
||||
|
||||
bytes32 constant private TOKENS_SENDER_INTERFACE_HASH = keccak256("ERC777TokensSender");
|
||||
bytes32 constant private TOKENS_RECIPIENT_INTERFACE_HASH = keccak256("ERC777TokensRecipient");
|
||||
|
||||
// This isn't ever read from - it's only used to respond to the defaultOperators query.
|
||||
address[] private _defaultOperatorsArray;
|
||||
|
||||
// Immutable, but accounts may revoke them (tracked in __revokedDefaultOperators).
|
||||
mapping(address => bool) private _defaultOperators;
|
||||
|
||||
// For each account, a mapping of its operators and revoked default operators.
|
||||
mapping(address => mapping(address => bool)) private _operators;
|
||||
mapping(address => mapping(address => bool)) private _revokedDefaultOperators;
|
||||
|
||||
constructor(
|
||||
string memory name,
|
||||
string memory symbol,
|
||||
uint256 granularity,
|
||||
address[] memory defaultOperators
|
||||
) public {
|
||||
require(granularity > 0);
|
||||
|
||||
_name = name;
|
||||
_symbol = symbol;
|
||||
_granularity = granularity;
|
||||
|
||||
_defaultOperatorsArray = defaultOperators;
|
||||
for (uint256 i = 0; i < _defaultOperatorsArray.length; i++) {
|
||||
_defaultOperators[_defaultOperatorsArray[i]] = true;
|
||||
}
|
||||
|
||||
// register interface
|
||||
_erc1820.setInterfaceImplementer(address(this), keccak256("ERC777Token"), address(this));
|
||||
}
|
||||
|
||||
/**
|
||||
* @dev Send the amount of tokens from the address msg.sender to the address to
|
||||
* @param to address recipient address
|
||||
* @param amount uint256 amount of tokens to transfer
|
||||
* @param data bytes information attached to the send, and intended for the recipient (to)
|
||||
*/
|
||||
function send(address to, uint256 amount, bytes calldata data) external {
|
||||
_send(msg.sender, msg.sender, to, amount, data, "");
|
||||
}
|
||||
|
||||
/**
|
||||
* @dev Send the amount of tokens on behalf of the address from to the address to
|
||||
* @param from address token holder address.
|
||||
* @param to address recipient address
|
||||
* @param amount uint256 amount of tokens to transfer
|
||||
* @param data bytes information attached to the send, and intended for the recipient (to)
|
||||
* @param operatorData bytes extra information provided by the operator (if any)
|
||||
*/
|
||||
function operatorSend(
|
||||
address from,
|
||||
address to,
|
||||
uint256 amount,
|
||||
bytes calldata data,
|
||||
bytes calldata operatorData
|
||||
)
|
||||
external
|
||||
{
|
||||
require(isOperatorFor(msg.sender, from));
|
||||
_send(msg.sender, from, to, amount, data, operatorData);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dev Burn the amount of tokens from the address msg.sender
|
||||
* @param amount uint256 amount of tokens to transfer
|
||||
* @param data bytes extra information provided by the token holder
|
||||
*/
|
||||
function burn(uint256 amount, bytes calldata data) external {
|
||||
_burn(msg.sender, msg.sender, amount, data, "");
|
||||
}
|
||||
|
||||
/**
|
||||
* @dev Burn the amount of tokens on behalf of the address from
|
||||
* @param from address token holder address.
|
||||
* @param amount uint256 amount of tokens to transfer
|
||||
* @param data bytes extra information provided by the token holder
|
||||
* @param operatorData bytes extra information provided by the operator (if any)
|
||||
*/
|
||||
function operatorBurn(address from, uint256 amount, bytes calldata data, bytes calldata operatorData) external {
|
||||
require(isOperatorFor(msg.sender, from));
|
||||
_burn(msg.sender, from, amount, data, operatorData);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dev Authorize an operator for the sender
|
||||
* @param operator address to be authorized as operator
|
||||
*/
|
||||
function authorizeOperator(address operator) external {
|
||||
require(msg.sender != operator);
|
||||
|
||||
if (_defaultOperators[operator]) {
|
||||
delete _revokedDefaultOperators[msg.sender][operator];
|
||||
} else {
|
||||
_operators[msg.sender][operator] = true;
|
||||
}
|
||||
|
||||
emit AuthorizedOperator(operator, msg.sender);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dev Revoke operator rights from one of the default operators
|
||||
* @param operator address to revoke operator rights from
|
||||
*/
|
||||
function revokeOperator(address operator) external {
|
||||
require(operator != msg.sender);
|
||||
|
||||
if (_defaultOperators[operator]) {
|
||||
_revokedDefaultOperators[msg.sender][operator] = true;
|
||||
} else {
|
||||
delete _operators[msg.sender][operator];
|
||||
}
|
||||
|
||||
emit RevokedOperator(operator, msg.sender);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the name of the token.
|
||||
*/
|
||||
function name() public view returns (string memory) {
|
||||
return _name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the symbol of the token.
|
||||
*/
|
||||
function symbol() public view returns (string memory) {
|
||||
return _symbol;
|
||||
}
|
||||
|
||||
/**
|
||||
* @dev Total number of tokens in existence
|
||||
*/
|
||||
function totalSupply() public view returns (uint256) {
|
||||
return _totalSupply;
|
||||
}
|
||||
|
||||
/**
|
||||
* @dev Gets the balance of the specified address.
|
||||
* @param tokenHolder The address to query the balance of.
|
||||
* @return uint256 representing the amount owned by the specified address.
|
||||
*/
|
||||
function balanceOf(address tokenHolder) public view returns (uint256) {
|
||||
return _balances[tokenHolder];
|
||||
}
|
||||
|
||||
/**
|
||||
* @dev Gets the token's granularity,
|
||||
* i.e. the smallest number of tokens (in the basic unit)
|
||||
* which may be minted, sent or burned at any time
|
||||
* @return uint256 granularity
|
||||
*/
|
||||
function granularity() public view returns (uint256) {
|
||||
return _granularity;
|
||||
}
|
||||
|
||||
/**
|
||||
* @dev Get the list of default operators as defined by the token contract.
|
||||
* @return address[] default operators
|
||||
*/
|
||||
function defaultOperators() public view returns (address[] memory) {
|
||||
return _defaultOperatorsArray;
|
||||
}
|
||||
|
||||
/**
|
||||
* @dev Indicate whether an address
|
||||
* is an operator of the tokenHolder address
|
||||
* @param operator address which may be an operator of tokenHolder
|
||||
* @param tokenHolder address of a token holder which may have the operator
|
||||
* address as an operator.
|
||||
*/
|
||||
function isOperatorFor(
|
||||
address operator,
|
||||
address tokenHolder
|
||||
) public view returns (bool) {
|
||||
return operator == tokenHolder ||
|
||||
(_defaultOperators[operator] && !_revokedDefaultOperators[tokenHolder][operator]) ||
|
||||
_operators[tokenHolder][operator];
|
||||
}
|
||||
|
||||
/**
|
||||
* @dev Mint tokens. Does not check authorization of operator
|
||||
* @dev the caller may ckeck that operator is authorized before calling
|
||||
* @param operator address operator requesting the operation
|
||||
* @param to address token recipient address
|
||||
* @param amount uint256 amount of tokens to mint
|
||||
* @param userData bytes extra information defined by the token recipient (if any)
|
||||
* @param operatorData bytes extra information provided by the operator (if any)
|
||||
*/
|
||||
function _mint(
|
||||
address operator,
|
||||
address to,
|
||||
uint256 amount,
|
||||
bytes memory userData,
|
||||
bytes memory operatorData
|
||||
)
|
||||
internal
|
||||
{
|
||||
require(to != address(0));
|
||||
require((amount % _granularity) == 0);
|
||||
|
||||
// Update state variables
|
||||
_totalSupply = _totalSupply.add(amount);
|
||||
_balances[to] = _balances[to].add(amount);
|
||||
|
||||
_callTokensReceived(operator, address(0), to, amount, userData, operatorData);
|
||||
|
||||
emit Minted(operator, to, amount, userData, operatorData);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dev Send tokens
|
||||
* @param operator address operator requesting the transfer
|
||||
* @param from address token holder address
|
||||
* @param to address recipient address
|
||||
* @param amount uint256 amount of tokens to transfer
|
||||
* @param userData bytes extra information provided by the token holder (if any)
|
||||
* @param operatorData bytes extra information provided by the operator (if any)
|
||||
*/
|
||||
function _send(
|
||||
address operator,
|
||||
address from,
|
||||
address to,
|
||||
uint256 amount,
|
||||
bytes memory userData,
|
||||
bytes memory operatorData
|
||||
)
|
||||
private
|
||||
{
|
||||
require(from != address(0));
|
||||
require(to != address(0));
|
||||
require((amount % _granularity) == 0);
|
||||
|
||||
_callTokensToSend(operator, from, to, amount, userData, operatorData);
|
||||
|
||||
// Update state variables
|
||||
_balances[from] = _balances[from].sub(amount);
|
||||
_balances[to] = _balances[to].add(amount);
|
||||
|
||||
_callTokensReceived(operator, from, to, amount, userData, operatorData);
|
||||
|
||||
emit Sent(operator, from, to, amount, userData, operatorData);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dev Burn tokens
|
||||
* @param operator address operator requesting the operation
|
||||
* @param from address token holder address
|
||||
* @param amount uint256 amount of tokens to burn
|
||||
* @param data bytes extra information provided by the token holder
|
||||
* @param operatorData bytes extra information provided by the operator (if any)
|
||||
*/
|
||||
function _burn(
|
||||
address operator,
|
||||
address from,
|
||||
uint256 amount,
|
||||
bytes memory data,
|
||||
bytes memory operatorData
|
||||
)
|
||||
private
|
||||
{
|
||||
require(from != address(0));
|
||||
require((amount % _granularity) == 0);
|
||||
|
||||
_callTokensToSend(operator, from, address(0), amount, data, operatorData);
|
||||
|
||||
// Update state variables
|
||||
_totalSupply = _totalSupply.sub(amount);
|
||||
_balances[from] = _balances[from].sub(amount);
|
||||
|
||||
emit Burned(operator, from, amount, data, operatorData);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dev Call from.tokensToSend() if the interface is registered
|
||||
* @param operator address operator requesting the transfer
|
||||
* @param from address token holder address
|
||||
* @param to address recipient address
|
||||
* @param amount uint256 amount of tokens to transfer
|
||||
* @param userData bytes extra information provided by the token holder (if any)
|
||||
* @param operatorData bytes extra information provided by the operator (if any)
|
||||
*/
|
||||
function _callTokensToSend(
|
||||
address operator,
|
||||
address from,
|
||||
address to,
|
||||
uint256 amount,
|
||||
bytes memory userData,
|
||||
bytes memory operatorData
|
||||
)
|
||||
private
|
||||
{
|
||||
address implementer = _erc1820.getInterfaceImplementer(from, TOKENS_SENDER_INTERFACE_HASH);
|
||||
if (implementer != address(0)) {
|
||||
IERC777Sender(implementer).tokensToSend(operator, from, to, amount, userData, operatorData);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @dev Call to.tokensReceived() if the interface is registered. Reverts if the recipient is a contract but
|
||||
* tokensReceived() was not registered for the recipient
|
||||
* @param operator address operator requesting the transfer
|
||||
* @param from address token holder address
|
||||
* @param to address recipient address
|
||||
* @param amount uint256 amount of tokens to transfer
|
||||
* @param userData bytes extra information provided by the token holder (if any)
|
||||
* @param operatorData bytes extra information provided by the operator (if any)
|
||||
*/
|
||||
function _callTokensReceived(
|
||||
address operator,
|
||||
address from,
|
||||
address to,
|
||||
uint256 amount,
|
||||
bytes memory userData,
|
||||
bytes memory operatorData
|
||||
)
|
||||
private
|
||||
{
|
||||
address implementer = _erc1820.getInterfaceImplementer(to, TOKENS_RECIPIENT_INTERFACE_HASH);
|
||||
if (implementer != address(0)) {
|
||||
IERC777Recipient(implementer).tokensReceived(operator, from, to, amount, userData, operatorData);
|
||||
} else {
|
||||
require(!to.isContract());
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,61 +0,0 @@
|
||||
pragma solidity ^0.5.7;
|
||||
|
||||
/**
|
||||
* @title ERC777 token interface
|
||||
* @dev See https://eips.ethereum.org/EIPS/eip-777
|
||||
*/
|
||||
interface IERC777 {
|
||||
function authorizeOperator(address operator) external;
|
||||
|
||||
function revokeOperator(address operator) external;
|
||||
|
||||
function send(address to, uint256 amount, bytes calldata data) external;
|
||||
|
||||
function operatorSend(
|
||||
address from,
|
||||
address to,
|
||||
uint256 amount,
|
||||
bytes calldata data,
|
||||
bytes calldata operatorData
|
||||
) external;
|
||||
|
||||
function burn(uint256 amount, bytes calldata data) external;
|
||||
|
||||
function operatorBurn(
|
||||
address from,
|
||||
uint256 amount,
|
||||
bytes calldata data,
|
||||
bytes calldata operatorData
|
||||
) external;
|
||||
|
||||
function name() external view returns (string memory);
|
||||
|
||||
function symbol() external view returns (string memory);
|
||||
|
||||
function totalSupply() external view returns (uint256);
|
||||
|
||||
function balanceOf(address owner) external view returns (uint256);
|
||||
|
||||
function granularity() external view returns (uint256);
|
||||
|
||||
function defaultOperators() external view returns (address[] memory);
|
||||
|
||||
function isOperatorFor(address operator, address tokenHolder) external view returns (bool);
|
||||
|
||||
event Sent(
|
||||
address indexed operator,
|
||||
address indexed from,
|
||||
address indexed to,
|
||||
uint256 amount,
|
||||
bytes data,
|
||||
bytes operatorData
|
||||
);
|
||||
|
||||
event Minted(address indexed operator, address indexed to, uint256 amount, bytes data, bytes operatorData);
|
||||
|
||||
event Burned(address indexed operator, address indexed from, uint256 amount, bytes data, bytes operatorData);
|
||||
|
||||
event AuthorizedOperator(address indexed operator, address indexed tokenHolder);
|
||||
|
||||
event RevokedOperator(address indexed operator, address indexed tokenHolder);
|
||||
}
|
||||
@ -1,16 +0,0 @@
|
||||
pragma solidity ^0.5.7;
|
||||
|
||||
/**
|
||||
* @title ERC777 token recipient interface
|
||||
* @dev See https://eips.ethereum.org/EIPS/eip-777
|
||||
*/
|
||||
interface IERC777Recipient {
|
||||
function tokensReceived(
|
||||
address operator,
|
||||
address from,
|
||||
address to,
|
||||
uint amount,
|
||||
bytes calldata userData,
|
||||
bytes calldata operatorData
|
||||
) external;
|
||||
}
|
||||
@ -1,16 +0,0 @@
|
||||
pragma solidity ^0.5.7;
|
||||
|
||||
/**
|
||||
* @title ERC777 token sender interface
|
||||
* @dev See https://eips.ethereum.org/EIPS/eip-777
|
||||
*/
|
||||
interface IERC777Sender {
|
||||
function tokensToSend(
|
||||
address operator,
|
||||
address from,
|
||||
address to,
|
||||
uint amount,
|
||||
bytes calldata userData,
|
||||
bytes calldata operatorData
|
||||
) external;
|
||||
}
|
||||
@ -1,17 +0,0 @@
|
||||
pragma solidity ^0.5.7;
|
||||
|
||||
/**
|
||||
* @title IERC1820Implementer
|
||||
* Interface for contracts that will be registered as implementers in the ERC1820 registry.
|
||||
* @notice For more details, see https://eips.ethereum.org/EIPS/eip-1820
|
||||
*/
|
||||
interface IERC1820Implementer {
|
||||
/**
|
||||
* @notice Indicates whether the contract implements the interface `interfaceHash` for the address `account` or
|
||||
* not.
|
||||
* @param interfaceHash keccak256 hash of the name of the interface
|
||||
* @param account Address for which the contract will implement the interface
|
||||
* @return ERC1820_ACCEPT_MAGIC only if the contract implements `interfaceHash` for the address `account`.
|
||||
*/
|
||||
function canImplementInterfaceForAddress(bytes32 interfaceHash, address account) external view returns (bytes32);
|
||||
}
|
||||
@ -1,90 +0,0 @@
|
||||
pragma solidity ^0.5.7;
|
||||
|
||||
/**
|
||||
* @title ERC1820 Pseudo-introspection Registry Contract
|
||||
* @author Jordi Baylina and Jacques Dafflon
|
||||
* @notice For more details, see https://eips.ethereum.org/EIPS/eip-1820
|
||||
*/
|
||||
interface IERC1820Registry {
|
||||
/**
|
||||
* @notice Sets the contract which implements a specific interface for an address.
|
||||
* Only the manager defined for that address can set it.
|
||||
* (Each address is the manager for itself until it sets a new manager.)
|
||||
* @param account Address for which to set the interface.
|
||||
* (If 'account' is the zero address then 'msg.sender' is assumed.)
|
||||
* @param interfaceHash Keccak256 hash of the name of the interface as a string.
|
||||
* E.g., 'web3.utils.keccak256("ERC777TokensRecipient")' for the 'ERC777TokensRecipient' interface.
|
||||
* @param implementer Contract address implementing `interfaceHash` for `account.address()`.
|
||||
*/
|
||||
function setInterfaceImplementer(address account, bytes32 interfaceHash, address implementer) external;
|
||||
|
||||
/**
|
||||
* @notice Sets `newManager.address()` as manager for `account.address()`.
|
||||
* The new manager will be able to call 'setInterfaceImplementer' for `account.address()`.
|
||||
* @param account Address for which to set the new manager.
|
||||
* @param newManager Address of the new manager for `addr.address()`.
|
||||
* (Pass '0x0' to reset the manager to `account.address()`.)
|
||||
*/
|
||||
function setManager(address account, address newManager) external;
|
||||
|
||||
/**
|
||||
* @notice Updates the cache with whether the contract implements an ERC165 interface or not.
|
||||
* @param account Address of the contract for which to update the cache.
|
||||
* @param interfaceId ERC165 interface for which to update the cache.
|
||||
*/
|
||||
function updateERC165Cache(address account, bytes4 interfaceId) external;
|
||||
|
||||
/**
|
||||
* @notice Get the manager of an address.
|
||||
* @param account Address for which to return the manager.
|
||||
* @return Address of the manager for a given address.
|
||||
*/
|
||||
function getManager(address account) external view returns (address);
|
||||
|
||||
/**
|
||||
* @notice Query if an address implements an interface and through which contract.
|
||||
* @param account Address being queried for the implementer of an interface.
|
||||
* (If 'account' is the zero address then 'msg.sender' is assumed.)
|
||||
* @param interfaceHash Keccak256 hash of the name of the interface as a string.
|
||||
* E.g., 'web3.utils.keccak256("ERC777TokensRecipient")' for the 'ERC777TokensRecipient' interface.
|
||||
* @return The address of the contract which implements the interface `interfaceHash` for `account.address()`
|
||||
* or '0' if `account.address()` did not register an implementer for this interface.
|
||||
*/
|
||||
function getInterfaceImplementer(address account, bytes32 interfaceHash) external view returns (address);
|
||||
|
||||
/**
|
||||
* @notice Checks whether a contract implements an ERC165 interface or not.
|
||||
* If the result is not cached a direct lookup on the contract address is performed.
|
||||
* If the result is not cached or the cached value is out-of-date, the cache MUST be updated manually by calling
|
||||
* 'updateERC165Cache' with the contract address.
|
||||
* @param account Address of the contract to check.
|
||||
* @param interfaceId ERC165 interface to check.
|
||||
* @return True if `account.address()` implements `interfaceId`, false otherwise.
|
||||
*/
|
||||
function implementsERC165Interface(address account, bytes4 interfaceId) external view returns (bool);
|
||||
|
||||
/**
|
||||
* @notice Checks whether a contract implements an ERC165 interface or not without using nor updating the cache.
|
||||
* @param account Address of the contract to check.
|
||||
* @param interfaceId ERC165 interface to check.
|
||||
* @return True if `account.address()` implements `interfaceId`, false otherwise.
|
||||
*/
|
||||
function implementsERC165InterfaceNoCache(address account, bytes4 interfaceId) external view returns (bool);
|
||||
|
||||
/**
|
||||
* @notice Compute the keccak256 hash of an interface given its name.
|
||||
* @param interfaceName Name of the interface.
|
||||
* @return The keccak256 hash of an interface name.
|
||||
*/
|
||||
function interfaceHash(string calldata interfaceName) external pure returns (bytes32);
|
||||
|
||||
/**
|
||||
* @notice Indicates a contract is the `implementer` of `interfaceHash` for `account`.
|
||||
*/
|
||||
event InterfaceImplementerSet(address indexed account, bytes32 indexed interfaceHash, address indexed implementer);
|
||||
|
||||
/**
|
||||
* @notice Indicates `newManager` is the address of the new manager for `account`.
|
||||
*/
|
||||
event ManagerChanged(address indexed account, address indexed newManager);
|
||||
}
|
||||
16
contracts/drafts/README.md
Normal file
16
contracts/drafts/README.md
Normal file
@ -0,0 +1,16 @@
|
||||
---
|
||||
sections:
|
||||
- title: ERC 20
|
||||
contracts:
|
||||
- ERC20Migrator
|
||||
- ERC20Snapshot
|
||||
- TokenVesting
|
||||
- title: Miscellenous
|
||||
contracts:
|
||||
- Counters
|
||||
- SignatureBouncer
|
||||
- SignedSafeMath
|
||||
- subdirectory: ERC1046
|
||||
---
|
||||
|
||||
> This page is incomplete. We're working to improve it for the next release. Stay tuned!
|
||||
@ -1,4 +1,4 @@
|
||||
pragma solidity ^0.5.7;
|
||||
pragma solidity ^0.5.0;
|
||||
|
||||
import "../access/roles/SignerRole.sol";
|
||||
import "../cryptography/ECDSA.sol";
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
pragma solidity ^0.5.7;
|
||||
pragma solidity ^0.5.0;
|
||||
|
||||
/**
|
||||
* @title SignedSafeMath
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
pragma solidity ^0.5.7;
|
||||
pragma solidity ^0.5.0;
|
||||
|
||||
import "../token/ERC20/SafeERC20.sol";
|
||||
import "../ownership/Ownable.sol";
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
pragma solidity ^0.5.7;
|
||||
pragma solidity ^0.5.0;
|
||||
|
||||
import "../crowdsale/validation/CappedCrowdsale.sol";
|
||||
import "../crowdsale/distribution/RefundableCrowdsale.sol";
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
pragma solidity ^0.5.7;
|
||||
pragma solidity ^0.5.0;
|
||||
|
||||
import "../token/ERC20/ERC20.sol";
|
||||
import "../token/ERC20/ERC20Detailed.sol";
|
||||
|
||||
@ -1,11 +1,12 @@
|
||||
pragma solidity ^0.5.7;
|
||||
pragma solidity ^0.5.0;
|
||||
|
||||
import "./IERC165.sol";
|
||||
|
||||
/**
|
||||
* @title ERC165
|
||||
* @author Matt Condon (@shrugs)
|
||||
* @dev Implements ERC165 using a lookup table.
|
||||
* @dev Implementation of the `IERC165` interface.
|
||||
*
|
||||
* Contracts may inherit from this and call `_registerInterface` to declare
|
||||
* their support of an interface.
|
||||
*/
|
||||
contract ERC165 is IERC165 {
|
||||
/*
|
||||
@ -18,23 +19,31 @@ contract ERC165 is IERC165 {
|
||||
*/
|
||||
mapping(bytes4 => bool) private _supportedInterfaces;
|
||||
|
||||
/**
|
||||
* @dev A contract implementing SupportsInterfaceWithLookup
|
||||
* implements ERC165 itself.
|
||||
*/
|
||||
constructor () internal {
|
||||
// Derived contracts need only register support for their own interfaces,
|
||||
// we register support for ERC165 itself here
|
||||
_registerInterface(_INTERFACE_ID_ERC165);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dev Implement supportsInterface(bytes4) using a lookup table.
|
||||
* @dev See `IERC165.supportsInterface`.
|
||||
*
|
||||
* Time complexity O(1), guaranteed to always use less than 30 000 gas.
|
||||
*/
|
||||
function supportsInterface(bytes4 interfaceId) external view returns (bool) {
|
||||
return _supportedInterfaces[interfaceId];
|
||||
}
|
||||
|
||||
/**
|
||||
* @dev Internal method for registering an interface.
|
||||
* @dev Registers the contract as an implementer of the interface defined by
|
||||
* `interfaceId`. Support of the actual ERC165 interface is automatic and
|
||||
* registering its interface id is not required.
|
||||
*
|
||||
* See `IERC165.supportsInterface`.
|
||||
*
|
||||
* Requirements:
|
||||
*
|
||||
* - `interfaceId` cannot be the ERC165 invalid interface (`0xffffffff`).
|
||||
*/
|
||||
function _registerInterface(bytes4 interfaceId) internal {
|
||||
require(interfaceId != 0xffffffff, "ERC165: invalid interface id");
|
||||
|
||||
@ -1,9 +1,11 @@
|
||||
pragma solidity ^0.5.7;
|
||||
pragma solidity ^0.5.0;
|
||||
|
||||
/**
|
||||
* @title ERC165Checker
|
||||
* @dev Use `using ERC165Checker for address`; to include this library
|
||||
* https://eips.ethereum.org/EIPS/eip-165
|
||||
* @dev Library used to query support of an interface declared via `IERC165`.
|
||||
*
|
||||
* Note that these functions return the actual result of the query: they do not
|
||||
* `revert` if an interface is not supported. It is up to the caller to decide
|
||||
* what to do in these cases.
|
||||
*/
|
||||
library ERC165Checker {
|
||||
// As per the EIP-165 spec, no interface should ever match 0xffffffff
|
||||
@ -15,9 +17,7 @@ library ERC165Checker {
|
||||
bytes4 private constant _INTERFACE_ID_ERC165 = 0x01ffc9a7;
|
||||
|
||||
/**
|
||||
* @notice Query if a contract supports ERC165
|
||||
* @param account The address of the contract to query for support of ERC165
|
||||
* @return true if the contract at account implements ERC165
|
||||
* @dev Returns true if `account` supports the `IERC165` interface,
|
||||
*/
|
||||
function _supportsERC165(address account) internal view returns (bool) {
|
||||
// Any contract that implements ERC165 must explicitly indicate support of
|
||||
@ -27,12 +27,10 @@ library ERC165Checker {
|
||||
}
|
||||
|
||||
/**
|
||||
* @notice Query if a contract implements an interface, also checks support of ERC165
|
||||
* @param account The address of the contract to query for support of an interface
|
||||
* @param interfaceId The interface identifier, as specified in ERC-165
|
||||
* @return true if the contract at account indicates support of the interface with
|
||||
* identifier interfaceId, false otherwise
|
||||
* @dev Interface identification is specified in ERC-165.
|
||||
* @dev Returns true if `account` supports the interface defined by
|
||||
* `interfaceId`. Support for `IERC165` itself is queried automatically.
|
||||
*
|
||||
* See `IERC165.supportsInterface`.
|
||||
*/
|
||||
function _supportsInterface(address account, bytes4 interfaceId) internal view returns (bool) {
|
||||
// query support of both ERC165 as per the spec and support of _interfaceId
|
||||
@ -41,12 +39,13 @@ library ERC165Checker {
|
||||
}
|
||||
|
||||
/**
|
||||
* @notice Query if a contract implements interfaces, also checks support of ERC165
|
||||
* @param account The address of the contract to query for support of an interface
|
||||
* @param interfaceIds A list of interface identifiers, as specified in ERC-165
|
||||
* @return true if the contract at account indicates support all interfaces in the
|
||||
* interfaceIds list, false otherwise
|
||||
* @dev Interface identification is specified in ERC-165.
|
||||
* @dev Returns true if `account` supports all the interfaces defined in
|
||||
* `interfaceIds`. Support for `IERC165` itself is queried automatically.
|
||||
*
|
||||
* Batch-querying can lead to gas savings by skipping repeated checks for
|
||||
* `IERC165` support.
|
||||
*
|
||||
* See `IERC165.supportsInterface`.
|
||||
*/
|
||||
function _supportsAllInterfaces(address account, bytes4[] memory interfaceIds) internal view returns (bool) {
|
||||
// query support of ERC165 itself
|
||||
|
||||
@ -1,23 +1,34 @@
|
||||
pragma solidity ^0.5.7;
|
||||
pragma solidity ^0.5.0;
|
||||
|
||||
import "./IERC1820Implementer.sol";
|
||||
|
||||
/**
|
||||
* @dev ERC1820Implementer allows your contract to implement an interface for another account in the sense of ERC1820.
|
||||
* That account or one of its ERC1820 managers can register the implementer in the ERC1820 registry, but the registry
|
||||
* will first check with the implementer if it agrees to it, and only allow it if it does. Using the internal
|
||||
* function _registerInterfaceForAddress provided by this contract, you are expressing this agreement,
|
||||
* and you will be able to register the contract as an implementer in the registry for that account.
|
||||
* @dev Implementation of the `IERC1820Implementer` interface.
|
||||
*
|
||||
* Contracts may inherit from this and call `_registerInterfaceForAddress` to
|
||||
* declare their willingness to be implementers.
|
||||
* `IERC1820Registry.setInterfaceImplementer` should then be called for the
|
||||
* registration to be complete.
|
||||
*/
|
||||
contract ERC1820Implementer is IERC1820Implementer {
|
||||
bytes32 constant private ERC1820_ACCEPT_MAGIC = keccak256(abi.encodePacked("ERC1820_ACCEPT_MAGIC"));
|
||||
|
||||
mapping(bytes32 => mapping(address => bool)) private _supportedInterfaces;
|
||||
|
||||
/**
|
||||
* See `IERC1820Implementer.canImplementInterfaceForAddress`.
|
||||
*/
|
||||
function canImplementInterfaceForAddress(bytes32 interfaceHash, address account) external view returns (bytes32) {
|
||||
return _supportedInterfaces[interfaceHash][account] ? ERC1820_ACCEPT_MAGIC : bytes32(0x00);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dev Declares the contract as willing to be an implementer of
|
||||
* `interfaceHash` for `account`.
|
||||
*
|
||||
* See `IERC1820Registry.setInterfaceImplementer` and
|
||||
* `IERC1820Registry.interfaceHash`.
|
||||
*/
|
||||
function _registerInterfaceForAddress(bytes32 interfaceHash, address account) internal {
|
||||
_supportedInterfaces[interfaceHash][account] = true;
|
||||
}
|
||||
@ -1,15 +1,22 @@
|
||||
pragma solidity ^0.5.7;
|
||||
pragma solidity ^0.5.0;
|
||||
|
||||
/**
|
||||
* @title IERC165
|
||||
* @dev https://eips.ethereum.org/EIPS/eip-165
|
||||
* @dev Interface of the ERC165 standard, as defined in the
|
||||
* [EIP](https://eips.ethereum.org/EIPS/eip-165).
|
||||
*
|
||||
* Implementers can declare support of contract interfaces, which can then be
|
||||
* queried by others (`ERC165Checker`).
|
||||
*
|
||||
* For an implementation, see `ERC165`.
|
||||
*/
|
||||
interface IERC165 {
|
||||
/**
|
||||
* @notice Query if a contract implements an interface
|
||||
* @param interfaceId The interface identifier, as specified in ERC-165
|
||||
* @dev Interface identification is specified in ERC-165. This function
|
||||
* uses less than 30,000 gas.
|
||||
* @dev Returns true if this contract implements the interface defined by
|
||||
* `interfaceId`. See the corresponding
|
||||
* [EIP section](https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified)
|
||||
* to learn more about how these ids are created.
|
||||
*
|
||||
* This function call must use less than 30 000 gas.
|
||||
*/
|
||||
function supportsInterface(bytes4 interfaceId) external view returns (bool);
|
||||
}
|
||||
|
||||
17
contracts/introspection/IERC1820Implementer.sol
Normal file
17
contracts/introspection/IERC1820Implementer.sol
Normal file
@ -0,0 +1,17 @@
|
||||
pragma solidity ^0.5.0;
|
||||
|
||||
/**
|
||||
* @dev Interface for an ERC1820 implementer, as defined in the
|
||||
* [EIP](https://eips.ethereum.org/EIPS/eip-1820#interface-implementation-erc1820implementerinterface).
|
||||
* Used by contracts that will be registered as implementers in the
|
||||
* `IERC1820Registry`.
|
||||
*/
|
||||
interface IERC1820Implementer {
|
||||
/**
|
||||
* @dev Returns a special value (`ERC1820_ACCEPT_MAGIC`) if this contract
|
||||
* implements `interfaceHash` for `account`.
|
||||
*
|
||||
* See `IERC1820Registry.setInterfaceImplementer`.
|
||||
*/
|
||||
function canImplementInterfaceForAddress(bytes32 interfaceHash, address account) external view returns (bytes32);
|
||||
}
|
||||
109
contracts/introspection/IERC1820Registry.sol
Normal file
109
contracts/introspection/IERC1820Registry.sol
Normal file
@ -0,0 +1,109 @@
|
||||
pragma solidity ^0.5.0;
|
||||
|
||||
/**
|
||||
* @dev Interface of the global ERC1820 Registry, as defined in the
|
||||
* [EIP](https://eips.ethereum.org/EIPS/eip-1820). Accounts may register
|
||||
* implementers for interfaces in this registry, as well as query support.
|
||||
*
|
||||
* Implementers may be shared by multiple accounts, and can also implement more
|
||||
* than a single interface for each account. Contracts can implement interfaces
|
||||
* for themselves, but externally-owned accounts (EOA) must delegate this to a
|
||||
* contract.
|
||||
*
|
||||
* `IERC165` interfaces can also be queried via the registry.
|
||||
*
|
||||
* For an in-depth explanation and source code analysis, see the EIP text.
|
||||
*/
|
||||
interface IERC1820Registry {
|
||||
/**
|
||||
* @dev Sets `newManager` as the manager for `account`. A manager of an
|
||||
* account is able to set interface implementers for it.
|
||||
*
|
||||
* By default, each account is its own manager. Passing a value of `0x0` in
|
||||
* `newManager` will reset the manager to this initial state.
|
||||
*
|
||||
* Emits a `ManagerChanged` event.
|
||||
*
|
||||
* Requirements:
|
||||
*
|
||||
* - the caller must be the current manager for `account`.
|
||||
*/
|
||||
function setManager(address account, address newManager) external;
|
||||
|
||||
/**
|
||||
* @dev Returns the manager for `account`.
|
||||
*
|
||||
* See `setManager`.
|
||||
*/
|
||||
function getManager(address account) external view returns (address);
|
||||
|
||||
/**
|
||||
* @dev Sets the `implementer` contract as `account`'s implementer for
|
||||
* `interfaceHash`.
|
||||
*
|
||||
* `account` being the zero address is an alias for the caller's address.
|
||||
* The zero address can also be used in `implementer` to remove an old one.
|
||||
*
|
||||
* See `interfaceHash` to learn how these are created.
|
||||
*
|
||||
* Emits an `InterfaceImplementerSet` event.
|
||||
*
|
||||
* Requirements:
|
||||
*
|
||||
* - the caller must be the current manager for `account`.
|
||||
* - `interfaceHash` must not be an `IERC165` interface id (i.e. it must not
|
||||
* end in 28 zeroes).
|
||||
* - `implementer` must implement `IERC1820Implementer` and return true when
|
||||
* queried for support, unless `implementer` is the caller. See
|
||||
* `IERC1820Implementer.canImplementInterfaceForAddress`.
|
||||
*/
|
||||
function setInterfaceImplementer(address account, bytes32 interfaceHash, address implementer) external;
|
||||
|
||||
/**
|
||||
* @dev Returns the implementer of `interfaceHash` for `account`. If no such
|
||||
* implementer is registered, returns the zero address.
|
||||
*
|
||||
* If `interfaceHash` is an `IERC165` interface id (i.e. it ends with 28
|
||||
* zeroes), `account` will be queried for support of it.
|
||||
*
|
||||
* `account` being the zero address is an alias for the caller's address.
|
||||
*/
|
||||
function getInterfaceImplementer(address account, bytes32 interfaceHash) external view returns (address);
|
||||
|
||||
/**
|
||||
* @dev Returns the interface hash for an `interfaceName`, as defined in the
|
||||
* corresponding
|
||||
* [section of the EIP](https://eips.ethereum.org/EIPS/eip-1820#interface-name).
|
||||
*/
|
||||
function interfaceHash(string calldata interfaceName) external pure returns (bytes32);
|
||||
|
||||
/**
|
||||
* @notice Updates the cache with whether the contract implements an ERC165 interface or not.
|
||||
* @param account Address of the contract for which to update the cache.
|
||||
* @param interfaceId ERC165 interface for which to update the cache.
|
||||
*/
|
||||
function updateERC165Cache(address account, bytes4 interfaceId) external;
|
||||
|
||||
/**
|
||||
* @notice Checks whether a contract implements an ERC165 interface or not.
|
||||
* If the result is not cached a direct lookup on the contract address is performed.
|
||||
* If the result is not cached or the cached value is out-of-date, the cache MUST be updated manually by calling
|
||||
* 'updateERC165Cache' with the contract address.
|
||||
* @param account Address of the contract to check.
|
||||
* @param interfaceId ERC165 interface to check.
|
||||
* @return True if `account.address()` implements `interfaceId`, false otherwise.
|
||||
*/
|
||||
function implementsERC165Interface(address account, bytes4 interfaceId) external view returns (bool);
|
||||
|
||||
/**
|
||||
* @notice Checks whether a contract implements an ERC165 interface or not without using nor updating the cache.
|
||||
* @param account Address of the contract to check.
|
||||
* @param interfaceId ERC165 interface to check.
|
||||
* @return True if `account.address()` implements `interfaceId`, false otherwise.
|
||||
*/
|
||||
function implementsERC165InterfaceNoCache(address account, bytes4 interfaceId) external view returns (bool);
|
||||
|
||||
event InterfaceImplementerSet(address indexed account, bytes32 indexed interfaceHash, address indexed implementer);
|
||||
|
||||
event ManagerChanged(address indexed account, address indexed newManager);
|
||||
}
|
||||
23
contracts/introspection/README.md
Normal file
23
contracts/introspection/README.md
Normal file
@ -0,0 +1,23 @@
|
||||
---
|
||||
sections:
|
||||
- title: Local
|
||||
contracts:
|
||||
- IERC165
|
||||
- ERC165
|
||||
- ERC165Checker
|
||||
- title: Global
|
||||
contracts:
|
||||
- IERC1820Registry
|
||||
- IERC1820Implementer
|
||||
- ERC1820Implementer
|
||||
---
|
||||
|
||||
This set of interfaces and contracts deal with [type introspection](https://en.wikipedia.org/wiki/Type_introspection) of contracts, that is, examining which functions can be called on them. This is usually referred to as a contract's _interface_.
|
||||
|
||||
Ethereum contracts have no native concept of an interface, so applications must usually simply trust they are not making an incorrect call. For trusted setups this is a non-issue, but often unknown and untrusted third-party addresses need to be interacted with. There may even not be any direct calls to them! (e.g. `ERC20` tokens may be sent to a contract that lacks a way to transfer them out of it, locking them forever). In these cases, a contract _declaring_ its interface can be very helpful in preventing errors.
|
||||
|
||||
There are two main ways to approach this.
|
||||
- Locally, where a contract implements `IERC165` and declares an interface, and a second one queries it directly via `ERC165Checker`.
|
||||
- Globally, where a global and unique registry (`IERC1820Registry`) is used to register implementers of a certain interface (`IERC1820Implementer`). It is then the registry that is queried, which allows for more complex setups, like contracts implementing interfaces for externally-owned accounts.
|
||||
|
||||
Note that, in all cases, accounts simply _declare_ their interfaces, but they are not required to actually implement them. This mechanism can therefore be used to both prevent errors and allow for complex interactions (see `ERC777`), but it must not be relied on for security.
|
||||
@ -1,23 +1,39 @@
|
||||
pragma solidity ^0.5.7;
|
||||
pragma solidity ^0.5.0;
|
||||
|
||||
import "../access/roles/PauserRole.sol";
|
||||
|
||||
/**
|
||||
* @title Pausable
|
||||
* @dev Base contract which allows children to implement an emergency stop mechanism.
|
||||
* @dev Contract module which allows children to implement an emergency stop
|
||||
* mechanism that can be triggered by an authorized account.
|
||||
*
|
||||
* This module is used through inheritance. It will make available the
|
||||
* modifiers `whenNotPaused` and `whenPaused`, which can be applied to
|
||||
* the functions of your contract. Note that they will not be pausable by
|
||||
* simply including this module, only once the modifiers are put in place.
|
||||
*/
|
||||
contract Pausable is PauserRole {
|
||||
/**
|
||||
* @dev Emitted when the pause is triggered by a pauser (`account`).
|
||||
*/
|
||||
event Paused(address account);
|
||||
|
||||
/**
|
||||
* @dev Emitted when the pause is lifted by a pauser (`account`).
|
||||
*/
|
||||
event Unpaused(address account);
|
||||
|
||||
bool private _paused;
|
||||
|
||||
/**
|
||||
* @dev Initializes the contract in unpaused state. Assigns the Pauser role
|
||||
* to the deployer.
|
||||
*/
|
||||
constructor () internal {
|
||||
_paused = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return True if the contract is paused, false otherwise.
|
||||
* @dev Returns true if the contract is paused, and false otherwise.
|
||||
*/
|
||||
function paused() public view returns (bool) {
|
||||
return _paused;
|
||||
|
||||
@ -1,8 +1,7 @@
|
||||
pragma solidity ^0.5.7;
|
||||
pragma solidity ^0.5.0;
|
||||
|
||||
/**
|
||||
* @title Math
|
||||
* @dev Assorted math operations.
|
||||
* @dev Standard math utilities missing in the Solidity language.
|
||||
*/
|
||||
library Math {
|
||||
/**
|
||||
@ -20,9 +19,8 @@ library Math {
|
||||
}
|
||||
|
||||
/**
|
||||
* @dev Calculates the average of two numbers. Since these are integers,
|
||||
* averages of an even and odd number cannot be represented, and will be
|
||||
* rounded down.
|
||||
* @dev Returns the average of two numbers. The result is rounded towards
|
||||
* zero.
|
||||
*/
|
||||
function average(uint256 a, uint256 b) internal pure returns (uint256) {
|
||||
// (a + b) / 2 can overflow, so we distribute
|
||||
|
||||
10
contracts/math/README.md
Normal file
10
contracts/math/README.md
Normal file
@ -0,0 +1,10 @@
|
||||
---
|
||||
title: Math
|
||||
sections:
|
||||
- title: Libraries
|
||||
contracts:
|
||||
- SafeMath
|
||||
- Math
|
||||
---
|
||||
|
||||
These are math-related utilities.
|
||||
@ -1,12 +1,59 @@
|
||||
pragma solidity ^0.5.7;
|
||||
pragma solidity ^0.5.0;
|
||||
|
||||
/**
|
||||
* @title SafeMath
|
||||
* @dev Unsigned math operations with safety checks that revert on error.
|
||||
* @dev Wrappers over Solidity's arithmetic operations with added overflow
|
||||
* checks.
|
||||
*
|
||||
* Arithmetic operations in Solidity wrap on overflow. This can easily result
|
||||
* in bugs, because programmers usually assume that an overflow raises an
|
||||
* error, which is the standard behavior in high level programming languages.
|
||||
* `SafeMath` restores this intuition by reverting the transaction when an
|
||||
* operation overflows.
|
||||
*
|
||||
* Using this library instead of the unchecked operations eliminates an entire
|
||||
* class of bugs, so it's recommended to use it always.
|
||||
*/
|
||||
library SafeMath {
|
||||
/**
|
||||
* @dev Multiplies two unsigned integers, reverts on overflow.
|
||||
* @dev Returns the addition of two unsigned integers, reverting on
|
||||
* overflow.
|
||||
*
|
||||
* Counterpart to Solidity's `+` operator.
|
||||
*
|
||||
* Requirements:
|
||||
* - Addition cannot overflow.
|
||||
*/
|
||||
function add(uint256 a, uint256 b) internal pure returns (uint256) {
|
||||
uint256 c = a + b;
|
||||
require(c >= a, "SafeMath: addition overflow");
|
||||
|
||||
return c;
|
||||
}
|
||||
|
||||
/**
|
||||
* @dev Returns the subtraction of two unsigned integers, reverting on
|
||||
* overflow (when the result is negative).
|
||||
*
|
||||
* Counterpart to Solidity's `-` operator.
|
||||
*
|
||||
* Requirements:
|
||||
* - Subtraction cannot overflow.
|
||||
*/
|
||||
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
|
||||
require(b <= a, "SafeMath: subtraction overflow");
|
||||
uint256 c = a - b;
|
||||
|
||||
return c;
|
||||
}
|
||||
|
||||
/**
|
||||
* @dev Returns the multiplication of two unsigned integers, reverting on
|
||||
* overflow.
|
||||
*
|
||||
* Counterpart to Solidity's `*` operator.
|
||||
*
|
||||
* Requirements:
|
||||
* - Multiplication cannot overflow.
|
||||
*/
|
||||
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
|
||||
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
|
||||
@ -23,7 +70,15 @@ library SafeMath {
|
||||
}
|
||||
|
||||
/**
|
||||
* @dev Integer division of two unsigned integers truncating the quotient, reverts on division by zero.
|
||||
* @dev Returns the integer division of two unsigned integers. Reverts on
|
||||
* division by zero. The result is rounded towards zero.
|
||||
*
|
||||
* Counterpart to Solidity's `/` operator. Note: this function uses a
|
||||
* `revert` opcode (which leaves remaining gas untouched) while Solidity
|
||||
* uses an invalid opcode to revert (consuming all remaining gas).
|
||||
*
|
||||
* Requirements:
|
||||
* - The divisor cannot be zero.
|
||||
*/
|
||||
function div(uint256 a, uint256 b) internal pure returns (uint256) {
|
||||
// Solidity only automatically asserts when dividing by 0
|
||||
@ -35,28 +90,15 @@ library SafeMath {
|
||||
}
|
||||
|
||||
/**
|
||||
* @dev Subtracts two unsigned integers, reverts on overflow (i.e. if subtrahend is greater than minuend).
|
||||
*/
|
||||
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
|
||||
require(b <= a, "SafeMath: subtraction overflow");
|
||||
uint256 c = a - b;
|
||||
|
||||
return c;
|
||||
}
|
||||
|
||||
/**
|
||||
* @dev Adds two unsigned integers, reverts on overflow.
|
||||
*/
|
||||
function add(uint256 a, uint256 b) internal pure returns (uint256) {
|
||||
uint256 c = a + b;
|
||||
require(c >= a, "SafeMath: addition overflow");
|
||||
|
||||
return c;
|
||||
}
|
||||
|
||||
/**
|
||||
* @dev Divides two unsigned integers and returns the remainder (unsigned integer modulo),
|
||||
* reverts when dividing by zero.
|
||||
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
|
||||
* Reverts when dividing by zero.
|
||||
*
|
||||
* Counterpart to Solidity's `%` operator. This function uses a `revert`
|
||||
* opcode (which leaves remaining gas untouched) while Solidity uses an
|
||||
* invalid opcode to revert (consuming all remaining gas).
|
||||
*
|
||||
* Requirements:
|
||||
* - The divisor cannot be zero.
|
||||
*/
|
||||
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
|
||||
require(b != 0, "SafeMath: modulo by zero");
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
pragma solidity ^0.5.7;
|
||||
pragma solidity ^0.5.0;
|
||||
|
||||
import "../utils/Address.sol";
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
pragma solidity ^0.5.7;
|
||||
pragma solidity ^0.5.0;
|
||||
|
||||
import "../token/ERC20/IERC20.sol";
|
||||
import "../crowdsale/emission/AllowanceCrowdsale.sol";
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
pragma solidity ^0.5.7;
|
||||
pragma solidity ^0.5.0;
|
||||
|
||||
import "../utils/Arrays.sol";
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
pragma solidity ^0.5.7;
|
||||
pragma solidity ^0.5.0;
|
||||
|
||||
import "../token/ERC20/IERC20.sol";
|
||||
import "../crowdsale/validation/CappedCrowdsale.sol";
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
pragma solidity ^0.5.7;
|
||||
pragma solidity ^0.5.0;
|
||||
|
||||
import "../access/roles/CapperRole.sol";
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
pragma solidity ^0.5.7;
|
||||
pragma solidity ^0.5.0;
|
||||
|
||||
import "../payment/escrow/ConditionalEscrow.sol";
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
pragma solidity ^0.5.7;
|
||||
pragma solidity ^0.5.0;
|
||||
|
||||
import "../drafts/Counters.sol";
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
pragma solidity ^0.5.7;
|
||||
pragma solidity ^0.5.0;
|
||||
|
||||
import "../crowdsale/Crowdsale.sol";
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
pragma solidity ^0.5.7;
|
||||
pragma solidity ^0.5.0;
|
||||
|
||||
import "../cryptography/ECDSA.sol";
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
pragma solidity ^0.5.7;
|
||||
pragma solidity ^0.5.0;
|
||||
|
||||
import "../../introspection/IERC165.sol";
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
pragma solidity ^0.5.7;
|
||||
pragma solidity ^0.5.0;
|
||||
|
||||
contract ERC165NotSupported {
|
||||
// solhint-disable-previous-line no-empty-blocks
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
pragma solidity ^0.5.7;
|
||||
pragma solidity ^0.5.0;
|
||||
|
||||
import "../introspection/ERC165Checker.sol";
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
pragma solidity ^0.5.7;
|
||||
pragma solidity ^0.5.0;
|
||||
|
||||
import "../introspection/ERC165.sol";
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
pragma solidity ^0.5.7;
|
||||
pragma solidity ^0.5.0;
|
||||
|
||||
import "../drafts/ERC1820Implementer.sol";
|
||||
import "../introspection/ERC1820Implementer.sol";
|
||||
|
||||
contract ERC1820ImplementerMock is ERC1820Implementer {
|
||||
function registerInterfaceForAddress(bytes32 interfaceHash, address account) public {
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
pragma solidity ^0.5.7;
|
||||
pragma solidity ^0.5.0;
|
||||
|
||||
import "../token/ERC20/ERC20Burnable.sol";
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
pragma solidity ^0.5.7;
|
||||
pragma solidity ^0.5.0;
|
||||
|
||||
import "../token/ERC20/ERC20.sol";
|
||||
import "../token/ERC20/ERC20Detailed.sol";
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
pragma solidity ^0.5.7;
|
||||
pragma solidity ^0.5.0;
|
||||
|
||||
import "../token/ERC20/ERC20.sol";
|
||||
import "../drafts/ERC1046/ERC20Metadata.sol";
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
pragma solidity ^0.5.7;
|
||||
pragma solidity ^0.5.0;
|
||||
|
||||
import "../token/ERC20/ERC20Mintable.sol";
|
||||
import "./MinterRoleMock.sol";
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
pragma solidity ^0.5.7;
|
||||
pragma solidity ^0.5.0;
|
||||
|
||||
import "../token/ERC20/ERC20.sol";
|
||||
|
||||
@ -20,6 +20,10 @@ contract ERC20Mock is ERC20 {
|
||||
_burnFrom(account, amount);
|
||||
}
|
||||
|
||||
function transferInternal(address from, address to, uint256 value) public {
|
||||
_transfer(from, to, value);
|
||||
}
|
||||
|
||||
function approveInternal(address owner, address spender, uint256 value) public {
|
||||
_approve(owner, spender, value);
|
||||
}
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
pragma solidity ^0.5.7;
|
||||
pragma solidity ^0.5.0;
|
||||
|
||||
import "../token/ERC20/ERC20Pausable.sol";
|
||||
import "./PauserRoleMock.sol";
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
pragma solidity ^0.5.7;
|
||||
pragma solidity ^0.5.0;
|
||||
|
||||
import "../drafts/ERC20Snapshot.sol";
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
pragma solidity ^0.5.7;
|
||||
pragma solidity ^0.5.0;
|
||||
|
||||
import "../token/ERC721/ERC721Full.sol";
|
||||
import "../token/ERC721/ERC721Mintable.sol";
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
pragma solidity ^0.5.7;
|
||||
pragma solidity ^0.5.0;
|
||||
|
||||
import "../token/ERC721/ERC721Full.sol";
|
||||
import "../token/ERC721/ERC721Mintable.sol";
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
pragma solidity ^0.5.7;
|
||||
pragma solidity ^0.5.0;
|
||||
|
||||
import "../token/ERC721/ERC721.sol";
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
pragma solidity ^0.5.7;
|
||||
pragma solidity ^0.5.0;
|
||||
|
||||
import "../token/ERC721/ERC721Pausable.sol";
|
||||
import "./PauserRoleMock.sol";
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
pragma solidity ^0.5.7;
|
||||
pragma solidity ^0.5.0;
|
||||
|
||||
import "../token/ERC721/IERC721Receiver.sol";
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
pragma solidity ^0.5.7;
|
||||
pragma solidity ^0.5.0;
|
||||
|
||||
import "../drafts/ERC777/ERC777.sol";
|
||||
import "../token/ERC777/ERC777.sol";
|
||||
|
||||
contract ERC777Mock is ERC777 {
|
||||
constructor(
|
||||
@ -8,9 +8,8 @@ contract ERC777Mock is ERC777 {
|
||||
uint256 initialBalance,
|
||||
string memory name,
|
||||
string memory symbol,
|
||||
uint256 granularity,
|
||||
address[] memory defaultOperators
|
||||
) public ERC777(name, symbol, granularity, defaultOperators) {
|
||||
) public ERC777(name, symbol, defaultOperators) {
|
||||
_mint(msg.sender, initialHolder, initialBalance, "", "");
|
||||
}
|
||||
|
||||
|
||||
@ -1,10 +1,10 @@
|
||||
pragma solidity ^0.5.7;
|
||||
pragma solidity ^0.5.0;
|
||||
|
||||
import "../drafts/ERC777/IERC777.sol";
|
||||
import "../drafts/ERC777/IERC777Sender.sol";
|
||||
import "../drafts/ERC777/IERC777Recipient.sol";
|
||||
import "../drafts/IERC1820Registry.sol";
|
||||
import "../drafts/ERC1820Implementer.sol";
|
||||
import "../token/ERC777/IERC777.sol";
|
||||
import "../token/ERC777/IERC777Sender.sol";
|
||||
import "../token/ERC777/IERC777Recipient.sol";
|
||||
import "../introspection/IERC1820Registry.sol";
|
||||
import "../introspection/ERC1820Implementer.sol";
|
||||
|
||||
contract ERC777SenderRecipientMock is IERC777Sender, IERC777Recipient, ERC1820Implementer {
|
||||
event TokensToSendCalled(
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
pragma solidity ^0.5.7;
|
||||
pragma solidity ^0.5.0;
|
||||
|
||||
import "../token/ERC20/IERC20.sol";
|
||||
import "../crowdsale/distribution/FinalizableCrowdsale.sol";
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
pragma solidity ^0.5.7;
|
||||
pragma solidity ^0.5.0;
|
||||
|
||||
import "../crowdsale/price/IncreasingPriceCrowdsale.sol";
|
||||
import "../math/SafeMath.sol";
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
pragma solidity ^0.5.7;
|
||||
pragma solidity ^0.5.0;
|
||||
|
||||
import "../token/ERC20/IERC20.sol";
|
||||
import "../crowdsale/validation/IndividuallyCappedCrowdsale.sol";
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
pragma solidity ^0.5.7;
|
||||
pragma solidity ^0.5.0;
|
||||
|
||||
import "../math/Math.sol";
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
pragma solidity ^0.5.7;
|
||||
pragma solidity ^0.5.0;
|
||||
|
||||
import { MerkleProof } from "../cryptography/MerkleProof.sol";
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
pragma solidity ^0.5.7;
|
||||
pragma solidity ^0.5.0;
|
||||
|
||||
import "../token/ERC20/ERC20Mintable.sol";
|
||||
import "../crowdsale/emission/MintedCrowdsale.sol";
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
pragma solidity ^0.5.7;
|
||||
pragma solidity ^0.5.0;
|
||||
|
||||
import "../access/roles/MinterRole.sol";
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
pragma solidity ^0.5.7;
|
||||
pragma solidity ^0.5.0;
|
||||
|
||||
import "../ownership/Ownable.sol";
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
pragma solidity ^0.5.7;
|
||||
pragma solidity ^0.5.0;
|
||||
|
||||
import "../ownership/Ownable.sol";
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
pragma solidity ^0.5.7;
|
||||
pragma solidity ^0.5.0;
|
||||
|
||||
import "../token/ERC20/ERC20.sol";
|
||||
import "../crowdsale/validation/PausableCrowdsale.sol";
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
pragma solidity ^0.5.7;
|
||||
pragma solidity ^0.5.0;
|
||||
|
||||
import "../lifecycle/Pausable.sol";
|
||||
import "./PauserRoleMock.sol";
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
pragma solidity ^0.5.7;
|
||||
pragma solidity ^0.5.0;
|
||||
|
||||
import "../access/roles/PauserRole.sol";
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
pragma solidity ^0.5.7;
|
||||
pragma solidity ^0.5.0;
|
||||
|
||||
import "../token/ERC20/IERC20.sol";
|
||||
import "../crowdsale/distribution/PostDeliveryCrowdsale.sol";
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
pragma solidity ^0.5.7;
|
||||
pragma solidity ^0.5.0;
|
||||
|
||||
import "../payment/PullPayment.sol";
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
pragma solidity ^0.5.7;
|
||||
pragma solidity ^0.5.0;
|
||||
|
||||
contract ReentrancyAttack {
|
||||
function callSender(bytes4 data) public {
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
pragma solidity ^0.5.7;
|
||||
pragma solidity ^0.5.0;
|
||||
|
||||
import "../utils/ReentrancyGuard.sol";
|
||||
import "./ReentrancyAttack.sol";
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
pragma solidity ^0.5.7;
|
||||
pragma solidity ^0.5.0;
|
||||
|
||||
import "../token/ERC20/IERC20.sol";
|
||||
import "../crowdsale/distribution/RefundableCrowdsale.sol";
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user