Skip to content

Solidity API

TestDisputeManager

accept

mapping(bytes32 => bool) accept

accepted

function accepted(address provider, address buyer, bytes32 orig, bytes32 crypted) public view returns (bool)

setAccepted

function setAccepted(bytes32 orig, bytes32 crypted, address provider, address buyer) public

PlonkVerifier

n

uint32 n

nPublic

uint16 nPublic

nLagrange

uint16 nLagrange

Qmx

uint256 Qmx

Qmy

uint256 Qmy

Qlx

uint256 Qlx

Qly

uint256 Qly

Qrx

uint256 Qrx

Qry

uint256 Qry

Qox

uint256 Qox

Qoy

uint256 Qoy

Qcx

uint256 Qcx

Qcy

uint256 Qcy

S1x

uint256 S1x

S1y

uint256 S1y

S2x

uint256 S2x

S2y

uint256 S2y

S3x

uint256 S3x

S3y

uint256 S3y

k1

uint256 k1

k2

uint256 k2

X2x1

uint256 X2x1

X2x2

uint256 X2x2

X2y1

uint256 X2y1

X2y2

uint256 X2y2

q

uint256 q

qf

uint256 qf

w1

uint256 w1

G1x

uint256 G1x

G1y

uint256 G1y

G2x1

uint256 G2x1

G2x2

uint256 G2x2

G2y1

uint256 G2y1

G2y2

uint256 G2y2

pA

uint16 pA

pB

uint16 pB

pC

uint16 pC

pZ

uint16 pZ

pT1

uint16 pT1

pT2

uint16 pT2

pT3

uint16 pT3

pWxi

uint16 pWxi

pWxiw

uint16 pWxiw

pEval_a

uint16 pEval_a

pEval_b

uint16 pEval_b

pEval_c

uint16 pEval_c

pEval_s1

uint16 pEval_s1

pEval_s2

uint16 pEval_s2

pEval_zw

uint16 pEval_zw

pEval_r

uint16 pEval_r

pAlpha

uint16 pAlpha

pBeta

uint16 pBeta

pGamma

uint16 pGamma

pXi

uint16 pXi

pXin

uint16 pXin

pBetaXi

uint16 pBetaXi

pV1

uint16 pV1

pV2

uint16 pV2

pV3

uint16 pV3

pV4

uint16 pV4

pV5

uint16 pV5

pV6

uint16 pV6

pU

uint16 pU

pPl

uint16 pPl

pEval_t

uint16 pEval_t

pA1

uint16 pA1

pB1

uint16 pB1

pZh

uint16 pZh

pZhInv

uint16 pZhInv

pEval_l1

uint16 pEval_l1

pEval_l2

uint16 pEval_l2

pEval_l3

uint16 pEval_l3

pEval_l4

uint16 pEval_l4

pEval_l5

uint16 pEval_l5

pEval_l6

uint16 pEval_l6

pEval_l7

uint16 pEval_l7

lastMem

uint16 lastMem

verifyProof

function verifyProof(bytes proof, uint256[] pubSignals) public view returns (bool)

Common

getCurrentBlockNumber

function getCurrentBlockNumber() external view returns (uint256)

getCurrentBlockNumber get block number

Name Type Description
[0] uint256 the current block number

isContract

function isContract(address addr) public view returns (bool)

isContract detect whether the address is is a contract address or externally owned account

Name Type Description
[0] bool true if it is a contract address

provenanceSignatureIsCorrect

function provenanceSignatureIsCorrect(address _agentId, bytes32 _hash, bytes _signature) public pure returns (bool)
Name Type Description
_agentId address The address of the agent
_hash bytes32 bytes32 message, the hash is the signed message. What is recovered is the signer address.
_signature bytes Signatures provided by the agent
Name Type Description
[0] bool true if the signature correspond to the agent address

calculateTotalAmount

function calculateTotalAmount(uint256[] _amounts) public pure returns (uint256)

Sum the total amount given an uint array

Name Type Description
[0] uint256 the total amount

addressToBytes32

function addressToBytes32(address _addr) public pure returns (bytes32)

bytes32ToAddress

function bytes32ToAddress(bytes32 _b32) public pure returns (address)

Dispenser

tokenRequests

mapping(address => uint256) tokenRequests

totalMintAmount

uint256 totalMintAmount

maxAmount

uint256 maxAmount

maxMintAmount

uint256 maxMintAmount

minPeriod

uint256 minPeriod

scale

uint256 scale

token

contract NeverminedToken token

RequestFrequencyExceeded

event RequestFrequencyExceeded(address requester, uint256 minPeriod)

RequestLimitExceeded

event RequestLimitExceeded(address requester, uint256 amount, uint256 maxAmount)

isValidAddress

modifier isValidAddress(address _address)

initialize

function initialize(address _tokenAddress, address _owner) external

Dispenser Initializer

Name Type Description
_tokenAddress address The deployed contract address of an ERC20
_owner address The owner of the Dispenser Runs only on initial contract creation.

requestTokens

function requestTokens(uint256 amount) external returns (bool tokensTransferred)

user can request some tokens for testing

Name Type Description
amount uint256 the amount of tokens to be requested
Name Type Description
tokensTransferred bool Boolean indication of tokens are requested

setMinPeriod

function setMinPeriod(uint256 period) external

the Owner can set the min period for token requests

Name Type Description
period uint256 the min amount of time before next request

setMaxAmount

function setMaxAmount(uint256 amount) external

the Owner can set the max amount for token requests

Name Type Description
amount uint256 the max amount of tokens that can be requested

setMaxMintAmount

function setMaxMintAmount(uint256 amount) external

the Owner can set the max amount for token requests

Name Type Description
amount uint256 the max amount of tokens that can be requested

HashLists

Hash lists contract is a sample list contract in which uses HashListLibrary.sol in order to store, retrieve, remove, and update bytes32 values in hash lists. This is a reference implementation for IList interface. It is used for whitelisting condition. Any entity can have its own implementation of the interface in which could be used for the same condition.

lists

mapping(bytes32 => struct HashListLibrary.List) lists

initialize

function initialize(address _owner) public

HashLists Initializer

Name Type Description
_owner address The owner of the hash list Runs only upon contract creation.

hash

function hash(address account) public pure returns (bytes32)

hash ethereum accounts

Name Type Description
account address Ethereum address
Name Type Description
[0] bytes32 bytes32 hash of the account

add

function add(bytes32[] values) external returns (bool)

put an array of elements without indexing this meant to save gas in case of large arrays

Name Type Description
values bytes32[] is an array of elements value
Name Type Description
[0] bool true if values are added successfully

add

function add(bytes32 value) external returns (bool)

add indexes an element then adds it to a list

Name Type Description
value bytes32 is a bytes32 value
Name Type Description
[0] bool true if value is added successfully

update

function update(bytes32 oldValue, bytes32 newValue) external returns (bool)

update the value with a new value and maintain indices

Name Type Description
oldValue bytes32 is an element value in a list
newValue bytes32 new value
Name Type Description
[0] bool true if value is updated successfully

index

function index(uint256 from, uint256 to) external returns (bool)

index is used to map each element value to its index on the list

Name Type Description
from uint256 index is where to 'from' indexing in the list
to uint256 index is where to stop indexing
Name Type Description
[0] bool true if the sub list is indexed

has

function has(bytes32 id, bytes32 value) external view returns (bool)

has checks whether a value is exist

