Skip to content

Commit

Permalink
Merge pull request #54 from ConsenSys/feature/new_repo_structure
Browse files Browse the repository at this point in the history
Feature/new repo structure
  • Loading branch information
gauthierpetetin authored May 4, 2020
2 parents 1016d5e + 0b0e6cb commit f6de24d
Show file tree
Hide file tree
Showing 66 changed files with 14,236 additions and 7,785 deletions.
12 changes: 8 additions & 4 deletions .solcover.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,14 @@ module.exports = {
testCommand: 'node --max-old-space-size=4096 ../node_modules/.bin/truffle test --network coverage',
compileCommand: 'node --max-old-space-size=4096 ../node_modules/.bin/truffle compile --network coverage',
skipFiles: [
'mocks',
'CertificateController/CertificateControllerNonce',
'CertificateController/CertificateControllerSalt',
'tools/FundIssuer'
'certificate/ERC1400CertificateNonce',
'certificate/ERC1400CertificateSalt',
'certificate/certificateControllers/CertificateControllerNonce',
'certificate/certificateControllers/CertificateControllerSalt',
'mocks/BlacklistMock',
'mocks/CertificateControllerMock',
'mocks/ERC1400CertificateMock',
'tools/FundIssuer',
],
copyPackages: ['openzeppelin-solidity'],
}
334 changes: 145 additions & 189 deletions README.md

Large diffs are not rendered by default.

10 changes: 0 additions & 10 deletions contracts/CertificateController/CertificateController.sol

This file was deleted.

1,363 changes: 1,079 additions & 284 deletions contracts/ERC1400.sol

Large diffs are not rendered by default.

158 changes: 124 additions & 34 deletions contracts/IERC1400.sol
Original file line number Diff line number Diff line change
Expand Up @@ -5,52 +5,142 @@
pragma solidity ^0.5.0;

/**
* @title ERC1400 security token standard
* @dev ERC1400 logic
* @title IERC1400 security token standard
* @dev See https://github.com/SecurityTokenStandard/EIP-Spec/blob/master/eip/eip-1400.md
*/
interface IERC1400 {
interface IERC1400 /*is IERC20*/ { // Interfaces can currently not inherit interfaces, but IERC1400 shall include IERC20

// Document Management
function getDocument(bytes32 name) external view returns (string memory, bytes32); // 1/9
function setDocument(bytes32 name, string calldata uri, bytes32 documentHash) external; // 2/9
event Document(bytes32 indexed name, string uri, bytes32 documentHash);
// ****************** Document Management *******************
function getDocument(bytes32 name) external view returns (string memory, bytes32);
function setDocument(bytes32 name, string calldata uri, bytes32 documentHash) external;

// Controller Operation
function isControllable() external view returns (bool); // 3/9
// ******************* Token Information ********************
function balanceOfByPartition(bytes32 partition, address tokenHolder) external view returns (uint256);
function partitionsOf(address tokenHolder) external view returns (bytes32[] memory);

// Token Issuance
function isIssuable() external view returns (bool); // 4/9
function issueByPartition(bytes32 partition, address tokenHolder, uint256 value, bytes calldata data) external; // 5/9
event IssuedByPartition(bytes32 indexed partition, address indexed operator, address indexed to, uint256 value, bytes data, bytes operatorData);
// *********************** Transfers ************************
function transferWithData(address to, uint256 value, bytes calldata data) external;
function transferFromWithData(address from, address to, uint256 value, bytes calldata data) external;

// Token Redemption
function redeemByPartition(bytes32 partition, uint256 value, bytes calldata data) external; // 6/9
function operatorRedeemByPartition(bytes32 partition, address tokenHolder, uint256 value, bytes calldata data, bytes calldata operatorData) external; // 7/9
event RedeemedByPartition(bytes32 indexed partition, address indexed operator, address indexed from, uint256 value, bytes data, bytes operatorData);
// *************** Partition Token Transfers ****************
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);

// // Transfer Validity
function canTransferByPartition(bytes32 partition, address to, uint256 value, bytes calldata data) external view returns (byte, bytes32, bytes32); // 8/9
function canOperatorTransferByPartition(bytes32 partition, address from, address to, uint256 value, bytes calldata data, bytes calldata operatorData) external view returns (byte, bytes32, bytes32); // 9/9
// ****************** Controller Operation ******************
function isControllable() external view returns (bool);
// function controllerTransfer(address from, address to, uint256 value, bytes calldata data, bytes calldata operatorData) external; // removed because same action can be achieved with "operatorTransferByPartition"
// function controllerRedeem(address tokenHolder, uint256 value, bytes calldata data, bytes calldata operatorData) external; // removed because same action can be achieved with "operatorRedeemByPartition"

// ****************** Operator Management *******************
function authorizeOperator(address operator) external;
function revokeOperator(address operator) external;
function authorizeOperatorByPartition(bytes32 partition, address operator) external;
function revokeOperatorByPartition(bytes32 partition, address operator) external;

// ****************** Operator Information ******************
function isOperator(address operator, address tokenHolder) external view returns (bool);
function isOperatorForPartition(bytes32 partition, address operator, address tokenHolder) external view returns (bool);

// ********************* Token Issuance *********************
function isIssuable() external view returns (bool);
function issue(address tokenHolder, uint256 value, bytes calldata data) external;
function issueByPartition(bytes32 partition, address tokenHolder, uint256 value, bytes calldata data) external;

// ******************** Token Redemption ********************
function redeem(uint256 value, bytes calldata data) external;
function redeemFrom(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 operatorData) external;

// ******************* Transfer Validity ********************
// We use different transfer validity functions because those described in the interface don't allow to verify the certificate's validity.
// Indeed, verifying the ecrtificate's validity requires to keeps the function's arguments in the exact same order as the transfer function.
//
// function canTransfer(address to, uint256 value, bytes calldata data) external view returns (byte, bytes32);
// function canTransferFrom(address from, address to, uint256 value, bytes calldata data) external view returns (byte, bytes32);
// function canTransferByPartition(address from, address to, bytes32 partition, uint256 value, bytes calldata data) external view returns (byte, bytes32, bytes32);

// ******************* Controller Events ********************
// We don't use this event as we don't use "controllerTransfer"
// event ControllerTransfer(
// address controller,
// address indexed from,
// address indexed to,
// uint256 value,
// bytes data,
// bytes operatorData
// );
//
// We don't use this event as we don't use "controllerRedeem"
// event ControllerRedemption(
// address controller,
// address indexed tokenHolder,
// uint256 value,
// bytes data,
// bytes operatorData
// );

// ******************** Document Events *********************
event Document(bytes32 indexed name, string uri, bytes32 documentHash);

// ******************** Transfer Events *********************
event TransferByPartition(
bytes32 indexed fromPartition,
address operator,
address indexed from,
address indexed to,
uint256 value,
bytes data,
bytes operatorData
);

event ChangedPartition(
bytes32 indexed fromPartition,
bytes32 indexed toPartition,
uint256 value
);

// ******************** Operator Events *********************
event AuthorizedOperator(address indexed operator, address indexed tokenHolder);
event RevokedOperator(address indexed operator, address indexed tokenHolder);
event AuthorizedOperatorByPartition(bytes32 indexed partition, address indexed operator, address indexed tokenHolder);
event RevokedOperatorByPartition(bytes32 indexed partition, address indexed operator, address indexed tokenHolder);

// ************** 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);
event IssuedByPartition(bytes32 indexed partition, address indexed operator, address indexed to, uint256 value, bytes data, bytes operatorData);
event RedeemedByPartition(bytes32 indexed partition, address indexed operator, address indexed from, uint256 value, bytes operatorData);

}

