Commit 1fd993bc by skyge Committed by Francisco Giordano

Unify code comments style. (#1603)

* Updated code style to no more than120 characters per line.

* Unify code comments style with Doxygen-style tags.
parent a09cf147
...@@ -6,8 +6,8 @@ import "../../payment/escrow/RefundEscrow.sol"; ...@@ -6,8 +6,8 @@ import "../../payment/escrow/RefundEscrow.sol";
/** /**
* @title RefundableCrowdsale * @title RefundableCrowdsale
* @dev Extension of Crowdsale contract that adds a funding goal, and the possibility of users getting a refund if goal * @dev Extension of Crowdsale contract that adds a funding goal, and the possibility of users getting a refund
* is not met. * 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 * is met, then an attack is possible in which the attacker purchases tokens from the crowdsale and when they sees that
......
...@@ -9,11 +9,11 @@ import "../../access/roles/WhitelistedRole.sol"; ...@@ -9,11 +9,11 @@ import "../../access/roles/WhitelistedRole.sol";
*/ */
contract WhitelistCrowdsale is WhitelistedRole, Crowdsale { contract WhitelistCrowdsale is WhitelistedRole, Crowdsale {
/** /**
* @dev Extend parent behavior requiring beneficiary to be whitelisted. Note that no * @dev Extend parent behavior requiring beneficiary to be whitelisted. Note that no
* restriction is imposed on the account sending the transaction. * restriction is imposed on the account sending the transaction.
* @param _beneficiary Token beneficiary * @param _beneficiary Token beneficiary
* @param _weiAmount Amount of wei contributed * @param _weiAmount Amount of wei contributed
*/ */
function _preValidatePurchase(address _beneficiary, uint256 _weiAmount) internal view { function _preValidatePurchase(address _beneficiary, uint256 _weiAmount) internal view {
require(isWhitelisted(_beneficiary)); require(isWhitelisted(_beneficiary));
super._preValidatePurchase(_beneficiary, _weiAmount); super._preValidatePurchase(_beneficiary, _weiAmount);
......
...@@ -92,10 +92,10 @@ contract SignatureBouncer is SignerRole { ...@@ -92,10 +92,10 @@ contract SignatureBouncer is SignerRole {
} }
/** /**
* @dev is the signature of `this + sender + methodId + params(s)` from a signer? * @dev is the signature of `this + sender + methodId + params(s)` from a signer?
* @notice the signature parameter of the method being validated must be the "last" parameter * @notice the signature parameter of the method being validated must be the "last" parameter
* @return bool * @return bool
*/ */
function _isValidSignatureAndData(address account, bytes memory signature) internal view returns (bool) { function _isValidSignatureAndData(address account, bytes memory signature) internal view returns (bool) {
require(msg.data.length > _SIGNATURE_SIZE); require(msg.data.length > _SIGNATURE_SIZE);
......
...@@ -8,8 +8,8 @@ library SignedSafeMath { ...@@ -8,8 +8,8 @@ library SignedSafeMath {
int256 constant private INT256_MIN = -2**255; int256 constant private INT256_MIN = -2**255;
/** /**
* @dev Multiplies two signed integers, reverts on overflow. * @dev Multiplies two signed integers, reverts on overflow.
*/ */
function mul(int256 a, int256 b) internal pure returns (int256) { function mul(int256 a, int256 b) internal pure returns (int256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the // Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested. // benefit is lost if 'b' is also tested.
...@@ -27,8 +27,8 @@ library SignedSafeMath { ...@@ -27,8 +27,8 @@ library SignedSafeMath {
} }
/** /**
* @dev Integer division of two signed integers truncating the quotient, reverts on division by zero. * @dev Integer division of two signed integers truncating the quotient, reverts on division by zero.
*/ */
function div(int256 a, int256 b) internal pure returns (int256) { function div(int256 a, int256 b) internal pure returns (int256) {
require(b != 0); // Solidity only automatically asserts when dividing by 0 require(b != 0); // Solidity only automatically asserts when dividing by 0
require(!(b == -1 && a == INT256_MIN)); // This is the only case of overflow require(!(b == -1 && a == INT256_MIN)); // This is the only case of overflow
...@@ -39,8 +39,8 @@ library SignedSafeMath { ...@@ -39,8 +39,8 @@ library SignedSafeMath {
} }
/** /**
* @dev Subtracts two signed integers, reverts on overflow. * @dev Subtracts two signed integers, reverts on overflow.
*/ */
function sub(int256 a, int256 b) internal pure returns (int256) { function sub(int256 a, int256 b) internal pure returns (int256) {
int256 c = a - b; int256 c = a - b;
require((b >= 0 && c <= a) || (b < 0 && c > a)); require((b >= 0 && c <= a) || (b < 0 && c > a));
...@@ -49,8 +49,8 @@ library SignedSafeMath { ...@@ -49,8 +49,8 @@ library SignedSafeMath {
} }
/** /**
* @dev Adds two signed integers, reverts on overflow. * @dev Adds two signed integers, reverts on overflow.
*/ */
function add(int256 a, int256 b) internal pure returns (int256) { function add(int256 a, int256 b) internal pure returns (int256) {
int256 c = a + b; int256 c = a + b;
require((b >= 0 && c >= a) || (b < 0 && c < a)); require((b >= 0 && c >= a) || (b < 0 && c < a));
......
...@@ -12,9 +12,9 @@ import "../math/SafeMath.sol"; ...@@ -12,9 +12,9 @@ import "../math/SafeMath.sol";
*/ */
contract TokenVesting is Ownable { contract TokenVesting is Ownable {
// The vesting schedule is time-based (i.e. using block timestamps as opposed to e.g. block numbers), and is // The vesting schedule is time-based (i.e. using block timestamps as opposed to e.g. block numbers), and is
// therefore sensitive to timestamp manipulation (which is something miners can do, to a certain degree). Therefore, // therefore sensitive to timestamp manipulation (which is something miners can do, to a certain degree).Therefore,
// it is recommended to avoid using short time durations (less than a minute). Typical vesting schemes, with a cliff // it is recommended to avoid using short time durations (less than a minute). Typical vesting schemes, with a
// period of a year and a duration of four years, are safe to use. // cliff period of a year and a duration of four years, are safe to use.
// solhint-disable not-rely-on-time // solhint-disable not-rely-on-time
using SafeMath for uint256; using SafeMath for uint256;
......
...@@ -9,7 +9,7 @@ import "./IERC165.sol"; ...@@ -9,7 +9,7 @@ import "./IERC165.sol";
*/ */
contract ERC165 is IERC165 { contract ERC165 is IERC165 {
bytes4 private constant _INTERFACE_ID_ERC165 = 0x01ffc9a7; bytes4 private constant _INTERFACE_ID_ERC165 = 0x01ffc9a7;
/** /*
* 0x01ffc9a7 === * 0x01ffc9a7 ===
* bytes4(keccak256('supportsInterface(bytes4)')) * bytes4(keccak256('supportsInterface(bytes4)'))
*/ */
......
...@@ -10,7 +10,7 @@ library ERC165Checker { ...@@ -10,7 +10,7 @@ library ERC165Checker {
bytes4 private constant _INTERFACE_ID_INVALID = 0xffffffff; bytes4 private constant _INTERFACE_ID_INVALID = 0xffffffff;
bytes4 private constant _INTERFACE_ID_ERC165 = 0x01ffc9a7; bytes4 private constant _INTERFACE_ID_ERC165 = 0x01ffc9a7;
/** /*
* 0x01ffc9a7 === * 0x01ffc9a7 ===
* bytes4(keccak256('supportsInterface(bytes4)')) * bytes4(keccak256('supportsInterface(bytes4)'))
*/ */
...@@ -109,15 +109,15 @@ library ERC165Checker { ...@@ -109,15 +109,15 @@ library ERC165Checker {
mstore(output, 0x0) mstore(output, 0x0)
success := staticcall( success := staticcall(
30000, // 30k gas 30000, // 30k gas
account, // To addr account, // To addr
encodedParams_data, encodedParams_data,
encodedParams_size, encodedParams_size,
output, output,
0x20 // Outputs are 32 bytes long 0x20 // Outputs are 32 bytes long
) )
result := mload(output) // Load the result result := mload(output) // Load the result
} }
} }
} }
...@@ -6,24 +6,24 @@ pragma solidity ^0.5.2; ...@@ -6,24 +6,24 @@ pragma solidity ^0.5.2;
*/ */
library Math { library Math {
/** /**
* @dev Returns the largest of two numbers. * @dev Returns the largest of two numbers.
*/ */
function max(uint256 a, uint256 b) internal pure returns (uint256) { function max(uint256 a, uint256 b) internal pure returns (uint256) {
return a >= b ? a : b; return a >= b ? a : b;
} }
/** /**
* @dev Returns the smallest of two numbers. * @dev Returns the smallest of two numbers.
*/ */
function min(uint256 a, uint256 b) internal pure returns (uint256) { function min(uint256 a, uint256 b) internal pure returns (uint256) {
return a < b ? a : b; return a < b ? a : b;
} }
/** /**
* @dev Calculates the average of two numbers. Since these are integers, * @dev Calculates the average of two numbers. Since these are integers,
* averages of an even and odd number cannot be represented, and will be * averages of an even and odd number cannot be represented, and will be
* rounded down. * rounded down.
*/ */
function average(uint256 a, uint256 b) internal pure returns (uint256) { function average(uint256 a, uint256 b) internal pure returns (uint256) {
// (a + b) / 2 can overflow, so we distribute // (a + b) / 2 can overflow, so we distribute
return (a / 2) + (b / 2) + ((a % 2 + b % 2) / 2); return (a / 2) + (b / 2) + ((a % 2 + b % 2) / 2);
......
...@@ -6,8 +6,8 @@ pragma solidity ^0.5.2; ...@@ -6,8 +6,8 @@ pragma solidity ^0.5.2;
*/ */
library SafeMath { library SafeMath {
/** /**
* @dev Multiplies two unsigned integers, reverts on overflow. * @dev Multiplies two unsigned integers, reverts on overflow.
*/ */
function mul(uint256 a, uint256 b) internal pure returns (uint256) { function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the // Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested. // benefit is lost if 'b' is also tested.
...@@ -23,8 +23,8 @@ library SafeMath { ...@@ -23,8 +23,8 @@ library SafeMath {
} }
/** /**
* @dev Integer division of two unsigned integers truncating the quotient, reverts on division by zero. * @dev Integer division of two unsigned integers truncating the quotient, reverts on division by zero.
*/ */
function div(uint256 a, uint256 b) internal pure returns (uint256) { function div(uint256 a, uint256 b) internal pure returns (uint256) {
// Solidity only automatically asserts when dividing by 0 // Solidity only automatically asserts when dividing by 0
require(b > 0); require(b > 0);
...@@ -35,8 +35,8 @@ library SafeMath { ...@@ -35,8 +35,8 @@ library SafeMath {
} }
/** /**
* @dev Subtracts two unsigned integers, reverts on overflow (i.e. if subtrahend is greater than minuend). * @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) { function sub(uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a); require(b <= a);
uint256 c = a - b; uint256 c = a - b;
...@@ -45,8 +45,8 @@ library SafeMath { ...@@ -45,8 +45,8 @@ library SafeMath {
} }
/** /**
* @dev Adds two unsigned integers, reverts on overflow. * @dev Adds two unsigned integers, reverts on overflow.
*/ */
function add(uint256 a, uint256 b) internal pure returns (uint256) { function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b; uint256 c = a + b;
require(c >= a); require(c >= a);
...@@ -55,9 +55,9 @@ library SafeMath { ...@@ -55,9 +55,9 @@ library SafeMath {
} }
/** /**
* @dev Divides two unsigned integers and returns the remainder (unsigned integer modulo), * @dev Divides two unsigned integers and returns the remainder (unsigned integer modulo),
* reverts when dividing by zero. * reverts when dividing by zero.
*/ */
function mod(uint256 a, uint256 b) internal pure returns (uint256) { function mod(uint256 a, uint256 b) internal pure returns (uint256) {
require(b != 0); require(b != 0);
return a % b; return a % b;
......
...@@ -4,6 +4,7 @@ import "../../introspection/IERC165.sol"; ...@@ -4,6 +4,7 @@ import "../../introspection/IERC165.sol";
/** /**
* https://github.com/ethereum/EIPs/blob/master/EIPS/eip-214.md#specification * https://github.com/ethereum/EIPs/blob/master/EIPS/eip-214.md#specification
* From the specification:
* > Any attempts to make state-changing operations inside an execution instance with STATIC set to true will instead * > Any attempts to make state-changing operations inside an execution instance with STATIC set to true will instead
* throw an exception. * throw an exception.
* > These operations include [...], LOG0, LOG1, LOG2, [...] * > These operations include [...], LOG0, LOG1, LOG2, [...]
...@@ -13,7 +14,7 @@ import "../../introspection/IERC165.sol"; ...@@ -13,7 +14,7 @@ import "../../introspection/IERC165.sol";
*/ */
contract SupportsInterfaceWithLookupMock is IERC165 { contract SupportsInterfaceWithLookupMock is IERC165 {
bytes4 public constant INTERFACE_ID_ERC165 = 0x01ffc9a7; bytes4 public constant INTERFACE_ID_ERC165 = 0x01ffc9a7;
/** /*
* 0x01ffc9a7 === * 0x01ffc9a7 ===
* bytes4(keccak256('supportsInterface(bytes4)')) * bytes4(keccak256('supportsInterface(bytes4)'))
*/ */
......
...@@ -15,26 +15,26 @@ contract PullPayment { ...@@ -15,26 +15,26 @@ contract PullPayment {
} }
/** /**
* @dev Withdraw accumulated balance. * @dev Withdraw accumulated balance.
* @param payee Whose balance will be withdrawn. * @param payee Whose balance will be withdrawn.
*/ */
function withdrawPayments(address payable payee) public { function withdrawPayments(address payable payee) public {
_escrow.withdraw(payee); _escrow.withdraw(payee);
} }
/** /**
* @dev Returns the credit owed to an address. * @dev Returns the credit owed to an address.
* @param dest The creditor's address. * @param dest The creditor's address.
*/ */
function payments(address dest) public view returns (uint256) { function payments(address dest) public view returns (uint256) {
return _escrow.depositsOf(dest); return _escrow.depositsOf(dest);
} }
/** /**
* @dev Called by the payer to store the sent amount as credit to be pulled. * @dev Called by the payer to store the sent amount as credit to be pulled.
* @param dest The destination address of the funds. * @param dest The destination address of the funds.
* @param amount The amount to transfer. * @param amount The amount to transfer.
*/ */
function _asyncTransfer(address dest, uint256 amount) internal { function _asyncTransfer(address dest, uint256 amount) internal {
_escrow.deposit.value(amount)(dest); _escrow.deposit.value(amount)(dest);
} }
......
...@@ -9,10 +9,10 @@ import "./Escrow.sol"; ...@@ -9,10 +9,10 @@ import "./Escrow.sol";
*/ */
contract ConditionalEscrow is Escrow { contract ConditionalEscrow is Escrow {
/** /**
* @dev Returns whether an address is allowed to withdraw their funds. To be * @dev Returns whether an address is allowed to withdraw their funds. To be
* implemented by derived contracts. * implemented by derived contracts.
* @param payee The destination address of the funds. * @param payee The destination address of the funds.
*/ */
function withdrawalAllowed(address payee) public view returns (bool); function withdrawalAllowed(address payee) public view returns (bool);
function withdraw(address payable payee) public { function withdraw(address payable payee) public {
......
...@@ -4,17 +4,17 @@ import "../../math/SafeMath.sol"; ...@@ -4,17 +4,17 @@ import "../../math/SafeMath.sol";
import "../../ownership/Secondary.sol"; import "../../ownership/Secondary.sol";
/** /**
* @title Escrow * @title Escrow
* @dev Base escrow contract, holds funds designated for a payee until they * @dev Base escrow contract, holds funds designated for a payee until they
* withdraw them. * withdraw them.
* @dev Intended usage: This contract (and derived escrow contracts) should be a * @dev Intended usage: This contract (and derived escrow contracts) should be a
* standalone contract, that only interacts with the contract that instantiated * standalone contract, that only interacts with the contract that instantiated
* it. That way, it is guaranteed that all Ether will be handled according to * it. That way, it is guaranteed that all Ether will be handled according to
* the Escrow rules, and there is no need to check for payable functions or * the Escrow rules, and there is no need to check for payable functions or
* transfers in the inheritance tree. The contract that uses the escrow as its * transfers in the inheritance tree. The contract that uses the escrow as its
* payment method should be its primary, and provide public methods redirecting * payment method should be its primary, and provide public methods redirecting
* to the escrow's deposit and withdraw. * to the escrow's deposit and withdraw.
*/ */
contract Escrow is Secondary { contract Escrow is Secondary {
using SafeMath for uint256; using SafeMath for uint256;
...@@ -28,9 +28,9 @@ contract Escrow is Secondary { ...@@ -28,9 +28,9 @@ contract Escrow is Secondary {
} }
/** /**
* @dev Stores the sent amount as credit to be withdrawn. * @dev Stores the sent amount as credit to be withdrawn.
* @param payee The destination address of the funds. * @param payee The destination address of the funds.
*/ */
function deposit(address payee) public onlyPrimary payable { function deposit(address payee) public onlyPrimary payable {
uint256 amount = msg.value; uint256 amount = msg.value;
_deposits[payee] = _deposits[payee].add(amount); _deposits[payee] = _deposits[payee].add(amount);
...@@ -39,9 +39,9 @@ contract Escrow is Secondary { ...@@ -39,9 +39,9 @@ contract Escrow is Secondary {
} }
/** /**
* @dev Withdraw accumulated balance for a payee. * @dev Withdraw accumulated balance for a payee.
* @param payee The address whose funds will be withdrawn and transferred to. * @param payee The address whose funds will be withdrawn and transferred to.
*/ */
function withdraw(address payable payee) public onlyPrimary { function withdraw(address payable payee) public onlyPrimary {
uint256 payment = _deposits[payee]; uint256 payment = _deposits[payee];
......
...@@ -25,17 +25,17 @@ contract ERC20 is IERC20 { ...@@ -25,17 +25,17 @@ contract ERC20 is IERC20 {
uint256 private _totalSupply; uint256 private _totalSupply;
/** /**
* @dev Total number of tokens in existence * @dev Total number of tokens in existence
*/ */
function totalSupply() public view returns (uint256) { function totalSupply() public view returns (uint256) {
return _totalSupply; return _totalSupply;
} }
/** /**
* @dev Gets the balance of the specified address. * @dev Gets the balance of the specified address.
* @param owner The address to query the balance of. * @param owner The address to query the balance of.
* @return An uint256 representing the amount owned by the passed address. * @return An uint256 representing the amount owned by the passed address.
*/ */
function balanceOf(address owner) public view returns (uint256) { function balanceOf(address owner) public view returns (uint256) {
return _balances[owner]; return _balances[owner];
} }
...@@ -51,10 +51,10 @@ contract ERC20 is IERC20 { ...@@ -51,10 +51,10 @@ contract ERC20 is IERC20 {
} }
/** /**
* @dev Transfer token for a specified address * @dev Transfer token for a specified address
* @param to The address to transfer to. * @param to The address to transfer to.
* @param value The amount to be transferred. * @param value The amount to be transferred.
*/ */
function transfer(address to, uint256 value) public returns (bool) { function transfer(address to, uint256 value) public returns (bool) {
_transfer(msg.sender, to, value); _transfer(msg.sender, to, value);
return true; return true;
...@@ -119,11 +119,11 @@ contract ERC20 is IERC20 { ...@@ -119,11 +119,11 @@ contract ERC20 is IERC20 {
} }
/** /**
* @dev Transfer token for a specified addresses * @dev Transfer token for a specified addresses
* @param from The address to transfer from. * @param from The address to transfer from.
* @param to The address to transfer to. * @param to The address to transfer to.
* @param value The amount to be transferred. * @param value The amount to be transferred.
*/ */
function _transfer(address from, address to, uint256 value) internal { function _transfer(address from, address to, uint256 value) internal {
require(to != address(0)); require(to != address(0));
......
...@@ -17,8 +17,8 @@ contract ERC20Burnable is ERC20 { ...@@ -17,8 +17,8 @@ contract ERC20Burnable is ERC20 {
/** /**
* @dev Burns a specific amount of tokens from the target address and decrements allowance * @dev Burns a specific amount of tokens from the target address and decrements allowance
* @param from address The address which you want to send tokens from * @param from address The account whose tokens will be burned.
* @param value uint256 The amount of token to be burned * @param value uint256 The amount of token to be burned.
*/ */
function burnFrom(address from, uint256 value) public { function burnFrom(address from, uint256 value) public {
_burnFrom(from, value); _burnFrom(from, value);
......
...@@ -6,7 +6,7 @@ import "../../lifecycle/Pausable.sol"; ...@@ -6,7 +6,7 @@ import "../../lifecycle/Pausable.sol";
/** /**
* @title Pausable token * @title Pausable token
* @dev ERC20 modified with pausable transfers. * @dev ERC20 modified with pausable transfers.
**/ */
contract ERC20Pausable is ERC20, Pausable { contract ERC20Pausable is ERC20, Pausable {
function transfer(address to, uint256 value) public whenNotPaused returns (bool) { function transfer(address to, uint256 value) public whenNotPaused returns (bool) {
return super.transfer(to, value); return super.transfer(to, value);
......
...@@ -64,7 +64,7 @@ contract ERC721 is ERC165, IERC721 { ...@@ -64,7 +64,7 @@ contract ERC721 is ERC165, IERC721 {
/** /**
* @dev Gets the owner of the specified token ID * @dev Gets the owner of the specified token ID
* @param tokenId uint256 ID of the token to query the owner of * @param tokenId uint256 ID of the token to query the owner of
* @return owner address currently marked as the owner of the given token ID * @return address currently marked as the owner of the given token ID
*/ */
function ownerOf(uint256 tokenId) public view returns (address) { function ownerOf(uint256 tokenId) public view returns (address) {
address owner = _tokenOwner[tokenId]; address owner = _tokenOwner[tokenId];
...@@ -125,11 +125,11 @@ contract ERC721 is ERC165, IERC721 { ...@@ -125,11 +125,11 @@ contract ERC721 is ERC165, IERC721 {
/** /**
* @dev Transfers the ownership of a given token ID to another address * @dev Transfers the ownership of a given token ID to another address
* Usage of this method is discouraged, use `safeTransferFrom` whenever possible * Usage of this method is discouraged, use `safeTransferFrom` whenever possible
* Requires the msg sender to be the owner, approved, or operator * Requires the msg.sender to be the owner, approved, or operator
* @param from current owner of the token * @param from current owner of the token
* @param to address to receive the ownership of the given token ID * @param to address to receive the ownership of the given token ID
* @param tokenId uint256 ID of the token to be transferred * @param tokenId uint256 ID of the token to be transferred
*/ */
function transferFrom(address from, address to, uint256 tokenId) public { function transferFrom(address from, address to, uint256 tokenId) public {
require(_isApprovedOrOwner(msg.sender, tokenId)); require(_isApprovedOrOwner(msg.sender, tokenId));
...@@ -142,12 +142,11 @@ contract ERC721 is ERC165, IERC721 { ...@@ -142,12 +142,11 @@ contract ERC721 is ERC165, IERC721 {
* which is called upon a safe transfer, and return the magic value * which is called upon a safe transfer, and return the magic value
* `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))`; otherwise, * `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))`; otherwise,
* the transfer is reverted. * the transfer is reverted.
* * Requires the msg.sender to be the owner, approved, or operator
* Requires the msg sender to be the owner, approved, or operator
* @param from current owner of the token * @param from current owner of the token
* @param to address to receive the ownership of the given token ID * @param to address to receive the ownership of the given token ID
* @param tokenId uint256 ID of the token to be transferred * @param tokenId uint256 ID of the token to be transferred
*/ */
function safeTransferFrom(address from, address to, uint256 tokenId) public { function safeTransferFrom(address from, address to, uint256 tokenId) public {
safeTransferFrom(from, to, tokenId, ""); safeTransferFrom(from, to, tokenId, "");
} }
...@@ -158,7 +157,7 @@ contract ERC721 is ERC165, IERC721 { ...@@ -158,7 +157,7 @@ contract ERC721 is ERC165, IERC721 {
* which is called upon a safe transfer, and return the magic value * which is called upon a safe transfer, and return the magic value
* `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))`; otherwise, * `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))`; otherwise,
* the transfer is reverted. * the transfer is reverted.
* Requires the msg sender to be the owner, approved, or operator * Requires the msg.sender to be the owner, approved, or operator
* @param from current owner of the token * @param from current owner of the token
* @param to address to receive the ownership of the given token ID * @param to address to receive the ownership of the given token ID
* @param tokenId uint256 ID of the token to be transferred * @param tokenId uint256 ID of the token to be transferred
...@@ -172,7 +171,7 @@ contract ERC721 is ERC165, IERC721 { ...@@ -172,7 +171,7 @@ contract ERC721 is ERC165, IERC721 {
/** /**
* @dev Returns whether the specified token exists * @dev Returns whether the specified token exists
* @param tokenId uint256 ID of the token to query the existence of * @param tokenId uint256 ID of the token to query the existence of
* @return whether the token exists * @return bool whether the token exists
*/ */
function _exists(uint256 tokenId) internal view returns (bool) { function _exists(uint256 tokenId) internal view returns (bool) {
address owner = _tokenOwner[tokenId]; address owner = _tokenOwner[tokenId];
...@@ -184,7 +183,7 @@ contract ERC721 is ERC165, IERC721 { ...@@ -184,7 +183,7 @@ contract ERC721 is ERC165, IERC721 {
* @param spender address of the spender to query * @param spender address of the spender to query
* @param tokenId uint256 ID of the token to be transferred * @param tokenId uint256 ID of the token to be transferred
* @return bool whether the msg.sender is approved for the given token ID, * @return bool whether the msg.sender is approved for the given token ID,
* is an operator of the owner, or is the owner of the token * is an operator of the owner, or is the owner of the token
*/ */
function _isApprovedOrOwner(address spender, uint256 tokenId) internal view returns (bool) { function _isApprovedOrOwner(address spender, uint256 tokenId) internal view returns (bool) {
address owner = ownerOf(tokenId); address owner = ownerOf(tokenId);
...@@ -240,7 +239,7 @@ contract ERC721 is ERC165, IERC721 { ...@@ -240,7 +239,7 @@ contract ERC721 is ERC165, IERC721 {
* @param from current owner of the token * @param from current owner of the token
* @param to address to receive the ownership of the given token ID * @param to address to receive the ownership of the given token ID
* @param tokenId uint256 ID of the token to be transferred * @param tokenId uint256 ID of the token to be transferred
*/ */
function _transferFrom(address from, address to, uint256 tokenId) internal { function _transferFrom(address from, address to, uint256 tokenId) internal {
require(ownerOf(tokenId) == from); require(ownerOf(tokenId) == from);
require(to != address(0)); require(to != address(0));
...@@ -262,7 +261,7 @@ contract ERC721 is ERC165, IERC721 { ...@@ -262,7 +261,7 @@ contract ERC721 is ERC165, IERC721 {
* @param to target address that will receive the tokens * @param to target address that will receive the tokens
* @param tokenId uint256 ID of the token to be transferred * @param tokenId uint256 ID of the token to be transferred
* @param _data bytes optional data to send along with the call * @param _data bytes optional data to send along with the call
* @return whether the call correctly returned the expected magic value * @return bool whether the call correctly returned the expected magic value
*/ */
function _checkOnERC721Received(address from, address to, uint256 tokenId, bytes memory _data) function _checkOnERC721Received(address from, address to, uint256 tokenId, bytes memory _data)
internal returns (bool) internal returns (bool)
......
...@@ -22,7 +22,7 @@ contract ERC721Enumerable is ERC165, ERC721, IERC721Enumerable { ...@@ -22,7 +22,7 @@ contract ERC721Enumerable is ERC165, ERC721, IERC721Enumerable {
mapping(uint256 => uint256) private _allTokensIndex; mapping(uint256 => uint256) private _allTokensIndex;
bytes4 private constant _INTERFACE_ID_ERC721_ENUMERABLE = 0x780e9d63; bytes4 private constant _INTERFACE_ID_ERC721_ENUMERABLE = 0x780e9d63;
/** /*
* 0x780e9d63 === * 0x780e9d63 ===
* bytes4(keccak256('totalSupply()')) ^ * bytes4(keccak256('totalSupply()')) ^
* bytes4(keccak256('tokenOfOwnerByIndex(address,uint256)')) ^ * bytes4(keccak256('tokenOfOwnerByIndex(address,uint256)')) ^
...@@ -73,7 +73,7 @@ contract ERC721Enumerable is ERC165, ERC721, IERC721Enumerable { ...@@ -73,7 +73,7 @@ contract ERC721Enumerable is ERC165, ERC721, IERC721Enumerable {
* @param from current owner of the token * @param from current owner of the token
* @param to address to receive the ownership of the given token ID * @param to address to receive the ownership of the given token ID
* @param tokenId uint256 ID of the token to be transferred * @param tokenId uint256 ID of the token to be transferred
*/ */
function _transferFrom(address from, address to, uint256 tokenId) internal { function _transferFrom(address from, address to, uint256 tokenId) internal {
super._transferFrom(from, to, tokenId); super._transferFrom(from, to, tokenId);
......
...@@ -15,7 +15,7 @@ contract ERC721Metadata is ERC165, ERC721, IERC721Metadata { ...@@ -15,7 +15,7 @@ contract ERC721Metadata is ERC165, ERC721, IERC721Metadata {
mapping(uint256 => string) private _tokenURIs; mapping(uint256 => string) private _tokenURIs;
bytes4 private constant _INTERFACE_ID_ERC721_METADATA = 0x5b5e139f; bytes4 private constant _INTERFACE_ID_ERC721_METADATA = 0x5b5e139f;
/** /*
* 0x5b5e139f === * 0x5b5e139f ===
* bytes4(keccak256('name()')) ^ * bytes4(keccak256('name()')) ^
* bytes4(keccak256('symbol()')) ^ * bytes4(keccak256('symbol()')) ^
......
...@@ -6,7 +6,7 @@ import "../../lifecycle/Pausable.sol"; ...@@ -6,7 +6,7 @@ import "../../lifecycle/Pausable.sol";
/** /**
* @title ERC721 Non-Fungible Pausable token * @title ERC721 Non-Fungible Pausable token
* @dev ERC721 modified with pausable transfers. * @dev ERC721 modified with pausable transfers.
**/ */
contract ERC721Pausable is ERC721, Pausable { contract ERC721Pausable is ERC721, Pausable {
function approve(address to, uint256 tokenId) public whenNotPaused { function approve(address to, uint256 tokenId) public whenNotPaused {
super.approve(to, tokenId); super.approve(to, tokenId);
......
...@@ -18,7 +18,7 @@ contract IERC721Receiver { ...@@ -18,7 +18,7 @@ contract IERC721Receiver {
* @param from The address which previously owned the token * @param from The address which previously owned the token
* @param tokenId The NFT identifier which is being transferred * @param tokenId The NFT identifier which is being transferred
* @param data Additional data with no specified format * @param data Additional data with no specified format
* @return `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))` * @return bytes4 `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))`
*/ */
function onERC721Received(address operator, address from, uint256 tokenId, bytes memory data) function onERC721Received(address operator, address from, uint256 tokenId, bytes memory data)
public returns (bytes4); public returns (bytes4);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment