-
Notifications
You must be signed in to change notification settings - Fork 13
fix #49 (Multiple KYC Providers) -> TBD in V2 #91
base: master
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -23,6 +23,8 @@ contract Template is ITemplate { | |
| bytes32 public issuerJurisdiction; // Variable contains the jurisdiction of the issuer of the template | ||
| mapping(bytes32 => bool) public allowedJurisdictions; // Mapping that contains the allowed staus of Jurisdictions | ||
| mapping(uint8 => bool) public allowedRoles; // Mapping that contains the allowed status of Roles | ||
| mapping(address => bool) public allowedKYC; // Mapping that contains the status of the kyc providers for this template | ||
| address[10] public allowedKYCProviders; // An array of addresses to store the allowed KYC providers of the template | ||
| bool public accredited; // Variable that define the required level of accrediation for the investor | ||
| address public KYC; // Address of the KYC provider | ||
| bytes32 details; // Details of the offering requirements | ||
|
|
@@ -39,15 +41,16 @@ contract Template is ITemplate { | |
| string _offeringType, | ||
| bytes32 _issuerJurisdiction, | ||
| bool _accredited, | ||
| address _KYC, | ||
| address[10] _whiteListedKYC, | ||
| //address _KYC, | ||
| bytes32 _details, | ||
| uint256 _expires, | ||
| uint256 _fee, | ||
| uint8 _quorum, | ||
| uint256 _vestingPeriod | ||
| ) public | ||
| { | ||
| require(_KYC != address(0) && _owner != address(0)); | ||
| require(_whiteListedKYC[0] != address(0) && _owner != address(0)); | ||
| require(_fee > 0); | ||
| require(_details.length > 0 && _expires > now && _issuerJurisdiction.length > 0); | ||
| require(_quorum > 0 && _quorum <= 100); | ||
|
|
@@ -56,13 +59,28 @@ contract Template is ITemplate { | |
| offeringType = _offeringType; | ||
| issuerJurisdiction = _issuerJurisdiction; | ||
| accredited = _accredited; | ||
| KYC = _KYC; | ||
| details = _details; | ||
| finalized = false; | ||
| expires = _expires; | ||
| fee = _fee; | ||
| quorum = _quorum; | ||
| vestingPeriod = _vestingPeriod; | ||
| require(addAllowedKYC(_whiteListedKYC)); | ||
|
|
||
| } | ||
|
|
||
| /** | ||
| * @dev Internal function used to add whitelisted KYC providers in the template. | ||
| * @param _whiteListedKYC Array of permitted providers. | ||
| * @return bool | ||
| */ | ||
|
|
||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we are missing a function to allow the issuer to disable/reenable a KYC provider if they want to stop using one of them. If a KYC provider is disabled, then they can't be used to verify new investors.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If the particular template is used by one securitytoken only then we can add the functionality of adding more KYC providers and disable them in the Template contract. otherwise, we can maintain their allowedKYC mapping in the security token itself. But I think it doesn't have the sense to use the whitelistedKYC array in the first place(Template Constructor). I am not sure whether the template is used by more than one securityToken or used by one only. |
||
| function addAllowedKYC(address[10] _whiteListedKYC) internal returns(bool) { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How would a new KYC provider be added later on? |
||
| for (uint16 i; i < _whiteListedKYC.length; i++) { | ||
| allowedKYC[_whiteListedKYC[i]] = true; | ||
| allowedKYCProviders[i] = _whiteListedKYC[i]; | ||
| } | ||
| return true; | ||
| } | ||
|
|
||
| /** | ||
|
|
@@ -138,6 +156,15 @@ contract Template is ITemplate { | |
| return true; | ||
| } | ||
|
|
||
| /** | ||
| * @dev check the authentication of the KYC addresses | ||
| * @param _KYC address need to check | ||
| */ | ||
| function validKYC(address _KYC) public returns (bool) { | ||
| return allowedKYC[_KYC]; | ||
| } | ||
|
|
||
|
|
||
| /** | ||
| * @dev getTemplateDetails is a constant function that gets template details | ||
| * @return bytes32 details, bool finalized | ||
|
|
@@ -148,10 +175,10 @@ contract Template is ITemplate { | |
| } | ||
|
|
||
| /** | ||
| * @dev `getUsageFees` is a function to get all the details on template usage fees | ||
| * @dev `getUsageDetails` is a function to get all the details on template usage fees | ||
| * @return uint256 fee, uint8 quorum, uint256 vestingPeriod, address owner, address KYC | ||
| */ | ||
| function getUsageDetails() view public returns (uint256, uint8, uint256, address, address) { | ||
| return (fee, quorum, vestingPeriod, owner, KYC); | ||
| function getUsageDetails() view public returns (uint256, uint8, uint256, address, address[10]) { | ||
| return (fee, quorum, vestingPeriod, owner, allowedKYCProviders); | ||
| } | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is missing what we discussed yesterday about having the issuer be the only one that can add addresses to the whitelist.