IFrictionlessPermissionsManager
Author: DEFYCA Labs S.à.r.l
Copyright © 2023 DEFYCA Labs S.à.r.l Permission is hereby granted, free of charge, to any person obtaining a copy of the Frictionless protocol smart contracts (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice (including the next paragraph) shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL DEFYCA LABS S.à.r.l BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
The IFrictionlessPermissionsManager is responsible for the management of permission of the various participants in the Frictionless protocol. The roles and responsibilities are defined in the public README for the Frictionless protocol at https://gitlab.com/dfyclabs/protocol/dfyclabs-tokens/-/blob/main/README.md?ref_type=heads#roles-responsibilities
Functions
isPermissioned
Validates if a wallet address is permissioned in the Frictionless protocol
Parameters
userAddress
address
the wallet address to verify
Returns
<none>
bool
true if the address is permissioned in the Frictionless Protocol.
registerIdentity
Registers a users wallet address as an OnChainId (Identity) to the Frictionless protocol. This Identity is used when permissioning a user to the protocol by invoking the addUser function later.
Parameters
userAddress
address
the address of the user's wallet to register
userISOCountry
uint16
the ISO 3166-1 numeric code of the user, can be the place of residence or the location KYC/AML onboarding was undertaken. requires The msg.sender to have the TREX Agent permissions (PROTOCOL_TREASURY or PROTOCOL_ADMIN)
Returns
<none>
address
address the address of the user's OnChainId (Identity) with the associated claims.
getIdentity
Gets a users OnChainId (Identity) in the Frictionless protocol.
Parameters
userAddress
address
the address of the user's wallet to register requires The msg.sender to have the TREX Agent permissions (PROTOCOL_TREASURY or PROTOCOL_ADMIN)
Returns
<none>
address
address the address of the user's OnChainId (Identity) with the associated claims.
getClaimMsgHash
Get the signed claimData message to be used in the addUser function. The message must be signed using the PK of the ClaimIssuer (PROTOCOL_ADMIN)
Parameters
userIdentity
address
the address of the user's OnChainId (Identity)
userType
IFrictionlessPermissionsManager.FrictionlessPermissionedUser
the type of the user as per the enum
Returns
<none>
bytes32
signed claimData message to be used in the addUser unction once signed by the ClaimIssuer PK.
hasClaim
verify if the userAddress is permissioned in the Frictionless protocol and has a valid claim
Parameters
userAddress
address
the address of the user's wallet to verify
userType
FrictionlessPermissionedUser
the type of the user as per the enum
Returns
<none>
bool
true if a valid permissioned user and has a valid claim, otherwise false.
addUser
Adds a user's OnChainId (Identity) to the Frictionless protocol along with its associated claim data. The Identity is created by invoking the registerIdentity function first.
Parameters
userIdentity
address
the address of the user's OnChainId (Identity)
userType
FrictionlessPermissionedUser
the type of the user as per the enum
claimSignature
bytes
the signed claimData by the ClaimIssuer
claimURI
string
the URI of the off-chain claim for the user. i.e. The Frictionless Markets graphQL endpoint requires The msg.sender to be the Owner if the userType is the PROTOCOL_TREASURY requires The msg.sender to have the TREX Agent permissions (PROTOCOL_TREASURY or PROTOCOL_ADMIN) to add any user
Returns
<none>
address
address the address of the user's OnChainId (Identity) with the associated claims.
removeUser
Removes a user from the Frictionless protocol along with its associated claim data.
Parameters
userAddress
address
the address of the user's wallet requires The msg.sender to have the TREX Agent permissions (PROTOCOL_TREASURY or PROTOCOL_ADMIN) to remove any user
Returns
<none>
bool
true if the user is removed from the Frictionless protocol along with its associated claim data, otherwise false.
Events
FrictionlessPermissionedUserAdded
Emitted when a user is added to the Frictionless protocol. This event is emitted by the addUser
function.
FrictionlessPermissionedUserRegistered
Emitted when a user is registered in the Frictionless protocol. This event is emitted by the registerIdentity
function.
FrictionlessPermissionedUserRemoved
Emitted when a user is removed in the Frictionless protocol. This event is emitted by the removeUser
function.
Errors
FrictionlessIsZeroAddress
throws if specific address is zero.
FrictionlessInvalidPermissionForTreasury
throws if treasury tries to add or remove treasury.
FrictionlessUserIsNotPermssionedInvestor
throws if user is not a permissioned investor
Structs
Claim
the internal struct defining a Claim for a PERMISSIONED_USER in the protocol. Used to submit claims for the OnChainId by the ClaimIssuer.
Enums
FrictionlessPermissionedUser
Enum of the Frictionless protocol participants.