Name Type Description
id bytes32 the list identifier (the hash of list owner's address)
value bytes32 is element value in list
Name Type Description
[0] bool true if the value exists

has

function has(bytes32 value) external view returns (bool)

has checks whether a value is exist

Name Type Description
value bytes32 is element value in list
Name Type Description
[0] bool true if the value exists

remove

function remove(bytes32 value) external returns (bool)

remove value from a list, updates indices, and list size

Name Type Description
value bytes32 is an element value in a list
Name Type Description
[0] bool true if value is removed successfully

get

function get(bytes32 id, uint256 _index) external view returns (bytes32)

has value by index

Name Type Description
id bytes32 the list identifier (the hash of list owner's address)
_index uint256 is where is value is stored in the list
Name Type Description
[0] bytes32 the value if exists

size

function size(bytes32 id) external view returns (uint256)

size gets the list size

Name Type Description
id bytes32 the list identifier (the hash of list owner's address)
Name Type Description
[0] uint256 total length of the list

all

function all(bytes32 id) external view returns (bytes32[])

all returns all list elements

Name Type Description
id bytes32 the list identifier (the hash of list owner's address)
Name Type Description
[0] bytes32[] all list elements

indexOf

function indexOf(bytes32 id, bytes32 value) external view returns (uint256)

indexOf gets the index of a value in a list

Name Type Description
id bytes32 the list identifier (the hash of list owner's address)
value bytes32 is element value in list
Name Type Description
[0] uint256 value index in list

ownedBy

function ownedBy(bytes32 id) external view returns (address)

ownedBy gets the list owner

Name Type Description
id bytes32 the list identifier (the hash of list owner's address)
Name Type Description
[0] address list owner

isIndexed

function isIndexed(bytes32 id) external view returns (bool)

isIndexed checks if the list is indexed

Name Type Description
id bytes32 the list identifier (the hash of list owner's address)
Name Type Description
[0] bool true if the list is indexed

NeverminedToken

Implementation of a Test Token. Test Token is an ERC20 token only for testing purposes

initialize

function initialize(address _owner, address payable _initialMinter) public

NeverminedToken Initializer Runs only on initial contract creation.

Name Type Description
_owner address refers to the owner of the contract
_initialMinter address payable is the first token minter added

_beforeTokenTransfer

function _beforeTokenTransfer(address from, address to, uint256 amount) internal

_See {ERC20-_beforeTokenTransfer}.

Requirements:

  • minted tokens must not cause the total supply to go over the cap._

mint

function mint(address account, uint256 amount) external returns (bool)

_Creates amount tokens and assigns them to account, increasing the total supply.

Emits a {Transfer} event with from set to the zero address.

Requirements:

  • to cannot be the zero address._

AgreementStoreLibrary

Implementation of the Agreement Store Library. The agreement store library holds the business logic in which manages the life cycle of SEA agreement, each agreement is linked to the DID of an asset, template, and condition IDs.

Agreement

struct Agreement {
  bytes32 did;
  address templateId;
  bytes32[] conditionIds;
  address lastUpdatedBy;
  uint256 blockNumberUpdated;
}

AgreementList

struct AgreementList {
  mapping(bytes32 => struct AgreementStoreLibrary.Agreement) agreements;
  mapping(bytes32 => bytes32[]) didToAgreementIds;
  mapping(address => bytes32[]) templateIdToAgreementIds;
  bytes32[] agreementIds;
}

create

function create(struct AgreementStoreLibrary.AgreementList _self, bytes32 _id, bytes32, address _templateId, bytes32[]) internal

create new agreement checks whether the agreement Id exists, creates new agreement instance, including the template, conditions and DID.

Name Type Description
_self struct AgreementStoreLibrary.AgreementList is AgreementList storage pointer
_id bytes32 agreement identifier
bytes32
_templateId address template identifier
bytes32[]

Template

getConditionTypes

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

AgreementStoreManager

_Implementation of the Agreement Store.

 The agreement store generates conditions for an agreement template.
 Agreement templates must to be approved in the Template Store
 Each agreement is linked to the DID of an asset._

PROXY_ROLE

bytes32 PROXY_ROLE

grantProxyRole

function grantProxyRole(address _address) public

revokeProxyRole

function revokeProxyRole(address _address) public

agreementList

struct AgreementStoreLibrary.AgreementList agreementList

state storage for the agreements

conditionStoreManager

contract ConditionStoreManager conditionStoreManager

templateStoreManager

contract TemplateStoreManager templateStoreManager

didRegistry

contract DIDRegistry didRegistry

initialize

function initialize(address _owner, address _conditionStoreManagerAddress, address _templateStoreManagerAddress, address _didRegistryAddress) public

initialize AgreementStoreManager Initializer Initializes Ownable. Only on contract creation.

Name Type Description
_owner address refers to the owner of the contract
_conditionStoreManagerAddress address is the address of the connected condition store
_templateStoreManagerAddress address is the address of the connected template store
_didRegistryAddress address is the address of the connected DID Registry

fullConditionId

function fullConditionId(bytes32 _agreementId, address _condType, bytes32 _valueHash) public pure returns (bytes32)

agreementId

function agreementId(bytes32 _agreementId, address _creator) public pure returns (bytes32)

createAgreement

function createAgreement(bytes32 _id, bytes32 _did, address[] _conditionTypes, bytes32[] _conditionIds, uint256[] _timeLocks, uint256[] _timeOuts) public

Create a new agreement. The agreement will create conditions of conditionType with conditionId. Only "approved" templates can access this function.

Name Type Description
_id bytes32 is the ID of the new agreement. Must be unique.
_did bytes32 is the bytes32 DID of the asset. The DID must be registered beforehand.
_conditionTypes address[] is a list of addresses that point to Condition contracts.
_conditionIds bytes32[] is a list of bytes32 content-addressed Condition IDs
_timeLocks uint256[] is a list of uint time lock values associated to each Condition
_timeOuts uint256[] is a list of uint time out values associated to each Condition

CreateAgreementArgs

struct CreateAgreementArgs {
  bytes32 _id;
  bytes32 _did;
  address[] _conditionTypes;
  bytes32[] _conditionIds;
  uint256[] _timeLocks;
  uint256[] _timeOuts;
  address _creator;
  uint256 _idx;
  address payable _rewardAddress;
  address _tokenAddress;
  uint256[] _amounts;
  address[] _receivers;
}

createAgreementAndPay

function createAgreementAndPay(struct AgreementStoreManager.CreateAgreementArgs args) public payable

createAgreementAndFulfill

function createAgreementAndFulfill(bytes32 _id, bytes32 _did, address[] _conditionTypes, bytes32[] _conditionIds, uint256[] _timeLocks, uint256[] _timeOuts, address[] _account, uint256[] _idx, bytes[] params) public payable

getAgreementTemplate

function getAgreementTemplate(bytes32 _id) external view returns (address)

getDIDRegistryAddress

function getDIDRegistryAddress() public view virtual returns (address)

getDIDRegistryAddress utility function used by other contracts or any EOA.

Name Type Description
[0] address the DIDRegistry address

AccessCondition

_Implementation of the Access Condition

 Access Secret Store Condition is special condition
 where a client or Parity secret store can encrypt/decrypt documents 
 based on the on-chain granted permissions. For a given DID 
 document, and agreement ID, the owner/provider of the DID 
 will fulfill the condition. Consequently secret store 
 will check whether the permission is granted for the consumer
 in order to encrypt/decrypt the document._

CONDITION_TYPE

bytes32 CONDITION_TYPE

DocumentPermission

struct DocumentPermission {
  bytes32 agreementIdDeprecated;
  mapping(address => bool) permission;
}

documentPermissions

mapping(bytes32 => struct AccessCondition.DocumentPermission) documentPermissions

agreementStoreManager

contract AgreementStoreManager agreementStoreManager

didRegistry

contract DIDRegistry didRegistry

Fulfilled

event Fulfilled(bytes32 _agreementId, bytes32 _documentId, address _grantee, bytes32 _conditionId)

onlyDIDOwnerOrProvider

modifier onlyDIDOwnerOrProvider(bytes32 _documentId)

initialize

function initialize(address _owner, address _conditionStoreManagerAddress, address _agreementStoreManagerAddress) external

initialize init the contract with the following parameters

this function is called only once during the contract initialization.

Name Type Description
_owner address contract's owner account address
_conditionStoreManagerAddress address condition store manager address
_agreementStoreManagerAddress address agreement store manager address

reinitialize

function reinitialize() external

Should be called when the contract has been upgraded.

hashValues

function hashValues(bytes32 _documentId, address _grantee) public pure returns (bytes32)

hashValues generates the hash of condition inputs with the following parameters

Name Type Description
_documentId bytes32 refers to the DID in which secret store will issue the decryption keys
_grantee address is the address of the granted user or the DID provider
Name Type Description
[0] bytes32 bytes32 hash of all these values

fulfill

function fulfill(bytes32 _agreementId, bytes32 _documentId, address _grantee) public returns (enum ConditionStoreLibrary.ConditionState)

fulfill access secret store condition

only DID owner or DID provider can call this method. Fulfill method sets the permissions for the granted consumer's address to true then fulfill the condition

Name Type Description
_agreementId bytes32 agreement identifier
_documentId bytes32 refers to the DID in which secret store will issue the decryption keys
_grantee address is the address of the granted user or the DID provider
Name Type Description
[0] enum ConditionStoreLibrary.ConditionState condition state (Fulfilled/Aborted)

grantPermission

function grantPermission(address _grantee, bytes32 _documentId) public

grantPermission is called only by DID owner or provider

Name Type Description
_grantee address is the address of the granted user or the DID provider
_documentId bytes32 refers to the DID in which secret store will issue the decryption keys

renouncePermission

function renouncePermission(address _grantee, bytes32 _documentId) public

renouncePermission is called only by DID owner or provider

Name Type Description
_grantee address is the address of the granted user or the DID provider
_documentId bytes32 refers to the DID in which secret store will issue the decryption keys

checkPermissions

function checkPermissions(address _grantee, bytes32 _documentId) external view returns (bool permissionGranted)

checkPermissions is called by Parity secret store

Name Type Description
_grantee address is the address of the granted user or the DID provider
_documentId bytes32 refers to the DID in which secret store will issue the decryption keys
Name Type Description
permissionGranted bool true if the access was granted

IDisputeManager

verifyProof

function verifyProof(bytes proof, uint256[] pubSignals) external view returns (bool)

AccessProofCondition

Implementation of the Access Condition with transfer proof. The idea is that the hash of the decryption key is known before hand, and the key matching this hash is passed from data provider to the buyer using this smart contract. Using ZK proof the key is kept hidden from outsiders. For the protocol to work, both the provider and buyer need to have public keys in the babyjub curve. To initiate the deal, buyer will pass the key hash and the public keys of participants. The provider needs to pass the cipher text encrypted using MIMC (symmetric encryption). The secret key for MIMC is computed using ECDH (requires one public key and one secret key for the curve). The hash function that is used is Poseidon.

CONDITION_TYPE

bytes32 CONDITION_TYPE

agreementStoreManager

contract AgreementStoreManager agreementStoreManager

disputeManager

contract IDisputeManager disputeManager

Fulfilled

event Fulfilled(bytes32 _agreementId, uint256 _origHash, uint256[2] _buyer, uint256[2] _provider, uint256[2] _cipher, bytes _proof, bytes32 _conditionId)

initialize

function initialize(address _owner, address _conditionStoreManagerAddress, address _agreementStoreManagerAddress, address _disputeManagerAddress) external

initialize init the contract with the following parameters

this function is called only once during the contract initialization.

Name Type Description
_owner address contract's owner account address
_conditionStoreManagerAddress address condition store manager address
_agreementStoreManagerAddress address agreement store manager address
_disputeManagerAddress address dispute manager address

changeDisputeManager

function changeDisputeManager(address _disputeManagerAddress) external

hashValues

function hashValues(uint256 _origHash, uint256[2] _buyer, uint256[2] _provider) public pure returns (bytes32)

hashValues generates the hash of condition inputs with the following parameters

Name Type Description
_origHash uint256 is the hash of the key
_buyer uint256[2] buyer public key
_provider uint256[2] provider public key
Name Type Description
[0] bytes32 bytes32 hash of all these values

fulfill

function fulfill(bytes32 _agreementId, uint256 _origHash, uint256[2] _buyer, uint256[2] _provider, uint256[2] _cipher, bytes _proof) public returns (enum ConditionStoreLibrary.ConditionState)

fulfill key transfer

The key with hash _origHash is transferred to the _buyer from _provider.

Name Type Description
_agreementId bytes32 associated agreement
_origHash uint256 is the hash of data to access
_buyer uint256[2] buyer public key
_provider uint256[2] provider public key
_cipher uint256[2] encrypted version of the key
_proof bytes SNARK proof that the cipher text can be decrypted by buyer to give the key with hash _origHash
Name Type Description
[0] enum ConditionStoreLibrary.ConditionState condition state (Fulfilled/Aborted)

ComputeExecutionCondition

Implementation of the Compute Execution Condition This condition is meant to be a signal in which triggers the execution of a compute service. The compute service is fully described in the associated DID document. The provider of the compute service will send this signal to its workers by fulfilling the condition where they are listening to the fulfilled event.

CONDITION_TYPE

bytes32 CONDITION_TYPE

computeExecutionStatus

mapping(bytes32 => mapping(address => bool)) computeExecutionStatus

agreementStoreManager

contract AgreementStoreManager agreementStoreManager

Fulfilled

event Fulfilled(bytes32 _agreementId, bytes32 _did, address _computeConsumer, bytes32 _conditionId)

onlyDIDOwnerOrProvider

modifier onlyDIDOwnerOrProvider(bytes32 _did)

initialize

function initialize(address _owner, address _conditionStoreManagerAddress, address _agreementStoreManagerAddress) external

initialize init the contract with the following parameters

this function is called only once during the contract initialization.

Name Type Description
_owner address contract's owner account address
_conditionStoreManagerAddress address condition store manager address
_agreementStoreManagerAddress address agreement store manager address

hashValues

function hashValues(bytes32 _did, address _computeConsumer) public pure returns (bytes32)

hashValues generates the hash of condition inputs with the following parameters

Name Type Description
_did bytes32 Decentralized Identifier (unique compute/asset resolver) describes the compute service
_computeConsumer address is the consumer's address
Name Type Description
[0] bytes32 bytes32 hash of all these values

fulfill

function fulfill(bytes32 _agreementId, bytes32 _did, address _computeConsumer) public returns (enum ConditionStoreLibrary.ConditionState)

fulfill compute execution condition

only the compute provider can fulfill this condition. By fulfilling this condition the compute provider will trigger the execution of the offered job/compute. The compute service is described in a DID document.

Name Type Description
_agreementId bytes32 agreement identifier
_did bytes32 Decentralized Identifier (unique compute/asset resolver) describes the compute service
_computeConsumer address is the consumer's address
Name Type Description
[0] enum ConditionStoreLibrary.ConditionState condition state (Fulfilled/Aborted)

wasComputeTriggered

function wasComputeTriggered(bytes32 _did, address _computeConsumer) public view returns (bool)

wasComputeTriggered checks whether the compute is triggered or not.

Name Type Description
_did bytes32 Decentralized Identifier (unique compute/asset resolver) describes the compute service
_computeConsumer address is the compute consumer's address
Name Type Description
[0] bool true if the compute is triggered

Condition

_Implementation of the Condition

 Each condition has a validation function that returns either FULFILLED, 
 ABORTED or UNFULFILLED. When a condition is successfully solved, we call 
 it FULFILLED. If a condition cannot be FULFILLED anymore due to a timeout 
 or other types of counter-proofs, the condition is ABORTED. UNFULFILLED 
 values imply that a condition has not been provably FULFILLED or ABORTED. 
 All initialized conditions start out as UNFULFILLED._

conditionStoreManager

contract ConditionStoreManager conditionStoreManager

generateId

function generateId(bytes32 _agreementId, bytes32 _valueHash) public view returns (bytes32)

generateId condition Id from the following parameters

Name Type Description
_agreementId bytes32 SEA agreement ID
_valueHash bytes32 hash of all the condition input values

fulfill

function fulfill(bytes32 _id, enum ConditionStoreLibrary.ConditionState _newState) internal returns (enum ConditionStoreLibrary.ConditionState)

fulfill set the condition state to Fulfill | Abort

Name Type Description
_id bytes32 condition identifier
_newState enum ConditionStoreLibrary.ConditionState new condition state (Fulfill/Abort)
Name Type Description
[0] enum ConditionStoreLibrary.ConditionState the updated condition state

abortByTimeOut

function abortByTimeOut(bytes32 _id) external returns (enum ConditionStoreLibrary.ConditionState)

abortByTimeOut set condition state to Aborted if the condition is timed out

Name Type Description
_id bytes32 condition identifier
Name Type Description
[0] enum ConditionStoreLibrary.ConditionState the updated condition state

ConditionStoreLibrary

_Implementation of the Condition Store Library.

 Condition is a key component in the service execution agreement. 
 This library holds the logic for creating and updating condition 
 Any Condition has only four state transitions starts with Uninitialized,
 Unfulfilled, Fulfilled, and Aborted. Condition state transition goes only 
 forward from Unintialized -> Unfulfilled -> {Fulfilled || Aborted}_

ConditionState

enum ConditionState {
  Uninitialized,
  Unfulfilled,
  Fulfilled,
  Aborted
}

Condition

struct Condition {
  address typeRef;
  enum ConditionStoreLibrary.ConditionState state;
  address createdBy;
  address lastUpdatedBy;
  uint256 blockNumberUpdated;
}

ConditionList

struct ConditionList {
  mapping(bytes32 => struct ConditionStoreLibrary.Condition) conditions;
  mapping(bytes32 => mapping(bytes32 => bytes32)) map;
  bytes32[] conditionIds;
}

create

function create(struct ConditionStoreLibrary.ConditionList _self, bytes32 _id, address _typeRef) internal

create new condition

check whether the condition exists, assigns condition type, condition state, last updated by, and update at (which is the current block number)

Name Type Description
_self struct ConditionStoreLibrary.ConditionList is the ConditionList storage pointer
_id bytes32 valid condition identifier
_typeRef address condition contract address

updateState

function updateState(struct ConditionStoreLibrary.ConditionList _self, bytes32 _id, enum ConditionStoreLibrary.ConditionState _newState) internal

updateState update the condition state

check whether the condition state transition is right, assign the new state, update last updated by and updated at.

Name Type Description
_self struct ConditionStoreLibrary.ConditionList is the ConditionList storage pointer
_id bytes32 condition identifier
_newState enum ConditionStoreLibrary.ConditionState the new state of the condition

updateKeyValue

function updateKeyValue(struct ConditionStoreLibrary.ConditionList _self, bytes32 _id, bytes32 _key, bytes32 _value) internal

ConditionStoreManager

_Implementation of the Condition Store Manager.

 Condition store manager is responsible for enforcing the 
 the business logic behind creating/updating the condition state
 based on the assigned role to each party. Only specific type of
 contracts are allowed to call this contract, therefore there are 
 two types of roles, create role that in which is able to create conditions.
 The second role is the update role, which is can update the condition state.
 Also, it support delegating the roles to other contract(s)/account(s)._

PROXY_ROLE

bytes32 PROXY_ROLE

RoleType

enum RoleType {
  Create,
  Update
}

createRole

address createRole

conditionList

struct ConditionStoreLibrary.ConditionList conditionList

epochList

struct EpochLibrary.EpochList epochList

nvmConfigAddress

address nvmConfigAddress

ConditionCreated

event ConditionCreated(bytes32 _id, address _typeRef, address _who)

ConditionUpdated

event ConditionUpdated(bytes32 _id, address _typeRef, enum ConditionStoreLibrary.ConditionState _state, address _who)

onlyCreateRole

modifier onlyCreateRole()

onlyUpdateRole

modifier onlyUpdateRole(bytes32 _id)

onlyValidType

modifier onlyValidType(address typeRef)

initialize

function initialize(address _creator, address _owner, address _nvmConfigAddress) public

initialize ConditionStoreManager Initializer Initialize Ownable. Only on contract creation,

Name Type Description
_creator address refers to the creator of the contract
_owner address refers to the owner of the contract
_nvmConfigAddress address refers to the contract address of NeverminedConfig

getCreateRole

function getCreateRole() external view returns (address)

getCreateRole get the address of contract which has the create role

Name Type Description
[0] address create condition role address

getNvmConfigAddress

function getNvmConfigAddress() external view returns (address)

getNvmConfigAddress get the address of the NeverminedConfig contract

Name Type Description
[0] address NeverminedConfig contract address

setNvmConfigAddress

function setNvmConfigAddress(address _addr) external

delegateCreateRole

function delegateCreateRole(address delegatee) external

delegateCreateRole only owner can delegate the create condition role to a different address

Name Type Description
delegatee address delegatee address

delegateUpdateRole

function delegateUpdateRole(bytes32 _id, address delegatee) external

delegateUpdateRole only owner can delegate the update role to a different address for specific condition Id which has the create role

Name Type Description
_id bytes32
delegatee address delegatee address

grantProxyRole

function grantProxyRole(address _address) public

revokeProxyRole

function revokeProxyRole(address _address) public

createCondition

function createCondition(bytes32 _id, address _typeRef) external

createCondition only called by create role address the condition should use a valid condition contract address, valid time lock and timeout. Moreover, it enforce the condition state transition from Uninitialized to Unfulfilled.

Name Type Description
_id bytes32 unique condition identifier
_typeRef address condition contract address

createCondition2

function createCondition2(bytes32 _id, address _typeRef) external

createCondition

function createCondition(bytes32 _id, address _typeRef, uint256 _timeLock, uint256 _timeOut) public

createCondition only called by create role address the condition should use a valid condition contract address, valid time lock and timeout. Moreover, it enforce the condition state transition from Uninitialized to Unfulfilled.

Name Type Description
_id bytes32 unique condition identifier
_typeRef address condition contract address
_timeLock uint256 start of the time window
_timeOut uint256 end of the time window

updateConditionState

function updateConditionState(bytes32 _id, enum ConditionStoreLibrary.ConditionState _newState) external returns (enum ConditionStoreLibrary.ConditionState)

updateConditionState only called by update role address. It enforce the condition state transition to either Fulfill or Aborted state

Name Type Description
_id bytes32 unique condition identifier
_newState enum ConditionStoreLibrary.ConditionState
Name Type Description
[0] enum ConditionStoreLibrary.ConditionState the current condition state

updateConditionMapping

function updateConditionMapping(bytes32 _id, bytes32 _key, bytes32 _value) external

updateConditionMappingProxy

function updateConditionMappingProxy(bytes32 _id, bytes32 _key, bytes32 _value) external

getCondition

function getCondition(bytes32 _id) external view returns (address typeRef, enum ConditionStoreLibrary.ConditionState state, uint256 timeLock, uint256 timeOut, uint256 blockNumber)

getCondition

Name Type Description
typeRef address the type reference
state enum ConditionStoreLibrary.ConditionState condition state
timeLock uint256 the time lock
timeOut uint256 time out
blockNumber uint256 block number

getConditionState

function getConditionState(bytes32 _id) external view virtual returns (enum ConditionStoreLibrary.ConditionState)

getConditionState

Name Type Description
[0] enum ConditionStoreLibrary.ConditionState condition state

getConditionTypeRef

function getConditionTypeRef(bytes32 _id) external view virtual returns (address)

getConditionTypeRef

Name Type Description
[0] address condition typeRef

getMappingValue

function getMappingValue(bytes32 _id, bytes32 _key) external view virtual returns (bytes32)

getConditionState

Name Type Description
[0] bytes32 condition state

isConditionTimeLocked

function isConditionTimeLocked(bytes32 _id) public view returns (bool)

isConditionTimeLocked

Name Type Description
[0] bool whether the condition is timedLock ended

isConditionTimedOut

function isConditionTimedOut(bytes32 _id) public view returns (bool)

isConditionTimedOut

Name Type Description
[0] bool whether the condition is timed out

HashLockCondition

Implementation of the Hash Lock Condition

CONDITION_TYPE

bytes32 CONDITION_TYPE

initialize

function initialize(address _owner, address _conditionStoreManagerAddress) external

initialize init the contract with the following parameters

this function is called only once during the contract initialization.

Name Type Description
_owner address contract's owner account address
_conditionStoreManagerAddress address condition store manager address

hashValues

function hashValues(uint256 _preimage) public pure returns (bytes32)

hashValues generates the hash of condition inputs with the following parameters

Name Type Description
_preimage uint256 refers uint value of the hash pre-image.
Name Type Description
[0] bytes32 bytes32 hash of all these values

hashValues

function hashValues(string _preimage) public pure returns (bytes32)

hashValues generates the hash of condition inputs with the following parameters

Name Type Description
_preimage string refers string value of the hash pre-image.
Name Type Description
[0] bytes32 bytes32 hash of all these values

hashValues

function hashValues(bytes32 _preimage) public pure returns (bytes32)

hashValues generates the hash of condition inputs with the following parameters

Name Type Description
_preimage bytes32 refers bytes32 value of the hash pre-image.
Name Type Description
[0] bytes32 bytes32 hash of all these values

fulfill

function fulfill(bytes32 _agreementId, uint256 _preimage) external returns (enum ConditionStoreLibrary.ConditionState)

fulfill the condition by calling check the the hash and the pre-image uint value

Name Type Description
_agreementId bytes32 SEA agreement identifier
_preimage uint256
Name Type Description
[0] enum ConditionStoreLibrary.ConditionState condition state

fulfill

function fulfill(bytes32 _agreementId, string _preimage) public returns (enum ConditionStoreLibrary.ConditionState)

fulfill the condition by calling check the the hash and the pre-image string value

Name Type Description
_agreementId bytes32 SEA agreement identifier
_preimage string
Name Type Description
[0] enum ConditionStoreLibrary.ConditionState condition state

fulfill

function fulfill(bytes32 _agreementId, bytes32 _preimage) external returns (enum ConditionStoreLibrary.ConditionState)

fulfill the condition by calling check the the hash and the pre-image bytes32 value

Name Type Description
_agreementId bytes32 SEA agreement identifier
_preimage bytes32
Name Type Description
[0] enum ConditionStoreLibrary.ConditionState condition state

_fulfill

function _fulfill(bytes32 _generatedId) private returns (enum ConditionStoreLibrary.ConditionState)

_fulfill calls super fulfil method

Name Type Description
_generatedId bytes32 SEA agreement identifier
Name Type Description
[0] enum ConditionStoreLibrary.ConditionState condition state

ICondition

fulfillProxy

function fulfillProxy(address _account, bytes32 _agreementId, bytes params) external payable

ILockPayment

Fulfilled

event Fulfilled(bytes32 _agreementId, bytes32 _did, bytes32 _conditionId, address _rewardAddress, address _tokenAddress, address[] _receivers, uint256[] _amounts)

hashValues

function hashValues(bytes32 _did, address _rewardAddress, address _tokenAddress, uint256[] _amounts, address[] _receivers) external pure returns (bytes32)

hashValues generates the hash of condition inputs with the following parameters

Name Type Description
_did bytes32 the asset decentralized identifier
_rewardAddress address the contract address where the reward is locked
_tokenAddress address the ERC20 contract address to use during the lock payment. If the address is 0x0 means we won't use a ERC20 but ETH for payment
_amounts uint256[] token amounts to be locked/released
_receivers address[] receiver's addresses
Name Type Description
[0] bytes32 bytes32 hash of all these values

fulfill

function fulfill(bytes32 _agreementId, bytes32 _did, address payable _rewardAddress, address _tokenAddress, uint256[] _amounts, address[] _receivers) external payable returns (enum ConditionStoreLibrary.ConditionState)

fulfill requires valid token transfer in order to lock the amount of tokens based on the SEA

Name Type Description
_agreementId bytes32 the agreement identifier
_did bytes32 the asset decentralized identifier
_rewardAddress address payable the contract address where the reward is locked
_tokenAddress address the ERC20 contract address to use during the lock payment.
_amounts uint256[] token amounts to be locked/released
_receivers address[] receiver's addresses
Name Type Description
[0] enum ConditionStoreLibrary.ConditionState condition state

LockPaymentCondition

Implementation of the Lock Payment Condition This condition allows to lock payment for multiple receivers taking into account the royalties to be paid to the original creators in a secondary market.

didRegistry

contract DIDRegistry didRegistry

nvmConfig

contract INVMConfig nvmConfig

CONDITION_TYPE

bytes32 CONDITION_TYPE

KEY_ASSET_RECEIVER

bytes32 KEY_ASSET_RECEIVER

PROXY_ROLE

bytes32 PROXY_ROLE

ALLOWED_EXTERNAL_CONTRACT_ROLE

bytes32 ALLOWED_EXTERNAL_CONTRACT_ROLE

grantProxyRole

function grantProxyRole(address _address) public

revokeProxyRole

function revokeProxyRole(address _address) public

grantExternalContractRole

function grantExternalContractRole(address _address) public

revokeExternalContractRole

function revokeExternalContractRole(address _address) public

initialize

function initialize(address _owner, address _conditionStoreManagerAddress, address _didRegistryAddress) external

initialize init the contract with the following parameters

this function is called only once during the contract initialization.

Name Type Description
_owner address contract's owner account address
_conditionStoreManagerAddress address condition store manager address
_didRegistryAddress address DID Registry address

reinitialize

function reinitialize() external

Should be called when the contract has been upgraded.

hashValues

function hashValues(bytes32 _did, address _rewardAddress, address _tokenAddress, uint256[] _amounts, address[] _receivers) public pure returns (bytes32)

hashValues generates the hash of condition inputs with the following parameters

Name Type Description
_did bytes32 the asset decentralized identifier
_rewardAddress address the contract address where the reward is locked
_tokenAddress address the ERC20 contract address to use during the lock payment. If the address is 0x0 means we won't use a ERC20 but ETH for payment
_amounts uint256[] token amounts to be locked/released
_receivers address[] receiver's addresses
Name Type Description
[0] bytes32 bytes32 hash of all these values

fulfill

function fulfill(bytes32 _agreementId, bytes32 _did, address payable _rewardAddress, address _tokenAddress, uint256[] _amounts, address[] _receivers) external payable returns (enum ConditionStoreLibrary.ConditionState)

fulfill requires valid token transfer in order to lock the amount of tokens based on the SEA

Name Type Description
_agreementId bytes32 the agreement identifier
_did bytes32 the asset decentralized identifier
_rewardAddress address payable the contract address where the reward is locked
_tokenAddress address the ERC20 contract address to use during the lock payment.
_amounts uint256[] token amounts to be locked/released
_receivers address[] receiver's addresses
Name Type Description
[0] enum ConditionStoreLibrary.ConditionState condition state

fulfillExternal

function fulfillExternal(bytes32 _agreementId, bytes32 _did, address payable _rewardAddress, address _externalContract, bytes32 _remoteId, uint256[] _amounts, address[] _receivers) external payable returns (enum ConditionStoreLibrary.ConditionState)

fulfill lock condition using the funds locked in an external contract (auction, bonding curve, lottery, etc)

Name Type Description
_agreementId bytes32 the agreement identifier
_did bytes32 the asset decentralized identifier
_rewardAddress address payable the contract address where the reward is locked
_externalContract address the address of the contract with the lock funds are locked
_remoteId bytes32 the id used to identify into the external contract
_amounts uint256[] token amounts to be locked/released
_receivers address[] receiver's addresses
Name Type Description
[0] enum ConditionStoreLibrary.ConditionState condition state

encodeParams

function encodeParams(bytes32 _did, address payable _rewardAddress, address _tokenAddress, uint256[] _amounts, address[] _receivers) external pure returns (bytes)

fulfillInternal

function fulfillInternal(address _account, bytes32 _agreementId, bytes32 _did, address payable _rewardAddress, address _tokenAddress, uint256[] _amounts, address[] _receivers) internal returns (enum ConditionStoreLibrary.ConditionState)

fulfillProxy

function fulfillProxy(address _account, bytes32 _agreementId, bytes params) external payable

_transferERC20Proxy

function _transferERC20Proxy(address _senderAddress, address _rewardAddress, address _tokenAddress, uint256 _amount) internal

_transferERC20Proxy transfer ERC20 tokens

Will throw if transfer fails

Name Type Description
_senderAddress address the address to send the tokens from
_rewardAddress address the address to receive the tokens
_tokenAddress address the ERC20 contract address to use during the payment
_amount uint256 token amount to be locked/released

_transferETH

function _transferETH(address payable _rewardAddress, uint256 _amount) internal

_transferETH transfer ETH

Name Type Description
_rewardAddress address payable the address to receive the ETH
_amount uint256 ETH amount to be locked/released

allowedExternalContract

modifier allowedExternalContract(address _externalContractAddress)

areMarketplaceFeesIncluded

function areMarketplaceFeesIncluded(uint256[] _amounts, address[] _receivers) internal view returns (bool)

DistributeNFTCollateralCondition

Implementation of a condition allowing to transfer a NFT to an account or another depending on the final state of a lock condition

CONDITION_TYPE

bytes32 CONDITION_TYPE

aaveCreditVault

contract AaveCreditVault aaveCreditVault

_lockConditionAddress

address _lockConditionAddress

Fulfilled

event Fulfilled(bytes32 _agreementId, bytes32 _did, address _receiver, bytes32 _conditionId, address _contract)

initialize

function initialize(address _owner, address _conditionStoreManagerAddress, address _lockNFTConditionAddress) external

initialize init the contract with the following parameters

this function is called only once during the contract initialization.

Name Type Description
_owner address contract's owner account address
_conditionStoreManagerAddress address condition store manager address
_lockNFTConditionAddress address Lock NFT Condition address

hashValues

function hashValues(bytes32 _did, address _vaultAddress, address _nftContractAddress) public pure returns (bytes32)

hashValues generates the hash of condition inputs with the following parameters

Name Type Description
_did bytes32 refers to the DID in which secret store will issue the decryption keys
_vaultAddress address The contract address of the vault
_nftContractAddress address NFT contract to use
Name Type Description
[0] bytes32 bytes32 hash of all these values

fulfill

function fulfill(bytes32 _agreementId, bytes32 _did, address _vaultAddress, address _nftContractAddress) public returns (enum ConditionStoreLibrary.ConditionState)

fulfill the transfer NFT condition

Fulfill method transfer a certain amount of NFTs to the _nftReceiver address. When true then fulfill the condition

Name Type Description
_agreementId bytes32 agreement identifier
_did bytes32 refers to the DID in which secret store will issue the decryption keys
_vaultAddress address The contract address of the vault
_nftContractAddress address NFT contract to use
Name Type Description
[0] enum ConditionStoreLibrary.ConditionState condition state (Fulfilled/Aborted)

INFTAccess

Fulfilled

event Fulfilled(bytes32 _agreementId, bytes32 _documentId, address _grantee, bytes32 _conditionId)

hashValues

function hashValues(bytes32 _documentId, address _grantee, address _contractAddress) external pure returns (bytes32)

hashValues generates the hash of condition inputs with the following parameters

Name Type Description
_documentId bytes32 refers to the DID in which secret store will issue the decryption keys
_grantee address is the address of the granted user or the DID provider
_contractAddress address contract address holding the NFT (ERC-721) or the NFT Factory (ERC-1155)
Name Type Description
[0] bytes32 bytes32 hash of all these values

fulfill

function fulfill(bytes32 _agreementId, bytes32 _documentId, address _grantee, address _contractAddress) external returns (enum ConditionStoreLibrary.ConditionState)

fulfill NFT Access conditions

only DID owner or DID provider can call this method. Fulfill method sets the permissions for the granted consumer's address to true then fulfill the condition

Name Type Description
_agreementId bytes32 agreement identifier
_documentId bytes32 refers to the DID in which secret store will issue the decryption keys
_grantee address is the address of the granted user or the DID provider
_contractAddress address contract address holding the NFT (ERC-721) or the NFT Factory (ERC-1155)
Name Type Description
[0] enum ConditionStoreLibrary.ConditionState condition state (Fulfilled/Aborted)

INFTHolder

Fulfilled

event Fulfilled(bytes32 _agreementId, bytes32 _did, address _address, bytes32 _conditionId, uint256 _amount)

hashValues

function hashValues(bytes32 _did, address _holderAddress, uint256 _amount, address _contractAddress) external pure returns (bytes32)

hashValues generates the hash of condition inputs with the following parameters

Name Type Description
_did bytes32 the Decentralized Identifier of the asset
_holderAddress address the address of the NFT holder
_amount uint256 is the amount NFTs that need to be hold by the holder
_contractAddress address contract address holding the NFT (ERC-721) or the NFT Factory (ERC-1155)
Name Type Description
[0] bytes32 bytes32 hash of all these values

fulfill

function fulfill(bytes32 _agreementId, bytes32 _did, address _holderAddress, uint256 _amount, address _contractAddress) external returns (enum ConditionStoreLibrary.ConditionState)

fulfill requires a validation that holder has enough NFTs for a specific DID

Name Type Description
_agreementId bytes32 SEA agreement identifier
_did bytes32 the Decentralized Identifier of the asset
_holderAddress address the contract address where the reward is locked
_amount uint256 is the amount of NFT to be hold
_contractAddress address contract address holding the NFT (ERC-721) or the NFT Factory (ERC-1155)
Name Type Description
[0] enum ConditionStoreLibrary.ConditionState condition state

INFTLock

Fulfilled

event Fulfilled(bytes32 _agreementId, bytes32 _did, address _lockAddress, bytes32 _conditionId, uint256 _amount, address _receiver, address _nftContractAddress)

hashValues

function hashValues(bytes32 _did, address _lockAddress, uint256 _amount, address _nftContractAddress) external pure returns (bytes32)

hashValues generates the hash of condition inputs with the following parameters

Name Type Description
_did bytes32 the DID of the asset with NFTs attached to lock
_lockAddress address the contract address where the NFT will be locked
_amount uint256 is the amount of the NFTs locked
_nftContractAddress address Is the address of the NFT (ERC-721, ERC-1155) contract to use
Name Type Description
[0] bytes32 bytes32 hash of all these values

hashValuesMarked

function hashValuesMarked(bytes32 _did, address _lockAddress, uint256 _amount, address _receiver, address _nftContractAddress) external pure returns (bytes32)

fulfill

function fulfill(bytes32 _agreementId, bytes32 _did, address _lockAddress, uint256 _amount, address _nftContractAddress) external returns (enum ConditionStoreLibrary.ConditionState)

fulfill the transfer NFT condition

Fulfill method transfer a certain amount of NFTs to the _nftReceiver address. When true then fulfill the condition

Name Type Description
_agreementId bytes32 agreement identifier
_did bytes32 refers to the DID in which secret store will issue the decryption keys
_lockAddress address the contract address where the NFT will be locked
_amount uint256 is the amount of the locked tokens
_nftContractAddress address Is the address of the NFT (ERC-721) contract to use
Name Type Description
[0] enum ConditionStoreLibrary.ConditionState condition state (Fulfilled/Aborted)

fulfillMarked

function fulfillMarked(bytes32 _agreementId, bytes32 _did, address _lockAddress, uint256 _amount, address _receiver, address _nftContractAddress) external returns (enum ConditionStoreLibrary.ConditionState)

ITransferNFT

Fulfilled

event Fulfilled(bytes32 _agreementId, bytes32 _did, address _receiver, uint256 _amount, bytes32 _conditionId, address _contract)

hashValues

function hashValues(bytes32 _did, address _nftHolder, address _nftReceiver, uint256 _nftAmount, bytes32 _lockCondition, address _contract, bool _transfer) external pure returns (bytes32)

hashValues generates the hash of condition inputs with the following parameters

Name Type Description
_did bytes32 refers to the DID in which secret store will issue the decryption keys
_nftHolder address
_nftReceiver address is the address of the granted user or the DID provider
_nftAmount uint256 amount of NFTs to transfer
_lockCondition bytes32 lock condition identifier
_contract address
_transfer bool Indicates if the NFT will be transferred (true) or minted (false)
Name Type Description
[0] bytes32 bytes32 hash of all these values

fulfill

function fulfill(bytes32 _agreementId, bytes32 _did, address _nftReceiver, uint256 _nftAmount, bytes32 _lockPaymentCondition, address _contract, bool _transfer) external returns (enum ConditionStoreLibrary.ConditionState)

fulfill the transfer NFT condition

Fulfill method transfer a certain amount of NFTs to the _nftReceiver address. When true then fulfill the condition

Name Type Description
_agreementId bytes32 agreement identifier
_did bytes32 refers to the DID in which secret store will issue the decryption keys
_nftReceiver address is the address of the account to receive the NFT
_nftAmount uint256 amount of NFTs to transfer
_lockPaymentCondition bytes32 lock payment condition identifier
_contract address
_transfer bool Indicates if the NFT will be transferred (true) or minted (false)
Name Type Description
[0] enum ConditionStoreLibrary.ConditionState condition state (Fulfilled/Aborted)

getNFTDefaultAddress

function getNFTDefaultAddress() external view returns (address)

returns if the default NFT contract address

The default NFT contract address was given to the Transfer Condition during the contract initialization

Name Type Description
[0] address the NFT contract address used by default in the transfer condition

NFT721HolderCondition

Implementation of the Nft Holder Condition

CONDITION_TYPE

bytes32 CONDITION_TYPE

initialize

function initialize(address _owner, address _conditionStoreManagerAddress) external

initialize init the contract with the following parameters

this function is called only once during the contract initialization.

Name Type Description
_owner address contract's owner account address
_conditionStoreManagerAddress address condition store manager address

hashValues

function hashValues(bytes32 _did, address _holderAddress, uint256 _amount, address _contractAddress) public pure returns (bytes32)

hashValues generates the hash of condition inputs with the following parameters

Name Type Description
_did bytes32 the Decentralized Identifier of the asset
_holderAddress address the address of the NFT holder
_amount uint256 is the amount NFTs that need to be hold by the holder
_contractAddress address contract address holding the NFT (ERC-721) or the NFT Factory (ERC-1155)
Name Type Description
[0] bytes32 bytes32 hash of all these values

fulfill

function fulfill(bytes32 _agreementId, bytes32 _did, address _holderAddress, uint256 _amount, address _contractAddress) external returns (enum ConditionStoreLibrary.ConditionState)

fulfill requires a validation that holder has enough NFTs for a specific DID

Name Type Description
_agreementId bytes32 SEA agreement identifier
_did bytes32 the Decentralized Identifier of the asset
_holderAddress address the contract address where the reward is locked
_amount uint256 is the amount of NFT to be hold
_contractAddress address contract address holding the NFT (ERC-721) or the NFT Factory (ERC-1155)
Name Type Description
[0] enum ConditionStoreLibrary.ConditionState condition state

NFT721LockCondition

Implementation of the NFT Lock Condition for ERC-721 based NFTs

CONDITION_TYPE

bytes32 CONDITION_TYPE

initialize

function initialize(address _owner, address _conditionStoreManagerAddress) external

initialize init the contract with the following parameters

this function is called only once during the contract initialization.

Name Type Description
_owner address contract's owner account address
_conditionStoreManagerAddress address condition store manager address

hashValues

function hashValues(bytes32 _did, address _lockAddress, uint256 _amount, address _nftContractAddress) public pure returns (bytes32)

hashValues generates the hash of condition inputs with the following parameters

Name Type Description
_did bytes32 the DID of the asset with NFTs attached to lock
_lockAddress address the contract address where the NFT will be locked
_amount uint256 is the amount of the locked tokens
_nftContractAddress address Is the address of the NFT (ERC-721) contract to use
Name Type Description
[0] bytes32 bytes32 hash of all these values

hashValuesMarked

function hashValuesMarked(bytes32 _did, address _lockAddress, uint256 _amount, address _receiver, address _nftContractAddress) public pure returns (bytes32)

fulfillMarked

function fulfillMarked(bytes32 _agreementId, bytes32 _did, address _lockAddress, uint256 _amount, address _receiver, address _nftContractAddress) public returns (enum ConditionStoreLibrary.ConditionState)

fulfill the transfer NFT condition

Fulfill method lock a NFT into the _lockAddress.

Name Type Description
_agreementId bytes32 agreement identifier
_did bytes32 refers to the DID in which secret store will issue the decryption keys
_lockAddress address the contract address where the NFT will be locked
_amount uint256 is the amount of the locked tokens (1)
_receiver address
_nftContractAddress address Is the address of the NFT (ERC-721) contract to use
Name Type Description
[0] enum ConditionStoreLibrary.ConditionState condition state (Fulfilled/Aborted)

fulfill

function fulfill(bytes32 _agreementId, bytes32 _did, address _lockAddress, uint256 _amount, address _nftContractAddress) external returns (enum ConditionStoreLibrary.ConditionState)

fulfill the transfer NFT condition

Fulfill method transfer a certain amount of NFTs to the _nftReceiver address. When true then fulfill the condition

Name Type Description
_agreementId bytes32 agreement identifier
_did bytes32 refers to the DID in which secret store will issue the decryption keys
_lockAddress address the contract address where the NFT will be locked
_amount uint256 is the amount of the locked tokens
_nftContractAddress address Is the address of the NFT (ERC-721) contract to use
Name Type Description
[0] enum ConditionStoreLibrary.ConditionState condition state (Fulfilled/Aborted)

onERC721Received

function onERC721Received(address, address, uint256, bytes) public virtual returns (bytes4)

Always returns IERC721Receiver.onERC721Received.selector.

NFTAccessCondition

_Implementation of the Access Condition specific for NFTs

 NFT Access Condition is special condition used to give access 
 to a specific NFT related to a DID._

CONDITION_TYPE

bytes32 CONDITION_TYPE

DocumentPermission

struct DocumentPermission {
  bytes32 agreementIdDeprecated;
  mapping(address => bool) permission;
}

nftPermissions

mapping(bytes32 => struct NFTAccessCondition.DocumentPermission) nftPermissions

didRegistry

contract DIDRegistry didRegistry

onlyDIDOwnerOrProvider

modifier onlyDIDOwnerOrProvider(bytes32 _documentId)

initialize

function initialize(address _owner, address _conditionStoreManagerAddress, address _didRegistryAddress) external

initialize init the contract with the following parameters

this function is called only once during the contract initialization.

Name Type Description
_owner address contract's owner account address
_conditionStoreManagerAddress address condition store manager address
_didRegistryAddress address DID registry address

hashValues

function hashValues(bytes32 _documentId, address _grantee) public view returns (bytes32)

hashValues generates the hash of condition inputs with the following parameters

Name Type Description
_documentId bytes32 refers to the DID in which secret store will issue the decryption keys
_grantee address is the address of the granted user or the DID provider
Name Type Description
[0] bytes32 bytes32 hash of all these values

hashValues

function hashValues(bytes32 _documentId, address _grantee, address _contractAddress) public pure returns (bytes32)

hashValues generates the hash of condition inputs with the following parameters

Name Type Description
_documentId bytes32 refers to the DID in which secret store will issue the decryption keys
_grantee address is the address of the granted user or the DID provider
_contractAddress address contract address holding the NFT (ERC-721) or the NFT Factory (ERC-1155)
Name Type Description
[0] bytes32 bytes32 hash of all these values

fulfill

function fulfill(bytes32 _agreementId, bytes32 _documentId, address _grantee) public returns (enum ConditionStoreLibrary.ConditionState)

fulfill NFT Access condition

only DID owner or DID provider can call this method. Fulfill method sets the permissions for the granted consumer's address to true then fulfill the condition

Name Type Description
_agreementId bytes32 agreement identifier
_documentId bytes32 refers to the DID in which secret store will issue the decryption keys
_grantee address is the address of the granted user or the DID provider
Name Type Description
[0] enum ConditionStoreLibrary.ConditionState condition state (Fulfilled/Aborted)

fulfill

function fulfill(bytes32 _agreementId, bytes32 _documentId, address _grantee, address _contractAddress) public returns (enum ConditionStoreLibrary.ConditionState)

fulfill NFT Access condition

only DID owner or DID provider can call this method. Fulfill method sets the permissions for the granted consumer's address to true then fulfill the condition

Name Type Description
_agreementId bytes32 agreement identifier
_documentId bytes32 refers to the DID in which secret store will issue the decryption keys
_grantee address is the address of the granted user or the DID provider
_contractAddress address is the contract address of the NFT implementation (ERC-1155 or ERC-721)
Name Type Description
[0] enum ConditionStoreLibrary.ConditionState condition state (Fulfilled/Aborted)

grantPermission

function grantPermission(address _grantee, bytes32 _documentId) public

grantPermission is called only by DID owner or provider

Name Type Description
_grantee address is the address of the granted user or the DID provider
_documentId bytes32 refers to the DID in which secret store will issue the decryption keys

checkPermissions

function checkPermissions(address _grantee, bytes32 _documentId) external view returns (bool permissionGranted)

checkPermissions is called to validate the permissions of user related to the NFT attached to an asset

Name Type Description
_grantee address is the address of the granted user or the DID provider
_documentId bytes32 refers to the DID
Name Type Description
permissionGranted bool true if the access was granted

NFTHolderCondition

Implementation of the Nft Holder Condition

erc1155

contract ERC1155BurnableUpgradeable erc1155

CONDITION_TYPE

bytes32 CONDITION_TYPE

initialize

function initialize(address _owner, address _conditionStoreManagerAddress, address _ercAddress) external

initialize init the contract with the following parameters

this function is called only once during the contract initialization.

Name Type Description
_owner address contract's owner account address
_conditionStoreManagerAddress address condition store manager address
_ercAddress address Nevermined ERC-1155 address

hashValues

function hashValues(bytes32 _did, address _holderAddress, uint256 _amount) public view returns (bytes32)

hashValues generates the hash of condition inputs with the following parameters

Name Type Description
_did bytes32 the Decentralized Identifier of the asset
_holderAddress address the address of the NFT holder
_amount uint256 is the amount NFTs that need to be hold by the holder
Name Type Description
[0] bytes32 bytes32 hash of all these values

hashValues

function hashValues(bytes32 _did, address _holderAddress, uint256 _amount, address _contractAddress) public pure returns (bytes32)

hashValues generates the hash of condition inputs with the following parameters

Name Type Description
_did bytes32 the Decentralized Identifier of the asset
_holderAddress address the address of the NFT holder
_amount uint256 is the amount NFTs that need to be hold by the holder
_contractAddress address contract address holding the NFT (ERC-721) or the NFT Factory (ERC-1155)
Name Type Description
[0] bytes32 bytes32 hash of all these values

fulfill

function fulfill(bytes32 _agreementId, bytes32 _did, address _holderAddress, uint256 _amount) public returns (enum ConditionStoreLibrary.ConditionState)

fulfill requires a validation that holder has enough NFTs for a specific DID

Name Type Description
_agreementId bytes32 SEA agreement identifier
_did bytes32 the Decentralized Identifier of the asset
_holderAddress address the contract address where the reward is locked
_amount uint256 is the amount of NFT to be hold
Name Type Description
[0] enum ConditionStoreLibrary.ConditionState condition state

fulfill

function fulfill(bytes32 _agreementId, bytes32 _did, address _holderAddress, uint256 _amount, address _contractAddress) public returns (enum ConditionStoreLibrary.ConditionState)

fulfill requires a validation that holder has enough NFTs for a specific DID

Name Type Description
_agreementId bytes32 SEA agreement identifier
_did bytes32 the Decentralized Identifier of the asset
_holderAddress address the contract address where the reward is locked
_amount uint256 is the amount of NFT to be hold
_contractAddress address contract address holding the NFT (ERC-721) or the NFT Factory (ERC-1155)
Name Type Description
[0] enum ConditionStoreLibrary.ConditionState condition state

NFTLockCondition

Implementation of the NFT Lock Condition

erc1155

contract IERC1155Upgradeable erc1155

CONDITION_TYPE

bytes32 CONDITION_TYPE

ERC1155_ACCEPTED

bytes4 ERC1155_ACCEPTED

ERC1155_BATCH_ACCEPTED

bytes4 ERC1155_BATCH_ACCEPTED

initialize

function initialize(address _owner, address _conditionStoreManagerAddress, address _ercAddress) external

initialize init the contract with the following parameters

this function is called only once during the contract initialization.

Name Type Description
_owner address contract's owner account address
_conditionStoreManagerAddress address condition store manager address
_ercAddress address Nevermined ERC-1155 address

hashValues

function hashValues(bytes32 _did, address _lockAddress, uint256 _amount) public view returns (bytes32)

hashValues generates the hash of condition inputs with the following parameters

Name Type Description
_did bytes32 the DID of the asset with NFTs attached to lock
_lockAddress address the contract address where the NFT will be locked
_amount uint256 is the amount of the locked tokens
Name Type Description
[0] bytes32 bytes32 hash of all these values

hashValues

function hashValues(bytes32 _did, address _lockAddress, uint256 _amount, address _nftContractAddress) public pure returns (bytes32)

hashValues generates the hash of condition inputs with the following parameters

Name Type Description
_did bytes32 the DID of the asset with NFTs attached to lock
_lockAddress address the contract address where the NFT will be locked
_amount uint256 is the amount of the locked tokens
_nftContractAddress address Is the address of the NFT (ERC-1155) contract to use
Name Type Description
[0] bytes32 bytes32 hash of all these values

hashValuesMarked

function hashValuesMarked(bytes32 _did, address _lockAddress, uint256 _amount, address _receiver, address _nftContractAddress) public pure returns (bytes32)

fulfill

function fulfill(bytes32 _agreementId, bytes32 _did, address _lockAddress, uint256 _amount) public returns (enum ConditionStoreLibrary.ConditionState)

fulfill the transfer NFT condition

Fulfill method transfer a certain amount of NFTs to the _nftReceiver address. When true then fulfill the condition

Name Type Description
_agreementId bytes32 agreement identifier
_did bytes32 refers to the DID in which secret store will issue the decryption keys
_lockAddress address the contract address where the NFT will be locked
_amount uint256 is the amount of the locked tokens
Name Type Description
[0] enum ConditionStoreLibrary.ConditionState condition state (Fulfilled/Aborted)

fulfill

function fulfill(bytes32 _agreementId, bytes32 _did, address _lockAddress, uint256 _amount, address _nft) public returns (enum ConditionStoreLibrary.ConditionState)

fulfillMarked

function fulfillMarked(bytes32 _agreementId, bytes32 _did, address _lockAddress, uint256 _amount, address _receiver, address _nftContractAddress) public returns (enum ConditionStoreLibrary.ConditionState)

fulfill the transfer NFT condition

Fulfill method transfer a certain amount of NFTs to the _nftReceiver address. When true then fulfill the condition

Name Type Description
_agreementId bytes32 agreement identifier
_did bytes32 refers to the DID in which secret store will issue the decryption keys
_lockAddress address the contract address where the NFT will be locked
_amount uint256 is the amount of the locked tokens
_receiver address
_nftContractAddress address Is the address of the NFT (ERC-1155) contract to use
Name Type Description
[0] enum ConditionStoreLibrary.ConditionState condition state (Fulfilled/Aborted)

onERC1155Received

function onERC1155Received(address, address, uint256, uint256, bytes) external pure returns (bytes4)

onERC1155BatchReceived

function onERC1155BatchReceived(address, address, uint256[], uint256[], bytes) external pure returns (bytes4)

supportsInterface

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

_Returns true if this contract implements the interface defined by interfaceId. See the corresponding https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] to learn more about how these ids are created.

This function call must use less than 30 000 gas._

TransferNFT721Condition

Implementation of condition allowing to transfer an NFT between the original owner and a receiver

CONDITION_TYPE

bytes32 CONDITION_TYPE

MARKET_ROLE

bytes32 MARKET_ROLE

erc721

contract NFT721Upgradeable erc721

_lockConditionAddress

address _lockConditionAddress

PROXY_ROLE

bytes32 PROXY_ROLE

didRegistry

contract DIDRegistry didRegistry

grantProxyRole

function grantProxyRole(address _address) public

revokeProxyRole

function revokeProxyRole(address _address) public

initialize

function initialize(address _owner, address _conditionStoreManagerAddress, address _didRegistryAddress, address _ercAddress, address _lockNFTConditionAddress) external

initialize init the contract with the following parameters

this function is called only once during the contract initialization.

Name Type Description
_owner address contract's owner account address
_conditionStoreManagerAddress address condition store manager address
_didRegistryAddress address DID Registry address
_ercAddress address Nevermined ERC-721 address
_lockNFTConditionAddress address

getNFTDefaultAddress

function getNFTDefaultAddress() external view returns (address)

returns if the default NFT contract address

The default NFT contract address was given to the Transfer Condition during the contract initialization

Name Type Description
[0] address the NFT contract address used by default in the transfer condition

hashValues

function hashValues(bytes32 _did, address _nftHolder, address _nftReceiver, uint256 _nftAmount, bytes32 _lockCondition, address _contract, bool _transfer) public pure returns (bytes32)

hashValues generates the hash of condition inputs with the following parameters

Name Type Description
_did bytes32 refers to the DID in which secret store will issue the decryption keys
_nftHolder address
_nftReceiver address is the address of the granted user or the DID provider
_nftAmount uint256 amount of NFTs to transfer
_lockCondition bytes32 lock condition identifier
_contract address NFT contract to use
_transfer bool
Name Type Description
[0] bytes32 bytes32 hash of all these values

encodeParams

function encodeParams(bytes32 _did, address _nftHolder, address _nftReceiver, uint256 _nftAmount, bytes32 _lockPaymentCondition, address _nftContractAddress, bool _transfer) external pure returns (bytes)

Encodes/serialize all the parameters received

Name Type Description
_did bytes32 refers to the DID in which secret store will issue the decryption keys
_nftHolder address is the address of the account to receive the NFT
_nftReceiver address is the address of the account to receive the NFT
_nftAmount uint256 amount of NFTs to transfer
_lockPaymentCondition bytes32 lock payment condition identifier
_nftContractAddress address the NFT contract to use
_transfer bool if yes it does a transfer if false it mints the NFT
Name Type Description
[0] bytes the encoded parameters

fulfill

function fulfill(bytes32 _agreementId, bytes32 _did, address _nftReceiver, uint256 _nftAmount, bytes32 _lockPaymentCondition, address _contract, bool _transfer) public returns (enum ConditionStoreLibrary.ConditionState)

fulfill the transfer NFT condition

Fulfill method transfer a certain amount of NFTs to the _nftReceiver address. When true then fulfill the condition

Name Type Description
_agreementId bytes32 agreement identifier
_did bytes32 refers to the DID in which secret store will issue the decryption keys
_nftReceiver address is the address of the account to receive the NFT
_nftAmount uint256 amount of NFTs to transfer
_lockPaymentCondition bytes32 lock payment condition identifier
_contract address NFT contract to use
_transfer bool Indicates if the NFT will be transferred (true) or minted (false)
Name Type Description
[0] enum ConditionStoreLibrary.ConditionState condition state (Fulfilled/Aborted)

fulfillProxy

function fulfillProxy(address _account, bytes32 _agreementId, bytes _params) external payable

fulfill the transfer NFT condition by a proxy

Fulfill method transfer a certain amount of NFTs

Name Type Description
_account address NFT Holder
_agreementId bytes32 agreement identifier
_params bytes encoded parameters

fulfillInternal

function fulfillInternal(address _account, bytes32 _agreementId, bytes32 _did, address _nftReceiver, uint256 _nftAmount, bytes32 _lockPaymentCondition, address _contract, bool _transfer) internal returns (enum ConditionStoreLibrary.ConditionState)

fulfillForDelegate

function fulfillForDelegate(bytes32 _agreementId, bytes32 _did, address _nftHolder, address _nftReceiver, uint256 _nftAmount, bytes32 _lockPaymentCondition, bool _transfer) public returns (enum ConditionStoreLibrary.ConditionState)

fulfill the transfer NFT condition

Fulfill method transfer a certain amount of NFTs to the _nftReceiver address in the DIDRegistry contract. When true then fulfill the condition

Name Type Description
_agreementId bytes32 agreement identifier
_did bytes32 refers to the DID in which secret store will issue the decryption keys
_nftHolder address is the address of the account to receive the NFT
_nftReceiver address is the address of the account to receive the NFT
_nftAmount uint256 amount of NFTs to transfer
_lockPaymentCondition bytes32 lock payment condition identifier
_transfer bool if yes it does a transfer if false it mints the NFT
Name Type Description
[0] enum ConditionStoreLibrary.ConditionState condition state (Fulfilled/Aborted)

TransferNFTCondition

Implementation of condition allowing to transfer an NFT between the original owner and a receiver

CONDITION_TYPE

bytes32 CONDITION_TYPE

MARKET_ROLE

bytes32 MARKET_ROLE

erc1155

contract NFTUpgradeable erc1155

didRegistry

contract DIDRegistry didRegistry

PROXY_ROLE

bytes32 PROXY_ROLE

grantProxyRole

function grantProxyRole(address _address) public

revokeProxyRole

function revokeProxyRole(address _address) public

initialize

function initialize(address _owner, address _conditionStoreManagerAddress, address _didRegistryAddress, address _ercAddress, address _nftContractAddress) external

initialize init the contract with the following parameters

this function is called only once during the contract initialization.

Name Type Description
_owner address contract's owner account address
_conditionStoreManagerAddress address condition store manager address
_didRegistryAddress address DID Registry address
_ercAddress address Nevermined ERC-1155 address
_nftContractAddress address Market address

grantMarketRole

function grantMarketRole(address _nftContractAddress) public

revokeMarketRole

function revokeMarketRole(address _nftContractAddress) public

getNFTDefaultAddress

function getNFTDefaultAddress() external view returns (address)

returns if the default NFT contract address

The default NFT contract address was given to the Transfer Condition during the contract initialization

Name Type Description
[0] address the NFT contract address used by default in the transfer condition

hashValues

function hashValues(bytes32 _did, address _nftHolder, address _nftReceiver, uint256 _nftAmount, bytes32 _lockCondition) public view returns (bytes32)

hashValues generates the hash of condition inputs with the following parameters

Name Type Description
_did bytes32 refers to the DID in which secret store will issue the decryption keys
_nftHolder address
_nftReceiver address is the address of the granted user or the DID provider
_nftAmount uint256 amount of NFTs to transfer
_lockCondition bytes32 lock condition identifier
Name Type Description
[0] bytes32 bytes32 hash of all these values

hashValues

function hashValues(bytes32 _did, address _nftHolder, address _nftReceiver, uint256 _nftAmount, bytes32 _lockCondition, address _nftContractAddress, bool _transfer) public pure returns (bytes32)

hashValues generates the hash of condition inputs with the following parameters

Name Type Description
_did bytes32 refers to the DID in which secret store will issue the decryption keys
_nftHolder address
_nftReceiver address is the address of the granted user or the DID provider
_nftAmount uint256 amount of NFTs to transfer
_lockCondition bytes32 lock condition identifier
_nftContractAddress address NFT contract to use
_transfer bool Indicates if the NFT will be transferred (true) or minted (false)
Name Type Description
[0] bytes32 bytes32 hash of all these values

fulfill

function fulfill(bytes32 _agreementId, bytes32 _did, address _nftReceiver, uint256 _nftAmount, bytes32 _lockPaymentCondition) public returns (enum ConditionStoreLibrary.ConditionState)

encodeParams

function encodeParams(bytes32 _did, address _nftHolder, address _nftReceiver, uint256 _nftAmount, bytes32 _lockPaymentCondition, address _nftContractAddress, bool _transfer) external pure returns (bytes)

Encodes/serialize all the parameters received

Name Type Description
_did bytes32 refers to the DID in which secret store will issue the decryption keys
_nftHolder address is the address of the account to receive the NFT
_nftReceiver address is the address of the account to receive the NFT
_nftAmount uint256 amount of NFTs to transfer
_lockPaymentCondition bytes32 lock payment condition identifier
_nftContractAddress address the NFT contract to use
_transfer bool if yes it does a transfer if false it mints the NFT
Name Type Description
[0] bytes the encoded parameters

fulfillProxy

function fulfillProxy(address _account, bytes32 _agreementId, bytes _params) external payable

fulfill the transfer NFT condition by a proxy

Fulfill method transfer a certain amount of NFTs

Name Type Description
_account address NFT Holder
_agreementId bytes32 agreement identifier
_params bytes encoded parameters

fulfill

function fulfill(bytes32 _agreementId, bytes32 _did, address _nftReceiver, uint256 _nftAmount, bytes32 _lockPaymentCondition, address _nftContractAddress, bool _transfer) public returns (enum ConditionStoreLibrary.ConditionState)

fulfill the transfer NFT condition

Fulfill method transfer a certain amount of NFTs to the _nftReceiver address. When true then fulfill the condition

Name Type Description
_agreementId bytes32 agreement identifier
_did bytes32 refers to the DID in which secret store will issue the decryption keys
_nftReceiver address is the address of the account to receive the NFT
_nftAmount uint256 amount of NFTs to transfer
_lockPaymentCondition bytes32 lock payment condition identifier
_nftContractAddress address NFT contract to use
_transfer bool Indicates if the NFT will be transferred (true) or minted (false)
Name Type Description
[0] enum ConditionStoreLibrary.ConditionState condition state (Fulfilled/Aborted)

fulfillInternal

function fulfillInternal(address _account, bytes32 _agreementId, bytes32 _did, address _nftReceiver, uint256 _nftAmount, bytes32 _lockPaymentCondition, address _nftContractAddress, bool _transfer) internal returns (enum ConditionStoreLibrary.ConditionState)

fulfillForDelegate

function fulfillForDelegate(bytes32 _agreementId, bytes32 _did, address _nftHolder, address _nftReceiver, uint256 _nftAmount, bytes32 _lockPaymentCondition, bool _transfer) public returns (enum ConditionStoreLibrary.ConditionState)

fulfill the transfer NFT condition

Fulfill method transfer a certain amount of NFTs to the _nftReceiver address in the DIDRegistry contract. When true then fulfill the condition

Name Type Description
_agreementId bytes32 agreement identifier
_did bytes32 refers to the DID in which secret store will issue the decryption keys
_nftHolder address is the address of the account to receive the NFT
_nftReceiver address is the address of the account to receive the NFT
_nftAmount uint256 amount of NFTs to transfer
_lockPaymentCondition bytes32 lock payment condition identifier
_transfer bool if yes it does a transfer if false it mints the NFT
Name Type Description
[0] enum ConditionStoreLibrary.ConditionState condition state (Fulfilled/Aborted)

SignCondition

Implementation of the Sign Condition

CONDITION_TYPE

bytes32 CONDITION_TYPE

initialize

function initialize(address _owner, address _conditionStoreManagerAddress) external

initialize init the contract with the following parameters

this function is called only once during the contract initialization.

Name Type Description
_owner address contract's owner account address
_conditionStoreManagerAddress address condition store manager address

hashValues

function hashValues(bytes32 _message, address _publicKey) public pure returns (bytes32)

hashValues generates the hash of condition inputs with the following parameters

Name Type Description
_message bytes32 the message to be signed
_publicKey address the public key of the signing address
Name Type Description
[0] bytes32 bytes32 hash of all these values

fulfill

function fulfill(bytes32 _agreementId, bytes32 _message, address _publicKey, bytes _signature) public returns (enum ConditionStoreLibrary.ConditionState)

fulfill validate the signed message and fulfill the condition

Name Type Description
_agreementId bytes32 SEA agreement identifier
_message bytes32 the message to be signed
_publicKey address the public key of the signing address
_signature bytes signature of the signed message using the public key
Name Type Description
[0] enum ConditionStoreLibrary.ConditionState condition state

ThresholdCondition

_Implementation of the Threshold Condition

 Threshold condition acts as a filter for a set of input condition(s) in which sends 
 a signal whether to complete the flow execution or abort it. This type of conditions 
 works as intermediary conditions where they wire SEA conditions in order to support  
 more complex scenarios._

CONDITION_TYPE

bytes32 CONDITION_TYPE

initialize

function initialize(address _owner, address _conditionStoreManagerAddress) external

initialize init the contract with the following parameters

this function is called only once during the contract initialization.

Name Type Description
_owner address contract's owner account address
_conditionStoreManagerAddress address condition store manager address

hashValues

function hashValues(bytes32[] inputConditions, uint256 threshold) public pure returns (bytes32)

hashValues generates the hash of condition inputs with the following parameters

Name Type Description
inputConditions bytes32[] array of input conditions IDs
threshold uint256 the required number of fulfilled input conditions
Name Type Description
[0] bytes32 bytes32 hash of all these values

fulfill

function fulfill(bytes32 _agreementId, bytes32[] _inputConditions, uint256 threshold) external returns (enum ConditionStoreLibrary.ConditionState)

fulfill threshold condition

the fulfill method check whether input conditions are fulfilled or not.

Name Type Description
_agreementId bytes32 agreement identifier
_inputConditions bytes32[] array of input conditions IDs
threshold uint256 the required number of fulfilled input conditions
Name Type Description
[0] enum ConditionStoreLibrary.ConditionState condition state (Fulfilled/Aborted)

canFulfill

function canFulfill(bytes32[] _inputConditions, uint256 threshold) private view returns (bool _fulfill)

canFulfill check if condition can be fulfilled

Name Type Description
_inputConditions bytes32[] array of input conditions IDs
threshold uint256 the required number of fulfilled input conditions
Name Type Description
_fulfill bool true if can fulfill

TransferDIDOwnershipCondition

Implementation of condition allowing to transfer the ownership between the original owner and a receiver

CONDITION_TYPE

bytes32 CONDITION_TYPE

didRegistry

contract DIDRegistry didRegistry

Fulfilled

event Fulfilled(bytes32 _agreementId, bytes32 _did, address _receiver, bytes32 _conditionId)

initialize

function initialize(address _owner, address _conditionStoreManagerAddress, address _didRegistryAddress) external

initialize init the contract with the following parameters

this function is called only once during the contract initialization.

Name Type Description
_owner address contract's owner account address
_conditionStoreManagerAddress address condition store manager address
_didRegistryAddress address DID Registry address

hashValues

function hashValues(bytes32 _did, address _receiver) public pure returns (bytes32)

hashValues generates the hash of condition inputs with the following parameters

Name Type Description
_did bytes32 refers to the DID in which secret store will issue the decryption keys
_receiver address is the address of the granted user or the DID provider
Name Type Description
[0] bytes32 bytes32 hash of all these values

fulfill

function fulfill(bytes32 _agreementId, bytes32 _did, address _receiver) public returns (enum ConditionStoreLibrary.ConditionState)

fulfill the transfer DID ownership condition

only DID owner or DID provider can call this method. Fulfill method transfer full ownership permissions to to _receiver address. When true then fulfill the condition

Name Type Description
_agreementId bytes32 agreement identifier
_did bytes32 refers to the DID in which secret store will issue the decryption keys
_receiver address is the address of the granted user
Name Type Description
[0] enum ConditionStoreLibrary.ConditionState condition state (Fulfilled/Aborted)

WhitelistingCondition

Implementation of the Whitelisting Condition

CONDITION_TYPE

bytes32 CONDITION_TYPE

initialize

function initialize(address _owner, address _conditionStoreManagerAddress) external

initialize init the contract with the following parameters

this function is called only once during the contract initialization.

Name Type Description
_owner address contract's owner account address
_conditionStoreManagerAddress address condition store manager address

hashValues

function hashValues(address _listAddress, bytes32 _item) public pure returns (bytes32)

hashValues generates the hash of condition inputs with the following parameters

Name Type Description
_listAddress address list contract address
_item bytes32 item in the list
Name Type Description
[0] bytes32 bytes32 hash of all these values

fulfill

function fulfill(bytes32 _agreementId, address _listAddress, bytes32 _item) public returns (enum ConditionStoreLibrary.ConditionState)

fulfill check whether address is whitelisted in order to fulfill the condition. This method will be called by any one in this whitelist.

Name Type Description
_agreementId bytes32 SEA agreement identifier
_listAddress address list contract address
_item bytes32 item in the list
Name Type Description
[0] enum ConditionStoreLibrary.ConditionState condition state

AaveBorrowCondition

Implementation of the Aave Borrow Credit Condition

aaveCreditVault

contract AaveCreditVault aaveCreditVault

CONDITION_TYPE

bytes32 CONDITION_TYPE

Fulfilled

event Fulfilled(bytes32 _agreementId, bytes32 _did, bytes32 _conditionId)

initialize

function initialize(address _owner, address _conditionStoreManagerAddress) external

initialize init the contract with the following parameters

this function is called only once during the contract initialization.

Name Type Description
_owner address contract's owner account address
_conditionStoreManagerAddress address condition store manager address

hashValues

function hashValues(bytes32 _did, address _vaultAddress, address _assetToBorrow, uint256 _amount, uint256 _interestRateMode) public pure returns (bytes32)

hashValues generates the hash of condition inputs with the following parameters

Name Type Description
_did bytes32 the DID of the asset
_vaultAddress address the address of vault locking the deposited collateral and the asset
_assetToBorrow address the address of the asset to borrow (i.e DAI)
_amount uint256 the amount of the ERC-20 the assets to borrow (i.e 50 DAI)
_interestRateMode uint256 interest rate type stable 1, variable 2
Name Type Description
[0] bytes32 bytes32 hash of all these values

fulfill

function fulfill(bytes32 _agreementId, bytes32 _did, address _vaultAddress, address _assetToBorrow, uint256 _amount, uint256 _interestRateMode) external returns (enum ConditionStoreLibrary.ConditionState)

It allows the borrower to borrow the asset deposited by the lender

Name Type Description
_agreementId bytes32 the identifier of the agreement
_did bytes32 the DID of the asset
_vaultAddress address the address of vault locking the deposited collateral and the asset
_assetToBorrow address the address of the asset to borrow (i.e DAI)
_amount uint256 the amount of the ERC-20 the assets to borrow (i.e 50 DAI)
_interestRateMode uint256 interest rate type stable 1, variable 2
Name Type Description
[0] enum ConditionStoreLibrary.ConditionState ConditionStoreLibrary.ConditionState the state of the condition (Fulfilled if everything went good)

AaveCollateralDepositCondition

Implementation of the Aave Collateral Deposit Condition This condition allows a Lender to deposit the collateral that into account the royalties to be paid to the original creators in a secondary market.

aaveCreditVault

contract AaveCreditVault aaveCreditVault

CONDITION_TYPE

bytes32 CONDITION_TYPE

Fulfilled

event Fulfilled(bytes32 _agreementId, bytes32 _did, bytes32 _conditionId)

initialize

function initialize(address _owner, address _conditionStoreManagerAddress) external

initialize init the contract with the following parameters

this function is called only once during the contract initialization.

Name Type Description
_owner address contract's owner account address
_conditionStoreManagerAddress address condition store manager address

hashValues

function hashValues(bytes32 _did, address _vaultAddress, address _collateralAsset, uint256 _collateralAmount, address _delegatedAsset, uint256 _delegatedAmount, uint256 _interestRateMode) public pure returns (bytes32)

hashValues generates the hash of condition inputs with the following parameters

Name Type Description
_did bytes32 the DID of the asset
_vaultAddress address Address of the vault
_collateralAsset address the address of the ERC-20 that will be used as collateral (i.e WETH)
_collateralAmount uint256 the amount of the ERC-20 that will be used as collateral (i.e 10 WETH)
_delegatedAsset address the address of the ERC-20 that will be delegated to the borrower (i.e DAI)
_delegatedAmount uint256 the amount of the ERC-20 that will be delegated to the borrower (i.e 500 DAI)
_interestRateMode uint256 interest rate type stable 1, variable 2
Name Type Description
[0] bytes32 bytes32 hash of all these values

fulfill

function fulfill(bytes32 _agreementId, bytes32 _did, address _vaultAddress, address _collateralAsset, uint256 _collateralAmount, address _delegatedAsset, uint256 _delegatedAmount, uint256 _interestRateMode) external payable returns (enum ConditionStoreLibrary.ConditionState)

It fulfills the condition if the collateral can be deposited into the vault

Name Type Description
_agreementId bytes32 the identifier of the agreement
_did bytes32 the DID of the asset
_vaultAddress address Address of the vault
_collateralAsset address the address of the ERC-20 that will be used as collateral (i.e WETH)
_collateralAmount uint256 the amount of the ERC-20 that will be used as collateral (i.e 10 WETH)
_delegatedAsset address the address of the ERC-20 that will be delegated to the borrower (i.e DAI)
_delegatedAmount uint256 the amount of the ERC-20 that will be delegated to the borrower (i.e 500 DAI)
_interestRateMode uint256 interest rate type stable 1, variable 2
Name Type Description
[0] enum ConditionStoreLibrary.ConditionState ConditionStoreLibrary.ConditionState the state of the condition (Fulfilled if everything went good)

AaveCollateralWithdrawCondition

Implementation of the Collateral Withdraw Condition This condition allows to credit delegator withdraw the collateral and fees after the agreement expiration

aaveCreditVault

contract AaveCreditVault aaveCreditVault

CONDITION_TYPE

bytes32 CONDITION_TYPE

Fulfilled

event Fulfilled(bytes32 _agreementId, bytes32 _did, bytes32 _conditionId)

initialize

function initialize(address _owner, address _conditionStoreManagerAddress) external

initialize init the contract with the following parameters

this function is called only once during the contract initialization.

Name Type Description
_owner address contract's owner account address
_conditionStoreManagerAddress address condition store manager address

hashValues

function hashValues(bytes32 _did, address _vaultAddress, address _collateralAsset) public pure returns (bytes32)

hashValues generates the hash of condition inputs with the following parameters

Name Type Description
_did bytes32 the DID of the asset
_vaultAddress address Address of the vault
_collateralAsset address the address of the asset used as collateral (i.e DAI)
Name Type Description
[0] bytes32 bytes32 hash of all these values

fulfill

function fulfill(bytes32 _agreementId, bytes32 _did, address _vaultAddress, address _collateralAsset) external payable returns (enum ConditionStoreLibrary.ConditionState)

It allows the borrower to repay the loan

Name Type Description
_agreementId bytes32 the identifier of the agreement
_did bytes32 the DID of the asset
_vaultAddress address Address of the vault
_collateralAsset address the address of the asset used as collateral (i.e DAI)
Name Type Description
[0] enum ConditionStoreLibrary.ConditionState ConditionStoreLibrary.ConditionState the state of the condition (Fulfilled if everything went good)

AaveCreditVault

lendingPool

contract ILendingPool lendingPool

dataProvider

contract IProtocolDataProvider dataProvider

weth

contract IWETHGateway weth

addressProvider

contract ILendingPoolAddressesProvider addressProvider

priceOracle

contract IPriceOracleGetter priceOracle

borrowedAsset

address borrowedAsset

borrowedAmount

uint256 borrowedAmount

nvmFee

uint256 nvmFee

agreementFee

uint256 agreementFee

FEE_BASE

uint256 FEE_BASE

treasuryAddress

address treasuryAddress

borrower

address borrower

lender

address lender

repayConditionId

bytes32 repayConditionId

nftId

uint256 nftId

nftAddress

address nftAddress

BORROWER_ROLE

bytes32 BORROWER_ROLE

LENDER_ROLE

bytes32 LENDER_ROLE

CONDITION_ROLE

bytes32 CONDITION_ROLE

initialize

function initialize(address _lendingPool, address _dataProvider, address _weth, uint256 _nvmFee, uint256 _agreementFee, address _treasuryAddress, address _borrower, address _lender, address[] _conditions) public

Vault constructor, creates a unique vault for each agreement

Name Type Description
_lendingPool address Aave lending pool address
_dataProvider address Aave data provider address
_weth address WETH address
_nvmFee uint256 Nevermined fee that will apply to this agreeement
_agreementFee uint256 Agreement fee that lender will receive on agreement maturity
_treasuryAddress address Address of nevermined contract to store fees
_borrower address
_lender address
_conditions address[]

isLender

function isLender(address _address) public view returns (bool)

isBorrower

function isBorrower(address _address) public view returns (bool)

deposit

function deposit(address _collateralAsset, uint256 _amount) public payable

Deposit function. Receives the funds from the delegator and deposits the funds in the Aave contracts

Name Type Description
_collateralAsset address collateral asset that will be deposit on Aave
_amount uint256 Amount of collateral to deposit

approveBorrower

function approveBorrower(address _borrower, uint256 _amount, address _asset, uint256 _interestRateMode) public

Appproves delegatee to borrow funds from Aave on behalf of delegator

Name Type Description
_borrower address delegatee that will borrow the funds
_amount uint256 Amount of funds to delegate
_asset address Asset to delegate the borrow
_interestRateMode uint256 interest rate type stable 1, variable 2

delegatedAmount

function delegatedAmount(address _borrower, address _asset, uint256 _interestRateMode) public view returns (uint256)

Return the actual delegated amount for the borrower in the specific asset

Name Type Description
_borrower address The borrower of the funds (i.e. delgatee)
_asset address The asset they are allowed to borrow
_interestRateMode uint256 interest rate type stable 1, variable 2

borrow

function borrow(address _assetToBorrow, uint256 _amount, address _delgatee, uint256 _interestRateMode) public

Borrower can call this function to borrow the delegated funds

Name Type Description
_assetToBorrow address The asset they are allowed to borrow
_amount uint256 Amount to borrow
_delgatee address Address where the funds will be transfered
_interestRateMode uint256 interest rate type stable 1, variable 2

repay

function repay(address _asset, uint256 _interestRateMode, bytes32 _repayConditionId) public

Repay an uncollaterised loan

Name Type Description
_asset address The asset to be repaid
_interestRateMode uint256 interest rate type stable 1, variable 2
_repayConditionId bytes32 identifier of the condition id working as lock for other vault methods

setRepayConditionId

function setRepayConditionId(bytes32 _repayConditionId) public

getBorrowedAmount

function getBorrowedAmount() public view returns (uint256)

Returns the borrowed amount from the delegatee on this agreement

getAssetPrice

function getAssetPrice(address _asset) public view returns (uint256)

Returns the priceof the asset in the Aave oracles

Name Type Description
_asset address The asset to get the actual price

getCreditAssetDebt

function getCreditAssetDebt() public view returns (uint256)

Returns the total debt of the credit in the Aave protocol expressed in token units

getActualCreditDebt

function getActualCreditDebt() public view returns (uint256)

Returns the total debt of the credit in the Aave protocol expressed in ETH units

getTotalActualDebt

function getTotalActualDebt() public view returns (uint256)

Returns the total actual debt of the agreement credit + fees in token units

withdrawCollateral

function withdrawCollateral(address _asset, address _delegator) public

Withdraw all of a collateral as the underlying asset, if no outstanding loans delegated

Name Type Description
_asset address The underlying asset to withdraw
_delegator address Delegator address that deposited the collateral

transferNFT

function transferNFT(uint256 _tokenId, address _receiver) public

Transfer a NFT (ERC-721) locked into the vault to a receiver address

Name Type Description
_tokenId uint256 the token id
_receiver address the receiver adddress

_transferERC20

function _transferERC20(address _collateralAsset, uint256 _amount) internal

Transfers the ERC20 token deposited to the Aave contracts

Name Type Description
_collateralAsset address collateral asset that will be deposit on Aave
_amount uint256 Amount of collateral to deposit

onERC721Received

function onERC721Received(address, address, uint256 _tokenId, bytes) public virtual returns (bytes4)

Handle the receipt of an NFT

_The ERC721 smart contract calls this function on the recipient after a {IERC721-safeTransferFrom}. This function MUST return the function selector, otherwise the caller will revert the transaction.

Note: the ERC721 contract address is always the message sender. (param not used): operator The address which called safeTransferFrom function (param not used): from The address which previously owned the token_

Name Type Description
address
address
_tokenId uint256 The NFT identifier which is being transferred (param not used): data Additional data with no specified format
bytes
Name Type Description
[0] bytes4 bytes4 bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))

AaveRepayCondition

Implementation of the Aave Repay Condition This condition allows to a borrower to repay a credit as part of a credit template

aaveCreditVault

contract AaveCreditVault aaveCreditVault

CONDITION_TYPE

bytes32 CONDITION_TYPE

Fulfilled

event Fulfilled(bytes32 _agreementId, bytes32 _did, bytes32 _conditionId)

initialize

function initialize(address _owner, address _conditionStoreManagerAddress) external

initialize init the contract with the following parameters

this function is called only once during the contract initialization.

Name Type Description
_owner address contract's owner account address
_conditionStoreManagerAddress address condition store manager address

hashValues

function hashValues(bytes32 _did, address _vaultAddress, address _assetToRepay, uint256 _amountToRepay, uint256 _interestRateMode) public pure returns (bytes32)

hashValues generates the hash of condition inputs with the following parameters

Name Type Description
_did bytes32 the DID of the asset
_vaultAddress address the address of vault locking the deposited collateral and the asset
_assetToRepay address the address of the asset to repay (i.e DAI)
_amountToRepay uint256 Amount to repay
_interestRateMode uint256 interest rate type stable 1, variable 2
Name Type Description
[0] bytes32 bytes32 hash of all these values

fulfill

function fulfill(bytes32 _agreementId, bytes32 _did, address _vaultAddress, address _assetToRepay, uint256 _amountToRepay, uint256 _interestRateMode) external returns (enum ConditionStoreLibrary.ConditionState)

It allows the borrower to repay the loan

Name Type Description
_agreementId bytes32 the identifier of the agreement
_did bytes32 the DID of the asset
_vaultAddress address the address of vault locking the deposited collateral and the asset
_assetToRepay address the address of the asset to repay (i.e DAI)
_amountToRepay uint256 Amount to repay
_interestRateMode uint256 interest rate type stable 1, variable 2
Name Type Description
[0] enum ConditionStoreLibrary.ConditionState ConditionStoreLibrary.ConditionState the state of the condition (Fulfilled if everything went good)

EscrowPaymentCondition

_Implementation of the Escrow Payment Condition

 The Escrow payment is reward condition in which only 
 can release reward if lock and release conditions
 are fulfilled._

CONDITION_TYPE

bytes32 CONDITION_TYPE

USED_PAYMENT_ID

bytes32 USED_PAYMENT_ID

Fulfilled

event Fulfilled(bytes32 _agreementId, address _tokenAddress, address[] _receivers, bytes32 _conditionId, uint256[] _amounts)

Received

event Received(address _from, uint256 _value)

receive

receive() external payable

initialize

function initialize(address _owner, address _conditionStoreManagerAddress) external

initialize init the contract with the following parameters

Name Type Description
_owner address contract's owner account address
_conditionStoreManagerAddress address condition store manager address

hashValuesMulti

function hashValuesMulti(bytes32 _did, uint256[] _amounts, address[] _receivers, address _returnAddress, address _lockPaymentAddress, address _tokenAddress, bytes32 _lockCondition, bytes32[] _releaseConditions) public pure returns (bytes32)

hashValues generates the hash of condition inputs with the following parameters

Name Type Description
_did bytes32 asset decentralized identifier
_amounts uint256[] token amounts to be locked/released
_receivers address[] receiver's addresses
_returnAddress address
_lockPaymentAddress address lock payment contract address
_tokenAddress address the ERC20 contract address to use during the payment
_lockCondition bytes32 lock condition identifier
_releaseConditions bytes32[] release condition identifier
Name Type Description
[0] bytes32 bytes32 hash of all these values

encodeParams

function encodeParams(bytes32 _did, uint256[] _amounts, address[] _receivers, address _returnAddress, address _lockPaymentAddress, address _tokenAddress, bytes32 _lockCondition, bytes32[] _releaseConditions) public pure returns (bytes)

hashValues

function hashValues(bytes32 _did, uint256[] _amounts, address[] _receivers, address _returnAddress, address _lockPaymentAddress, address _tokenAddress, bytes32 _lockCondition, bytes32 _releaseCondition) public pure returns (bytes32)

hashValuesLockPayment

function hashValuesLockPayment(bytes32 _did, address _rewardAddress, address _tokenAddress, uint256[] _amounts, address[] _receivers) public pure returns (bytes32)

hashValuesLockPayment generates the hash of condition inputs with the following parameters

Name Type Description
_did bytes32 the asset decentralized identifier
_rewardAddress address the contract address where the reward is locked
_tokenAddress address the ERC20 contract address to use during the lock payment. If the address is 0x0 means we won't use a ERC20 but ETH for payment
_amounts uint256[] token amounts to be locked/released
_receivers address[] receiver's addresses
Name Type Description
[0] bytes32 bytes32 hash of all these values

fulfillMulti

function fulfillMulti(bytes32 _agreementId, bytes32 _did, uint256[] _amounts, address[] _receivers, address _returnAddress, address _lockPaymentAddress, address _tokenAddress, bytes32 _lockCondition, bytes32[] _releaseConditions) public returns (enum ConditionStoreLibrary.ConditionState)

fulfill escrow reward condition

fulfill method checks whether the lock and release conditions are fulfilled in order to release/refund the reward to receiver/sender respectively.

Name Type Description
_agreementId bytes32 agreement identifier
_did bytes32 asset decentralized identifier
_amounts uint256[] token amounts to be locked/released
_receivers address[] receiver's address
_returnAddress address
_lockPaymentAddress address lock payment contract address
_tokenAddress address the ERC20 contract address to use during the payment
_lockCondition bytes32 lock condition identifier
_releaseConditions bytes32[] release condition identifier
Name Type Description
[0] enum ConditionStoreLibrary.ConditionState condition state (Fulfilled/Aborted)

Args

struct Args {
  bytes32 _agreementId;
  bytes32 _did;
  uint256[] _amounts;
  address[] _receivers;
  address _returnAddress;
  address _lockPaymentAddress;
  address _tokenAddress;
  bytes32 _lockCondition;
  bytes32[] _releaseConditions;
}

fulfillKludge

function fulfillKludge(struct EscrowPaymentCondition.Args a) internal returns (enum ConditionStoreLibrary.ConditionState)

fulfill

function fulfill(bytes32 _agreementId, bytes32 _did, uint256[] _amounts, address[] _receivers, address _returnAddress, address _lockPaymentAddress, address _tokenAddress, bytes32 _lockCondition, bytes32 _releaseCondition) external returns (enum ConditionStoreLibrary.ConditionState)

_transferAndFulfillERC20

function _transferAndFulfillERC20(bytes32 _id, address _tokenAddress, address[] _receivers, uint256[] _amounts) private returns (enum ConditionStoreLibrary.ConditionState)

_transferAndFulfill transfer ERC20 tokens and fulfill the condition

Name Type Description
_id bytes32 condition identifier
_tokenAddress address the ERC20 contract address to use during the payment
_receivers address[] receiver's address
_amounts uint256[] token amount to be locked/released
Name Type Description
[0] enum ConditionStoreLibrary.ConditionState condition state (Fulfilled/Aborted)

_transferAndFulfillETH

function _transferAndFulfillETH(bytes32 _id, address[] _receivers, uint256[] _amounts) private returns (enum ConditionStoreLibrary.ConditionState)

_transferAndFulfill transfer ETH and fulfill the condition

Name Type Description
_id bytes32 condition identifier
_receivers address[] receiver's address
_amounts uint256[] token amount to be locked/released
Name Type Description
[0] enum ConditionStoreLibrary.ConditionState condition state (Fulfilled/Aborted)

INFTEscrow

Common interface for ERC-721 and ERC-1155

Fulfilled

event Fulfilled(bytes32 _agreementId, address _tokenAddress, bytes32 _did, address _receivers, bytes32 _conditionId, uint256 _amounts)

NFT721EscrowPaymentCondition

_Implementation of the Escrow Payment Condition

 The Escrow payment is reward condition in which only 
 can release reward if lock and release conditions
 are fulfilled._

CONDITION_TYPE

bytes32 CONDITION_TYPE

Received

event Received(address _from, uint256 _value)

receive

receive() external payable

initialize

function initialize(address _owner, address _conditionStoreManagerAddress) external

initialize init the contract with the following parameters

Name Type Description
_owner address contract's owner account address
_conditionStoreManagerAddress address condition store manager address

hashValues

function hashValues(bytes32 _did, uint256 _amounts, address _receivers, address _returnAddress, address _lockPaymentAddress, address _tokenAddress, bytes32 _lockCondition, bytes32[] _releaseConditions) public pure returns (bytes32)

hashValues generates the hash of condition inputs with the following parameters

Name Type Description
_did bytes32 asset decentralized identifier
_amounts uint256 token amounts to be locked/released
_receivers address receiver's addresses
_returnAddress address
_lockPaymentAddress address lock payment contract address
_tokenAddress address the ERC20 contract address to use during the payment
_lockCondition bytes32 lock condition identifier
_releaseConditions bytes32[] release condition identifier
Name Type Description
[0] bytes32 bytes32 hash of all these values

hashValuesLockPayment

function hashValuesLockPayment(bytes32 _did, address _lockAddress, address _nftContractAddress, uint256 _amount, address _receiver) public pure returns (bytes32)

hashValuesLockPayment generates the hash of condition inputs with the following parameters

Name Type Description
_did bytes32 the asset decentralized identifier
_lockAddress address the contract address where the reward is locked
_nftContractAddress address the ERC20 contract address to use during the lock payment. If the address is 0x0 means we won't use a ERC20 but ETH for payment
_amount uint256 token amounts to be locked/released
_receiver address receiver's addresses
Name Type Description
[0] bytes32 bytes32 hash of all these values

fulfill

function fulfill(bytes32 _agreementId, bytes32 _did, uint256 _amount, address _receiver, address _returnAddress, address _lockPaymentAddress, address _tokenAddress, bytes32 _lockCondition, bytes32[] _releaseConditions) external returns (enum ConditionStoreLibrary.ConditionState)

fulfill escrow reward condition

fulfill method checks whether the lock and release conditions are fulfilled in order to release/refund the reward to receiver/sender respectively.

Name Type Description
_agreementId bytes32 agreement identifier
_did bytes32 asset decentralized identifier
_amount uint256 token amounts to be locked/released
_receiver address receiver's address
_returnAddress address
_lockPaymentAddress address lock payment contract address
_tokenAddress address the ERC20 contract address to use during the payment
_lockCondition bytes32 lock condition identifier
_releaseConditions bytes32[] release condition identifier
Name Type Description
[0] enum ConditionStoreLibrary.ConditionState condition state (Fulfilled/Aborted)

Args

struct Args {
  bytes32 _agreementId;
  bytes32 _did;
  uint256 _amount;
  address _receiver;
  address _returnAddress;
  address _lockPaymentAddress;
  address _tokenAddress;
  bytes32 _lockCondition;
  bytes32[] _releaseConditions;
}

fulfillKludge

function fulfillKludge(struct NFT721EscrowPaymentCondition.Args a) internal returns (enum ConditionStoreLibrary.ConditionState)

_transferAndFulfillNFT

function _transferAndFulfillNFT(bytes32 _agreementId, bytes32 _id, bytes32 _did, address _tokenAddress, address _receiver, uint256 _amount) private returns (enum ConditionStoreLibrary.ConditionState)

_transferAndFulfill transfer ERC20 tokens and fulfill the condition

Name Type Description
_agreementId bytes32
_id bytes32 condition identifier
_did bytes32
_tokenAddress address the ERC20 contract address to use during the payment
_receiver address receiver's address
_amount uint256 token amount to be locked/released
Name Type Description
[0] enum ConditionStoreLibrary.ConditionState condition state (Fulfilled/Aborted)

onERC721Received

function onERC721Received(address, address, uint256, bytes) public virtual returns (bytes4)

NFTEscrowPaymentCondition

_Implementation of the Escrow Payment Condition

 The Escrow payment is reward condition in which only 
 can release reward if lock and release conditions
 are fulfilled._

CONDITION_TYPE

bytes32 CONDITION_TYPE

LOCK_CONDITION_TYPE

bytes32 LOCK_CONDITION_TYPE

Received

event Received(address _from, uint256 _value)

receive

receive() external payable

initialize

function initialize(address _owner, address _conditionStoreManagerAddress) external

initialize init the contract with the following parameters

Name Type Description
_owner address contract's owner account address
_conditionStoreManagerAddress address condition store manager address

hashValues

function hashValues(bytes32 _did, uint256 _amounts, address _receivers, address _returnAddress, address _lockPaymentAddress, address _tokenAddress, bytes32 _lockCondition, bytes32[] _releaseConditions) public pure returns (bytes32)

hashValues generates the hash of condition inputs with the following parameters

Name Type Description
_did bytes32 asset decentralized identifier
_amounts uint256 token amounts to be locked/released
_receivers address receiver's addresses
_returnAddress address
_lockPaymentAddress address lock payment contract address
_tokenAddress address the ERC20 contract address to use during the payment
_lockCondition bytes32 lock condition identifier
_releaseConditions bytes32[] release condition identifier
Name Type Description
[0] bytes32 bytes32 hash of all these values

hashValuesLockPayment

function hashValuesLockPayment(bytes32 _did, address _lockAddress, address _nftContractAddress, uint256 _amount, address _receiver) public pure returns (bytes32)

hashValuesLockPayment generates the hash of condition inputs with the following parameters

Name Type Description
_did bytes32 the asset decentralized identifier
_lockAddress address the contract address where the reward is locked
_nftContractAddress address the ERC20 contract address to use during the lock payment. If the address is 0x0 means we won't use a ERC20 but ETH for payment
_amount uint256 token amounts to be locked/released
_receiver address receiver's addresses
Name Type Description
[0] bytes32 bytes32 hash of all these values

fulfill

function fulfill(bytes32 _agreementId, bytes32 _did, uint256 _amount, address _receiver, address _returnAddress, address _lockPaymentAddress, address _tokenAddress, bytes32 _lockCondition, bytes32[] _releaseConditions) external returns (enum ConditionStoreLibrary.ConditionState)

fulfill escrow reward condition

fulfill method checks whether the lock and release conditions are fulfilled in order to release/refund the reward to receiver/sender respectively.

Name Type Description
_agreementId bytes32 agreement identifier
_did bytes32 asset decentralized identifier
_amount uint256 token amounts to be locked/released
_receiver address receiver's address
_returnAddress address
_lockPaymentAddress address lock payment contract address
_tokenAddress address the ERC20 contract address to use during the payment
_lockCondition bytes32 lock condition identifier
_releaseConditions bytes32[] release condition identifier
Name Type Description
[0] enum ConditionStoreLibrary.ConditionState condition state (Fulfilled/Aborted)

Args

struct Args {
  bytes32 _agreementId;
  bytes32 _did;
  uint256 _amount;
  address _receiver;
  address _returnAddress;
  address _lockPaymentAddress;
  address _tokenAddress;
  bytes32 _lockCondition;
  bytes32[] _releaseConditions;
}

fulfillKludge

function fulfillKludge(struct NFTEscrowPaymentCondition.Args a) internal returns (enum ConditionStoreLibrary.ConditionState)

_transferAndFulfillNFT

function _transferAndFulfillNFT(bytes32 _agreementId, bytes32 _id, bytes32 _did, address _tokenAddress, address _receiver, uint256 _amount) private returns (enum ConditionStoreLibrary.ConditionState)

_transferAndFulfill transfer ERC20 tokens and fulfill the condition

Name Type Description
_agreementId bytes32
_id bytes32 condition identifier
_did bytes32
_tokenAddress address the ERC20 contract address to use during the payment
_receiver address receiver's address
_amount uint256 token amount to be locked/released
Name Type Description
[0] enum ConditionStoreLibrary.ConditionState condition state (Fulfilled/Aborted)

ERC1155_ACCEPTED

bytes4 ERC1155_ACCEPTED

ERC1155_BATCH_ACCEPTED

bytes4 ERC1155_BATCH_ACCEPTED

onERC1155Received

function onERC1155Received(address, address, uint256, uint256, bytes) external pure returns (bytes4)

onERC1155BatchReceived

function onERC1155BatchReceived(address, address, uint256[], uint256[], bytes) external pure returns (bytes4)

supportsInterface

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

_Returns true if this contract implements the interface defined by interfaceId. See the corresponding https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] to learn more about how these ids are created.

This function call must use less than 30 000 gas._

Reward

_Implementation of the Reward.

 Generic reward condition_

INVMConfig

GOVERNOR_ROLE

bytes32 GOVERNOR_ROLE

NeverminedConfigChange

event NeverminedConfigChange(address _whoChanged, bytes32 _parameter)

Event that is emitted when a parameter is changed

Name Type Description
_whoChanged address the address of the governor changing the parameter
_parameter bytes32 the hash of the name of the parameter changed

initialize

function initialize(address _owner, address _governor) external virtual

Used to initialize the contract during delegator constructor

Name Type Description
_owner address The owner of the contract
_governor address The address to be granted with the GOVERNOR_ROLE

setMarketplaceFees

function setMarketplaceFees(uint256 _marketplaceFee, address _feeReceiver) external virtual

The governor can update the Nevermined Marketplace fees

Name Type Description
_marketplaceFee uint256 new marketplace fee
_feeReceiver address The address receiving the fee

isGovernor

function isGovernor(address _address) external view virtual returns (bool)

Indicates if an address is a having the GOVERNOR role

Name Type Description
_address address The address to validate
Name Type Description
[0] bool true if is a governor

getMarketplaceFee

function getMarketplaceFee() external view virtual returns (uint256)

Returns the marketplace fee

Name Type Description
[0] uint256 the marketplace fee

getFeeReceiver

function getFeeReceiver() external view virtual returns (address)

Returns the receiver address of the marketplace fee

Name Type Description
[0] address the receiver address

NeverminedConfig

marketplaceFee

uint256 marketplaceFee

feeReceiver

address feeReceiver

initialize

function initialize(address _owner, address _governor) public

Used to initialize the contract during delegator constructor

Name Type Description
_owner address The owner of the contract
_governor address The address to be granted with the GOVERNOR_ROLE

setMarketplaceFees

function setMarketplaceFees(uint256 _marketplaceFee, address _feeReceiver) external virtual

The governor can update the Nevermined Marketplace fees

Name Type Description
_marketplaceFee uint256 new marketplace fee
_feeReceiver address The address receiving the fee

setGovernor

function setGovernor(address _address) external

isGovernor

function isGovernor(address _address) external view returns (bool)

Indicates if an address is a having the GOVERNOR role

Name Type Description
_address address The address to validate
Name Type Description
[0] bool true if is a governor

getMarketplaceFee

function getMarketplaceFee() external view returns (uint256)

Returns the marketplace fee

Name Type Description
[0] uint256 the marketplace fee

getFeeReceiver

function getFeeReceiver() external view returns (address)

Returns the receiver address of the marketplace fee

Name Type Description
[0] address the receiver address

onlyGovernor

modifier onlyGovernor(address _address)

IERC20

totalSupply

function totalSupply() external view returns (uint256)

Returns the amount of tokens in existence.

balanceOf

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

Returns the amount of tokens owned by account.

transfer

function transfer(address recipient, uint256 amount) external returns (bool)

_Moves amount tokens from the caller's account to recipient.

Returns a boolean value indicating whether the operation succeeded.

Emits a {Transfer} event._

allowance

function allowance(address owner, address spender) external view returns (uint256)

_Returns the remaining number of tokens that spender will be allowed to spend on behalf of owner through {transferFrom}. This is zero by default.

This value changes when {approve} or {transferFrom} are called._

approve

function approve(address spender, uint256 amount) external returns (bool)

_Sets amount as the allowance of spender over the caller's tokens.

Returns a boolean value indicating whether the operation succeeded.

IMPORTANT: Beware that changing an allowance with this method brings the risk that someone may use both the old and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards: https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729

Emits an {Approval} event._

transferFrom

function transferFrom(address sender, address recipient, uint256 amount) external returns (bool)

_Moves amount tokens from sender to recipient using the allowance mechanism. amount is then deducted from the caller's allowance.

Returns a boolean value indicating whether the operation succeeded.

Emits a {Transfer} event._

Transfer

event Transfer(address from, address to, uint256 value)

_Emitted when value tokens are moved from one account (from) to another (to).

Note that value may be zero._

Approval

event Approval(address owner, address spender, uint256 value)

Emitted when the allowance of a spender for an owner is set by a call to {approve}. value is the new allowance.

IPriceOracleGetter

Interface for the Aave price oracle.

getAssetPrice

function getAssetPrice(address asset) external view returns (uint256)

returns the asset price in ETH

Name Type Description
asset address the address of the asset
Name Type Description
[0] uint256 the ETH price of the asset

IProtocolDataProvider

TokenData

struct TokenData {
  string symbol;
  address tokenAddress;
}

ADDRESSES_PROVIDER

function ADDRESSES_PROVIDER() external view returns (contract ILendingPoolAddressesProvider)

getAllReservesTokens

function getAllReservesTokens() external view returns (struct IProtocolDataProvider.TokenData[])

getAllATokens

function getAllATokens() external view returns (struct IProtocolDataProvider.TokenData[])

getReserveConfigurationData

function getReserveConfigurationData(address asset) external view returns (uint256 decimals, uint256 ltv, uint256 liquidationThreshold, uint256 liquidationBonus, uint256 reserveFactor, bool usageAsCollateralEnabled, bool borrowingEnabled, bool stableBorrowRateEnabled, bool isActive, bool isFrozen)

getReserveData

function getReserveData(address asset) external view returns (uint256 availableLiquidity, uint256 totalStableDebt, uint256 totalVariableDebt, uint256 liquidityRate, uint256 variableBorrowRate, uint256 stableBorrowRate, uint256 averageStableBorrowRate, uint256 liquidityIndex, uint256 variableBorrowIndex, uint40 lastUpdateTimestamp)

getUserReserveData

function getUserReserveData(address asset, address user) external view returns (uint256 currentATokenBalance, uint256 currentStableDebt, uint256 currentVariableDebt, uint256 principalStableDebt, uint256 scaledVariableDebt, uint256 stableBorrowRate, uint256 liquidityRate, uint40 stableRateLastUpdated, bool usageAsCollateralEnabled)

getReserveTokensAddresses

function getReserveTokensAddresses(address asset) external view returns (address aTokenAddress, address stableDebtTokenAddress, address variableDebtTokenAddress)

ILendingPoolAddressesProvider

MarketIdSet

event MarketIdSet(string newMarketId)

LendingPoolUpdated

event LendingPoolUpdated(address newAddress)

ConfigurationAdminUpdated

event ConfigurationAdminUpdated(address newAddress)

EmergencyAdminUpdated

event EmergencyAdminUpdated(address newAddress)

LendingPoolConfiguratorUpdated

event LendingPoolConfiguratorUpdated(address newAddress)

LendingPoolCollateralManagerUpdated

event LendingPoolCollateralManagerUpdated(address newAddress)

PriceOracleUpdated

event PriceOracleUpdated(address newAddress)

LendingRateOracleUpdated

event LendingRateOracleUpdated(address newAddress)

ProxyCreated

event ProxyCreated(bytes32 id, address newAddress)

AddressSet

event AddressSet(bytes32 id, address newAddress, bool hasProxy)

getMarketId

function getMarketId() external view returns (string)

setMarketId

function setMarketId(string marketId) external

setAddress

function setAddress(bytes32 id, address newAddress) external

setAddressAsProxy

function setAddressAsProxy(bytes32 id, address impl) external

getAddress

function getAddress(bytes32 id) external view returns (address)

getLendingPool

function getLendingPool() external view returns (address)

setLendingPoolImpl

function setLendingPoolImpl(address pool) external

getLendingPoolConfigurator

function getLendingPoolConfigurator() external view returns (address)

setLendingPoolConfiguratorImpl

function setLendingPoolConfiguratorImpl(address configurator) external

getLendingPoolCollateralManager

function getLendingPoolCollateralManager() external view returns (address)

setLendingPoolCollateralManager

function setLendingPoolCollateralManager(address manager) external

getPoolAdmin

function getPoolAdmin() external view returns (address)

setPoolAdmin

function setPoolAdmin(address admin) external

getEmergencyAdmin

function getEmergencyAdmin() external view returns (address)

setEmergencyAdmin

function setEmergencyAdmin(address admin) external

getPriceOracle

function getPriceOracle() external view returns (address)

setPriceOracle

function setPriceOracle(address priceOracle) external

getLendingRateOracle

function getLendingRateOracle() external view returns (address)

setLendingRateOracle

function setLendingRateOracle(address lendingRateOracle) external

ILendingPool

Deposit

event Deposit(address reserve, address user, address onBehalfOf, uint256 amount, uint16 referral)

Emitted on deposit()

Name Type Description
reserve address The address of the underlying asset of the reserve
user address The address initiating the deposit
onBehalfOf address The beneficiary of the deposit, receiving the aTokens
amount uint256 The amount deposited
referral uint16 The referral code used

Withdraw

event Withdraw(address reserve, address user, address to, uint256 amount)

Emitted on withdraw()

Name Type Description
reserve address The address of the underlyng asset being withdrawn
user address The address initiating the withdrawal, owner of aTokens
to address Address that will receive the underlying
amount uint256 The amount to be withdrawn

Borrow

event Borrow(address reserve, address user, address onBehalfOf, uint256 amount, uint256 borrowRateMode, uint256 borrowRate, uint16 referral)

Emitted on borrow() and flashLoan() when debt needs to be opened

Name Type Description
reserve address The address of the underlying asset being borrowed
user address The address of the user initiating the borrow(), receiving the funds on borrow() or just initiator of the transaction on flashLoan()
onBehalfOf address The address that will be getting the debt
amount uint256 The amount borrowed out
borrowRateMode uint256 The rate mode: 1 for Stable, 2 for Variable
borrowRate uint256 The numeric rate at which the user has borrowed
referral uint16 The referral code used

Repay

event Repay(address reserve, address user, address repayer, uint256 amount)

Emitted on repay()

Name Type Description
reserve address The address of the underlying asset of the reserve
user address The beneficiary of the repayment, getting his debt reduced
repayer address The address of the user initiating the repay(), providing the funds
amount uint256 The amount repaid

Swap

event Swap(address reserve, address user, uint256 rateMode)

Emitted on swapBorrowRateMode()

Name Type Description
reserve address The address of the underlying asset of the reserve
user address The address of the user swapping his rate mode
rateMode uint256 The rate mode that the user wants to swap to

ReserveUsedAsCollateralEnabled

event ReserveUsedAsCollateralEnabled(address reserve, address user)

Emitted on setUserUseReserveAsCollateral()

Name Type Description
reserve address The address of the underlying asset of the reserve
user address The address of the user enabling the usage as collateral

ReserveUsedAsCollateralDisabled

event ReserveUsedAsCollateralDisabled(address reserve, address user)

Emitted on setUserUseReserveAsCollateral()

Name Type Description
reserve address The address of the underlying asset of the reserve
user address The address of the user enabling the usage as collateral

RebalanceStableBorrowRate

event RebalanceStableBorrowRate(address reserve, address user)

Emitted on rebalanceStableBorrowRate()

Name Type Description
reserve address The address of the underlying asset of the reserve
user address The address of the user for which the rebalance has been executed

FlashLoan

event FlashLoan(address target, address initiator, address asset, uint256 amount, uint256 premium, uint16 referralCode)

Emitted on flashLoan()

Name Type Description
target address The address of the flash loan receiver contract
initiator address The address initiating the flash loan
asset address The address of the asset being flash borrowed
amount uint256 The amount flash borrowed
premium uint256 The fee flash borrowed
referralCode uint16 The referral code used

Paused

event Paused()

Emitted when the pause is triggered.

Unpaused

event Unpaused()

Emitted when the pause is lifted.

LiquidationCall

event LiquidationCall(address collateralAsset, address debtAsset, address user, uint256 debtToCover, uint256 liquidatedCollateralAmount, address liquidator, bool receiveAToken)

Emitted when a borrower is liquidated. This event is emitted by the LendingPool via LendingPoolCollateral manager using a DELEGATECALL This allows to have the events in the generated ABI for LendingPool.

Name Type Description
collateralAsset address The address of the underlying asset used as collateral, to receive as result of the liquidation
debtAsset address The address of the underlying borrowed asset to be repaid with the liquidation
user address The address of the borrower getting liquidated
debtToCover uint256 The debt amount of borrowed asset the liquidator wants to cover
liquidatedCollateralAmount uint256 The amount of collateral received by the liiquidator
liquidator address The address of the liquidator
receiveAToken bool true if the liquidators wants to receive the collateral aTokens, false if he wants to receive the underlying collateral asset directly

ReserveDataUpdated

event ReserveDataUpdated(address reserve, uint256 liquidityRate, uint256 stableBorrowRate, uint256 variableBorrowRate, uint256 liquidityIndex, uint256 variableBorrowIndex)

Emitted when the state of a reserve is updated. NOTE: This event is actually declared in the ReserveLogic library and emitted in the updateInterestRates() function. Since the function is internal, the event will actually be fired by the LendingPool contract. The event is therefore replicated here so it gets added to the LendingPool ABI

Name Type Description
reserve address The address of the underlying asset of the reserve
liquidityRate uint256 The new liquidity rate
stableBorrowRate uint256 The new stable borrow rate
variableBorrowRate uint256 The new variable borrow rate
liquidityIndex uint256 The new liquidity index
variableBorrowIndex uint256 The new variable borrow index

deposit

function deposit(address asset, uint256 amount, address onBehalfOf, uint16 referralCode) external

Deposits an amount of underlying asset into the reserve, receiving in return overlying aTokens. - E.g. User deposits 100 USDC and gets in return 100 aUSDC

Name Type Description
asset address The address of the underlying asset to deposit
amount uint256 The amount to be deposited
onBehalfOf address The address that will receive the aTokens, same as msg.sender if the user wants to receive them on his own wallet, or a different address if the beneficiary of aTokens is a different wallet
referralCode uint16 Code used to register the integrator originating the operation, for potential rewards. 0 if the action is executed directly by the user, without any middle-man

withdraw

function withdraw(address asset, uint256 amount, address to) external returns (uint256)

Withdraws an amount of underlying asset from the reserve, burning the equivalent aTokens owned E.g. User has 100 aUSDC, calls withdraw() and receives 100 USDC, burning the 100 aUSDC

Name Type Description
asset address The address of the underlying asset to withdraw
amount uint256 The underlying amount to be withdrawn - Send the value type(uint256).max in order to withdraw the whole aToken balance
to address Address that will receive the underlying, same as msg.sender if the user wants to receive it on his own wallet, or a different address if the beneficiary is a different wallet
Name Type Description
[0] uint256 The final amount withdrawn

borrow

function borrow(address asset, uint256 amount, uint256 interestRateMode, uint16 referralCode, address onBehalfOf) external

Allows users to borrow a specific amount of the reserve underlying asset, provided that the borrower already deposited enough collateral, or he was given enough allowance by a credit delegator on the corresponding debt token (StableDebtToken or VariableDebtToken) - E.g. User borrows 100 USDC passing as onBehalfOf his own address, receiving the 100 USDC in his wallet and 100 stable/variable debt tokens, depending on the interestRateMode

Name Type Description
asset address The address of the underlying asset to borrow
amount uint256 The amount to be borrowed
interestRateMode uint256 The interest rate mode at which the user wants to borrow: 1 for Stable, 2 for Variable
referralCode uint16 Code used to register the integrator originating the operation, for potential rewards. 0 if the action is executed directly by the user, without any middle-man
onBehalfOf address Address of the user who will receive the debt. Should be the address of the borrower itself calling the function if he wants to borrow against his own collateral, or the address of the credit delegator if he has been given credit delegation allowance

repay

function repay(address asset, uint256 amount, uint256 rateMode, address onBehalfOf) external returns (uint256)

Repays a borrowed amount on a specific reserve, burning the equivalent debt tokens owned - E.g. User repays 100 USDC, burning 100 variable/stable debt tokens of the onBehalfOf address

Name Type Description
asset address The address of the borrowed underlying asset previously borrowed
amount uint256 The amount to repay - Send the value type(uint256).max in order to repay the whole debt for asset on the specific debtMode
rateMode uint256 The interest rate mode at of the debt the user wants to repay: 1 for Stable, 2 for Variable
onBehalfOf address Address of the user who will get his debt reduced/removed. Should be the address of the user calling the function if he wants to reduce/remove his own debt, or the address of any other other borrower whose debt should be removed
Name Type Description
[0] uint256 The final amount repaid

swapBorrowRateMode

function swapBorrowRateMode(address asset, uint256 rateMode) external

Allows a borrower to swap his debt between stable and variable mode, or viceversa

Name Type Description
asset address The address of the underlying asset borrowed
rateMode uint256 The rate mode that the user wants to swap to

rebalanceStableBorrowRate

function rebalanceStableBorrowRate(address asset, address user) external

Rebalances the stable interest rate of a user to the current stable rate defined on the reserve. - Users can be rebalanced if the following conditions are satisfied: 1. Usage ratio is above 95% 2. the current deposit APY is below REBALANCE_UP_THRESHOLD * maxVariableBorrowRate, which means that too much has been borrowed at a stable rate and depositors are not earning enough

Name Type Description
asset address The address of the underlying asset borrowed
user address The address of the user to be rebalanced

setUserUseReserveAsCollateral

function setUserUseReserveAsCollateral(address asset, bool useAsCollateral) external

Allows depositors to enable/disable a specific deposited asset as collateral

Name Type Description
asset address The address of the underlying asset deposited
useAsCollateral bool true if the user wants to use the deposit as collateral, false otherwise

liquidationCall

function liquidationCall(address collateralAsset, address debtAsset, address user, uint256 debtToCover, bool receiveAToken) external

Function to liquidate a non-healthy position collateral-wise, with Health Factor below 1 - The caller (liquidator) covers debtToCover amount of debt of the user getting liquidated, and receives a proportionally amount of the collateralAsset plus a bonus to cover market risk

Name Type Description
collateralAsset address The address of the underlying asset used as collateral, to receive as result of the liquidation
debtAsset address The address of the underlying borrowed asset to be repaid with the liquidation
user address The address of the borrower getting liquidated
debtToCover uint256 The debt amount of borrowed asset the liquidator wants to cover
receiveAToken bool true if the liquidators wants to receive the collateral aTokens, false if he wants to receive the underlying collateral asset directly

flashLoan

function flashLoan(address receiverAddress, address[] assets, uint256[] amounts, uint256[] modes, address onBehalfOf, bytes params, uint16 referralCode) external

Allows smartcontracts to access the liquidity of the pool within one transaction, as long as the amount taken plus a fee is returned. IMPORTANT There are security concerns for developers of flashloan receiver contracts that must be kept into consideration. For further details please visit https://developers.aave.com

Name Type Description
receiverAddress address The address of the contract receiving the funds, implementing the IFlashLoanReceiver interface
assets address[] The addresses of the assets being flash-borrowed
amounts uint256[] The amounts amounts being flash-borrowed
modes uint256[] Types of the debt to open if the flash loan is not returned: 0 -> Don't open any debt, just revert if funds can't be transferred from the receiver 1 -> Open debt at stable rate for the value of the amount flash-borrowed to the onBehalfOf address 2 -> Open debt at variable rate for the value of the amount flash-borrowed to the onBehalfOf address
onBehalfOf address The address that will receive the debt in the case of using on modes 1 or 2
params bytes Variadic packed params to pass to the receiver as extra information
referralCode uint16 Code used to register the integrator originating the operation, for potential rewards. 0 if the action is executed directly by the user, without any middle-man

getUserAccountData

function getUserAccountData(address user) external view returns (uint256 totalCollateralETH, uint256 totalDebtETH, uint256 availableBorrowsETH, uint256 currentLiquidationThreshold, uint256 ltv, uint256 healthFactor)

Returns the user account data across all the reserves

Name Type Description
user address The address of the user
Name Type Description
totalCollateralETH uint256 the total collateral in ETH of the user
totalDebtETH uint256 the total debt in ETH of the user
availableBorrowsETH uint256 the borrowing power left of the user
currentLiquidationThreshold uint256 the liquidation threshold of the user
ltv uint256 the loan to value of the user
healthFactor uint256 the current health factor of the user

initReserve

function initReserve(address reserve, address aTokenAddress, address stableDebtAddress, address variableDebtAddress, address interestRateStrategyAddress) external

setReserveInterestRateStrategyAddress

function setReserveInterestRateStrategyAddress(address reserve, address rateStrategyAddress) external

setConfiguration

function setConfiguration(address reserve, uint256 configuration) external

getConfiguration

function getConfiguration(address asset) external view returns (struct DataTypes.ReserveConfigurationMap)

Returns the configuration of the reserve

Name Type Description
asset address The address of the underlying asset of the reserve
Name Type Description
[0] struct DataTypes.ReserveConfigurationMap The configuration of the reserve

getUserConfiguration

function getUserConfiguration(address user) external view returns (struct DataTypes.UserConfigurationMap)

Returns the configuration of the user across all the reserves

Name Type Description
user address The user address
Name Type Description
[0] struct DataTypes.UserConfigurationMap The configuration of the user

getReserveNormalizedIncome

function getReserveNormalizedIncome(address asset) external view returns (uint256)

Returns the normalized income normalized income of the reserve

Name Type Description
asset address The address of the underlying asset of the reserve
Name Type Description
[0] uint256 The reserve's normalized income

getReserveNormalizedVariableDebt

function getReserveNormalizedVariableDebt(address asset) external view returns (uint256)

Returns the normalized variable debt per unit of asset

Name Type Description
asset address The address of the underlying asset of the reserve
Name Type Description
[0] uint256 The reserve normalized variable debt

getReserveData

function getReserveData(address asset) external view returns (struct DataTypes.ReserveData)

Returns the state and configuration of the reserve

Name Type Description
asset address The address of the underlying asset of the reserve
Name Type Description
[0] struct DataTypes.ReserveData The state of the reserve

finalizeTransfer

function finalizeTransfer(address asset, address from, address to, uint256 amount, uint256 balanceFromAfter, uint256 balanceToBefore) external

getReservesList

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

getAddressesProvider

function getAddressesProvider() external view returns (contract ILendingPoolAddressesProvider)

setPause

function setPause(bool val) external

paused

function paused() external view returns (bool)

IStableDebtToken

Mint

event Mint(address user, address onBehalfOf, uint256 amount, uint256 currentBalance, uint256 balanceIncrease, uint256 newRate, uint256 avgStableRate, uint256 newTotalSupply)

Emitted when new stable debt is minted

Name Type Description
user address The address of the user who triggered the minting
onBehalfOf address The recipient of stable debt tokens
amount uint256 The amount minted
currentBalance uint256 The current balance of the user
balanceIncrease uint256 The increase in balance since the last action of the user
newRate uint256 The rate of the debt after the minting
avgStableRate uint256 The new average stable rate after the minting
newTotalSupply uint256 The new total supply of the stable debt token after the action

Burn

event Burn(address user, uint256 amount, uint256 currentBalance, uint256 balanceIncrease, uint256 avgStableRate, uint256 newTotalSupply)

Emitted when new stable debt is burned

Name Type Description
user address The address of the user
amount uint256 The amount being burned
currentBalance uint256 The current balance of the user
balanceIncrease uint256 The the increase in balance since the last action of the user
avgStableRate uint256 The new average stable rate after the burning
newTotalSupply uint256 The new total supply of the stable debt token after the action

approveDelegation

function approveDelegation(address delegatee, uint256 amount) external

delegates borrowing power to a user on the specific debt token

Name Type Description
delegatee address the address receiving the delegated borrowing power
amount uint256 the maximum amount being delegated. Delegation will still respect the liquidation constraints (even if delegated, a delegatee cannot force a delegator HF to go below 1)

borrowAllowance

function borrowAllowance(address fromUser, address toUser) external view returns (uint256)

returns the borrow allowance of the user

Name Type Description
fromUser address The user to giving allowance
toUser address The user to give allowance to
Name Type Description
[0] uint256 the current allowance of toUser

mint

function mint(address user, address onBehalfOf, uint256 amount, uint256 rate) external returns (bool)

Mints debt token to the onBehalfOf address. - The resulting rate is the weighted average between the rate of the new debt and the rate of the previous debt

Name Type Description
user address The address receiving the borrowed underlying, being the delegatee in case of credit delegate, or same as onBehalfOf otherwise
onBehalfOf address The address receiving the debt tokens
amount uint256 The amount of debt tokens to mint
rate uint256 The rate of the debt being minted

burn

function burn(address user, uint256 amount) external

Burns debt of user - The resulting rate is the weighted average between the rate of the new debt and the rate of the previous debt

Name Type Description
user address The address of the user getting his debt burned
amount uint256 The amount of debt tokens getting burned

getAverageStableRate

function getAverageStableRate() external view returns (uint256)

Returns the average rate of all the stable rate loans.

Name Type Description
[0] uint256 The average stable rate

getUserStableRate

function getUserStableRate(address user) external view returns (uint256)

Returns the stable rate of the user debt

Name Type Description
[0] uint256 The stable rate of the user

getUserLastUpdated

function getUserLastUpdated(address user) external view returns (uint40)

Returns the timestamp of the last update of the user

Name Type Description
[0] uint40 The timestamp

getSupplyData

function getSupplyData() external view returns (uint256, uint256, uint256, uint40)

Returns the principal, the total supply and the average stable rate

getTotalSupplyLastUpdated

function getTotalSupplyLastUpdated() external view returns (uint40)

Returns the timestamp of the last update of the total supply

Name Type Description
[0] uint40 The timestamp

getTotalSupplyAndAvgRate

function getTotalSupplyAndAvgRate() external view returns (uint256, uint256)

Returns the total supply and the average stable rate

principalBalanceOf

function principalBalanceOf(address user) external view returns (uint256)

Returns the principal debt balance of the user

Name Type Description
[0] uint256 The debt balance of the user since the last burn/mint action

IDynamicPricing

DynamicPricingState

enum DynamicPricingState {
  NotStarted,
  Finished,
  InProgress,
  Aborted
}

getPricingType

function getPricingType() external view returns (bytes32)

getPrice

function getPrice(bytes32 did) external view returns (uint256)

getTokenAddress

function getTokenAddress(bytes32 did) external view returns (address)

getStatus

function getStatus(bytes32 did) external view returns (enum IDynamicPricing.DynamicPricingState, uint256, address)

canBePurchased

function canBePurchased(bytes32 did) external view returns (bool)

withdraw

function withdraw(bytes32 did, address withdrawAddress) external returns (bool)

IList

has

function has(bytes32 value) external view returns (bool)

has

function has(bytes32 value, bytes32 id) external view returns (bool)

IRoyaltyScheme

check

function check(bytes32 _did, uint256[] _amounts, address[] _receivers, address _tokenAddress) external view returns (bool)

check that royalties are correct

Name Type Description
_did bytes32 compute royalties for this DID
_amounts uint256[] amounts in payment
_receivers address[] receivers of payments
_tokenAddress address payment token. zero address means native token (ether)

ISecretStore

checkPermissions

function checkPermissions(address user, bytes32 documentKeyId) external view returns (bool permissionGranted)

checkPermissions is called by Parity secret store

ISecretStorePermission

grantPermission

function grantPermission(address user, bytes32 documentKeyId) external

grantPermission is called only by documentKeyId Owner or provider

renouncePermission

function renouncePermission(address user, bytes32 documentKeyId) external

renouncePermission is called only by documentKeyId Owner or provider

IWETHGateway

depositETH

function depositETH(address lendingPool, address onBehalfOf, uint16 referralCode) external payable

withdrawETH

function withdrawETH(address lendingPool, uint256 amount, address to) external

repayETH

function repayETH(address lendingPool, uint256 amount, uint256 rateMode, address onBehalfOf) external payable

borrowETH

function borrowETH(address lendingPool, uint256 amount, uint256 interesRateMode, uint16 referralCode) external

DataTypes

ReserveData

struct ReserveData {
  struct DataTypes.ReserveConfigurationMap configuration;
  uint128 liquidityIndex;
  uint128 variableBorrowIndex;
  uint128 currentLiquidityRate;
  uint128 currentVariableBorrowRate;
  uint128 currentStableBorrowRate;
  uint40 lastUpdateTimestamp;
  address aTokenAddress;
  address stableDebtTokenAddress;
  address variableDebtTokenAddress;
  address interestRateStrategyAddress;
  uint8 id;
}

ReserveConfigurationMap

struct ReserveConfigurationMap {
  uint256 data;
}

UserConfigurationMap

struct UserConfigurationMap {
  uint256 data;
}

InterestRateMode

enum InterestRateMode {
  NONE,
  STABLE,
  VARIABLE
}

SafeMath

add

function add(uint256 a, uint256 b) internal pure returns (uint256)

_Returns the addition of two unsigned integers, reverting on overflow.

Counterpart to Solidity's + operator.

Requirements: - Addition cannot overflow._

sub

function sub(uint256 a, uint256 b) internal pure returns (uint256)

_Returns the subtraction of two unsigned integers, reverting on overflow (when the result is negative).

Counterpart to Solidity's - operator.

Requirements: - Subtraction cannot overflow._

sub

function sub(uint256 a, uint256 b, string errorMessage) internal pure returns (uint256)

_Returns the subtraction of two unsigned integers, reverting with custom message on overflow (when the result is negative).

Counterpart to Solidity's - operator.

Requirements: - Subtraction cannot overflow._

mul

function mul(uint256 a, uint256 b) internal pure returns (uint256)

_Returns the multiplication of two unsigned integers, reverting on overflow.

Counterpart to Solidity's * operator.

Requirements: - Multiplication cannot overflow._

div

function div(uint256 a, uint256 b) internal pure returns (uint256)

_Returns the integer division of two unsigned integers. Reverts on division by zero. The result is rounded towards zero.

Counterpart to Solidity's / operator. Note: this function uses a revert opcode (which leaves remaining gas untouched) while Solidity uses an invalid opcode to revert (consuming all remaining gas).

Requirements: - The divisor cannot be zero._

div

function div(uint256 a, uint256 b, string errorMessage) internal pure returns (uint256)

_Returns the integer division of two unsigned integers. Reverts with custom message on division by zero. The result is rounded towards zero.

Counterpart to Solidity's / operator. Note: this function uses a revert opcode (which leaves remaining gas untouched) while Solidity uses an invalid opcode to revert (consuming all remaining gas).

Requirements: - The divisor cannot be zero._

mod

function mod(uint256 a, uint256 b) internal pure returns (uint256)

_Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), Reverts when dividing by zero.

Counterpart to Solidity's % operator. This function uses a revert opcode (which leaves remaining gas untouched) while Solidity uses an invalid opcode to revert (consuming all remaining gas).

Requirements: - The divisor cannot be zero._

mod

function mod(uint256 a, uint256 b, string errorMessage) internal pure returns (uint256)

_Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), Reverts with custom message when dividing by zero.

Counterpart to Solidity's % operator. This function uses a revert opcode (which leaves remaining gas untouched) while Solidity uses an invalid opcode to revert (consuming all remaining gas).

Requirements: - The divisor cannot be zero._

Address

isContract

function isContract(address account) internal view returns (bool)

_Returns true if account is a contract.

[IMPORTANT]

It is unsafe to assume that an address for which this function returns false is an externally-owned account (EOA) and not a contract.

Among others, isContract will return false for the following types of addresses:

  • an externally-owned account
  • a contract in construction
  • an address where a contract will be created
  • an address where a contract lived, but was destroyed ====_

sendValue

function sendValue(address payable recipient, uint256 amount) internal

_Replacement for Solidity's transfer: sends amount wei to recipient, forwarding all available gas and reverting on errors.

https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost of certain opcodes, possibly making contracts go over the 2300 gas limit imposed by transfer, making them unable to receive funds via transfer. {sendValue} removes this limitation.

https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].

