Skip to content

DlpcContract

DlpcContract class extends ethers.Contract class to interact with the DLPC (Digital Ledger Payment Commitment) smart contract.It includes methods for preparing transaction data, retrieving contract details, and managing roles and proofs within the contract.

To deploy a new contract, use the Dlpc methods: prepareDeployTxFromTracker or prepareDeployTx, depending on whether database dependencies are involved or not respectively.

Creating Instances

new DlpcContract( target: string, contractRunner: Signer | Provider )

Creates a new instance of the DlpcContract class, connecting to a specified target DLPC contract. The contractRunner can be either a signer or a provider.

Properties

  • dlpcContract.target ⇒ string
    The target to connect to. This can be an address, ENS name or any Addressable, such as another contract.

  • dlpcContract.contractRunner ⇒ Signer | Provider
    The Signer or Provider used for interacting with the contract.

    To query or retrieve blockchain details, use the Provider, while for executing transactions, use the Signer.

Methods

dlpcContract.prepareTxData( methodName: string, args: any[], signerAddress: string ) ⇒ Promise<TxData>

Prepares the transaction data for invoking a method on the contract by generating the required data.



dlpcContract.getRoles( ) ⇒ Promise<Roles>

Retrieves the roles associated with the DLPC contract by filtering RoleGranted logs and checking current roles.



dlpcContract.getRoleForByte( roleByte: string ) ⇒ string

Translates a role byte into a readable role name (e.g., ADMIN_ROLE, MINTER_ROLE).



dlpcContract.getProofs( ) ⇒ Promise<Proofs>

Retrieves the proof records stored in the contract.



dlpcContract.getDoc () ⇒ Promise<DlpcDoc>

Returns a detailed document of the DLPC, including the committee, committer, denomination, and amount.



dlpcContract.getCondition () → Promise<Conditions>

Retrieves all conditions of the DLPC, including their ID and status.



dlpcContract.getCommitmentState () ⇒ Promise <string>

Gets the current state of the DLPC commitment.



dlpcContract.getAttestationStatus( dlpcDoc: DlpcDoc ) ⇒ Promise<Attestation>

Returns the attestation status of the committee and committer.



dlpcContract.getAccepted( ) ⇒ Promise<AcceptedEvent[]>

Retrieves the events where the DLPC was accepted.



dlpcContract.getTokens( ) ⇒ Promise<Tokens>

Retrieves the tokens associated with the DLPC.



dlpcContract.getApprovalForAll ( ) ⇒ Promise<ApprovalForAllEvent[]>

Retrieves all "approval for all" events related to the DLPC.



dlpcContract.getChangeConfirmed ( ) ⇒ Promise<ChangeConfirmedEvent[]>

Fetches events where changes in the DLPC were confirmed.



dlpcContract.getChangeRequested ( ) ⇒ Promise<ChangeRequestedEvent[]> Retrieves events where changes in the DLPC were requested.



dlpcContract.getClaimSettled ( ) ⇒ Promise<ClaimSettledEvent[]>

Retrieves all events where claims in the DLPC were settled.



dlpcContract.getConditionVerified ( ) ⇒ Promise<ConditionVerifiedEvent[]>

Fetches events indicating that a condition in the DLPC has been verified.



dlpcContract.getProofAdded ( ) ⇒ Promise<Proofs[]>

Retrieves all "ProofAdded" events with the corresponding data.



dlpcContract.getRoleAdminChanged ( ) ⇒ Promise<RoleAdminChangedEvent[]>

Retrieves events where the admin role for a role has changed.



dlpcContract.getRoleRevoked ( ) ⇒ Promise<RoleRevokedEvent[]>

Fetches events where roles have been revoked from certain addresses.



dlpcContract.getStateChanged ( ) ⇒ Promise<any[]>

Retrieves events where the DLPC state has changed.



dlpcContract.getDetails( dlpcAddress: string ) ⇒ Promise<Dlpc>

Returns all relevant details of a DLPC contract, including roles, tokens, documents, and conditions.



dlpcContract.getTrail( ) ⇒ Promise<Trail[]>

Generates a trail of all events associated with the DLPC contract.


Note: The DlpcContract class also allows interaction with the deployed DLPC Contract's functions. For more details, refer to the DLPC Contract Artifact.