Skip to main content

SoulLinker

Masa Finance

Soul linker

Soul linker smart contract that let add links to a Soulbound token.

Methods

DEFAULT_ADMIN_ROLE

function DEFAULT_ADMIN_ROLE() external view returns (bytes32)

Returns

NameTypeDescription
_0bytes32undefined

PROJECT_ADMIN_ROLE

function PROJECT_ADMIN_ROLE() external view returns (bytes32)

Returns

NameTypeDescription
_0bytes32undefined
function addLink(address paymentMethod, uint256 readerIdentityId, uint256 ownerIdentityId, address token, uint256 tokenId, uint256 signatureDate, uint256 expirationDate, bytes signature) external payable

Stores the link, validating the signature of the given read link request

The token must be linked to this soul linker

Parameters

NameTypeDescription
paymentMethodaddressundefined
readerIdentityIduint256Id of the identity of the reader
ownerIdentityIduint256Id of the identity of the owner of the SBT
tokenaddressAddress of the SBT contract
tokenIduint256Id of the token
signatureDateuint256Signature date of the signature
expirationDateuint256Expiration date of the signature
signaturebytesSignature of the read link request made by the owner

addSoulName

function addSoulName(contract ISoulName soulName) external nonpayable

Add a SoulName contract address linked to this soul store

The caller must have the admin role to call this function

Parameters

NameTypeDescription
soulNamecontract ISoulNameAddress of the SoulName contract

defaultSoulName

function defaultSoulName(address) external view returns (bool exists, address token, uint256 tokenId)

Parameters

NameTypeDescription
_0addressundefined

Returns

NameTypeDescription
existsboolundefined
tokenaddressundefined
tokenIduint256undefined

disablePaymentMethod

function disablePaymentMethod(address _paymentMethod) external nonpayable

Removes a token as a valid payment method

The caller must have the admin role to call this function

Parameters

NameTypeDescription
_paymentMethodaddressToken to remove

eip712Domain

function eip712Domain() external view returns (bytes1 fields, string name, string version, uint256 chainId, address verifyingContract, bytes32 salt, uint256[] extensions)

See {EIP-5267}. Available since v4.9.

Returns

NameTypeDescription
fieldsbytes1undefined
namestringundefined
versionstringundefined
chainIduint256undefined
verifyingContractaddressundefined
saltbytes32undefined
extensionsuint256[]undefined

enablePaymentMethod

function enablePaymentMethod(address _paymentMethod) external nonpayable

Adds a new token as a valid payment method

The caller must have the admin role to call this function

Parameters

NameTypeDescription
_paymentMethodaddressNew token to add

enabledPaymentMethod

function enabledPaymentMethod(address) external view returns (bool)

Parameters

NameTypeDescription
_0addressundefined

Returns

NameTypeDescription
_0boolundefined

enabledPaymentMethods

function enabledPaymentMethods(uint256) external view returns (address)

Parameters

NameTypeDescription
_0uint256undefined

Returns

NameTypeDescription
_0addressundefined

getDefaultSoulName

function getDefaultSoulName(address owner) external view returns (string)

Returns the default soul name of an account

This function queries the default soul name of the specified account

Parameters

NameTypeDescription
owneraddressAddress of the owner of the identities

Returns

NameTypeDescription
_0stringDefault soul name associated to the account

getEnabledPaymentMethods

function getEnabledPaymentMethods() external view returns (address[])

Returns all available payment methods

Returns the address of all available payment methods

Returns

NameTypeDescription
_0address[]Array of all enabled payment methods

getIdentityId

function getIdentityId(address token, uint256 tokenId) external view returns (uint256)

Returns the identityId owned by the given token

The token must be linked to this soul linker

Parameters

NameTypeDescription
tokenaddressAddress of the SBT contract
tokenIduint256Id of the token

Returns

NameTypeDescription
_0uint256Id of the identity

getLinkInfo

function getLinkInfo(address token, uint256 tokenId, uint256 readerIdentityId, uint256 signatureDate) external view returns (struct SoulLinker.LinkData)

Returns the information of link dates for a given SBT token and reader

Parameters

NameTypeDescription
tokenaddressAddress of the SBT contract
tokenIduint256Id of the token
readerIdentityIduint256Id of the identity of the reader of the SBT
signatureDateuint256Signature date of the signature

Returns

NameTypeDescription
_0SoulLinker.LinkDatalinkData List of linked SBTs

getLinkSignatureDates

function getLinkSignatureDates(address token, uint256 tokenId, uint256 readerIdentityId) external view returns (uint256[])

Returns the list of link signature dates for a given SBT token and reader

Parameters

NameTypeDescription
tokenaddressAddress of the SBT contract
tokenIduint256Id of the token
readerIdentityIduint256Id of the identity of the reader of the SBT

Returns

NameTypeDescription
_0uint256[]List of linked SBTs
function getLinks(address token, uint256 tokenId) external view returns (struct SoulLinker.LinkKey[])

Returns the list of link signature dates for a given SBT token and reader

Parameters

NameTypeDescription
tokenaddressAddress of the SBT contract
tokenIduint256Id of the token

Returns

NameTypeDescription
_0SoulLinker.LinkKey[]List of linked SBTs
function getPriceForAddLink(address paymentMethod, address token) external view returns (uint256 price)

Returns the price for storing a link

Returns the current pricing for storing a link

Parameters

NameTypeDescription
paymentMethodaddressAddress of token that user want to pay
tokenaddressToken that user want to store link

Returns

NameTypeDescription
priceuint256Current price for storing a link

getPriceForAddLinkWithProtocolFee

function getPriceForAddLinkWithProtocolFee(address paymentMethod, address token) external view returns (uint256 price, uint256 protocolFee)

Returns the price for storing a link with protocol fee

Returns the current pricing for storing a link with protocol fee

Parameters

NameTypeDescription
paymentMethodaddressAddress of token that user want to pay
tokenaddressToken that user want to store link

Returns

NameTypeDescription
priceuint256Current price for storing a link
protocolFeeuint256Current protocol fee for storing a link

getProtocolFee

function getProtocolFee(address paymentMethod, uint256 amount) external view returns (uint256)

Calculates the protocol fee added to the project fee

This method will calculate the protocol fee based on the payment method

Parameters

NameTypeDescription
paymentMethodaddressAddress of token that user want to pay
amountuint256Price to be paid in the specified payment method

Returns

NameTypeDescription
_0uint256undefined

getProtocolFeeSub

function getProtocolFeeSub(uint256 amount) external view returns (uint256)

Calculates the protocol fee substracted from the amount

This method will calculate the protocol fee based on the payment method

Parameters

NameTypeDescription
amountuint256Price to be paid in the specified payment method

Returns

NameTypeDescription
_0uint256undefined
function getReaderLinks(uint256 readerIdentityId) external view returns (struct SoulLinker.ReaderLink[])

Returns the list of links for a given reader identity id

Parameters

NameTypeDescription
readerIdentityIduint256Id of the identity of the reader of the SBT

Returns

NameTypeDescription
_0SoulLinker.ReaderLink[]List of links for the reader

getRoleAdmin

function getRoleAdmin(bytes32 role) external view returns (bytes32)

Returns the admin role that controls role. See {grantRole} and {revokeRole}. To change a role's admin, use {_setRoleAdmin}.

Parameters

NameTypeDescription
rolebytes32undefined

Returns

NameTypeDescription
_0bytes32undefined

getSBTConnections

function getSBTConnections(uint256 identityId, address token) external view returns (uint256[])

Returns the list of connected SBTs by a given SBT token

Parameters

NameTypeDescription
identityIduint256Id of the identity
tokenaddressAddress of the SBT contract

Returns

NameTypeDescription
_0uint256[]List of connected SBTs

getSBTConnections

function getSBTConnections(address owner, address token) external view returns (uint256[])

Returns the list of connected SBTs by a given SBT token

Parameters

NameTypeDescription
owneraddressAddress of the owner of the identity
tokenaddressAddress of the SBT contract

Returns

NameTypeDescription
_0uint256[]List of connectec SBTs

getSoulNames

function getSoulNames(uint256 tokenId) external view returns (string defaultName, string[] names)

Returns all the active soul names of an account

This function queries all the identity names of the specified identity Id

Parameters

NameTypeDescription
tokenIduint256TokenId of the identity

Returns

NameTypeDescription
defaultNamestringDefault soul name of the account
namesstring[]Array of soul names associated to the account

getSoulNames

function getSoulNames(address owner) external view returns (string defaultName, string[] names)

Returns all the active soul names of an account

This function queries all the identity names of the specified account

Parameters

NameTypeDescription
owneraddressAddress of the owner of the identities

Returns

NameTypeDescription
defaultNamestringDefault soul name of the account
namesstring[]Array of soul names associated to the account

grantRole