IMPORTANT: because control is transferred to recipient, care must be taken to not create reentrancy vulnerabilities. Consider using {ReentrancyGuard} or the https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]._

SafeERC20

Wrappers around ERC20 operations that throw on failure (when the token contract returns false). Tokens that return no value (and instead revert or throw on failure) are also supported, non-reverting calls are assumed to be successful. To use this library you can add a using SafeERC20 for IERC20; statement to your contract, which allows you to call the safe operations as token.safeTransfer(...), etc.

safeTransfer

function safeTransfer(contract IERC20 token, address to, uint256 value) internal

safeTransferFrom

function safeTransferFrom(contract IERC20 token, address from, address to, uint256 value) internal

safeApprove

function safeApprove(contract IERC20 token, address spender, uint256 value) internal

callOptionalReturn

function callOptionalReturn(contract IERC20 token, bytes data) private

CloneFactory

createClone

function createClone(address target) internal returns (address result)

isClone

function isClone(address target, address query) internal view returns (bool result)

EpochLibrary

Implementation of Epoch Library. For an arbitrary Epoch, this library manages the life cycle of an Epoch. Usually this library is used for handling the time window between conditions in an agreement.

Epoch

struct Epoch {
  uint256 timeLock;
  uint256 timeOut;
  uint256 blockNumber;
}

