diff --git a/contracts/DecentralizedAutonomousTrust.sol b/contracts/DecentralizedAutonomousTrust.sol index 6245f33f..7b330507 100644 --- a/contracts/DecentralizedAutonomousTrust.sol +++ b/contracts/DecentralizedAutonomousTrust.sol @@ -1,6 +1,6 @@ pragma solidity 0.5.13; -import "./Whitelist.sol"; +import "./interfaces/IWhitelist.sol"; import "./math/BigDiv.sol"; import "./math/Sqrt.sol"; import "@openzeppelin/contracts-ethereum-package/contracts/token/ERC20/IERC20.sol"; @@ -105,7 +105,7 @@ contract DecentralizedAutonomousTrust */ /// @notice The contract for transfer authorizations, if any. - Whitelist public whitelist; + IWhitelist public whitelist; /// @notice The total number of burned FAIR tokens, excluding tokens burned from a `Sell` action in the DAT. uint public burnedSupply; @@ -419,7 +419,7 @@ contract DecentralizedAutonomousTrust require(msg.sender == control, "CONTROL_ONLY"); // address(0) is okay - whitelist = Whitelist(_whitelistAddress); + whitelist = IWhitelist(_whitelistAddress); require(_control != address(0), "INVALID_ADDRESS"); control = _control; diff --git a/contracts/Whitelist.sol b/contracts/Whitelist.sol index f28d8897..f9e0428d 100644 --- a/contracts/Whitelist.sol +++ b/contracts/Whitelist.sol @@ -1,12 +1,13 @@ pragma solidity 0.5.13; -import "./interfaces/ERC1404.sol"; +import "./interfaces/IWhitelist.sol"; /** - * @title ERC-1404 whitelist implementation which manages KYC approvals for the org. + * @title whitelist implementation which manages KYC approvals for the org. + * @dev modeled after ERC-1404 */ -contract Whitelist is ERC1404 +contract Whitelist is IWhitelist { /** * Emits when an operator KYC approves (or revokes) a trader. @@ -85,6 +86,8 @@ contract Whitelist is ERC1404 /** * @notice Called by the DAT contract before a transfer occurs. * @dev This call will revert when the transfer is not authorized. + * This is a mutable call to allow additional data to be recorded, + * such as when the user aquired their tokens. */ function authorizeTransfer( address _from, diff --git a/contracts/interfaces/ERC1404.sol b/contracts/interfaces/IWhitelist.sol similarity index 72% rename from contracts/interfaces/ERC1404.sol rename to contracts/interfaces/IWhitelist.sol index 2264d8f6..2c022d2f 100644 --- a/contracts/interfaces/ERC1404.sol +++ b/contracts/interfaces/IWhitelist.sol @@ -4,8 +4,9 @@ pragma solidity 0.5.13; /** * Source: https://raw.githubusercontent.com/simple-restricted-token/reference-implementation/master/contracts/token/ERC1404/ERC1404.sol * With ERC-20 APIs removed (will be implemented as a separate contract). + * And adding authorizeTransfer. */ -interface ERC1404 +interface IWhitelist { /** * @notice Detects if a transfer will be reverted and if so returns an appropriate reference code @@ -32,4 +33,17 @@ interface ERC1404 uint8 restrictionCode ) external pure returns (string memory); + + /** + * @notice Called by the DAT contract before a transfer occurs. + * @dev This call will revert when the transfer is not authorized. + * This is a mutable call to allow additional data to be recorded, + * such as when the user aquired their tokens. + */ + function authorizeTransfer( + address _from, + address _to, + uint _value, + bool _isSell + ) external; } \ No newline at end of file