KYC Contract
Last updated
Last updated
KYCContract.sol
is a Graphite system smart contract. It's needed for general users and KYC Centers to enable KYC Verification.
The KYC Verification process starts and finishes on the blockchain with function calls of this smart contract. But the KYC verification itself (information providing, verification of the authenticity) happens off-chain between a user and a KYC Center. All private data stays off-chain, only the result of the KYC verification is written on the blockchain.
As a user, to apply for KYC Verification and transfer the deposit for KYC, call createKYCRequest(level, data)
.
As a KYC Center, to approve a user's KYC request and verify KYC Level, call approveKYCRequest(index)
.
As a KYC Center, to decline a user's KYC request in case of a failed verification, call declineRequest(index)
.
As a user, to view one of your KYC requests and check its status, call viewMyRequest(senderKYCIndex)
.
To get the global index of a user's last KYC request, call getLastGlobalRequestIndexOfAddress(addr)
.
To get a KYC request assigned to a KYC Center, call viewRequestAssignedToCentre(KYCCenteraddr, localKYCIndex)
.
As a user, for a pending KYC Request in which the assigned KYC Center was revoked of its role, call repairLostRequest()
to withdraw the KYC request and return the deposit.
As a KYC Center, to revoke a user’s granted KYC Level (justification for the action required), call decreaseKYCLevel(addr, level)
.
setLevelPrice(...)
is for administrative purposes and changes the deposit size needed for each KYC Level.
Call createKYCRequest(level, data)
to request KYC Verification of a desired level for a caller account. The requested KYC Level should be greater than the account's current KYC Level.
A successful call starts the KYC Verification process which is carried out by a randomly selected KYC Center.
level
- integer value; KYCLevel to be granted to a caller account upon successful KYC Verification.
data
- 32 byte array; will be stored in KYCRequest object, has no meaningful use in current v. of Graphite.
Successful createKYCRequest()
call creates KYCRequest
object holding info (user addr, KYC Level, status, KYC Center, deposit) needed for KYC-Verification and stores it on the blockchain. Instances ofKYCRequest
have consecutive integer indexes starting from 0
. Pending KYCRequest
has status
equal to 0
.
This function appoints a randomly choosen KYC Center from the pool of compliant KYC Centers. The chosen KYC Center is the only one for this and related KYCRequest
. Only this KYC Center has the power to then approve or decline the KYCRequest
.
The verification itself is carried out off-chain by the appointed KYC Center. Upon completing it, the KYC Center calls approveKYCRequest(ind)
or declineRequest(ind)
functions of the KYCContract.sol (current one).
Note: Only the result of KYC Verification is written on the blockchain. All private data stays off-chain between a user and a KYC Center which follows strict data protection and governance rules.
If a KYC Level of a function caller account is equal to or greater than the requested KYC level (level
arg.), the error message You already have this KYC level
will be sent and execution will be stopped.
If a caller has not finished KYCVerification, execution will be stopped with a Your previous request is still pending answer
error-message. Approval or decline of an active KYCRequest
is required for the creation of a new one.
If a currency fee bound to a calling transaction is less than the needed amount for the requested KYC Level, the message Provided not enough Ether.
will be sent with no KYCRequest
creation. The exceeding fee amount, if any, will be returned to the function caller.
The KYC Verification can only happen if there is at least one appointed KYC Center on the network. If there is none, There are no kyc centres
error is thrown.
As the KYC-Center of a KYCRequest
, call approveKYCRequest(ind) to approve the very KYCRequest
.
index
- integer value; Index of KYCRequest
object to be approved.
Successful approveKYCRequest(index)
call approves the KYCRequest
under the index
producing KYCLevelChanged(user, level)
, RequestApproved(index)
events.
Function changes the status
of KYCRequest
to 2
. Now the account in KYCRequest
is officially granted the requested KYC-level.
In terms of payment, 50% of the KYCRequest
deposit sum is sent to the user who created KYCRequest
, the other 50% is sent to the KYC-Center responsible for approving KYCRequest
(i.e. calling this function).
Execution will only go through if approveKYCRequest(index)
is called by the KYC-Center mentioned KYCRequest
under index
.
Only KYC-Centers can call this function; Not allowed to approve
error is thrown if called by a non-KYC-Center account.
If the KYCRequest
isn't pending (status
!= 0), the This request is not pending decision
error is thrown.
As the KYC-Center of a KYCRequest
, call declineRequest(ind)
to decline the very KYCRequest
.
index
- integer value; Index of KYCRequest
object to be approved.
Successful declineRequest
call declines the KYCRequest
under the index
producing aRequestApproved(index)
event.
This unction changes the status
of KYCRequest
to 1
. The KYC-Level of the account in KYCRequest
doesn't change.
In terms of payment, 50% of the KYCRequest
deposit sum is sent to the KYC-Center which declined KYCRequest
(i.e. called this function). The rest goes to the Graphite Foundation.
Execution will only go through if declineRequest(index)
is called by the KYC-Center mentioned KYCRequest
under index
.
Only KYC-Centers can call this function; Not allowed to approve
error is thrown if called by a non-KYC-Center account.
For security reasons, it's technically possible to call declineRequest(index)
for both pending (status
= 0) and approved (status
= 2) instances of KYCRequest
.
An account calls viewMyRequest(senderKYCIndex)
to get its KYCRequest
object under an index (account-specific).
Then, for example, a user can check a status
of KYCReuqest
: Pending - 0
, Declined - 1
, Approved - 2
, Withdrawn due to loss of KYC-Center - 3
.
senderKYCIndex
- integer value; Consecutive index (from 0
) of KYCRequest
objects created by function caller account. This index is account-specific. It's not the same as the general index ofKYCRequest
objects mentioned elsewhere in this document.
Returns a caller account's KYCRequest
under an account-specific index.
Calling with an invalid senderKYCIndex
arg. (i.e. an account caller only successfully requested KYC twice; but viewMyRequest(4)
is called) won't return KYCRequest
object.
This function returns the index of the last KYCRequest
created by the user under addr
. Returns -1
if there were none KYCRequests
for the addr
.
Anyone on the network can all this function.
Call viewRequestAssignedToCentre(KYCCenteraddr, localKYCIndex)
to get KYCRequest
object that was assigned to the KYC Center(KYCCenteraddr
) under an index (KYC-Center-specific localKYCIndex
).
Function decreases the KYC Level of a specified account (addr
) to a specified value (level
). It can only be called by a KYC-Center.
The intended purpose of this function is to decrease an account's KYC Level due to fraudulent or suspicious activities. The calling of this function by KYC Centers follows strict guidelines. A KYC Center that abuses the usage of decreaseKYCLevel()
will be removed from its role.
Only decreasing a KYC Level is possible with this mechanism for security reasons.
In an event that the KYC Center assigned to a pending KYCRequest is to be removed from their KYC Center role, KYCRequest
cannot be resolved in a standard way.
In this case, the user (creator of KYCRequest
) can call repairLostRequest()
, to withdraw KYCRequest
(sets its status
= 3) and return all of the KYCRequest
deposit.
Determines the fee size needed to start verification for a certain KYC Level. Only Graphite network admins (owners of the KYCContract smart contract) can call this function.