EpochList

struct EpochList {
  mapping(bytes32 => struct EpochLibrary.Epoch) epochs;
  bytes32[] epochIds;
}

create

function create(struct EpochLibrary.EpochList _self, bytes32 _id, uint256 _timeLock, uint256 _timeOut) internal

create creates new Epoch

Name Type Description
_self struct EpochLibrary.EpochList is the Epoch storage pointer
_id bytes32
_timeLock uint256 value in block count (can not fulfill before)
_timeOut uint256 value in block count (can not fulfill after)

isTimedOut

function isTimedOut(struct EpochLibrary.EpochList _self, bytes32 _id) external view returns (bool)

isTimedOut means you cannot fulfill after

Name Type Description
_self struct EpochLibrary.EpochList is the Epoch storage pointer
_id bytes32
Name Type Description
[0] bool true if the current block number is gt timeOut

isTimeLocked

function isTimeLocked(struct EpochLibrary.EpochList _self, bytes32 _id) external view returns (bool)

isTimeLocked means you cannot fulfill before

Name Type Description
_self struct EpochLibrary.EpochList is the Epoch storage pointer
_id bytes32
Name Type Description
[0] bool true if the current block number is gt timeLock

getEpochTimeOut

function getEpochTimeOut(struct EpochLibrary.Epoch _self) public view returns (uint256)