/**
* Reason codes - ERC1066
* Reason codes - ERC-1066
*
* To improve the token holder experience, canTransfer MUST return a reason byte code
* on success or failure based on the EIP-1066 application-specific status codes specified below.
* on success or failure based on the ERC-1066 application-specific status codes specified below.
* An implementation can also return arbitrary data as a bytes32 to provide additional
* information not captured by the reason code.
*
*
* Code Reason
* 0xA0 Transfer Verified - Unrestricted
* 0xA1 Transfer Verified - On-Chain approval for restricted token
* 0xA2 Transfer Verified - Off-Chain approval for restricted token
* 0xA3 Transfer Blocked - Sender lockup period not ended
* 0xA4 Transfer Blocked - Sender balance insufficient
* 0xA5 Transfer Blocked - Sender not eligible
* 0xA6 Transfer Blocked - Receiver not eligible
* 0xA7 Transfer Blocked - Identity restriction
* 0xA8 Transfer Blocked - Token restriction
* 0xA9 Transfer Blocked - Token granularity
*/
* 0x50 transfer failure
* 0x51 transfer success
* 0x52 insufficient balance
* 0x53 insufficient allowance
* 0x54 transfers halted (contract paused)
* 0x55 funds locked (lockup period)
* 0x56 invalid sender
* 0x57 invalid receiver
* 0x58 invalid operator (transfer agent)
* 0x59
* 0x5a
* 0x5b
* 0x5a
* 0x5b
* 0x5c
* 0x5d
* 0x5e
* 0x5f token meta or info
*
* These codes are being discussed at: https://ethereum-magicians.org/t/erc-1066-ethereum-status-codes-esc/283/24
*/
1 change: 1 addition & 0 deletions contracts/Migrations.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
pragma solidity ^0.5.0;


contract Migrations {

address public owner;
Expand Down
Loading

0 comments on commit f6de24d

Please sign in to comment.