CollateralSufficient

scalus.cardano.ledger.utils.CollateralSufficient

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Self type

Members list

Value members

Concrete methods

def calculateRequiredCollateral(fee: Coin, collateralPercentage: Long): Coin

Calculates the required collateral amount based on the transaction fee and collateral percentage from protocol parameters.

Calculates the required collateral amount based on the transaction fee and collateral percentage from protocol parameters.

Value parameters

collateralPercentage

the collateral percentage from protocol parameters

fee

the transaction fee

Attributes

Returns

the required collateral amount

def check(actualTotalSumOfCollateralCoins: Coin, transactionFee: Coin, collateralPercentage: Long): Boolean

Checks if the actual collateral amount is sufficient according to the protocol's collateral percentage requirement.

Checks if the actual collateral amount is sufficient according to the protocol's collateral percentage requirement.

The collateral is considered sufficient if: actualCollateral * 100 >= fee * collateralPercentage

Value parameters

actualTotalSumOfCollateralCoins

the actual sum of all collateral input coins

collateralPercentage

the collateral percentage from protocol parameters (e.g., 150 means 150%)

transactionFee

the transaction fee

Attributes

Returns

true if the collateral is sufficient, false otherwise