function grantRole(bytes32 role, address account) external nonpayable

Grants role to account. If account had not been already granted role, emits a {RoleGranted} event. Requirements: - the caller must have role's admin role. May emit a {RoleGranted} event.

Parameters

NameTypeDescription
rolebytes32undefined
accountaddressundefined

hasRole

function hasRole(bytes32 role, address account) external view returns (bool)

Returns true if account has been granted role.

Parameters

NameTypeDescription
rolebytes32undefined
accountaddressundefined

Returns

NameTypeDescription
_0boolundefined

isSoulName

function isSoulName(address) external view returns (bool)

Parameters

NameTypeDescription
_0addressundefined

Returns

NameTypeDescription
_0boolundefined

masaToken

function masaToken() external view returns (address)

Returns

NameTypeDescription
_0addressundefined

pause

function pause() external nonpayable

Pauses the smart contract

The caller must have the admin role to call this function

paused

function paused() external view returns (bool)

Returns true if the contract is paused, and false otherwise.

Returns

NameTypeDescription
_0boolundefined

projectFeeReceiver

function projectFeeReceiver() external view returns (address)

Returns

NameTypeDescription
_0addressundefined

protocolFeeAmount

function protocolFeeAmount() external view returns (uint256)

Returns

NameTypeDescription
_0uint256undefined

protocolFeePercent

function protocolFeePercent() external view returns (uint256)

Returns

NameTypeDescription
_0uint256undefined

protocolFeePercentSub

function protocolFeePercentSub() external view returns (uint256)

Returns

NameTypeDescription
_0uint256undefined

protocolFeeReceiver

function protocolFeeReceiver() external view returns (address)

Returns

NameTypeDescription
_0addressundefined

removeSoulName

function removeSoulName(contract ISoulName soulName) external nonpayable

Remove a SoulName contract address linked to this soul store

The caller must have the admin role to call this function

Parameters

NameTypeDescription
soulNamecontract ISoulNameAddress of the SoulName contract

renounceRole

function renounceRole(bytes32 role, address account) external nonpayable

Revokes role from the calling account. Roles are often managed via {grantRole} and {revokeRole}: this function's purpose is to provide a mechanism for accounts to lose their privileges if they are compromised (such as when a trusted device is misplaced). If the calling account had been revoked role, emits a {RoleRevoked} event. Requirements: - the caller must be account. May emit a {RoleRevoked} event.

Parameters

NameTypeDescription
rolebytes32undefined
accountaddressundefined
function revokeLink(uint256 readerIdentityId, uint256 ownerIdentityId, address token, uint256 tokenId, uint256 signatureDate) external nonpayable

Revokes the link

The links can be revoked, wether the token is linked or not. The caller must be the owner of the token. The owner of the token can revoke a link even if the reader has not added it yet.

Parameters

NameTypeDescription
readerIdentityIduint256Id of the identity of the reader
ownerIdentityIduint256Id of the identity of the owner of the SBT
tokenaddressAddress of the SBT contract
tokenIduint256Id of the token
signatureDateuint256Signature date of the signature

revokeRole

function revokeRole(bytes32 role, address account) external nonpayable

Revokes role from account. If account had been granted role, emits a {RoleRevoked} event. Requirements: - the caller must have role's admin role. May emit a {RoleRevoked} event.

Parameters

NameTypeDescription
rolebytes32undefined
accountaddressundefined

setDefaultSoulName

function setDefaultSoulName(address token, uint256 tokenId) external nonpayable

Sets the default soul name for the owner

The caller must be the owner of the soul name.

Parameters

NameTypeDescription
tokenaddressAddress of the SoulName contract
tokenIduint256TokenId of the soul name

setMasaToken

function setMasaToken(address _masaToken) external nonpayable

Sets the utility token to pay the fee in (MASA)

The caller must have the admin role to call this function It can be set to address(0) to disable paying in MASA

Parameters

NameTypeDescription
_masaTokenaddressNew utility token to pay the fee in

setProjectFeeReceiver

function setProjectFeeReceiver(address _projectFeeReceiver) external nonpayable

Set the project fee receiver wallet

The caller must have the admin or project admin role to call this function

Parameters

NameTypeDescription
_projectFeeReceiveraddressNew project fee receiver wallet

setProtocolFeeAmount

function setProtocolFeeAmount(uint256 _protocolFeeAmount) external nonpayable

Set the protocol fee amount

The caller must have the admin role to call this function

Parameters