getEpochTimeOut

Name Type Description
_self struct EpochLibrary.Epoch is the Epoch storage pointer

getEpochTimeLock

function getEpochTimeLock(struct EpochLibrary.Epoch _self) public view returns (uint256)

getEpochTimeLock

Name Type Description
_self struct EpochLibrary.Epoch is the Epoch storage pointer

HashListLibrary

Implementation of the basic functionality of list of hash values. This library allows other contracts to build and maintain lists and also preserves the privacy of the data by accepting only hashed content (bytes32 based data type)

List

struct List {
  address _owner;
  bytes32[] values;
  mapping(bytes32 => uint256) indices;
}

onlyListOwner

modifier onlyListOwner(struct HashListLibrary.List _self)

add

function add(struct HashListLibrary.List _self, bytes32 value) public returns (bool)

add index an element then add it to a list

Name Type Description
_self struct HashListLibrary.List is a pointer to list in the storage
value bytes32 is a bytes32 value
Name Type Description
[0] bool true if value is added successfully

add

function add(struct HashListLibrary.List _self, bytes32[] values) public returns (bool)

put an array of elements without indexing this meant to save gas in case of large arrays

Name Type Description
_self struct HashListLibrary.List is a pointer to list in the storage
values bytes32[] is an array of elements value
Name Type Description
[0] bool true if values are added successfully

