Certificate of Deposit Client
The CertificateOfDepositClient class extends ContractEngine to interact with a specific smart contract implementation for a Certificate of Deposit on the Stellar network. It implements methods for managing deposits, withdrawals, and fetching contract-related data.
Constructor
Parameters:
contractId: Contract ID of the deployed contract.network: Network configuration.rpcHandler: RPC handler for interactions.
Purpose: Initializes the client with the necessary configurations to interact with the Certificate of Deposit contract.
Methods
deposit
Purpose: Deposits assets into the contract.
Parameters:
address: Account address making the deposit.amount: Deposit amount.signers: Authorizing signers.header: Transaction header.feeBump: Optional fee bump.
withdraw
Purpose: Withdraws assets from the contract.
Parameters:
address: Account address withdrawing assets.acceptPrematureWithdraw: Flag for premature withdrawal acceptance.signers: Authorizing signers.header: Transaction header.feeBump: Optional fee bump.
getEstimatedYield
Purpose: Fetches estimated yield.
Parameters:
address: Account address.header: Transaction header.
getPosition
Purpose: Retrieves current position.
Parameters:
address: Account address.header: Transaction header.
getEstimatedPrematureWithdraw
Purpose: Estimates premature withdrawal amount.
Parameters:
address: Account address.header: Transaction header.
getTimeLeft
Purpose: Determines time left for penalty-free withdrawal.
Parameters:
address: Account address.header: Transaction header.
initialize
Purpose: Initializes contract state.
Parameters:
admin,asset,term,compoundStep,yieldRate,minDeposit,penaltyRate,allowancePeriod: Contract parameters.signers: Authorizing signers.header: Transaction header.feeBump: Optional fee bump.
This class provides a structured and convenient way to interact with the Certificate of Deposit contract on the Stellar network, encapsulating complex contract interactions into simpler method calls.
Last updated
Was this helpful?