NameTypeDescription
_protocolFeeAmountuint256New protocol fee amount

setProtocolFeePercent

function setProtocolFeePercent(uint256 _protocolFeePercent) external nonpayable

Set the protocol fee percent added to the project fee

The caller must have the admin role to call this function

Parameters

NameTypeDescription
_protocolFeePercentuint256New protocol fee percent added to the project fee

setProtocolFeePercentSub

function setProtocolFeePercentSub(uint256 _protocolFeePercentSub) external nonpayable

Set the protocol fee percent substracted from the amount

The caller must have the admin role to call this function

Parameters

NameTypeDescription
_protocolFeePercentSubuint256New protocol fee percent substracted from the amount

setProtocolFeeReceiver

function setProtocolFeeReceiver(address _protocolFeeReceiver) external nonpayable

Set the protocol fee wallet

The caller must have the admin role to call this function

Parameters

NameTypeDescription
_protocolFeeReceiveraddressNew protocol fee wallet

setSoulboundIdentity

function setSoulboundIdentity(contract ISoulboundIdentity _soulboundIdentity) external nonpayable

Sets the SoulboundIdentity contract address linked to this soul store

The caller must have the admin role to call this function

Parameters

NameTypeDescription
_soulboundIdentitycontract ISoulboundIdentityAddress of the SoulboundIdentity contract

setStableCoin

function setStableCoin(address _stableCoin) external nonpayable

Sets the stable coin to pay the fee in (USDC)

The caller must have the admin role to call this function

Parameters

NameTypeDescription
_stableCoinaddressNew stable coin to pay the fee in

setSwapRouter

function setSwapRouter(address _swapRouter) external nonpayable

Sets the swap router address

The caller must have the admin role to call this function

Parameters

NameTypeDescription
_swapRouteraddressNew swap router address

setWrappedNativeToken

function setWrappedNativeToken(address _wrappedNativeToken) external nonpayable

Sets the wrapped native token address

The caller must have the admin role to call this function

Parameters

NameTypeDescription
_wrappedNativeTokenaddressNew wrapped native token address

soulNames

function soulNames(uint256) external view returns (contract ISoulName)

Parameters

NameTypeDescription
_0uint256undefined

Returns

NameTypeDescription
_0contract ISoulNameundefined

soulboundIdentity

function soulboundIdentity() external view returns (contract ISoulboundIdentity)

Returns

NameTypeDescription
_0contract ISoulboundIdentityundefined

stableCoin

function stableCoin() external view returns (address)

Returns

NameTypeDescription
_0addressundefined

supportsInterface

function supportsInterface(bytes4 interfaceId) external view returns (bool)

See {IERC165-supportsInterface}.

Parameters

NameTypeDescription
interfaceIdbytes4undefined

Returns

NameTypeDescription
_0boolundefined

swapRouter

function swapRouter() external view returns (address)

Returns

NameTypeDescription
_0addressundefined

unpause

function unpause() external nonpayable

Unpauses the smart contract

The caller must have the admin role to call this function

function validateLink(uint256 readerIdentityId, uint256 ownerIdentityId, address token, uint256 tokenId, uint256 signatureDate) external view returns (bool)

Validates the link of the given read link request and returns the data that reader can read if the link is valid

The token must be linked to this soul linker

Parameters

NameTypeDescription
readerIdentityIduint256Id of the identity of the reader
ownerIdentityIduint256Id of the identity of the owner of the SBT
tokenaddressAddress of the SBT contract
tokenIduint256Id of the token
signatureDateuint256Signature date of the signature

Returns

NameTypeDescription
_0boolTrue if the link is valid

wrappedNativeToken

function wrappedNativeToken() external view returns (address)

Returns

NameTypeDescription
_0addressundefined

Events

EIP712DomainChanged

event EIP712DomainChanged()

MAY be emitted to signal that the domain could have changed.

LinkAdded

event LinkAdded(uint256 readerIdentityId, uint256 ownerIdentityId, address token, uint256 tokenId, uint256 signatureDate, uint256 expirationDate)

Parameters

NameTypeDescription
readerIdentityIduint256undefined
ownerIdentityIduint256undefined
tokenaddressundefined
tokenIduint256undefined
signatureDateuint256undefined
expirationDateuint256undefined

LinkRevoked

event LinkRevoked(uint256 readerIdentityId, uint256 ownerIdentityId, address token, uint256 tokenId, uint256 signatureDate)

Parameters