update

function update(struct HashListLibrary.List _self, bytes32 oldValue, bytes32 newValue) public returns (bool)

update the value with a new value and maintain indices

Name Type Description
_self struct HashListLibrary.List is a pointer to list in the storage
oldValue bytes32 is an element value in a list
newValue bytes32 new value
Name Type Description
[0] bool true if value is updated successfully

remove

function remove(struct HashListLibrary.List _self, bytes32 value) public returns (bool)

remove value from a list, updates indices, and list size

Name Type Description
_self struct HashListLibrary.List is a pointer to list in the storage
value bytes32 is an element value in a list
Name Type Description
[0] bool true if value is removed successfully

get

function get(struct HashListLibrary.List _self, uint256 __index) public view returns (bytes32)

has value by index

Name Type Description
_self struct HashListLibrary.List is a pointer to list in the storage
__index uint256 is where is value is stored in the list
Name Type Description
[0] bytes32 the value if exists

index

function index(struct HashListLibrary.List _self, uint256 from, uint256 to) public returns (bool)

index is used to map each element value to its index on the list

Name Type Description
_self struct HashListLibrary.List is a pointer to list in the storage
from uint256 index is where to 'from' indexing in the list
to uint256 index is where to stop indexing
Name Type Description
[0] bool true if the sub list is indexed

setOwner

function setOwner(struct HashListLibrary.List _self, address _owner) public

setOwner set list owner param _owner owner address

indexOf

function indexOf(struct HashListLibrary.List _self, bytes32 value) public view returns (uint256)

indexOf gets the index of a value in a list

Name Type Description
_self struct HashListLibrary.List is a pointer to list in the storage
value bytes32 is element value in list
Name Type Description
[0] uint256 value index in list

isIndexed

function isIndexed(struct HashListLibrary.List _self) public view returns (bool)

isIndexed checks if the list is indexed

Name Type Description
_self struct HashListLibrary.List is a pointer to list in the storage
Name Type Description
[0] bool true if the list is indexed

all

function all(struct HashListLibrary.List _self) public view returns (bytes32[])

all returns all list elements

Name Type Description
_self struct HashListLibrary.List is a pointer to list in the storage
Name Type Description
[0] bytes32[] all list elements

has

function has(struct HashListLibrary.List _self, bytes32 value) public view returns (bool)

size returns the list size

Name Type Description
_self struct HashListLibrary.List is a pointer to list in the storage
value bytes32 is element value in list
Name Type Description
[0] bool true if the value exists

size

function size(struct HashListLibrary.List _self) public view returns (uint256)

size gets the list size

Name Type Description
_self struct HashListLibrary.List is a pointer to list in the storage
Name Type Description
[0] uint256 total length of the list

ownedBy

function ownedBy(struct HashListLibrary.List _self) public view returns (address)

ownedBy gets the list owner

Name Type Description
_self struct HashListLibrary.List is a pointer to list in the storage
Name Type Description
[0] address list owner

_index

function _index(struct HashListLibrary.List _self, uint256 from, uint256 to) private returns (bool)

__index assign index to the list elements_

Name Type Description
_self struct HashListLibrary.List is a pointer to list in the storage
from uint256 is the starting index id
to uint256 is the ending index id

AbstractAuction

AUCTION_MANAGER_ROLE

bytes32 AUCTION_MANAGER_ROLE

NVM_AGREEMENT_ROLE

bytes32 NVM_AGREEMENT_ROLE

Auction

struct Auction {
  bytes32 did;
  enum IDynamicPricing.DynamicPricingState state;
  address creator;
  uint256 blockNumberCreated;
  uint256 floor;
  uint256 starts;
  uint256 ends;
  uint256 price;
  address tokenAddress;
  address whoCanClaim;
  string hash;
}

auctions

mapping(bytes32 => struct AbstractAuction.Auction) auctions

auctionBids

mapping(bytes32 => mapping(address => uint256)) auctionBids

AuctionCreated

event AuctionCreated(bytes32 auctionId, bytes32 did, address creator, uint256 blockNumberCreated, uint256 floor, uint256 starts, uint256 ends, address tokenAddress)

AuctionChangedState

event AuctionChangedState(bytes32 auctionId, address who, enum IDynamicPricing.DynamicPricingState previousState, enum IDynamicPricing.DynamicPricingState newState)

AuctionBidReceived

event AuctionBidReceived(bytes32 auctionId, address bidder, address tokenAddress, uint256 amount)

AuctionWithdrawal

event AuctionWithdrawal(bytes32 auctionId, address receiver, address tokenAddress, uint256 amount)

receive

receive() external payable

abortAuction

function abortAuction(bytes32 _auctionId) external virtual

withdraw

function withdraw(bytes32 _auctionId, address _withdrawAddress) external virtual returns (bool)

getPricingType

function getPricingType() external pure virtual returns (bytes32)

getPrice

function getPrice(bytes32 _auctionId) external view returns (uint256)

getTokenAddress

function getTokenAddress(bytes32 _auctionId) external view returns (address)

getStatus

function getStatus(bytes32 _auctionId) external view returns (enum IDynamicPricing.DynamicPricingState state, uint256 price, address whoCanClaim)

canBePurchased

function canBePurchased(bytes32 _auctionId) external view virtual returns (bool)

addNVMAgreementRole

function addNVMAgreementRole(address account) public

onlyCreator

modifier onlyCreator(bytes32 _auctionId)

onlyCreatorOrAdmin

modifier onlyCreatorOrAdmin(bytes32 _auctionId)

onlyNotCreator

modifier onlyNotCreator(bytes32 _auctionId)

onlyAfterStart

modifier onlyAfterStart(bytes32 _auctionId)

onlyBeforeStarts

modifier onlyBeforeStarts(bytes32 _auctionId)

onlyBeforeEnd

modifier onlyBeforeEnd(bytes32 _auctionId)

onlyNotAbortedOrFinished

modifier onlyNotAbortedOrFinished(bytes32 _auctionId)

onlyAbortedOrFinished

modifier onlyAbortedOrFinished(bytes32 _auctionId)

onlyNotAborted

modifier onlyNotAborted(bytes32 _auctionId)

onlyFinishedOrAborted

modifier onlyFinishedOrAborted(bytes32 _auctionId)

DutchAuction

initialize

function initialize(address _owner) external

initialize init the contract with the following parameters

Name Type Description
_owner address contract's owner account address

create

function create(bytes32 _auctionId, bytes32 _did, uint256 _startPrice, uint256 _starts, uint256 _ends, address _tokenAddress, string _hash) external virtual

It creates a new Auction given some setup parameters

Name Type Description
_auctionId bytes32 unique auction identifier
_did bytes32 reference to the asset part of the auction
_startPrice uint256 start price (and max) for the auction
_starts uint256 block number when the auction starts
_ends uint256 block number of when the auction ends
_tokenAddress address token address to use for the auction. If address(0) means native token
_hash string ipfs hash referring to the auction metadata

placeNativeTokenBid

function placeNativeTokenBid(bytes32 _auctionId) external payable virtual

placeERC20Bid

function placeERC20Bid(bytes32 _auctionId, uint256 _bidAmount) external virtual

withdraw

function withdraw(bytes32 _auctionId, address _withdrawAddress) external virtual returns (bool)

getPricingType

function getPricingType() external pure returns (bytes32)

EnglishAuction

initialize

function initialize(address _owner) external

initialize init the contract with the following parameters

Name Type Description
_owner address contract's owner account address

create

function create(bytes32 _auctionId, bytes32 _did, uint256 _floor, uint256 _starts, uint256 _ends, address _tokenAddress, string _hash) external virtual

It creates a new Auction given some setup parameters

Name Type Description
_auctionId bytes32 unique auction identifier
_did bytes32 reference to the asset part of the auction
_floor uint256 floor price
_starts uint256 block number when the auction starts
_ends uint256 block number of when the auction ends
_tokenAddress address token address to use for the auction. If address(0) means native token
_hash string ipfs hash referring to the auction metadata

placeNativeTokenBid

function placeNativeTokenBid(bytes32 _auctionId) external payable virtual

placeERC20Bid

function placeERC20Bid(bytes32 _auctionId, uint256 _bidAmount) external virtual

getPricingType

function getPricingType() external pure returns (bytes32)

DIDFactory

Implementation of the DID Registry.

didRegisterList

struct DIDRegistryLibrary.DIDRegisterList didRegisterList

state storage for the DID registry

didPermissions

mapping(bytes32 => mapping(address => bool)) didPermissions

manager

address manager

onlyDIDOwner

modifier onlyDIDOwner(bytes32 _did)

onlyManager

modifier onlyManager()

onlyOwnerProviderOrDelegated

modifier onlyOwnerProviderOrDelegated(bytes32 _did)

onlyValidAttributes

modifier onlyValidAttributes(string _attributes)

nftIsInitialized

modifier nftIsInitialized(bytes32 _did)

nft721IsInitialized

modifier nft721IsInitialized(bytes32 _did)

DIDAttributeRegistered

event DIDAttributeRegistered(bytes32 _did, address _owner, bytes32 _checksum, string _value, address _lastUpdatedBy, uint256 _blockNumberUpdated)

DID Events

DIDProviderRemoved

event DIDProviderRemoved(bytes32 _did, address _provider, bool state)

DIDProviderAdded

event DIDProviderAdded(bytes32 _did, address _provider)

DIDOwnershipTransferred

event DIDOwnershipTransferred(bytes32 _did, address _previousOwner, address _newOwner)

DIDPermissionGranted

event DIDPermissionGranted(bytes32 _did, address _owner, address _grantee)

DIDPermissionRevoked

event DIDPermissionRevoked(bytes32 _did, address _owner, address _grantee)

DIDProvenanceDelegateRemoved

event DIDProvenanceDelegateRemoved(bytes32 _did, address _delegate, bool state)

DIDProvenanceDelegateAdded

event DIDProvenanceDelegateAdded(bytes32 _did, address _delegate)

setManager

function setManager(address _addr) external

Sets the manager role. Should be the TransferCondition contract address

registerAttribute

function registerAttribute(bytes32 _didSeed, bytes32 _checksum, address[] _providers, string _url) public virtual

Register DID attributes.

The first attribute of a DID registered sets the DID owner. Subsequent updates record _checksum and update info.

Name Type Description
_didSeed bytes32 refers to decentralized identifier seed (a bytes32 length ID).
_checksum bytes32 includes a one-way HASH calculated using the DDO content.
_providers address[]
_url string refers to the attribute value, limited to 2048 bytes.

registerDID

function registerDID(bytes32 _didSeed, bytes32 _checksum, address[] _providers, string _url, bytes32 _activityId, string _attributes) public virtual

Register DID attributes.

The first attribute of a DID registered sets the DID owner. Subsequent updates record _checksum and update info.

Name Type Description
_didSeed bytes32 refers to decentralized identifier seed (a bytes32 length ID). The final DID will be calculated with the creator address using the hashDID function
_checksum bytes32 includes a one-way HASH calculated using the DDO content.
_providers address[] list of addresses that can act as an asset provider
_url string refers to the url resolving the DID into a DID Document (DDO), limited to 2048 bytes.
_activityId bytes32 refers to activity
_attributes string refers to the provenance attributes

hashDID

function hashDID(bytes32 _didSeed, address _creator) public pure returns (bytes32)

It generates a DID using as seed a bytes32 and the address of the DID creator

Name Type Description
_didSeed bytes32 refers to DID Seed used as base to generate the final DID
_creator address address of the creator of the DID
Name Type Description
[0] bytes32 the new DID created

areRoyaltiesValid

function areRoyaltiesValid(bytes32 _did, uint256[] _amounts, address[] _receivers, address _tokenAddress) public view returns (bool)

areRoyaltiesValid checks if for a given DID and rewards distribution, this allocate the
original creator royalties properly

Name Type Description
_did bytes32 refers to decentralized identifier (a byte32 length ID)
_amounts uint256[] refers to the amounts to reward
_receivers address[] refers to the receivers of rewards
_tokenAddress address
Name Type Description
[0] bool true if the rewards distribution respect the original creator royalties

wasGeneratedBy

function wasGeneratedBy(bytes32 _provId, bytes32 _did, address _agentId, bytes32 _activityId, string _attributes) internal returns (bool)

used

function used(bytes32 _provId, bytes32 _did, address _agentId, bytes32 _activityId, bytes _signatureUsing, string _attributes) public returns (bool success)

wasDerivedFrom

function wasDerivedFrom(bytes32 _provId, bytes32 _newEntityDid, bytes32 _usedEntityDid, address _agentId, bytes32 _activityId, string _attributes) public returns (bool success)

wasAssociatedWith

function wasAssociatedWith(bytes32 _provId, bytes32 _did, address _agentId, bytes32 _activityId, string _attributes) public returns (bool success)

actedOnBehalf

function actedOnBehalf(bytes32 _provId, bytes32 _did, address _delegateAgentId, address _responsibleAgentId, bytes32 _activityId, bytes _signatureDelegate, string _attributes) public returns (bool success)

Implements the W3C PROV Delegation action Each party involved in this method (_delegateAgentId & _responsibleAgentId) must provide a valid signature. The content to sign is a representation of the footprint of the event (_did + _delegateAgentId + _responsibleAgentId + _activityId)

Name Type Description
_provId bytes32 unique identifier referring to the provenance entry
_did bytes32 refers to decentralized identifier (a bytes32 length ID) of the entity
_delegateAgentId address refers to address acting on behalf of the provenance record
_responsibleAgentId address refers to address responsible of the provenance record
_activityId bytes32 refers to activity
_signatureDelegate bytes refers to the digital signature provided by the did delegate.
_attributes string refers to the provenance attributes
Name Type Description
success bool true if the action was properly registered

addDIDProvider

function addDIDProvider(bytes32 _did, address _provider) external

addDIDProvider add new DID provider.

it adds new DID provider to the providers list. A provider is any entity that can serve the registered asset

Name Type Description
_did bytes32 refers to decentralized identifier (a bytes32 length ID).
_provider address provider's address.

removeDIDProvider

function removeDIDProvider(bytes32 _did, address _provider) external

removeDIDProvider delete an existing DID provider.

Name Type Description
_did bytes32 refers to decentralized identifier (a bytes32 length ID).
_provider address provider's address.

addDIDProvenanceDelegate

function addDIDProvenanceDelegate(bytes32 _did, address _delegate) public

addDIDProvenanceDelegate add new DID provenance delegate.

it adds new DID provenance delegate to the delegates list. A delegate is any entity that interact with the provenance entries of one DID

Name Type Description
_did bytes32 refers to decentralized identifier (a bytes32 length ID).
_delegate address delegates's address.

removeDIDProvenanceDelegate

function removeDIDProvenanceDelegate(bytes32 _did, address _delegate) external

removeDIDProvenanceDelegate delete an existing DID delegate.

Name Type Description
_did bytes32 refers to decentralized identifier (a bytes32 length ID).
_delegate address delegate's address.

transferDIDOwnership

function transferDIDOwnership(bytes32 _did, address _newOwner) external

transferDIDOwnership transfer DID ownership

Name Type Description
_did bytes32 refers to decentralized identifier (a bytes32 length ID)
_newOwner address new owner address

transferDIDOwnershipManaged

function transferDIDOwnershipManaged(address _sender, bytes32 _did, address _newOwner) external

transferDIDOwnershipManaged transfer DID ownership

Name Type Description
_sender address
_did bytes32 refers to decentralized identifier (a bytes32 length ID)
_newOwner address new owner address

_transferDIDOwnership

function _transferDIDOwnership(address _sender, bytes32 _did, address _newOwner) internal

grantPermission

function grantPermission(bytes32 _did, address _grantee) external

grantPermission grants access permission to grantee

Name Type Description
_did bytes32 refers to decentralized identifier (a bytes32 length ID)
_grantee address address

revokePermission

function revokePermission(bytes32 _did, address _grantee) external

revokePermission revokes access permission from grantee

Name Type Description
_did bytes32 refers to decentralized identifier (a bytes32 length ID)
_grantee address address

getPermission

function getPermission(bytes32 _did, address _grantee) external view returns (bool)

getPermission gets access permission of a grantee

Name Type Description
_did bytes32 refers to decentralized identifier (a bytes32 length ID)
_grantee address address
Name Type Description
[0] bool true if grantee has access permission to a DID

isDIDProvider

function isDIDProvider(bytes32 _did, address _provider) public view returns (bool)

isDIDProvider check whether a given DID provider exists

Name Type Description
_did bytes32 refers to decentralized identifier (a bytes32 length ID).
_provider address provider's address.

isDIDProviderOrOwner

function isDIDProviderOrOwner(bytes32 _did, address _provider) public view returns (bool)

getDIDRegister

function getDIDRegister(bytes32 _did) public view returns (address owner, bytes32 lastChecksum, string url, address lastUpdatedBy, uint256 blockNumberUpdated, address[] providers, uint256 nftSupply, uint256 mintCap, uint256 royalties)
Name Type Description
_did bytes32 refers to decentralized identifier (a bytes32 length ID).
Name Type Description
owner address the did owner
lastChecksum bytes32 last checksum
url string URL to the DID metadata
lastUpdatedBy address who was the last updating the DID
blockNumberUpdated uint256 In which block was the DID updated
providers address[] the list of providers
nftSupply uint256 the supply of nfts
mintCap uint256 the maximum number of nfts that can be minted
royalties uint256 the royalties amount

getDIDSupply

function getDIDSupply(bytes32 _did) public view returns (uint256 nftSupply, uint256 mintCap)

getBlockNumberUpdated

function getBlockNumberUpdated(bytes32 _did) public view returns (uint256 blockNumberUpdated)
Name Type Description
_did bytes32 refers to decentralized identifier (a bytes32 length ID).
Name Type Description
blockNumberUpdated uint256 last modified (update) block number of a DID.

getDIDOwner

function getDIDOwner(bytes32 _did) public view returns (address didOwner)
Name Type Description
_did bytes32 refers to decentralized identifier (a bytes32 length ID).
Name Type Description
didOwner address the address of the DID owner.

getDIDRoyaltyRecipient

function getDIDRoyaltyRecipient(bytes32 _did) public view returns (address)

getDIDRoyaltyScheme

function getDIDRoyaltyScheme(bytes32 _did) public view returns (address)

getDIDCreator

function getDIDCreator(bytes32 _did) public view returns (address)

_grantPermission

function _grantPermission(bytes32 _did, address _grantee) internal

__grantPermission grants access permission to grantee_

Name Type Description
_did bytes32 refers to decentralized identifier (a bytes32 length ID)
_grantee address address

_revokePermission

function _revokePermission(bytes32 _did, address _grantee) internal

__revokePermission revokes access permission from grantee_

Name Type Description
_did bytes32 refers to decentralized identifier (a bytes32 length ID)
_grantee address address

_getPermission

function _getPermission(bytes32 _did, address _grantee) internal view returns (bool)

__getPermission gets access permission of a grantee_

Name Type Description
_did bytes32 refers to decentralized identifier (a bytes32 length ID)
_grantee address address
Name Type Description
[0] bool true if grantee has access permission to a DID

getProvenanceEntry

function getProvenanceEntry(bytes32 _provId) public view returns (bytes32 did, bytes32 relatedDid, address agentId, bytes32 activityId, address agentInvolvedId, uint8 method, address createdBy, uint256 blockNumberUpdated, bytes signature)

Fetch the complete provenance entry attributes

Name Type Description
_provId bytes32 refers to the provenance identifier
Name Type Description
did bytes32 to what DID refers this entry
relatedDid bytes32 DID related with the entry
agentId address the agent identifier
activityId bytes32 referring to the id of the activity
agentInvolvedId address agent involved with the action
method uint8 the w3c provenance method
createdBy address who is creating this entry
blockNumberUpdated uint256 in which block was updated
signature bytes digital signature

isDIDOwner

function isDIDOwner(address _address, bytes32 _did) public view returns (bool)

isDIDOwner check whether a given address is owner for a DID

Name Type Description
_address address user address.
_did bytes32 refers to decentralized identifier (a bytes32 length ID).

isOwnerProviderOrDelegate

function isOwnerProviderOrDelegate(bytes32 _did) public view returns (bool)

isOwnerProviderOrDelegate check whether msg.sender is owner, provider or delegate for a DID given

Name Type Description
_did bytes32 refers to decentralized identifier (a bytes32 length ID).
Name Type Description
[0] bool boolean true if yes

isProvenanceDelegate

function isProvenanceDelegate(bytes32 _did, address _delegate) public view returns (bool)

isProvenanceDelegate check whether a given DID delegate exists

Name Type Description
_did bytes32 refers to decentralized identifier (a bytes32 length ID).
_delegate address delegate's address.
Name Type Description
[0] bool boolean true if yes

getProvenanceOwner

function getProvenanceOwner(bytes32 _did) public view returns (address provenanceOwner)
Name Type Description
_did bytes32 refers to decentralized identifier (a bytes32 length ID).
Name Type Description
provenanceOwner address the address of the Provenance owner.

DIDRegistry

Implementation of a Mintable DID Registry.

erc1155

contract NFTUpgradeable erc1155

erc721

contract NFT721Upgradeable erc721

royaltiesCheckers

mapping(address => bool) royaltiesCheckers

initialize

function initialize(address _owner, address _erc1155, address _erc721) public

DIDRegistry Initializer Initialize Ownable. Only on contract creation.

Name Type Description
_owner address refers to the owner of the contract.
_erc1155 address
_erc721 address

registerRoyaltiesChecker

function registerRoyaltiesChecker(address _addr) public

DIDRoyaltiesAdded

event DIDRoyaltiesAdded(bytes32 did, address addr)

DIDRoyaltyRecipientChanged

event DIDRoyaltyRecipientChanged(bytes32 did, address addr)

setDIDRoyalties

function setDIDRoyalties(bytes32 _did, address _royalties) public

setDIDRoyaltyRecipient

function setDIDRoyaltyRecipient(bytes32 _did, address _recipient) public

registerMintableDID

function registerMintableDID(bytes32 _didSeed, bytes32 _checksum, address[] _providers, string _url, uint256 _cap, uint8 _royalties, bool _mint, bytes32 _activityId, string _nftMetadata) public

Register a Mintable DID using NFTs based in the ERC-1155 standard.

The first attribute of a DID registered sets the DID owner. Subsequent updates record _checksum and update info.

Name Type Description
_didSeed bytes32 refers to decentralized identifier seed (a bytes32 length ID).
_checksum bytes32 includes a one-way HASH calculated using the DDO content.
_providers address[] list of addresses that can act as an asset provider
_url string refers to the url resolving the DID into a DID Document (DDO), limited to 2048 bytes.
_cap uint256 refers to the mint cap
_royalties uint8 refers to the royalties to reward to the DID creator in the secondary market
_mint bool if true it mints the ERC-1155 NFTs attached to the asset
_activityId bytes32 refers to activity
_nftMetadata string refers to the url providing the NFT Metadata

registerMintableDID721

function registerMintableDID721(bytes32 _didSeed, bytes32 _checksum, address[] _providers, string _url, uint8 _royalties, bool _mint, bytes32 _activityId, string _nftMetadata) public

Register a Mintable DID using NFTs based in the ERC-721 standard.

The first attribute of a DID registered sets the DID owner. Subsequent updates record _checksum and update info.

Name Type Description
_didSeed bytes32 refers to decentralized identifier seed (a bytes32 length ID).
_checksum bytes32 includes a one-way HASH calculated using the DDO content.
_providers address[] list of addresses that can act as an asset provider
_url string refers to the url resolving the DID into a DID Document (DDO), limited to 2048 bytes.
_royalties uint8 refers to the royalties to reward to the DID creator in the secondary market
_mint bool if true it mints the ERC-1155 NFTs attached to the asset
_activityId bytes32 refers to activity
_nftMetadata string refers to the url providing the NFT Metadata

registerMintableDID

function registerMintableDID(bytes32 _didSeed, bytes32 _checksum, address[] _providers, string _url, uint256 _cap, uint8 _royalties, bytes32 _activityId, string _nftMetadata) public

Register a Mintable DID.

The first attribute of a DID registered sets the DID owner. Subsequent updates record _checksum and update info.

Name Type Description
_didSeed bytes32 refers to decentralized identifier seed (a bytes32 length ID).
_checksum bytes32 includes a one-way HASH calculated using the DDO content.
_providers address[] list of addresses that can act as an asset provider
_url string refers to the url resolving the DID into a DID Document (DDO), limited to 2048 bytes.
_cap uint256 refers to the mint cap
_royalties uint8 refers to the royalties to reward to the DID creator in the secondary market
_activityId bytes32 refers to activity
_nftMetadata string refers to the url providing the NFT Metadata

enableAndMintDidNft

function enableAndMintDidNft(bytes32 _did, uint256 _cap, uint8 _royalties, bool _mint, string _nftMetadata) public returns (bool success)

enableDidNft creates the initial setup of NFTs minting and royalties distribution for ERC-1155 NFTs. After this initial setup, this data can't be changed anymore for the DID given, even for the owner of the DID. The reason of this is to avoid minting additional NFTs after the initial agreement, what could affect the valuation of NFTs of a DID already created.

