Skip to main content

SoulboundCreditScore

Masa Finance

Soulbound Credit Score

Soulbound token that represents a credit score.

Soulbound credit score, that inherits from the SBT contract.

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

addAuthority

function addAuthority(address _authority) external nonpayable

Adds a new authority to the list of authorities

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

Parameters

NameTypeDescription
_authorityaddressNew authority to add

addLinkPrice

function addLinkPrice() external view returns (uint256)

Returns

NameTypeDescription
_0uint256undefined

addLinkPriceMASA

function addLinkPriceMASA() external view returns (uint256)

Returns

NameTypeDescription
_0uint256undefined

authorities

function authorities(address) external view returns (bool)

Parameters

NameTypeDescription
_0addressundefined

Returns

NameTypeDescription
_0boolundefined

balanceOf

function balanceOf(address owner) external view returns (uint256)

See {ISBT-balanceOf}.

Parameters

NameTypeDescription
owneraddressundefined

Returns

NameTypeDescription
_0uint256undefined

burn

function burn(uint256 tokenId) external nonpayable

Burns tokenId. See {SBT-_burn}. Requirements: - The caller must own tokenId or be an approved operator.

Parameters

NameTypeDescription
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

exists

function exists(uint256 tokenId) external view returns (bool)

Returns true if the token exists

Returns true if the token has been minted

Parameters

NameTypeDescription
tokenIduint256Token to check

Returns

NameTypeDescription
_0boolTrue if the token exists

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(uint256 tokenId) external view returns (uint256)

Returns the identityId owned by the given token

Parameters

NameTypeDescription
tokenIduint256Id of the token

Returns

NameTypeDescription
_0uint256Id of the identity

getMintPrice

function getMintPrice(address paymentMethod) external view returns (uint256 price)

Returns the price for minting

Returns current pricing for minting

Parameters

NameTypeDescription
paymentMethodaddressAddress of token that user want to pay

Returns

NameTypeDescription
priceuint256Current price for minting in the given payment method

getMintPriceWithProtocolFee

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

Returns the price for minting with protocol fee

Returns current pricing for minting with protocol fee

Parameters

NameTypeDescription
paymentMethodaddressAddress of token that user want to pay

Returns

NameTypeDescription
priceuint256Current price for minting in the given payment method
protocolFeeuint256Current protocol fee for minting in the given payment method

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

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

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

masaToken

function masaToken() external view returns (address)

Returns

NameTypeDescription
_0addressundefined

maxSBTToMint

function maxSBTToMint() external view returns (uint256)

Returns

NameTypeDescription
_0uint256undefined

mint

function mint(address paymentMethod, uint256 identityId, address authorityAddress, uint256 signatureDate, bytes signature) external payable returns (uint256)

Mints a new SBT

The caller must have the MINTER role

Parameters

NameTypeDescription
paymentMethodaddressAddress of token that user want to pay
identityIduint256TokenId of the identity to mint the NFT to
authorityAddressaddressAddress of the authority that signed the message
signatureDateuint256Date of the signature
signaturebytesSignature of the message

Returns

NameTypeDescription
_0uint256The SBT ID of the newly minted SBT

mint

function mint(address paymentMethod, address to, address authorityAddress, uint256 signatureDate, bytes signature) external payable returns (uint256)

Mints a new SBT

The caller must have the MINTER role

Parameters

NameTypeDescription
paymentMethodaddressAddress of token that user want to pay
toaddressThe address to mint the SBT to
authorityAddressaddressAddress of the authority that signed the message
signatureDateuint256Date of the signature
signaturebytesSignature of the message

Returns

NameTypeDescription
_0uint256The SBT ID of the newly minted SBT

mintPrice

function mintPrice() external view returns (uint256)

Returns

NameTypeDescription
_0uint256undefined

mintPriceMASA

function mintPriceMASA() external view returns (uint256)

Returns

