Open quinoah opened 5 years ago
Thanks @quinoah. This is a very interesting request.
As you mentionned correctly, the user attributes are identified by an Id and the corresponding values is stored in a map.
The values are defined by convention. Both the UserRegistry.sol
and OracleEnrichedTokenDelegate.sol
support a remapping of attributes if needed. UserTokensale.sol
does not as the contract is much shorted lived.
Extended Key 0
refers to the validated Tier. This value is only used at the moment to allow generic contribution limits based solely on the validated tier.Extended Key 1
refers to the all time reception AML limit. This limit correspond to the maximum of token that a user may receive in the core. This limit is defined in the base currency of the UserRegistry
. For compatibility and historical reason, this limit is also used in UserTokensale. Whenever the limit is reached, the user must request an increase of his limit.It was envisioned to support more advanced control AML attributes for both reception and emission.
In a simplified approach, it is proposed to used a reception recovery rate which would represent the proven recurrent incomes of the user. It was also considered to provide a max recovery that the recovery rate will never be allowed to exceed.
The reception would then be used in the following formula:: receptionAllowance = allTimeReceptionLimit - totalReceived + Min((now - lastAllTimeReceptionLimitUpdate) * receptionLimitRecoveryRate, maxReceptionRecoveryLimit)
This AML setup will requires these three new following attributes:
Now you are suggesting, two very interesting attributes
It seems very relevant to also to be able to link users with their document hashes. It should be seen how the hash would be used onchain. One use case is to only allow some services if a document is signed. The user can enable the service at any time onchain by submitting the signed hash of the document.
Note for implementation: the current structure of the UserRegistry
does not seems ideal to store document hashes. We could either add a new structure in existing contract mapping(uint256 => bytes32) documentsHash
or add a new contract UserDocuments
to handle this specific concerns.
It shall also be seen if the hashes need to be stored in the state or only in transaction logs.
Storing data onchain and keeping them accurate is costly. Therefore, the focus should be on what features can be enabled by having the data onchain and how the benefits of the feature compare to the cost of maintaining this data.
Hello!
Extended keys (
array
ofuint256
) are presently used in the following way:extendedKeys_[0]
is the validated TierextendedKeys_[1]
is the maximum accepted purchase amount in CHFextendedKeys_[2]
has reserved use for AML recoveryCould it be relevant to add two keys (non-personal data):
extendedKeys_[4]
as auint256
encoding the user's country of residenceextendedKeys_[5]
as auint256
encoding the user's nationalityRegarding encoding, first intuition was to use international phone country code (e.g. 41 for Switzerland) unfortunately some countries have the good idea to share codes (e.g. 1 for both Canada and the US). It looks more convenient to use UN codes or encoded ISO 3166-1.
I'm also thinking of other parameters which are useful in a user context: