This repository was archived by the owner on Jul 6, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 14
fix #49 (Multiple KYC Providers) -> TBD in V2 #91
Open
satyamakgec
wants to merge
2
commits into
master
Choose a base branch
from
multiple-KYC
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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,15 @@ contract Template is ITemplate { | |
string _offeringType, | ||
bytes32 _issuerJurisdiction, | ||
bool _accredited, | ||
address _KYC, | ||
address[10] _whiteListedKYC, | ||
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 +58,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 | ||
*/ | ||
|
||
function addAllowedKYC(address[10] _whiteListedKYC) internal returns(bool) { | ||
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 +155,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 +174,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); | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 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.
We need to figure out what we would do with addresses already verified by a KYC provider if it gets disabled.
Uh oh!
There was an error while loading. Please reload this page.
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.
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.
if we can confirm the above line then I can re-design accordingly