NameTypeDescription
_0uint256undefined

name

function name() external view returns (string)

See {ISBTMetadata-name}.

Returns

NameTypeDescription
_0stringundefined

ownerOf

function ownerOf(uint256 tokenId) external view returns (address)

See {ISBT-ownerOf}.

Parameters

NameTypeDescription
tokenIduint256undefined

Returns

NameTypeDescription
_0addressundefined

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

queryLinkPrice

function queryLinkPrice() external view returns (uint256)

Returns

NameTypeDescription
_0uint256undefined

queryLinkPriceMASA

function queryLinkPriceMASA() external view returns (uint256)

Returns

NameTypeDescription
_0uint256undefined

removeAuthority

function removeAuthority(address _authority) external nonpayable

Removes an authority from the list of authorities

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

Parameters

NameTypeDescription
_authorityaddressAuthority to remove

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

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

setAddLinkPrice

function setAddLinkPrice(uint256 _addLinkPrice) external nonpayable

Sets the price for adding the link in SoulLinker in stable coin

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

Parameters

NameTypeDescription
_addLinkPriceuint256New price for adding the link in SoulLinker in stable coin

setAddLinkPriceMASA

function setAddLinkPriceMASA(uint256 _addLinkPriceMASA) external nonpayable

Sets the price for adding the link in SoulLinker in MASA

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

Parameters

NameTypeDescription
_addLinkPriceMASAuint256New price for adding the link in SoulLinker in MASA

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

setMintPrice

function setMintPrice(uint256 _mintPrice) external nonpayable

Sets the price of minting in stable coin

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

Parameters

NameTypeDescription
_mintPriceuint256New price of minting in stable coin

setMintPriceMASA

function setMintPriceMASA(uint256 _mintPriceMASA) external nonpayable

Sets the price of minting in MASA

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

Parameters

NameTypeDescription
_mintPriceMASAuint256New price of minting in MASA

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

setQueryLinkPrice

function setQueryLinkPrice(uint256 _queryLinkPrice) external nonpayable

Sets the price for reading data in SoulLinker in stable coin

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

Parameters

NameTypeDescription
_queryLinkPriceuint256New price for reading data in SoulLinker in stable coin

setQueryLinkPriceMASA

function setQueryLinkPriceMASA(uint256 _queryLinkPriceMASA) external nonpayable

Sets the price for reading data in SoulLinker in MASA

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

Parameters

NameTypeDescription
_queryLinkPriceMASAuint256New price for reading data in SoulLinker in MASA

setSoulboundIdentity

function setSoulboundIdentity(address _soulboundIdentity) external nonpayable

Sets the SoulboundIdentity contract address linked to this SBT

The caller must be the admin to call this function

Parameters

NameTypeDescription
_soulboundIdentityaddressAddress 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

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)

Query if a contract implements an interface

Interface identification is specified in ERC-165.

Parameters

NameTypeDescription
interfaceIdbytes4The interface identifier, as specified in ERC-165

Returns

NameTypeDescription
_0booltrue if the contract implements interfaceId and interfaceId is not 0xffffffff, false otherwise

swapRouter

function swapRouter() external view returns (address)

Returns

NameTypeDescription
_0addressundefined

symbol

function symbol() external view returns (string)

See {ISBTMetadata-symbol}.

Returns

NameTypeDescription
_0stringundefined

tokenByIndex

function tokenByIndex(uint256 index) external view returns (uint256)

See {ISBTEnumerable-tokenByIndex}.

Parameters

NameTypeDescription
indexuint256undefined

Returns

NameTypeDescription
_0uint256undefined

tokenOfOwnerByIndex

function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256)

See {ISBTEnumerable-tokenOfOwnerByIndex}.

Parameters

NameTypeDescription
owneraddressundefined
indexuint256undefined

Returns

NameTypeDescription
_0uint256undefined

tokenURI

function tokenURI(uint256 tokenId) external view returns (string)