update the DID registry providers list by adding the mintCap and royalties configuration

Name Type Description
_did bytes32 refers to decentralized identifier (a byte32 length ID)
_cap uint256 refers to the mint cap
_royalties uint8 refers to the royalties to reward to the DID creator in the secondary market
_mint bool if is true mint directly the amount capped tokens and lock in the _lockAddress
_nftMetadata string refers to the url providing the NFT Metadata

enableAndMintDidNft721

function enableAndMintDidNft721(bytes32 _did, uint8 _royalties, bool _mint, string _nftMetadata) public returns (bool success)

enableAndMintDidNft721 creates the initial setup of NFTs minting and royalties distribution for ERC-721 NFTs. After this initial setup, this data can't be changed anymore for the DID given, even for the owner of the DID. The reason of this is to avoid minting additional NFTs after the initial agreement, what could affect the valuation of NFTs of a DID already created.

update the DID registry providers list by adding the mintCap and royalties configuration

Name Type Description
_did bytes32 refers to decentralized identifier (a byte32 length ID)
_royalties uint8 refers to the royalties to reward to the DID creator in the secondary market
_mint bool if is true mint directly the amount capped tokens and lock in the _lockAddress
_nftMetadata string refers to the url providing the NFT Metadata

mint

function mint(bytes32 _did, uint256 _amount, address _receiver) public

Mints a NFT associated to the DID

Because ERC-1155 uses uint256 and DID's are bytes32, there is a conversion between both Only the DID owner can mint NFTs associated to the DID

Name Type Description
_did bytes32 refers to decentralized identifier (a bytes32 length ID).
_amount uint256 amount to mint
_receiver address the address that will receive the new nfts minted

mint

function mint(bytes32 _did, uint256 _amount) public

mint721

function mint721(bytes32 _did, address _receiver) public

Mints a ERC-721 NFT associated to the DID

Name Type Description
_did bytes32 refers to decentralized identifier (a bytes32 length ID).
_receiver address the address that will receive the new nfts minted

mint721

function mint721(bytes32 _did) public

burn

function burn(bytes32 _did, uint256 _amount) public

Burns NFTs associated to the DID

Because ERC-1155 uses uint256 and DID's are bytes32, there is a conversion between both Only the DID owner can burn NFTs associated to the DID

Name Type Description
_did bytes32 refers to decentralized identifier (a bytes32 length ID).
_amount uint256 amount to burn

burn721

function burn721(bytes32 _did) public

DIDRegistryLibrary

All function calls are currently implemented without side effects

DIDRegister

struct DIDRegister {
  address owner;
  uint8 royalties;
  bool nftInitialized;
  bool nft721Initialized;
  address creator;
  bytes32 lastChecksum;
  string url;
  address lastUpdatedBy;
  uint256 blockNumberUpdated;
  address[] providers;
  address[] delegates;
  uint256 nftSupply;
  uint256 mintCap;
  address royaltyRecipient;
  contract IRoyaltyScheme royaltyScheme;
}

DIDRegisterList

struct DIDRegisterList {
  mapping(bytes32 => struct DIDRegistryLibrary.DIDRegister) didRegisters;
  bytes32[] didRegisterIds;
}

update

function update(struct DIDRegistryLibrary.DIDRegisterList _self, bytes32 _did, bytes32 _checksum, string _url) external

update the DID store

access modifiers and storage pointer should be implemented in DIDRegistry

Name Type Description
_self struct DIDRegistryLibrary.DIDRegisterList refers to storage pointer
_did bytes32 refers to decentralized identifier (a byte32 length ID)
_checksum bytes32 includes a one-way HASH calculated using the DDO content
_url string includes the url resolving to the DID Document (DDO)

initializeNftConfig

function initializeNftConfig(struct DIDRegistryLibrary.DIDRegisterList _self, bytes32 _did, uint256 _cap, uint8 _royalties) internal

initializeNftConfig creates the initial setup of NFTs minting and royalties distribution. After this initial setup, this data can't be changed anymore for the DID given, even for the owner of the DID. The reason of this is to avoid minting additional NFTs after the initial agreement, what could affect the valuation of NFTs of a DID already created.

update the DID registry providers list by adding the mintCap and royalties configuration

Name Type Description
_self struct DIDRegistryLibrary.DIDRegisterList refers to storage pointer
_did bytes32 refers to decentralized identifier (a byte32 length ID)
_cap uint256 refers to the mint cap
_royalties uint8 refers to the royalties to reward to the DID creator in the secondary market The royalties in secondary market for the creator should be between 0% >= x < 100%

initializeNft721Config

function initializeNft721Config(struct DIDRegistryLibrary.DIDRegisterList _self, bytes32 _did, uint8 _royalties) internal

areRoyaltiesValid

function areRoyaltiesValid(struct DIDRegistryLibrary.DIDRegisterList _self, bytes32 _did, uint256[] _amounts, address[] _receivers, address _tokenAddress) internal view returns (bool)

areRoyaltiesValid checks if for a given DID and rewards distribution, this allocate the
original creator royalties properly

Name Type Description
_self struct DIDRegistryLibrary.DIDRegisterList refers to storage pointer
_did bytes32 refers to decentralized identifier (a byte32 length ID)
_amounts uint256[] refers to the amounts to reward
_receivers address[] refers to the receivers of rewards
_tokenAddress address
Name Type Description
[0] bool true if the rewards distribution respect the original creator royalties

addProvider

function addProvider(struct DIDRegistryLibrary.DIDRegisterList _self, bytes32 _did, address provider) internal

addProvider add provider to DID registry

update the DID registry providers list by adding a new provider

Name Type Description
_self struct DIDRegistryLibrary.DIDRegisterList refers to storage pointer
_did bytes32 refers to decentralized identifier (a byte32 length ID)
provider address the provider's address

removeProvider

function removeProvider(struct DIDRegistryLibrary.DIDRegisterList _self, bytes32 _did, address _provider) internal returns (bool)

removeProvider remove provider from DID registry

update the DID registry providers list by removing an existing provider

Name Type Description
_self struct DIDRegistryLibrary.DIDRegisterList refers to storage pointer
_did bytes32 refers to decentralized identifier (a byte32 length ID)
_provider address the provider's address

updateDIDOwner

function updateDIDOwner(struct DIDRegistryLibrary.DIDRegisterList _self, bytes32 _did, address _newOwner) internal

updateDIDOwner transfer DID ownership to a new owner

Name Type Description
_self struct DIDRegistryLibrary.DIDRegisterList refers to storage pointer
_did bytes32 refers to decentralized identifier (a byte32 length ID)
_newOwner address the new DID owner address

isProvider

function isProvider(struct DIDRegistryLibrary.DIDRegisterList _self, bytes32 _did, address _provider) public view returns (bool)

isProvider check whether DID provider exists

Name Type Description
_self struct DIDRegistryLibrary.DIDRegisterList refers to storage pointer
_did bytes32 refers to decentralized identifier (a byte32 length ID)
_provider address the provider's address
Name Type Description
[0] bool true if the provider already exists

getProviderIndex

function getProviderIndex(struct DIDRegistryLibrary.DIDRegisterList _self, bytes32 _did, address provider) private view returns (int256)

getProviderIndex get the index of a provider

Name Type Description
_self struct DIDRegistryLibrary.DIDRegisterList refers to storage pointer
_did bytes32 refers to decentralized identifier (a byte32 length ID)
provider address the provider's address
Name Type Description
[0] int256 the index if the provider exists otherwise return -1

addDelegate

function addDelegate(struct DIDRegistryLibrary.DIDRegisterList _self, bytes32 _did, address delegate) internal

addDelegate add delegate to DID registry

update the DID registry delegates list by adding a new delegate

Name Type Description
_self struct DIDRegistryLibrary.DIDRegisterList refers to storage pointer
_did bytes32 refers to decentralized identifier (a byte32 length ID)
delegate address the delegate's address

removeDelegate

function removeDelegate(struct DIDRegistryLibrary.DIDRegisterList _self, bytes32 _did, address _delegate) internal returns (bool)

removeDelegate remove delegate from DID registry

update the DID registry delegates list by removing an existing delegate

Name Type Description
_self struct DIDRegistryLibrary.DIDRegisterList refers to storage pointer
_did bytes32 refers to decentralized identifier (a byte32 length ID)
_delegate address the delegate's address

isDelegate

function isDelegate(struct DIDRegistryLibrary.DIDRegisterList _self, bytes32 _did, address _delegate) public view returns (bool)

isDelegate check whether DID delegate exists

Name Type Description
_self struct DIDRegistryLibrary.DIDRegisterList refers to storage pointer
_did bytes32 refers to decentralized identifier (a byte32 length ID)
_delegate address the delegate's address
Name Type Description
[0] bool true if the delegate already exists

getDelegateIndex

function getDelegateIndex(struct DIDRegistryLibrary.DIDRegisterList _self, bytes32 _did, address delegate) private view returns (int256)

getDelegateIndex get the index of a delegate

Name Type Description
_self struct DIDRegistryLibrary.DIDRegisterList refers to storage pointer
_did bytes32 refers to decentralized identifier (a byte32 length ID)
delegate address the delegate's address
Name Type Description
[0] int256 the index if the delegate exists otherwise return -1

ProvenanceRegistry

All function calls are currently implemented without side effects

__ProvenanceRegistry_init

function __ProvenanceRegistry_init() internal

__ProvenanceRegistry_init_unchained

function __ProvenanceRegistry_init_unchained() internal

Provenance

struct Provenance {
  bytes32 did;
  bytes32 relatedDid;
  address agentId;
  bytes32 activityId;
  address agentInvolvedId;
  uint8 method;
  address createdBy;
  uint256 blockNumberUpdated;
  bytes signature;
}

ProvenanceRegistryList

struct ProvenanceRegistryList {
  mapping(bytes32 &#x3D;&gt; struct ProvenanceRegistry.Provenance) list;
}

provenanceRegistry

struct ProvenanceRegistry.ProvenanceRegistryList provenanceRegistry

ProvenanceMethod

enum ProvenanceMethod {
  ENTITY,
  ACTIVITY,
  WAS_GENERATED_BY,
  USED,
  WAS_INFORMED_BY,
  WAS_STARTED_BY,
  WAS_ENDED_BY,
  WAS_INVALIDATED_BY,
  WAS_DERIVED_FROM,
  AGENT,
  WAS_ATTRIBUTED_TO,
  WAS_ASSOCIATED_WITH,
  ACTED_ON_BEHALF
}

ProvenanceAttributeRegistered

event ProvenanceAttributeRegistered(bytes32 provId, bytes32 _did, address _agentId, bytes32 _activityId, bytes32 _relatedDid, address _agentInvolvedId, enum ProvenanceRegistry.ProvenanceMethod _method, string _attributes, uint256 _blockNumberUpdated)

Provenance Events

WasGeneratedBy

event WasGeneratedBy(bytes32 _did, address _agentId, bytes32 _activityId, bytes32 provId, string _attributes, uint256 _blockNumberUpdated)

Used

event Used(bytes32 _did, address _agentId, bytes32 _activityId, bytes32 provId, string _attributes, uint256 _blockNumberUpdated)

WasDerivedFrom

event WasDerivedFrom(bytes32 _newEntityDid, bytes32 _usedEntityDid, address _agentId, bytes32 _activityId, bytes32 provId, string _attributes, uint256 _blockNumberUpdated)

WasAssociatedWith

event WasAssociatedWith(bytes32 _entityDid, address _agentId, bytes32 _activityId, bytes32 provId, string _attributes, uint256 _blockNumberUpdated)

ActedOnBehalf

event ActedOnBehalf(bytes32 _entityDid, address _delegateAgentId, address _responsibleAgentId, bytes32 _activityId, bytes32 provId, string _attributes, uint256 _blockNumberUpdated)

createProvenanceEntry

function createProvenanceEntry(bytes32 _provId, bytes32 _did, bytes32 _relatedDid, address _agentId, bytes32 _activityId, address _agentInvolvedId, enum ProvenanceRegistry.ProvenanceMethod _method, address _createdBy, bytes _signatureDelegate, string _attributes) internal returns (bool)

create an event in the Provenance store

access modifiers and storage pointer should be implemented in ProvenanceRegistry

Name Type Description
_provId bytes32 refers to provenance event identifier
_did bytes32 refers to decentralized identifier (a byte32 length ID)
_relatedDid bytes32 refers to decentralized identifier (a byte32 length ID) of a related entity
_agentId address refers to address of the agent creating the provenance record
_activityId bytes32 refers to activity
_agentInvolvedId address refers to address of the agent involved with the provenance record
_method enum ProvenanceRegistry.ProvenanceMethod refers to the W3C Provenance method
_createdBy address refers to address of the agent triggering the activity
_signatureDelegate bytes refers to the digital signature provided by the did delegate.
_attributes string

_wasGeneratedBy

function _wasGeneratedBy(bytes32 _provId, bytes32 _did, address _agentId, bytes32 _activityId, string _attributes) internal virtual returns (bool)

Implements the W3C PROV Generation action

Name Type Description
_provId bytes32 unique identifier referring to the provenance entry
_did bytes32 refers to decentralized identifier (a bytes32 length ID) of the entity created
_agentId address refers to address of the agent creating the provenance record
_activityId bytes32 refers to activity
_attributes string refers to the provenance attributes
Name Type Description
[0] bool the number of the new provenance size

_used

function _used(bytes32 _provId, bytes32 _did, address _agentId, bytes32 _activityId, bytes _signatureUsing, string _attributes) internal virtual returns (bool success)

Implements the W3C PROV Usage action

Name Type Description
_provId bytes32 unique identifier referring to the provenance entry
_did bytes32 refers to decentralized identifier (a bytes32 length ID) of the entity created
_agentId address refers to address of the agent creating the provenance record
_activityId bytes32 refers to activity
_signatureUsing bytes refers to the digital signature provided by the agent using the _did
_attributes string refers to the provenance attributes
Name Type Description
success bool true if the action was properly registered

_wasDerivedFrom

function _wasDerivedFrom(bytes32 _provId, bytes32 _newEntityDid, bytes32 _usedEntityDid, address _agentId, bytes32 _activityId, string _attributes) internal virtual returns (bool success)

Implements the W3C PROV Derivation action

Name Type Description
_provId bytes32 unique identifier referring to the provenance entry
_newEntityDid bytes32 refers to decentralized identifier (a bytes32 length ID) of the entity created
_usedEntityDid bytes32 refers to decentralized identifier (a bytes32 length ID) of the entity used to derive the new did
_agentId address refers to address of the agent creating the provenance record
_activityId bytes32 refers to activity
_attributes string refers to the provenance attributes
Name Type Description
success bool true if the action was properly registered

_wasAssociatedWith

function _wasAssociatedWith(bytes32 _provId, bytes32 _did, address _agentId, bytes32 _activityId, string _attributes) internal virtual returns (bool success)

Implements the W3C PROV Association action

Name Type Description
_provId bytes32 unique identifier referring to the provenance entry
_did bytes32 refers to decentralized identifier (a bytes32 length ID) of the entity
_agentId address refers to address of the agent creating the provenance record
_activityId bytes32 refers to activity
_attributes string refers to the provenance attributes
Name Type Description
success bool true if the action was properly registered

_actedOnBehalf

function _actedOnBehalf(bytes32 _provId, bytes32 _did, address _delegateAgentId, address _responsibleAgentId, bytes32 _activityId, bytes _signatureDelegate, string _attributes) internal virtual returns (bool success)

Implements the W3C PROV Delegation action Each party involved in this method (_delegateAgentId & _responsibleAgentId) must provide a valid signature. The content to sign is a representation of the footprint of the event (_did + _delegateAgentId + _responsibleAgentId + _activityId)

Name Type Description
_provId bytes32 unique identifier referring to the provenance entry
_did bytes32 refers to decentralized identifier (a bytes32 length ID) of the entity
_delegateAgentId address refers to address acting on behalf of the provenance record
_responsibleAgentId address refers to address responsible of the provenance record
_activityId bytes32 refers to activity
_signatureDelegate bytes refers to the digital signature provided by the did delegate.
_attributes string refers to the provenance attributes
Name Type Description
success bool true if the action was properly registered

CurveRoyalties

registry

contract DIDRegistry registry

DENOMINATOR

uint256 DENOMINATOR

royalties

mapping(bytes32 => uint256) royalties

initialize

function initialize(address _registry) public

royaltyCurve

function royaltyCurve(uint256 num, uint256 max, uint256 rate) public pure virtual returns (uint256)

setRoyalty

function setRoyalty(bytes32 _did, uint256 _royalty) public

Set royalties for a DID

Can only be called by creator of the DID

Name Type Description
_did bytes32 DID for which the royalties are set
_royalty uint256 Royalty, the actual royalty will be _royalty / 10000 percent

check

function check(bytes32 _did, uint256[] _amounts, address[] _receivers, address _token) external view returns (bool)

RewardsDistributor

used

mapping(bytes32 => bool) used

receivers

mapping(bytes32 => address[]) receivers

registry

contract DIDRegistry registry

conditionStoreManager

contract ConditionStoreManager conditionStoreManager

escrow

address escrow

initialize

function initialize(address _registry, address _conditionStoreManager, address _escrow) public

setReceivers

function setReceivers(bytes32 _did, address[] _addr) public

set receivers for did

Name Type Description
_did bytes32 DID
_addr address[] list of receivers

claimReward

function claimReward(bytes32 _agreementId, bytes32 _did, uint256[] _amounts, address[] _receivers, address _returnAddress, address _lockPaymentAddress, address _tokenAddress, bytes32 _lockCondition, bytes32[] _releaseConditions) public

distribute rewards associated with an escrow condition

as paramemeters, it just gets the same parameters as fulfill for escrow condition

Name Type Description
_agreementId bytes32 agreement identifier
_did bytes32 asset decentralized identifier
_amounts uint256[] token amounts to be locked/released
_receivers address[] receiver's address
_returnAddress address
_lockPaymentAddress address lock payment contract address
_tokenAddress address the ERC20 contract address to use during the payment
_lockCondition bytes32 lock condition identifier
_releaseConditions bytes32[] release condition identifier

StandardRoyalties

registry

contract DIDRegistry registry

DENOMINATOR

uint256 DENOMINATOR

royalties

mapping(bytes32 => uint256) royalties

initialize

function initialize(address _registry) public

setRoyalty

function setRoyalty(bytes32 _did, uint256 _royalty) public

Set royalties for a DID

Can only be called by creator of the DID

Name Type Description
_did bytes32 DID for which the royalties are set
_royalty uint256 Royalty, the actual royalty will be _royalty / 10000 percent

check

function check(bytes32 _did, uint256[] _amounts, address[] _receivers, address) external view returns (bool)

AaveCreditTemplate

Implementation of the Aaven Credit Agreement Template 0. Initialize the agreement 1. LockNFT - Delegatee locks the NFT 2. AaveCollateralDeposit - Delegator deposits the collateral into Aave. And approves the delegation flow 3. AaveBorrowCondition - The Delegatee claim the credit amount from Aave 4. AaveRepayCondition. Options: 4.a Fulfilled state - The Delegatee pay back the loan (including fee) into Aave and gets back the NFT 4.b Aborted state - The Delegatee doesn't pay the loan in time so the Delegator gets the NFT. The Delegator pays the loan to Aave 5. TransferNFT. Options: 5.a if AaveRepayCondition was fulfilled, it will allow transfer back to the Delegatee or Borrower 5.b if AaveRepayCondition was aborted, it will allow transfer the NFT to the Delegator or Lender

didRegistry

contract DIDRegistry didRegistry

nftLockCondition

contract INFTLock nftLockCondition

depositCondition

contract AaveCollateralDepositCondition depositCondition

borrowCondition

contract AaveBorrowCondition borrowCondition

repayCondition

contract AaveRepayCondition repayCondition

transferCondition

contract DistributeNFTCollateralCondition transferCondition

withdrawCondition

contract AaveCollateralWithdrawCondition withdrawCondition

vaultAddress

mapping(bytes32 => address) vaultAddress

nvmFee

uint256 nvmFee

vaultLibrary

address vaultLibrary

VaultCreated

event VaultCreated(address _vaultAddress, address _creator, address _lender, address _borrower)

initialize

function initialize(address _owner, address _agreementStoreManagerAddress, address _nftLockConditionAddress, address _depositConditionAddress, address _borrowConditionAddress, address _repayConditionAddress, address _withdrawCollateralAddress, address _transferConditionAddress, address _vaultLibrary) external

initialize init the contract with the following parameters.

this function is called only once during the contract initialization. It initializes the ownable feature, and set push the required condition types including access , lock payment and escrow payment conditions.

Name Type Description
_owner address contract's owner account address
_agreementStoreManagerAddress address agreement store manager contract address
_nftLockConditionAddress address NFT Lock Condition contract address
_depositConditionAddress address Aave collateral deposit Condition address
_borrowConditionAddress address Aave borrow deposit Condition address
_repayConditionAddress address Aave repay credit Condition address
_withdrawCollateralAddress address
_transferConditionAddress address NFT Transfer Condition address
_vaultLibrary address

createVaultAgreement

function createVaultAgreement(bytes32 _id, bytes32 _did, bytes32[] _conditionIds, uint256[] _timeLocks, uint256[] _timeOuts, address _vaultAddress) public

createAgreement

function createAgreement(bytes32 _id, address _lendingPool, address _dataProvider, address _weth, uint256 _agreementFee, address _treasuryAddress, bytes32 _did, bytes32[] _conditionIds, uint256[] _timeLocks, uint256[] _timeOuts, address _lender) public

deployVault

function deployVault(address _lendingPool, address _dataProvider, address _weth, uint256 _agreementFee, address _treasuryAddress, address _borrower, address _lender) public returns (address)

getVaultForAgreement

function getVaultForAgreement(bytes32 _agreementId) public view returns (address)

updateNVMFee

function updateNVMFee(uint256 _newFee) public

Updates the nevermined fee for this type of agreement

Name Type Description
_newFee uint256 New nevermined fee expressed in basis points

changeCreditVaultLibrary

function changeCreditVaultLibrary(address _vaultLibrary) public

AccessProofTemplate

Implementation of Access Agreement Template

didRegistry

contract DIDRegistry didRegistry

accessCondition

contract AccessProofCondition accessCondition

lockCondition

contract LockPaymentCondition lockCondition

escrowReward

contract EscrowPaymentCondition escrowReward

initialize

function initialize(address _owner, address _agreementStoreManagerAddress, address _didRegistryAddress, address _accessConditionAddress, address _lockConditionAddress, address payable _escrowConditionAddress) external

initialize init the contract with the following parameters.

this function is called only once during the contract initialization. It initializes the ownable feature, and set push the required condition types including access , lock payment and escrow payment conditions.

Name Type Description
_owner address contract's owner account address
_agreementStoreManagerAddress address agreement store manager contract address
_didRegistryAddress address DID registry contract address
_accessConditionAddress address access condition address
_lockConditionAddress address lock reward condition contract address
_escrowConditionAddress address payable escrow reward contract address

AccessTemplate

_Implementation of Access Agreement Template

 Access template is use case specific template.
 Anyone (consumer/provider/publisher) can use this template in order
 to setup an on-chain SEA. The template is a composite of three basic
 conditions. Once the agreement is created, the consumer will lock an amount
 of tokens (as listed in the DID document - off-chain metadata) to the 
 the lock reward contract which in turn will fire an event. ON the other hand 
 the provider is listening to all the emitted events, the provider 
 will catch the event and grant permissions to the consumer through 
 secret store contract, the consumer now is able to download the data set
 by asking the off-chain component of secret store to decrypt the DID and 
 encrypt it using the consumer's public key. Then the secret store will 
 provide an on-chain proof that the consumer had access to the data set.
 Finally, the provider can call the escrow reward condition in order 
 to release the payment. Every condition has a time window (time lock and 
 time out). This implies that if the provider didn't grant the access to 
 the consumer through secret store within this time window, the consumer 
 can ask for refund._

didRegistry

contract DIDRegistry didRegistry

accessCondition

contract AccessCondition accessCondition

lockCondition

contract LockPaymentCondition lockCondition

escrowReward

contract EscrowPaymentCondition escrowReward

initialize

function initialize(address _owner, address _agreementStoreManagerAddress, address _didRegistryAddress, address _accessConditionAddress, address _lockConditionAddress, address payable _escrowConditionAddress) external

initialize init the contract with the following parameters.

this function is called only once during the contract initialization. It initializes the ownable feature, and set push the required condition types including access , lock payment and escrow payment conditions.

Name Type Description
_owner address contract's owner account address
_agreementStoreManagerAddress address agreement store manager contract address
_didRegistryAddress address DID registry contract address
_accessConditionAddress address access condition address
_lockConditionAddress address lock reward condition contract address
_escrowConditionAddress address payable escrow reward contract address

AgreementTemplate

_Implementation of Agreement Template

 Agreement template is a reference template where it
 has the ability to create agreements from whitelisted 
 template_

conditionTypes

address[] conditionTypes

agreementStoreManager

contract AgreementStoreManager agreementStoreManager

createAgreement

function createAgreement(bytes32 _id, bytes32 _did, bytes32[] _conditionIds, uint256[] _timeLocks, uint256[] _timeOuts) public

createAgreement create new agreement

Name Type Description
_id bytes32 agreement unique identifier
_did bytes32 refers to decentralized identifier (a bytes32 length ID).
_conditionIds bytes32[] list of condition identifiers
_timeLocks uint256[] list of time locks, each time lock will be assigned to the same condition that has the same index
_timeOuts uint256[] list of time outs, each time out will be assigned to the same condition that has the same index

createAgreementAndPay

function createAgreementAndPay(bytes32 _id, bytes32 _did, bytes32[] _conditionIds, uint256[] _timeLocks, uint256[] _timeOuts, uint256 _idx, address payable _rewardAddress, address _tokenAddress, uint256[] _amounts, address[] _receivers) public payable

createAgreementAndFulfill

function createAgreementAndFulfill(bytes32 _id, bytes32 _did, bytes32[] _conditionIds, uint256[] _timeLocks, uint256[] _timeOuts, uint256[] _indices, address[] _accounts, bytes[] _params) internal

getConditionTypes

function getConditionTypes() public view returns (address[])

getConditionTypes gets the conditions addresses list

for the current template returns list of condition contracts addresses

Name Type Description
[0] address[] list of conditions contract addresses

BaseEscrowTemplate

agreementData

struct BaseEscrowTemplate.AgreementData agreementData

AgreementCreated

event AgreementCreated(bytes32 _agreementId, bytes32 _did, address _accessConsumer, address _accessProvider, uint256[] _timeLocks, uint256[] _timeOuts, bytes32[] _conditionIdSeeds, bytes32[] _conditionIds, bytes32 _idSeed, address _creator)

AgreementDataModel

struct AgreementDataModel {
  address accessConsumer;
  address accessProvider;
  bytes32 did;
}

AgreementData

struct AgreementData {
  mapping(bytes32 &#x3D;&gt; struct BaseEscrowTemplate.AgreementDataModel) agreementDataItems;
  bytes32[] agreementIds;
}

createAgreement

function createAgreement(bytes32 _id, bytes32 _did, bytes32[] _conditionIds, uint256[] _timeLocks, uint256[] _timeOuts, address _accessConsumer) public

createAgreement creates agreements through agreement template

this function initializes the agreement by setting the DID, conditions ID, timeouts, time locks and the consumer address. The DID provider/owner is automatically detected by the DID Registry

Name Type Description
_id bytes32 SEA agreement unique identifier
_did bytes32 Decentralized Identifier (DID)
_conditionIds bytes32[] conditions ID associated with the condition types
_timeLocks uint256[] the starting point of the time window ,time lock is in block number not seconds
_timeOuts uint256[] the ending point of the time window ,time lock is in block number not seconds
_accessConsumer address consumer address

createAgreementAndPayEscrow

function createAgreementAndPayEscrow(bytes32 _id, bytes32 _did, bytes32[] _conditionIds, uint256[] _timeLocks, uint256[] _timeOuts, address _accessConsumer, uint256 _idx, address payable _rewardAddress, address _tokenAddress, uint256[] _amounts, address[] _receivers) public payable

createAgreementAndFulfill

function createAgreementAndFulfill(bytes32 _id, bytes32 _did, bytes32[] _conditionIds, uint256[] _timeLocks, uint256[] _timeOuts, address _accessConsumer, uint256[] _indices, address[] _accounts, bytes[] _params) internal

_makeIds

function _makeIds(bytes32 _idSeed, bytes32[] _conditionIds) internal view returns (bytes32[])

_initAgreement

function _initAgreement(bytes32 _idSeed, bytes32 _did, uint256[] _timeLocks, uint256[] _timeOuts, address _accessConsumer, bytes32[] _conditionIds) internal

getAgreementData

function getAgreementData(bytes32 _id) external view returns (address accessConsumer, address accessProvider)

getAgreementData return the agreement Data

Name Type Description
_id bytes32 SEA agreement unique identifier
Name Type Description
accessConsumer address the agreement consumer
accessProvider address the provider addresses

DIDSalesTemplate

_Implementation of DID Sales Template

