Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions contracts/ERC1410/ERC1410Basic.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pragma solidity ^0.4.24;
pragma solidity ^0.5.0;

import "openzeppelin-solidity/contracts/math/SafeMath.sol";
import "../math/KindMath.sol";
Expand Down Expand Up @@ -63,7 +63,7 @@ contract ERC1410Basic {
/// @notice Use to get the list of partitions `_tokenHolder` is associated with
/// @param _tokenHolder An address corresponds whom partition list is queried
/// @return List of partitions
function partitionsOf(address _tokenHolder) external view returns (bytes32[]) {
function partitionsOf(address _tokenHolder) external view returns (bytes32[] memory) {
bytes32[] memory partitionsList = new bytes32[](partitions[_tokenHolder].length);
for (uint256 i = 0; i < partitions[_tokenHolder].length; i++) {
partitionsList[i] = partitions[_tokenHolder][i].partition;
Expand All @@ -77,7 +77,7 @@ contract ERC1410Basic {
/// @param _value The amount of tokens to transfer from `_partition`
/// @param _data Additional data attached to the transfer of tokens
/// @return The partition to which the transferred tokens were allocated for the _to address
function transferByPartition(bytes32 _partition, address _to, uint256 _value, bytes _data) external returns (bytes32) {
function transferByPartition(bytes32 _partition, address _to, uint256 _value, bytes calldata _data) external returns (bytes32) {
// Add a function to verify the `_data` parameter
// TODO: Need to create the bytes division of the `_partition` so it can be easily findout in which receiver's partition
// token will transfered. For current implementation we are assuming that the receiver's partition will be same as sender's
Expand All @@ -98,7 +98,7 @@ contract ERC1410Basic {
/// @return ESC (Ethereum Status Code) following the EIP-1066 standard
/// @return Application specific reason codes with additional details
/// @return The partition to which the transferred tokens were allocated for the _to address
function canTransferByPartition(address _from, address _to, bytes32 _partition, uint256 _value, bytes _data) external view returns (byte, bytes32, bytes32) {
function canTransferByPartition(address _from, address _to, bytes32 _partition, uint256 _value, bytes calldata _data) external view returns (byte, bytes32, bytes32) {
// TODO: Applied the check over the `_data` parameter
if (!_validPartition(_partition, _from))
return (0x50, "Partition not exists", bytes32(""));
Expand All @@ -113,7 +113,7 @@ contract ERC1410Basic {
return (0x51, "Success", _partition);
}

function _transferByPartition(address _from, address _to, uint256 _value, bytes32 _partition, bytes _data, address _operator, bytes _operatorData) internal {
function _transferByPartition(address _from, address _to, uint256 _value, bytes32 _partition , bytes memory _data, address _operator, bytes memory _operatorData) internal {
require(_validPartition(_partition, _from), "Invalid partition");
require(partitions[_from][partitionToIndex[_from][_partition] - 1].amount >= _value, "Insufficient balance");
require(_to != address(0), "0x address not allowed");
Expand All @@ -138,4 +138,4 @@ contract ERC1410Basic {



}
}
6 changes: 3 additions & 3 deletions contracts/ERC1410/ERC1410Operator.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pragma solidity ^0.4.24;
pragma solidity ^0.5.0;

import "./ERC1410Basic.sol";

Expand Down Expand Up @@ -75,7 +75,7 @@ contract ERC1410Operator is ERC1410Basic {
/// @param _data Additional data attached to the transfer of tokens
/// @param _operatorData Additional data attached to the transfer of tokens by the operator
/// @return The partition to which the transferred tokens were allocated for the _to address
function operatorTransferByPartition(bytes32 _partition, address _from, address _to, uint256 _value, bytes _data, bytes _operatorData) external returns (bytes32) {
function operatorTransferByPartition(bytes32 _partition, address _from, address _to, uint256 _value, bytes calldata _data, bytes calldata _operatorData) external returns (bytes32) {
// TODO: Add a functionality of verifying the `_operatorData`
// TODO: Add a functionality of verifying the `_data`
require(
Expand All @@ -85,4 +85,4 @@ contract ERC1410Operator is ERC1410Basic {
_transferByPartition(_from, _to, _value, _partition, _data, msg.sender, _operatorData);
}

}
}
12 changes: 6 additions & 6 deletions contracts/ERC1410/ERC1410Standard.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pragma solidity ^0.4.24;
pragma solidity ^0.5.0;

import "./ERC1410Operator.sol";
import "./IERC1410.sol";
Expand All @@ -11,7 +11,7 @@ contract ERC1410Standard is IERC1410, ERC1410Operator, Ownable {
/// @param _tokenHolder The token holder whose balance should be increased
/// @param _value The amount by which to increase the balance
/// @param _data Additional data attached to the minting of tokens
function issueByPartition(bytes32 _partition, address _tokenHolder, uint256 _value, bytes _data) external onlyOwner {
function issueByPartition(bytes32 _partition, address _tokenHolder, uint256 _value, bytes calldata _data) external onlyOwner {
// Add the function to validate the `_data` parameter
_validateParams(_partition, _value);
require(_tokenHolder != address(0), "Invalid token receiver");
Expand All @@ -31,7 +31,7 @@ contract ERC1410Standard is IERC1410, ERC1410Operator, Ownable {
/// @param _partition The partition to allocate the decrease in balance
/// @param _value The amount by which to decrease the balance
/// @param _data Additional data attached to the burning of tokens
function redeemByPartition(bytes32 _partition, uint256 _value, bytes _data) external {
function redeemByPartition(bytes32 _partition, uint256 _value, bytes calldata _data) external {
// Add the function to validate the `_data` parameter
_redeemByPartition(_partition, msg.sender, address(0), _value, _data, "");
}
Expand All @@ -43,7 +43,7 @@ contract ERC1410Standard is IERC1410, ERC1410Operator, Ownable {
/// @param _value The amount by which to decrease the balance
/// @param _data Additional data attached to the burning of tokens
/// @param _operatorData Additional data attached to the transfer of tokens by the operator
function operatorRedeemByPartition(bytes32 _partition, address _tokenHolder, uint256 _value, bytes _data, bytes _operatorData) external {
function operatorRedeemByPartition(bytes32 _partition, address _tokenHolder, uint256 _value, bytes calldata _data, bytes calldata _operatorData) external {
// Add the function to validate the `_data` parameter
// TODO: Add a functionality of verifying the `_operatorData`
require(_tokenHolder != address(0), "Invalid from address");
Expand All @@ -54,7 +54,7 @@ contract ERC1410Standard is IERC1410, ERC1410Operator, Ownable {
_redeemByPartition(_partition, _tokenHolder, msg.sender, _value, _data, _operatorData);
}

function _redeemByPartition(bytes32 _partition, address _from, address _operator, uint256 _value, bytes _data, bytes _operatorData) internal {
function _redeemByPartition(bytes32 _partition, address _from, address _operator, uint256 _value, bytes memory _data, bytes memory _operatorData) internal {
// Add the function to validate the `_data` parameter
_validateParams(_partition, _value);
require(_validPartition(_partition, _from), "Invalid partition");
Expand Down Expand Up @@ -84,4 +84,4 @@ contract ERC1410Standard is IERC1410, ERC1410Operator, Ownable {
require(_partition != bytes32(0), "Invalid partition");
}

}
}
18 changes: 9 additions & 9 deletions contracts/ERC1410/IERC1410.sol
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
pragma solidity ^0.4.24;
pragma solidity ^0.5.0;

interface IERC1410 {

// Token Information
function balanceOf(address _tokenHolder) external view returns (uint256);
function balanceOfByPartition(bytes32 _partition, address _tokenHolder) external view returns (uint256);
function partitionsOf(address _tokenHolder) external view returns (bytes32[]);
function partitionsOf(address _tokenHolder) external view returns (bytes32[] memory);
function totalSupply() external view returns (uint256);

// Token Transfers
function transferByPartition(bytes32 _partition, address _to, uint256 _value, bytes _data) external returns (bytes32);
function operatorTransferByPartition(bytes32 _partition, address _from, address _to, uint256 _value, bytes _data, bytes _operatorData) external returns (bytes32);
function canTransferByPartition(address _from, address _to, bytes32 _partition, uint256 _value, bytes _data) external view returns (byte, bytes32, bytes32);
function transferByPartition(bytes32 _partition, address _to, uint256 _value, bytes calldata _data) external returns (bytes32);
function operatorTransferByPartition(bytes32 _partition, address _from, address _to, uint256 _value, bytes calldata _data, bytes calldata _operatorData) external returns (bytes32);
function canTransferByPartition(address _from, address _to, bytes32 _partition, uint256 _value, bytes calldata _data) external view returns (byte, bytes32, bytes32);

// Operator Information
function isOperator(address _operator, address _tokenHolder) external view returns (bool);
Expand All @@ -24,9 +24,9 @@ interface IERC1410 {
function revokeOperatorByPartition(bytes32 _partition, address _operator) external;

// Issuance / Redemption
function issueByPartition(bytes32 _partition, address _tokenHolder, uint256 _value, bytes _data) external;
function redeemByPartition(bytes32 _partition, uint256 _value, bytes _data) external;
function operatorRedeemByPartition(bytes32 _partition, address _tokenHolder, uint256 _value, bytes _data, bytes _operatorData) external;
function issueByPartition(bytes32 _partition, address _tokenHolder, uint256 _value, bytes calldata _data) external;
function redeemByPartition(bytes32 _partition, uint256 _value, bytes calldata _data) external;
function operatorRedeemByPartition(bytes32 _partition, address _tokenHolder, uint256 _value, bytes calldata _data, bytes calldata _operatorData) external;

// Transfer Events
event TransferByPartition(
Expand All @@ -49,4 +49,4 @@ interface IERC1410 {
event IssuedByPartition(bytes32 indexed partition, address indexed to, uint256 value, bytes data);
event RedeemedByPartition(bytes32 indexed partition, address indexed operator, address indexed from, uint256 value, bytes data, bytes operatorData);

}
}
18 changes: 9 additions & 9 deletions contracts/ERC1594/ERC1594.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pragma solidity ^0.4.24;
pragma solidity ^0.5.0;

import "./IERC1594.sol";
import "../ERC20Token.sol";
Expand Down Expand Up @@ -32,7 +32,7 @@ contract ERC1594 is IERC1594, ERC20Token, Ownable {
* for the token contract to interpret or record. This could be signed data authorising the transfer
* (e.g. a dynamic whitelist) but is flexible enough to accomadate other use-cases.
*/
function transferWithData(address _to, uint256 _value, bytes _data) external {
function transferWithData(address _to, uint256 _value, bytes calldata _data) external {
// Add a function to validate the `_data` parameter
_transfer(msg.sender, _to, _value);
}
Expand All @@ -50,7 +50,7 @@ contract ERC1594 is IERC1594, ERC20Token, Ownable {
* for the token contract to interpret or record. This could be signed data authorising the transfer
* (e.g. a dynamic whitelist) but is flexible enough to accomadate other use-cases.
*/
function transferFromWithData(address _from, address _to, uint256 _value, bytes _data) external {
function transferFromWithData(address _from, address _to, uint256 _value, bytes calldata _data) external {
// Add a function to validate the `_data` parameter
_transferFrom(msg.sender, _from, _to, _value);
}
Expand All @@ -75,7 +75,7 @@ contract ERC1594 is IERC1594, ERC20Token, Ownable {
* @param _value The amount of tokens need to be issued
* @param _data The `bytes _data` allows arbitrary data to be submitted alongside the transfer.
*/
function issue(address _tokenHolder, uint256 _value, bytes _data) external onlyOwner {
function issue(address _tokenHolder, uint256 _value, bytes calldata _data) external onlyOwner {
// Add a function to validate the `_data` parameter
require(issuance, "Issuance is closed");
_mint(_tokenHolder, _value);
Expand All @@ -89,7 +89,7 @@ contract ERC1594 is IERC1594, ERC20Token, Ownable {
* @param _value The amount of tokens need to be redeemed
* @param _data The `bytes _data` it can be used in the token contract to authenticate the redemption.
*/
function redeem(uint256 _value, bytes _data) external {
function redeem(uint256 _value, bytes calldata _data) external {
// Add a function to validate the `_data` parameter
_burn(msg.sender, _value);
emit Redeemed(address(0), msg.sender, _value, _data);
Expand All @@ -104,7 +104,7 @@ contract ERC1594 is IERC1594, ERC20Token, Ownable {
* @param _value The amount of tokens need to be redeemed
* @param _data The `bytes _data` it can be used in the token contract to authenticate the redemption.
*/
function redeemFrom(address _tokenHolder, uint256 _value, bytes _data) external {
function redeemFrom(address _tokenHolder, uint256 _value, bytes calldata _data) external {
// Add a function to validate the `_data` parameter
_burnFrom(_tokenHolder, _value);
emit Redeemed(msg.sender, _tokenHolder, _value, _data);
Expand All @@ -121,7 +121,7 @@ contract ERC1594 is IERC1594, ERC20Token, Ownable {
* @return byte Ethereum status code (ESC)
* @return bytes32 Application specific reason code
*/
function canTransfer(address _to, uint256 _value, bytes _data) external view returns (bool, byte, bytes32) {
function canTransfer(address _to, uint256 _value, bytes calldata _data) external view returns (bool, byte, bytes32) {
// Add a function to validate the `_data` parameter
if (_balances[msg.sender] < _value)
return (false, 0x52, bytes32(0));
Expand All @@ -146,7 +146,7 @@ contract ERC1594 is IERC1594, ERC20Token, Ownable {
* @return byte Ethereum status code (ESC)
* @return bytes32 Application specific reason code
*/
function canTransferFrom(address _from, address _to, uint256 _value, bytes _data) external view returns (bool, byte, bytes32) {
function canTransferFrom(address _from, address _to, uint256 _value, bytes calldata _data) external view returns (bool, byte, bytes32) {
// Add a function to validate the `_data` parameter
if (_value > _allowed[_from][msg.sender])
return (false, 0x53, bytes32(0));
Expand All @@ -162,4 +162,4 @@ contract ERC1594 is IERC1594, ERC20Token, Ownable {
return (true, 0x51, bytes32(0));
}

}
}
18 changes: 9 additions & 9 deletions contracts/ERC1594/IERC1594.sol
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
pragma solidity ^0.4.24;
pragma solidity ^0.5.0;

/**
* @title Standard Interface of ERC1594
*/
interface IERC1594 {

// Transfers
function transferWithData(address _to, uint256 _value, bytes _data) external;
function transferFromWithData(address _from, address _to, uint256 _value, bytes _data) external;
function transferWithData(address _to, uint256 _value, bytes calldata _data) external;
function transferFromWithData(address _from, address _to, uint256 _value, bytes calldata _data) external;

// Token Issuance
function isIssuable() external view returns (bool);
function issue(address _tokenHolder, uint256 _value, bytes _data) external;
function issue(address _tokenHolder, uint256 _value, bytes calldata _data) external;

// Token Redemption
function redeem(uint256 _value, bytes _data) external;
function redeemFrom(address _tokenHolder, uint256 _value, bytes _data) external;
function redeem(uint256 _value, bytes calldata _data) external;
function redeemFrom(address _tokenHolder, uint256 _value, bytes calldata _data) external;

// Transfer Validity
function canTransfer(address _to, uint256 _value, bytes _data) external view returns (bool, byte, bytes32);
function canTransferFrom(address _from, address _to, uint256 _value, bytes _data) external view returns (bool, byte, bytes32);
function canTransfer(address _to, uint256 _value, bytes calldata _data) external view returns (bool, byte, bytes32);
function canTransferFrom(address _from, address _to, uint256 _value, bytes calldata _data) external view returns (bool, byte, bytes32);

// Issuance / Redemption Events
event Issued(address indexed _operator, address indexed _to, uint256 _value, bytes _data);
event Redeemed(address indexed _operator, address indexed _from, uint256 _value, bytes _data);

}
}
6 changes: 3 additions & 3 deletions contracts/ERC1594/examples/ERC1594Token.sol
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
pragma solidity ^0.4.24;
pragma solidity ^0.5.0;

import "../ERC1594.sol";
import "openzeppelin-solidity/contracts/token/ERC20/ERC20Detailed.sol";

contract ERC1594Token is ERC1594, ERC20Detailed {

constructor(string name, string symbol, uint8 decimals)
constructor(string memory name, string memory symbol, uint8 decimals)
public
ERC20Detailed(name, symbol, decimals)
{
Expand All @@ -20,4 +20,4 @@ contract ERC1594Token is ERC1594, ERC20Detailed {
emit IssuanceFinalized();
}

}
}
10 changes: 5 additions & 5 deletions contracts/ERC1643/ERC1643.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pragma solidity ^0.4.24;
pragma solidity ^0.5.0;

import "./IERC1643.sol";
import "openzeppelin-solidity/contracts/ownership/Ownable.sol";
Expand Down Expand Up @@ -33,7 +33,7 @@ contract ERC1643 is IERC1643, Ownable {
* @param _uri Off-chain uri of the document from where it is accessible to investors/advisors to read.
* @param _documentHash hash (of the contents) of the document.
*/
function setDocument(bytes32 _name, string _uri, bytes32 _documentHash) external onlyOwner {
function setDocument(bytes32 _name, string calldata _uri, bytes32 _documentHash) external onlyOwner {
require(_name != bytes32(0), "Zero value is not allowed");
require(bytes(_uri).length > 0, "Should not be a empty uri");
if (_documents[_name].lastModified == uint256(0)) {
Expand Down Expand Up @@ -68,7 +68,7 @@ contract ERC1643 is IERC1643, Ownable {
* @return bytes32 The hash (of the contents) of the document.
* @return uint256 the timestamp at which the document was last modified.
*/
function getDocument(bytes32 _name) external view returns (string, bytes32, uint256) {
function getDocument(bytes32 _name) external view returns (string memory, bytes32, uint256) {
return (
_documents[_name].uri,
_documents[_name].docHash,
Expand All @@ -80,8 +80,8 @@ contract ERC1643 is IERC1643, Ownable {
* @notice Used to retrieve a full list of documents attached to the smart contract.
* @return bytes32 List of all documents names present in the contract.
*/
function getAllDocuments() external view returns (bytes32[]) {
function getAllDocuments() external view returns (bytes32[] memory) {
return _docNames;
}

}
}
10 changes: 5 additions & 5 deletions contracts/ERC1643/IERC1643.sol
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
pragma solidity ^0.4.24;
pragma solidity ^0.5.0;

// @title IERC1643 Document Management (part of the ERC1400 Security Token Standards)
/// @dev See https://github.com/SecurityTokenStandard/EIP-Spec

interface IERC1643 {

// Document Management
function getDocument(bytes32 _name) external view returns (string, bytes32, uint256);
function setDocument(bytes32 _name, string _uri, bytes32 _documentHash) external;
function getDocument(bytes32 _name) external view returns (string memory, bytes32, uint256);
function setDocument(bytes32 _name, string calldata _uri, bytes32 _documentHash) external;
function removeDocument(bytes32 _name) external;
function getAllDocuments() external view returns (bytes32[]);
function getAllDocuments() external view returns (bytes32[] memory);

// Document Events
event DocumentRemoved(bytes32 indexed _name, string _uri, bytes32 _documentHash);
event DocumentUpdated(bytes32 indexed _name, string _uri, bytes32 _documentHash);

}
}
Loading