IFrictionlessPermissionsManager

Git Source

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

function isPermissioned(address userAddress) external view returns (bool);

Parameters

NameTypeDescription

userAddress

address

the wallet address to verify

Returns

NameTypeDescription

<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.

function registerIdentity(address userAddress, uint16 userISOCountry) external returns (address);

Parameters

NameTypeDescription

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

NameTypeDescription

<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.

function getIdentity(address userAddress) external returns (address);

Parameters

NameTypeDescription

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

NameTypeDescription

<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)

function getClaimMsgHash(address userIdentity, IFrictionlessPermissionsManager.FrictionlessPermissionedUser userType)
    external
    view
    returns (bytes32);

Parameters

NameTypeDescription

userIdentity

address

the address of the user's OnChainId (Identity)

userType

IFrictionlessPermissionsManager.FrictionlessPermissionedUser

the type of the user as per the enum

Returns

NameTypeDescription

<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

function hasClaim(address userAddress, FrictionlessPermissionedUser userType) external view returns (bool);

Parameters

NameTypeDescription

userAddress

address

the address of the user's wallet to verify

userType

FrictionlessPermissionedUser

the type of the user as per the enum

Returns

NameTypeDescription

<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.

function addUser(
    address userIdentity,
    FrictionlessPermissionedUser userType,
    bytes memory claimSignature,
    string memory claimURI
) external returns (address);

Parameters

NameTypeDescription

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

NameTypeDescription

<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.

function removeUser(address userAddress) external returns (bool);

Parameters

NameTypeDescription

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

NameTypeDescription

<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.

event FrictionlessPermissionedUserAdded(address userIdentity, uint256 userType, string claimURI);

FrictionlessPermissionedUserRegistered

Emitted when a user is registered in the Frictionless protocol. This event is emitted by the registerIdentity function.

event FrictionlessPermissionedUserRegistered(address userAddress, uint16 userISOCountry);

FrictionlessPermissionedUserRemoved

Emitted when a user is removed in the Frictionless protocol. This event is emitted by the removeUser function.

event FrictionlessPermissionedUserRemoved(address userAddress);

Errors

FrictionlessIsZeroAddress

throws if specific address is zero.

error FrictionlessIsZeroAddress(string);

FrictionlessInvalidPermissionForTreasury

throws if treasury tries to add or remove treasury.

error FrictionlessInvalidPermissionForTreasury();

FrictionlessUserIsNotPermssionedInvestor

throws if user is not a permissioned investor

error FrictionlessUserIsNotPermssionedInvestor();

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.

struct Claim {
    address issuer;
    uint256 topic;
    uint8 scheme;
    address identity;
    bytes signature;
    bytes data;
}

Enums

FrictionlessPermissionedUser

Enum of the Frictionless protocol participants.

enum FrictionlessPermissionedUser {
    PROTOCOL_TREASURY,
    PERMISSIONED_CUSTODIAN,
    PERMISSIONED_INVESTOR,
    PERMISSIONED_MANAGER,
    PERMISSIONED_CALCULATING_AGENT,
    PERMISSIONED_TRANSFER_AGENT,
    PERMISSIONED_FUND_ACCOUNTANT
}
Logo

Copyright © 2024 Frictionless Markets S.à.r.l