 The DID Sales template supports an scenario where an Asset owner
 can sell that asset to a new Owner.
 Anyone (consumer/provider/publisher) can use this template in order
 to setup an agreement allowing an Asset owner to get transfer the asset ownership
 after some payment. 
 The template is a composite of 3 basic conditions: 
 - Lock Payment Condition
 - Transfer DID Condition
 - Escrow Reward Condition

 This scenario takes into account royalties for original creators in the secondary market.
 Once the agreement is created, the consumer after payment can request the ownership transfer of an asset
 from the current owner for a specific DID._

didRegistry

contract DIDRegistry didRegistry

lockPaymentCondition

contract LockPaymentCondition lockPaymentCondition

transferCondition

contract TransferDIDOwnershipCondition transferCondition

rewardCondition

contract EscrowPaymentCondition rewardCondition

id

function id() public pure returns (uint256)

initialize

function initialize(address _owner, address _agreementStoreManagerAddress, address _lockConditionAddress, address _transferConditionAddress, address payable _escrowPaymentAddress) external

initialize init the contract with the following parameters.

this function is called only once during the contract initialization. It initializes the ownable feature, and set push the required condition types including access secret store, lock reward and escrow reward conditions.

Name Type Description
_owner address contract's owner account address
_agreementStoreManagerAddress address agreement store manager contract address
_lockConditionAddress address lock reward condition contract address
_transferConditionAddress address transfer ownership condition contract address
_escrowPaymentAddress address payable escrow reward condition contract address

DynamicAccessTemplate

Implementation of Agreement Template This is a dynamic template that allows to setup flexible conditions depending on the use case.

didRegistry

contract DIDRegistry didRegistry

templateConfig

struct DynamicAccessTemplate.TemplateConditions templateConfig

TemplateConditions

struct TemplateConditions {
  mapping(address &#x3D;&gt; contract Condition) templateConditions;
}

initialize

function initialize(address _owner, address _agreementStoreManagerAddress, address _didRegistryAddress) external

initialize init the contract with the following parameters.

this function is called only once during the contract initialization. It initializes the ownable feature, and set push the required condition types including access secret store, lock reward and escrow reward conditions.

Name Type Description
_owner address contract's owner account address
_agreementStoreManagerAddress address agreement store manager contract address
_didRegistryAddress address DID registry contract address

addTemplateCondition

function addTemplateCondition(address _conditionAddress) external returns (uint256 length)

addTemplateCondition adds a new condition to the template

Name Type Description
_conditionAddress address condition contract address
Name Type Description
length uint256 conditionTypes array size

removeLastTemplateCondition

function removeLastTemplateCondition() external returns (address[])

removeLastTemplateCondition removes last condition added to the template

Name Type Description
[0] address[] conditionTypes existing in the array

EscrowComputeExecutionTemplate

_Implementation of a Compute Execution Agreement Template

 EscrowComputeExecutionTemplate is use case specific template.
 Anyone (consumer/provider/publisher) can use this template in order
 to setup an on-chain SEA. The template is a composite of three basic
 conditions. Once the agreement is created, the consumer will lock an amount
 of tokens (as listed in the DID document - off-chain metadata) to the 
 the lock reward contract which in turn will fire an event. ON the other hand 
 the provider is listening to all the emitted events, the provider 
 will catch the event and grant permissions to trigger a computation granting
 the execution via the ComputeExecutionCondition contract. 
 The consumer now is able to trigger that computation
 by asking the off-chain gateway to start the execution of a compute workflow.
 Finally, the provider can call the escrow reward condition in order 
 to release the payment. Every condition has a time window (time lock and 
 time out). This implies that if the provider didn't grant the execution to 
 the consumer within this time window, the consumer 
 can ask for refund._

didRegistry

contract DIDRegistry didRegistry

computeExecutionCondition

contract ComputeExecutionCondition computeExecutionCondition

lockPaymentCondition

contract LockPaymentCondition lockPaymentCondition

escrowPayment

contract EscrowPaymentCondition escrowPayment

initialize

function initialize(address _owner, address _agreementStoreManagerAddress, address _didRegistryAddress, address _computeExecutionConditionAddress, address _lockPaymentConditionAddress, address payable _escrowPaymentAddress) external

initialize init the contract with the following parameters.

this function is called only once during the contract initialization. It initializes the ownable feature, and set push the required condition types including service executor condition, lock reward and escrow reward conditions.

Name Type Description
_owner address contract's owner account address
_agreementStoreManagerAddress address agreement store manager contract address
_didRegistryAddress address DID registry contract address
_computeExecutionConditionAddress address service executor condition contract address
_lockPaymentConditionAddress address lock reward condition contract address
_escrowPaymentAddress address payable escrow reward contract address

name

function name() public pure returns (string)

NFT721AccessProofTemplate

Implementation of NFT721 Access Proof Template

NFT721AccessSwapTemplate

NFT721AccessTemplate

Implementation of NFT Access Template

NFT721SalesTemplate

Implementation of NFT Sales Template

NFT721SalesWithAccessTemplate

NFTAccessProofTemplate

_Implementation of NFT Access Template

 The NFT Access template is use case specific template.
 Anyone (consumer/provider/publisher) can use this template in order
 to setup an agreement allowing NFT holders to get access to Nevermined services. 
 The template is a composite of 2 basic conditions: 
 - NFT Holding Condition
 - Access Condition

 Once the agreement is created, the consumer can demonstrate is holding a NFT
 for a specific DID. If that's the case the Access condition can be fulfilled
 by the asset owner or provider and all the agreement is fulfilled.
 This can be used in scenarios where a data or services owner, can allow 
 users to get access to exclusive services only when they demonstrate the 
 are holding a specific number of NFTs of a DID.
 This is very useful in use cases like arts._

didRegistry

contract DIDRegistry didRegistry

nftHolderCondition

contract INFTHolder nftHolderCondition

accessCondition

contract AccessProofCondition accessCondition

initialize

function initialize(address _owner, address _agreementStoreManagerAddress, address _nftHolderConditionAddress, address _accessConditionAddress) external

initialize init the contract with the following parameters.

this function is called only once during the contract initialization. It initializes the ownable feature, and set push the required condition types including access secret store, lock reward and escrow reward conditions.

Name Type Description
_owner address contract's owner account address
_agreementStoreManagerAddress address agreement store manager contract address
_nftHolderConditionAddress address lock reward condition contract address
_accessConditionAddress address access condition contract address

NFTAccessSwapTemplate

_Implementation of NFT Sales Template

 The NFT Sales template supports an scenario where a NFT owner
 can sell that asset to a new Owner.
 Anyone (consumer/provider/publisher) can use this template in order
 to setup an agreement allowing a NFT owner to transfer the asset ownership
 after some payment. 
 The template is a composite of 3 basic conditions: 
 - Lock Payment Condition
 - Transfer NFT Condition
 - Escrow Reward Condition

 This scenario takes into account royalties for original creators in the secondary market.
 Once the agreement is created, the consumer after payment can request the transfer of the NFT
 from the current owner for a specific DID._

didRegistry

contract DIDRegistry didRegistry

lockPaymentCondition

contract INFTLock lockPaymentCondition

rewardCondition

contract INFTEscrow rewardCondition

accessCondition

contract AccessProofCondition accessCondition

id

function id() public pure returns (uint256)

initialize

function initialize(address _owner, address _agreementStoreManagerAddress, address _lockPaymentConditionAddress, address payable _escrowPaymentAddress, address _accessCondition) external

initialize init the contract with the following parameters.

this function is called only once during the contract initialization. It initializes the ownable feature, and set push the required condition types including access secret store, lock reward and escrow reward conditions.

Name Type Description
_owner address contract's owner account address
_agreementStoreManagerAddress address agreement store manager contract address
_lockPaymentConditionAddress address lock reward condition contract address
_escrowPaymentAddress address payable escrow reward condition contract address
_accessCondition address

NFTAccessTemplate

_Implementation of NFT Access Template

 The NFT Access template is use case specific template.
 Anyone (consumer/provider/publisher) can use this template in order
 to setup an agreement allowing NFT holders to get access to Nevermined services. 
 The template is a composite of 2 basic conditions: 
 - NFT Holding Condition
 - Access Condition

 Once the agreement is created, the consumer can demonstrate is holding a NFT
 for a specific DID. If that's the case the Access condition can be fulfilled
 by the asset owner or provider and all the agreement is fulfilled.
 This can be used in scenarios where a data or services owner, can allow 
 users to get access to exclusive services only when they demonstrate the 
 are holding a specific number of NFTs of a DID.
 This is very useful in use cases like arts._

didRegistry

contract DIDRegistry didRegistry

nftHolderCondition

contract INFTHolder nftHolderCondition

accessCondition

contract INFTAccess accessCondition

initialize

function initialize(address _owner, address _agreementStoreManagerAddress, address _nftHolderConditionAddress, address _accessConditionAddress) external

initialize init the contract with the following parameters.

this function is called only once during the contract initialization. It initializes the ownable feature, and set push the required condition types including access secret store, lock reward and escrow reward conditions.

Name Type Description
_owner address contract's owner account address
_agreementStoreManagerAddress address agreement store manager contract address
_nftHolderConditionAddress address lock reward condition contract address
_accessConditionAddress address access condition contract address

NFTSalesTemplate

_Implementation of NFT Sales Template

 The NFT Sales template supports an scenario where a NFT owner
 can sell that asset to a new Owner.
 Anyone (consumer/provider/publisher) can use this template in order
 to setup an agreement allowing a NFT owner to transfer the asset ownership
 after some payment. 
 The template is a composite of 3 basic conditions: 
 - Lock Payment Condition
 - Transfer NFT Condition
 - Escrow Reward Condition

 This scenario takes into account royalties for original creators in the secondary market.
 Once the agreement is created, the consumer after payment can request the transfer of the NFT
 from the current owner for a specific DID._

didRegistry

contract DIDRegistry didRegistry

lockPaymentCondition

contract LockPaymentCondition lockPaymentCondition

transferCondition

contract ITransferNFT transferCondition

rewardCondition

contract EscrowPaymentCondition rewardCondition

id

function id() public pure returns (uint256)

initialize

function initialize(address _owner, address _agreementStoreManagerAddress, address _lockPaymentConditionAddress, address _transferConditionAddress, address payable _escrowPaymentAddress) external

initialize init the contract with the following parameters.

this function is called only once during the contract initialization. It initializes the ownable feature, and set push the required condition types including access secret store, lock reward and escrow reward conditions.

Name Type Description
_owner address contract's owner account address
_agreementStoreManagerAddress address agreement store manager contract address
_lockPaymentConditionAddress address lock reward condition contract address
_transferConditionAddress address transfer NFT condition contract address
_escrowPaymentAddress address payable escrow reward condition contract address

nftPrice

mapping(address => mapping(address => mapping(address => mapping(bytes32 => uint256)))) nftPrice

nftSale

function nftSale(address nftAddress, bytes32 nftId, address token, uint256 amount) external

checkParamsTransfer

function checkParamsTransfer(bytes[] _params, bytes32 lockPaymentConditionId, bytes32 _did) internal view returns (address)

checkParamsEscrow

function checkParamsEscrow(bytes[] _params, bytes32 lockPaymentId, bytes32 transferId) internal pure

createAgreementFulfill

function createAgreementFulfill(bytes32 _id, bytes32 _did, uint256[] _timeLocks, uint256[] _timeOuts, address _accessConsumer, bytes[] _params) external payable

NFTSalesWithAccessTemplate

_Implementation of NFT Sales Template

 The NFT Sales template supports an scenario where a NFT owner
 can sell that asset to a new Owner.
 Anyone (consumer/provider/publisher) can use this template in order
 to setup an agreement allowing a NFT owner to transfer the asset ownership
 after some payment. 
 The template is a composite of 3 basic conditions: 
 - Lock Payment Condition
 - Transfer NFT Condition
 - Escrow Reward Condition

 This scenario takes into account royalties for original creators in the secondary market.
 Once the agreement is created, the consumer after payment can request the transfer of the NFT
 from the current owner for a specific DID._

didRegistry

contract DIDRegistry didRegistry

lockPaymentCondition

contract LockPaymentCondition lockPaymentCondition

transferCondition

contract ITransferNFT transferCondition

rewardCondition

contract EscrowPaymentCondition rewardCondition

accessCondition

contract AccessProofCondition accessCondition

initialize

function initialize(address _owner, address _agreementStoreManagerAddress, address _lockPaymentConditionAddress, address _transferConditionAddress, address payable _escrowPaymentAddress, address _accessCondition) external

initialize init the contract with the following parameters.

this function is called only once during the contract initialization. It initializes the ownable feature, and set push the required condition types including access secret store, lock reward and escrow reward conditions.

Name Type Description
_owner address contract's owner account address
_agreementStoreManagerAddress address agreement store manager contract address
_lockPaymentConditionAddress address lock reward condition contract address
_transferConditionAddress address transfer NFT condition contract address
_escrowPaymentAddress address payable escrow reward condition contract address
_accessCondition address

TemplateStoreLibrary

_Implementation of the Template Store Library.

 Templates are blueprints for modular SEAs. When 
 creating an Agreement, a templateId defines the condition 
 and reward types that are instantiated in the ConditionStore._

TemplateState

enum TemplateState {
  Uninitialized,
  Proposed,
  Approved,
  Revoked
}

Template

struct Template {
  enum TemplateStoreLibrary.TemplateState state;
  address owner;
  address lastUpdatedBy;
  uint256 blockNumberUpdated;
}

TemplateList

struct TemplateList {
  mapping(address &#x3D;&gt; struct TemplateStoreLibrary.Template) templates;
  address[] templateIds;
}

propose

function propose(struct TemplateStoreLibrary.TemplateList _self, address _id) internal returns (uint256 size)

propose new template

Name Type Description
_self struct TemplateStoreLibrary.TemplateList is the TemplateList storage pointer
_id address proposed template contract address
Name Type Description
size uint256 which is the index of the proposed template

approve

function approve(struct TemplateStoreLibrary.TemplateList _self, address _id) internal

approve new template

Name Type Description
_self struct TemplateStoreLibrary.TemplateList is the TemplateList storage pointer
_id address proposed template contract address

revoke

function revoke(struct TemplateStoreLibrary.TemplateList _self, address _id) internal

revoke new template

Name Type Description
_self struct TemplateStoreLibrary.TemplateList is the TemplateList storage pointer
_id address approved template contract address

TemplateStoreManager

Implementation of the Template Store Manager. Templates are blueprints for modular SEAs. When creating an Agreement, a templateId defines the condition and reward types that are instantiated in the ConditionStore. This contract manages the life cycle of the template ( Propose → Approve → Revoke ).

templateList

struct TemplateStoreLibrary.TemplateList templateList

onlyOwnerOrTemplateOwner

modifier onlyOwnerOrTemplateOwner(address _id)

initialize

function initialize(address _owner) public

initialize TemplateStoreManager Initializer Initializes Ownable. Only on contract creation.

Name Type Description
_owner address refers to the owner of the contract

proposeTemplate

function proposeTemplate(address _id) external returns (uint256 size)

proposeTemplate proposes a new template

Name Type Description
_id address unique template identifier which is basically the template contract address

approveTemplate

function approveTemplate(address _id) external

approveTemplate approves a template

Name Type Description
_id address unique template identifier which is basically the template contract address. Only template store manager owner (i.e OPNF) can approve this template.

revokeTemplate

function revokeTemplate(address _id) external

revokeTemplate revoke a template

Name Type Description
_id address unique template identifier which is basically the template contract address. Only template store manager owner (i.e OPNF) or template owner can revoke this template.

getTemplate

function getTemplate(address _id) external view returns (enum TemplateStoreLibrary.TemplateState state, address owner, address lastUpdatedBy, uint256 blockNumberUpdated)

getTemplate get more information about a template

Name Type Description
_id address unique template identifier which is basically the template contract address.
Name Type Description
state enum TemplateStoreLibrary.TemplateState template status
owner address template owner
lastUpdatedBy address last updated by
blockNumberUpdated uint256 last updated at.

getTemplateListSize

function getTemplateListSize() external view virtual returns (uint256 size)

getTemplateListSize number of templates

Name Type Description
size uint256 number of templates

isTemplateApproved

function isTemplateApproved(address _id) external view returns (bool)

isTemplateApproved check whether the template is approved

Name Type Description
_id address unique template identifier which is basically the template contract address.
Name Type Description
[0] bool true if the template is approved

AgreementStoreManagerChangeFunctionSignature

createAgreement

function createAgreement(bytes32 _id, bytes32 _did, address[] _conditionTypes, bytes32[] _conditionIds, uint256[] _timeLocks, uint256[] _timeOuts, address _creator, address _sender) public

AgreementStoreManagerChangeInStorage

agreementCount

uint256 agreementCount

AgreementStoreManagerChangeInStorageAndLogic

AgreementStoreManagerExtraFunctionality

dummyFunction

function dummyFunction() public pure returns (bool)

AgreementStoreManagerWithBug

getDIDRegistryAddress

function getDIDRegistryAddress() public pure returns (address)

getDIDRegistryAddress utility function used by other contracts or any EOA.

Name Type Description
[0] address the DIDRegistry address

ConditionStoreChangeFunctionSignature

createCondition

function createCondition(bytes32 _id, address _typeRef, address _sender) public

ConditionStoreChangeInStorage

conditionCount

uint256 conditionCount

ConditionStoreChangeInStorageAndLogic

ConditionStoreExtraFunctionality

dummyFunction

function dummyFunction() public pure returns (bool)

ConditionStoreWithBug

getConditionState

function getConditionState(bytes32 _id) public view returns (enum ConditionStoreLibrary.ConditionState)

getConditionState

Name Type Description
[0] enum ConditionStoreLibrary.ConditionState condition state

DIDRegistryChangeFunctionSignature

registerAttribute

function registerAttribute(bytes32 _didSeed, address[] _providers, bytes32 _checksum, string _url) public

DIDRegistryChangeInStorage

timeOfRegister

mapping(bytes32 => uint256) timeOfRegister

DIDRegistryChangeInStorageAndLogic

DIDRegistryExtraFunctionality

getNumber

function getNumber() public pure returns (uint256)

DIDRegistryWithBug

registerAttribute

function registerAttribute(bytes32 _checksum, bytes32 _didSeed, address[] _providers, string _url) public

registerAttribute is called only by DID owner.

this function registers DID attributes

Name Type Description
_checksum bytes32 includes a one-way HASH calculated using the DDO content
_didSeed bytes32 refers to decentralized identifier (a byte32 length ID)
_providers address[]
_url string refers to the attribute value

IPNFT

TokenURIChanged

event TokenURIChanged(uint256 tokenId, string newURI)

initialize

function initialize(string _name, string _symbol) public

setTokenURI

function setTokenURI(uint256 tokenId, string _tokenURI) public

mint

function mint(address to, uint256 _tokenId, string _tokenURI) public returns (bool)

mintWithoutTokenURI

function mintWithoutTokenURI(address to, uint256 _tokenId) external

transfer

function transfer(address from, address to, uint256 _tokenId) public

NeverminedConfigChangeInStorage

newVariable

uint256 newVariable

NeverminedConfigChangeFunctionSignature

setMarketplaceFees

function setMarketplaceFees(uint256 _marketplaceFee, address _feeReceiver, uint256 _newParameter) external virtual

NeverminedConfigChangeInStorageAndLogic

NeverminedConfigWithBug

setMarketplaceFees

function setMarketplaceFees(uint256 _marketplaceFee, address _feeReceiver) external virtual

The governor can update the Nevermined Marketplace fees

Name Type Description
_marketplaceFee uint256 new marketplace fee
_feeReceiver address The address receiving the fee

TemplateStoreChangeFunctionSignature

proposeTemplate

function proposeTemplate(address _id, address _sender) external returns (uint256 size)

TemplateStoreChangeInStorage

templateCount

uint256 templateCount

TemplateStoreChangeInStorageAndLogic

TemplateStoreExtraFunctionality

dummyFunction

function dummyFunction() public pure returns (bool)

TemplateStoreWithBug

getTemplateListSize

function getTemplateListSize() external view returns (uint256 size)

getTemplateListSize number of templates

Name Type Description
size uint256 number of templates

TestERC721

initialize

function initialize() public

mint

function mint(uint256 id) public

DIDRegistryLibraryProxy

didRegister

struct DIDRegistryLibrary.DIDRegister didRegister

didRegisterList

struct DIDRegistryLibrary.DIDRegisterList didRegisterList

areRoyaltiesValid

function areRoyaltiesValid(bytes32 _did, uint256[] _amounts, address[] _receivers, address _tokenAddress) public view returns (bool)

updateDIDOwner

function updateDIDOwner(bytes32 _did, address _newOwner) public

update

function update(bytes32 _did, bytes32 _checksum, string _url) public

initializeNftConfig

function initializeNftConfig(bytes32 _did, uint256 _cap, uint8 _royalties) public

initializeNft721Config

function initializeNft721Config(bytes32 _did, uint8 _royalties) public

getDIDInfo

function getDIDInfo(bytes32 _did) public view returns (address owner, address creator, uint256 royalties)

EpochLibraryProxy

epoch

struct EpochLibrary.Epoch epoch

epochList

struct EpochLibrary.EpochList epochList

create

function create(bytes32 _id, uint256 _timeLock, uint256 _timeOut) external

HashListLibraryProxy

testData

struct HashListLibrary.List testData

initialize

function initialize(address _owner) public

hash

function hash(address _address) public pure returns (bytes32)

add

function add(bytes32[] values) external returns (bool)

add

function add(bytes32 value) external returns (bool)

update

function update(bytes32 oldValue, bytes32 newValue) external returns (bool)

index

function index(uint256 from, uint256 to) external returns (bool)

has

function has(bytes32 value) external view returns (bool)

remove

function remove(bytes32 value) external returns (bool)

get

function get(uint256 _index) external view returns (bytes32)

size

function size() external view returns (uint256)

all

function all() external view returns (bytes32[])

indexOf

function indexOf(bytes32 value) external view returns (uint256)

ownedBy

function ownedBy() external view returns (address)

isIndexed

function isIndexed() external view returns (bool)

NFTBase

Implementation of the Royalties EIP-2981 base contract See https://eips.ethereum.org/EIPS/eip-2981

_proxyApprovals

mapping(address => bool) _proxyApprovals

MINTER_ROLE

bytes32 MINTER_ROLE

RoyaltyInfo

struct RoyaltyInfo {
  address receiver;
  uint256 royaltyAmount;
}

NFTMetadata

struct NFTMetadata {
  string nftURI;
}

_royalties

mapping(uint256 => struct NFTBase.RoyaltyInfo) _royalties

_metadata

mapping(uint256 => struct NFTBase.NFTMetadata) _metadata

_expiration

mapping(address => uint256) _expiration

ProxyApproval

event ProxyApproval(address sender, address operator, bool approved)

Event for recording proxy approvals.

setProxyApproval

function setProxyApproval(address operator, bool approved) public virtual

_setNFTMetadata

function _setNFTMetadata(uint256 tokenId, string tokenURI) internal

_setTokenRoyalty

function _setTokenRoyalty(uint256 tokenId, address receiver, uint256 royaltyAmount) internal

royaltyInfo

function royaltyInfo(uint256 tokenId, uint256 value) external view returns (address receiver, uint256 royaltyAmount)

@inheritdoc IERC2981Upgradeable

NFTUpgradeable

Implementation of the basic standard multi-token. See https://eips.ethereum.org/EIPS/eip-1155

initialize

function initialize(string uri_) public

See {_setURI}.

isApprovedForAll

function isApprovedForAll(address account, address operator) public view virtual returns (bool)

See {IERC1155-isApprovedForAll}.

mint

function mint(address to, uint256 id, uint256 amount, bytes data) public

burn

function burn(address to, uint256 id, uint256 amount) public

addMinter

function addMinter(address account) public

uri

function uri(uint256 tokenId) public view returns (string)

setNFTMetadata

function setNFTMetadata(uint256 tokenId, string nftURI) public

Record some NFT Metadata

Name Type Description
tokenId uint256 the id of the asset with the royalties associated
nftURI string the URI (https, ipfs, etc) to the metadata describing the NFT

setTokenRoyalty

function setTokenRoyalty(uint256 tokenId, address receiver, uint256 royaltyAmount) public

Record the asset royalties

Name Type Description
tokenId uint256 the id of the asset with the royalties associated
receiver address the receiver of the royalties (the original creator)
royaltyAmount uint256 percentage (no decimals, between 0 and 100)

supportsInterface

function supportsInterface(bytes4 interfaceId) public view virtual returns (bool)

NFT721SubscriptionUpgradeable

mint

function mint(address to, uint256 id, uint256 expirationBlock) public

balanceOf

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

See {IERC721-balanceOf}.

NFT721Upgradeable

Implementation of the basic standard multi-token.

initialize

function initialize(string name, string symbol) public virtual

initialize

function initialize() public virtual

isApprovedForAll

function isApprovedForAll(address account, address operator) public view virtual returns (bool)

See {IERC1155-isApprovedForAll}.

addMinter

function addMinter(address account) public

mint

function mint(address to, uint256 id) public virtual

burn

function burn(uint256 id) public

tokenURI

function tokenURI(uint256 tokenId) public view virtual returns (string)

See {IERC721Metadata-tokenURI}.

setNFTMetadata

function setNFTMetadata(uint256 tokenId, string nftURI) public

Record some NFT Metadata

Name Type Description
tokenId uint256 the id of the asset with the royalties associated
nftURI string the URI (https, ipfs, etc) to the metadata describing the NFT

setTokenRoyalty

function setTokenRoyalty(uint256 tokenId, address receiver, uint256 royaltyAmount) public

Record the asset royalties

Name Type Description
tokenId uint256 the id of the asset with the royalties associated
receiver address the receiver of the royalties (the original creator)
royaltyAmount uint256 percentage (no decimals, between 0 and 100)

supportsInterface

function supportsInterface(bytes4 interfaceId) public view virtual returns (bool)

POAPUpgradeable

_tokenIdCounter

struct CountersUpgradeable.Counter _tokenIdCounter

_tokenEvent

mapping(uint256 => uint256) _tokenEvent

initialize

function initialize() public

initialize

function initialize(string name, string symbol) public virtual

mint

function mint(address to, string uri, uint256 eventId) public

mint

function mint(address to, uint256 id) public

tokenEvent

function tokenEvent(uint256 tokenId) public view returns (uint256)

_beforeTokenTransfer

function _beforeTokenTransfer(address from, address to, uint256 tokenId) internal

_burn

function _burn(uint256 tokenId) internal

tokenDetailsOfOwner

function tokenDetailsOfOwner(address owner) public view returns (uint256[] tokenIds, uint256[] eventIds)

tokenURI

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

isApprovedForAll

function isApprovedForAll(address account, address operator) public view returns (bool)

supportsInterface

function supportsInterface(bytes4 interfaceId) public view virtual returns (bool)