NameTypeDescription
readerIdentityIduint256undefined
ownerIdentityIduint256undefined
tokenaddressundefined
tokenIduint256undefined
signatureDateuint256undefined

Paused

event Paused(address account)

Emitted when the pause is triggered by account.

Parameters

NameTypeDescription
accountaddressundefined

Pay

event Pay(address indexed paymentMethod, uint256 amount, uint256 protocolFee)

Parameters

NameTypeDescription
paymentMethod indexedaddressundefined
amountuint256undefined
protocolFeeuint256undefined

RoleAdminChanged

event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole)

Emitted when newAdminRole is set as role's admin role, replacing previousAdminRole DEFAULT_ADMIN_ROLE is the starting admin for all roles, despite {RoleAdminChanged} not being emitted signaling this. Available since v3.1.

Parameters

NameTypeDescription
role indexedbytes32undefined
previousAdminRole indexedbytes32undefined
newAdminRole indexedbytes32undefined

RoleGranted

event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender)

Emitted when account is granted role. sender is the account that originated the contract call, an admin role bearer except when using {AccessControl-_setupRole}.

Parameters

NameTypeDescription
role indexedbytes32undefined
account indexedaddressundefined
sender indexedaddressundefined

RoleRevoked

event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender)

Emitted when account is revoked role. sender is the account that originated the contract call: - if using revokeRole, it is the admin role bearer - if using renounceRole, it is the role bearer (i.e. account)

Parameters

NameTypeDescription
role indexedbytes32undefined
account indexedaddressundefined
sender indexedaddressundefined

Unpaused

event Unpaused(address account)

Emitted when the pause is lifted by account.

Parameters

NameTypeDescription
accountaddressundefined

Errors

AlreadyAdded

error AlreadyAdded()

CallerNotOwner

error CallerNotOwner(address caller)

Parameters

NameTypeDescription
calleraddressundefined

CallerNotReader

error CallerNotReader(address caller)

Parameters

NameTypeDescription
calleraddressundefined

IdentityOwnerIsReader

error IdentityOwnerIsReader(uint256 readerIdentityId)

Parameters

NameTypeDescription
readerIdentityIduint256undefined

IdentityOwnerNotTokenOwner

error IdentityOwnerNotTokenOwner(uint256 tokenId, uint256 ownerIdentityId)

Parameters

NameTypeDescription
tokenIduint256undefined
ownerIdentityIduint256undefined

InsufficientEthAmount

error InsufficientEthAmount(uint256 amount)

Parameters

NameTypeDescription
amountuint256undefined

InvalidPaymentMethod

error InvalidPaymentMethod(address paymentMethod)

Parameters

NameTypeDescription
paymentMethodaddressundefined

InvalidShortString

error InvalidShortString()

InvalidSignature

error InvalidSignature()

InvalidSignatureDate

error InvalidSignatureDate(uint256 signatureDate)

Parameters

NameTypeDescription
signatureDateuint256undefined

InvalidToken

error InvalidToken(address token)

Parameters

NameTypeDescription
tokenaddressundefined

LinkAlreadyExists

error LinkAlreadyExists(address token, uint256 tokenId, uint256 readerIdentityId, uint256 signatureDate)

Parameters

NameTypeDescription
tokenaddressundefined
tokenIduint256undefined
readerIdentityIduint256undefined
signatureDateuint256undefined

LinkAlreadyRevoked

error LinkAlreadyRevoked()

LinkDoesNotExist

error LinkDoesNotExist()

NonExistingErc20Token

error NonExistingErc20Token(address erc20token)

Parameters

NameTypeDescription
erc20tokenaddressundefined

PaymentParamsNotSet

error PaymentParamsNotSet()

ProtocolFeeReceiverNotSet

error ProtocolFeeReceiverNotSet()

RefundFailed

error RefundFailed()

SameValue

error SameValue()

SoulNameNotExist

error SoulNameNotExist()

SoulNameNotRegistered

error SoulNameNotRegistered(address token)

Parameters

NameTypeDescription
tokenaddressundefined

StringTooLong

error StringTooLong(string str)

Parameters

NameTypeDescription
strstringundefined

TransferFailed

error TransferFailed()

UserMustHaveProtocolOrProjectAdminRole

error UserMustHaveProtocolOrProjectAdminRole()

ValidPeriodExpired

error ValidPeriodExpired(uint256 expirationDate)

Parameters

NameTypeDescription
expirationDateuint256undefined

ZeroAddress

error ZeroAddress()