Skip to content

Commit

Permalink
ERC777 Update to solc 0.5.2 (OpenZeppelin#1159)
Browse files Browse the repository at this point in the history
  • Loading branch information
Bertrand Masius committed Mar 17, 2019
1 parent 9965393 commit 2582a2a
Show file tree
Hide file tree
Showing 13 changed files with 98 additions and 94 deletions.
12 changes: 6 additions & 6 deletions contracts/drafts/ERC777/ERC777.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pragma solidity ^0.4.24;
pragma solidity ^0.5.2;

import "./ERC777Base.sol";

Expand All @@ -21,13 +21,13 @@ contract ERC777 is ERC777Base {
* @param operatorData bytes extra information provided by the operator (if any)
*/
constructor(
string name,
string symbol,
string memory name,
string memory symbol,
uint256 granularity,
address[] defaultOperators,
address[] memory defaultOperators,
uint256 initialSupply,
bytes data,
bytes operatorData
bytes memory data,
bytes memory operatorData
)
ERC777Base(
name,
Expand Down
46 changes: 23 additions & 23 deletions contracts/drafts/ERC777/ERC777Base.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pragma solidity ^0.4.24;
pragma solidity ^0.5.2;

import "./IERC777.sol";
import "./IERC777TokensRecipient.sol";
Expand Down Expand Up @@ -37,10 +37,10 @@ contract ERC777Base is IERC777, ERC1820Client {
mapping(address => mapping(address => bool)) private _ops;

constructor(
string name,
string symbol,
string memory name,
string memory symbol,
uint256 granularity,
address[] defaultOperators
address[] memory defaultOperators
) internal {
require(granularity > 0);
_name = name;
Expand All @@ -67,7 +67,7 @@ contract ERC777Base is IERC777, ERC1820Client {
function send(
address to,
uint256 amount,
bytes data
bytes calldata data
) external {
_send(
msg.sender,
Expand All @@ -91,8 +91,8 @@ contract ERC777Base is IERC777, ERC1820Client {
address from,
address to,
uint256 amount,
bytes data,
bytes operatorData
bytes calldata data,
bytes calldata operatorData
)
external
{
Expand All @@ -112,7 +112,7 @@ contract ERC777Base is IERC777, ERC1820Client {
* @param amount uint256 amount of tokens to transfer
* @param data bytes extra information provided by the token holder
*/
function burn(uint256 amount, bytes data) external {
function burn(uint256 amount, bytes calldata data) external {
_burn(
msg.sender,
msg.sender,
Expand All @@ -132,8 +132,8 @@ contract ERC777Base is IERC777, ERC1820Client {
function operatorBurn(
address from,
uint256 amount,
bytes data,
bytes operatorData
bytes calldata data,
bytes calldata operatorData
)
external
{
Expand All @@ -150,14 +150,14 @@ contract ERC777Base is IERC777, ERC1820Client {
/**
* @return the name of the token.
*/
function name() public view returns (string) {
function name() public view returns (string memory) {
return _name;
}

/**
* @return the symbol of the token.
*/
function symbol() public view returns (string) {
function symbol() public view returns (string memory) {
return _symbol;
}

Expand Down Expand Up @@ -191,7 +191,7 @@ contract ERC777Base is IERC777, ERC1820Client {
* @dev Get the list of default operators as defined by the token contract.
* @return address[] default operators
*/
function defaultOperators() public view returns (address[]) {
function defaultOperators() public view returns (address[] memory) {
return _defaultOpsArray;
}

Expand Down Expand Up @@ -246,8 +246,8 @@ contract ERC777Base is IERC777, ERC1820Client {
address operator,
address from,
uint256 amount,
bytes data,
bytes operatorData
bytes memory data,
bytes memory operatorData
)
internal
{
Expand Down Expand Up @@ -290,8 +290,8 @@ contract ERC777Base is IERC777, ERC1820Client {
address operator,
address to,
uint256 amount,
bytes userData,
bytes operatorData
bytes memory userData,
bytes memory operatorData
)
internal
{
Expand Down Expand Up @@ -373,8 +373,8 @@ contract ERC777Base is IERC777, ERC1820Client {
address from,
address to,
uint256 amount,
bytes userData,
bytes operatorData
bytes memory userData,
bytes memory operatorData
)
private
{
Expand Down Expand Up @@ -430,8 +430,8 @@ contract ERC777Base is IERC777, ERC1820Client {
address from,
address to,
uint256 amount,
bytes userData,
bytes operatorData
bytes memory userData,
bytes memory operatorData
)
private
{
Expand Down Expand Up @@ -464,8 +464,8 @@ contract ERC777Base is IERC777, ERC1820Client {
address from,
address to,
uint256 amount,
bytes userData,
bytes operatorData
bytes memory userData,
bytes memory operatorData
)
private
returns(bool)
Expand Down
8 changes: 4 additions & 4 deletions contracts/drafts/ERC777/ERC777Burnable.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pragma solidity ^0.4.24;
pragma solidity ^0.5.2;

import "./ERC777Base.sol";

Expand All @@ -15,7 +15,7 @@ contract ERC777Burnable is ERC777Base {
* @param amount uint256 amount of tokens to transfer
* @param data bytes data provided by the token holder
*/
function burn(uint256 amount, bytes data) external {
function burn(uint256 amount, bytes calldata data) external {
_burn(
msg.sender,
msg.sender,
Expand All @@ -35,8 +35,8 @@ contract ERC777Burnable is ERC777Base {
function operatorBurn(
address from,
uint256 amount,
bytes data,
bytes operatorData
bytes calldata data,
bytes calldata operatorData
) external {
address holder = from == address(0) ? msg.sender : from;
_burn(
Expand Down
20 changes: 10 additions & 10 deletions contracts/drafts/ERC777/IERC777.sol
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
pragma solidity ^0.4.24;
pragma solidity ^0.5.2;

/**
* @title ERC777 interface
* @dev see https://github.com/ethereum/EIPs/blob/master/EIPS/eip-777.md
*/
interface IERC777 {
function name() external view returns (string);
function name() external view returns (string memory);

function symbol() external view returns (string);
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[]);
function defaultOperators() external view returns (address[] memory);

function authorizeOperator(address operator) external;

Expand All @@ -26,23 +26,23 @@ interface IERC777 {
address tokenHolder
) external view returns (bool);

function send(address to, uint256 amount, bytes data) external;
function send(address to, uint256 amount, bytes calldata data) external;

function operatorSend(
address from,
address to,
uint256 amount,
bytes data,
bytes operatorData
bytes calldata data,
bytes calldata operatorData
) external;

function burn(uint256 amount, bytes data) external;
function burn(uint256 amount, bytes calldata data) external;

function operatorBurn(
address from,
uint256 amount,
bytes data,
bytes operatorData
bytes calldata data,
bytes calldata operatorData
) external;

event Sent(
Expand Down
7 changes: 3 additions & 4 deletions contracts/drafts/ERC777/IERC777TokensRecipient.sol
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
// solhint-disable-next-line compiler-fixed
pragma solidity ^0.4.24;
pragma solidity ^0.5.2;

interface IERC777TokensRecipient {
function tokensReceived(
address operator,
address from,
address to,
uint amount,
bytes userData,
bytes operatorData
bytes calldata userData,
bytes calldata operatorData
) external;
}
7 changes: 3 additions & 4 deletions contracts/drafts/ERC777/IERC777TokensSender.sol
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
// solhint-disable-next-line compiler-fixed
pragma solidity ^0.4.24;
pragma solidity ^0.5.2;

interface IERC777TokensSender {
function tokensToSend(
address operator,
address from,
address to,
uint amount,
bytes userData,
bytes operatorData
bytes calldata userData,
bytes calldata operatorData
) external;
}
2 changes: 1 addition & 1 deletion contracts/introspection/ERC1820Client.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pragma solidity ^0.4.24;
pragma solidity ^0.5.2;

import "./IERC1820.sol";

Expand Down
4 changes: 2 additions & 2 deletions contracts/introspection/IERC1820.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pragma solidity ^0.4.24;
pragma solidity ^0.5.2;

/**
* @title IERC1820
Expand All @@ -24,7 +24,7 @@ interface IERC1820 {
function getManager(address _addr) external view returns(address);

function interfaceHash(
string _interfaceName
string calldata _interfaceName
) external pure returns(bytes32);

function updateERC165Cache(
Expand Down
6 changes: 3 additions & 3 deletions contracts/mocks/ERC777ReceiverMock.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pragma solidity ^0.4.24;
pragma solidity ^0.5.2;

import "../drafts/ERC777/IERC777TokensRecipient.sol";
import "../introspection/ERC1820Client.sol";
Expand Down Expand Up @@ -44,8 +44,8 @@ contract ERC777ReceiverMock is IERC777TokensRecipient, ERC1820Client {
address from,
address to,
uint256 amount,
bytes userData,
bytes operatorData
bytes calldata userData,
bytes calldata operatorData
)
external
{
Expand Down
20 changes: 14 additions & 6 deletions contracts/mocks/ERC777SenderMock.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pragma solidity ^0.4.24;
pragma solidity ^0.5.2;

import "../drafts/ERC777/IERC777.sol";
import "../drafts/ERC777/IERC777TokensSender.sol";
Expand Down Expand Up @@ -26,7 +26,11 @@ contract ERC777SenderMock is IERC777TokensSender, ERC1820Client {
_erc777 = erc777;
// register interface
if (setInterface) {
setInterfaceImplementer(address(this), keccak256("ERC777TokensSender"), address(this));
setInterfaceImplementer(
address(this),
keccak256("ERC777TokensSender"),
address(this)
);
}
}

Expand All @@ -36,7 +40,11 @@ contract ERC777SenderMock is IERC777TokensSender, ERC1820Client {
* @param amount uint256 amount of tokens to transfer
* @param data bytes extra information provided by the token holder (if any)
*/
function sendTokens(address to, uint amount, bytes data) external {
function sendTokens(
address to,
uint amount,
bytes calldata data
) external {
IERC777(_erc777).send(to, amount, data);
}

Expand All @@ -45,7 +53,7 @@ contract ERC777SenderMock is IERC777TokensSender, ERC1820Client {
* @param amount uint256 amount of tokens to transfer
* @param data bytes extra information provided by the token holder (if any)
*/
function burnTokens(uint amount, bytes data) external {
function burnTokens(uint amount, bytes calldata data) external {
IERC777(_erc777).burn(amount, data);
}

Expand All @@ -71,8 +79,8 @@ contract ERC777SenderMock is IERC777TokensSender, ERC1820Client {
address from,
address to,
uint256 amount,
bytes userData,
bytes operatorData
bytes calldata userData,
bytes calldata operatorData
)
external
{
Expand Down
Loading

0 comments on commit 2582a2a

Please sign in to comment.