A distinct Uniform Resource Identifier (URI) for a given asset.

Throws if _tokenId is not a valid SBT. URIs are defined in RFC 3986. The URI may point to a JSON file that conforms to the "ERC721 Metadata JSON Schema".

Parameters

NameTypeDescription
tokenIduint256SBT to get the URI of

Returns

NameTypeDescription
_0stringURI of the SBT

totalSupply

function totalSupply() external view returns (uint256)

See {ISBTEnumerable-totalSupply}.

Returns

NameTypeDescription
_0uint256undefined

wrappedNativeToken

function wrappedNativeToken() external view returns (address)

Returns

NameTypeDescription
_0addressundefined

Events

Burn

event Burn(address indexed _owner, uint256 indexed _tokenId)

This emits when an SBT is burned This event emits when SBTs are destroyed

Parameters

NameTypeDescription
_owner indexedaddressundefined
_tokenId indexeduint256undefined

EIP712DomainChanged

event EIP712DomainChanged()

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

Mint

event Mint(address indexed _owner, uint256 indexed _tokenId)

This emits when an SBT is newly minted. This event emits when SBTs are created

Parameters

NameTypeDescription
_owner indexedaddressundefined
_tokenId indexeduint256undefined

MintedToAddress

event MintedToAddress(uint256 tokenId, address to, address authorityAddress, uint256 signatureDate, address paymentMethod, uint256 mintPrice)

Parameters

NameTypeDescription
tokenIduint256undefined
toaddressundefined
authorityAddressaddressundefined
signatureDateuint256undefined
paymentMethodaddressundefined
mintPriceuint256undefined

MintedToIdentity

event MintedToIdentity(uint256 tokenId, uint256 identityId, address authorityAddress, uint256 signatureDate, address paymentMethod, uint256 mintPrice)

Parameters

NameTypeDescription
tokenIduint256undefined
identityIduint256undefined
authorityAddressaddressundefined
signatureDateuint256undefined
paymentMethodaddressundefined
mintPriceuint256undefined

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

Errors

AlreadyAdded

error AlreadyAdded()

AuthorityNotExists

error AuthorityNotExists(address authority)

Parameters

NameTypeDescription
authorityaddressundefined

CallerNotOwner

error CallerNotOwner(address caller)

Parameters

NameTypeDescription
calleraddressundefined

InsufficientEthAmount

error InsufficientEthAmount(uint256 amount)

Parameters

NameTypeDescription
amountuint256undefined

InvalidPaymentMethod

error InvalidPaymentMethod(address paymentMethod)

Parameters

NameTypeDescription
paymentMethodaddressundefined

InvalidShortString

error InvalidShortString()

InvalidSignature

error InvalidSignature()

InvalidToken

error InvalidToken(address token)

Parameters

NameTypeDescription
tokenaddressundefined

MaxSBTMinted

error MaxSBTMinted(address to, uint256 maximum)

Parameters

NameTypeDescription
toaddressundefined
maximumuint256undefined

NonExistingErc20Token

error NonExistingErc20Token(address erc20token)

Parameters

NameTypeDescription
erc20tokenaddressundefined

NotAuthorized

error NotAuthorized(address signer)

Parameters

NameTypeDescription
signeraddressundefined

NotLinkedToAnIdentitySBT

error NotLinkedToAnIdentitySBT()

PaymentParamsNotSet

error PaymentParamsNotSet()

ProtocolFeeReceiverNotSet

error ProtocolFeeReceiverNotSet()

RefundFailed

error RefundFailed()

SameValue

error SameValue()

StringTooLong

error StringTooLong(string str)

Parameters

NameTypeDescription
strstringundefined

TransferFailed

error TransferFailed()

UserMustHaveProtocolOrProjectAdminRole

error UserMustHaveProtocolOrProjectAdminRole()

ZeroAddress

error ZeroAddress()