Utility.Commercials.V0.Model.CommercialAgreement
Templates used for payment of fees for using the Utility.
Templates
template CommercialAgreement
A commercial agreement that describes the fees that the user will pay for using the Utility.
Signatory: operator, user
Field
Type
Description
operator
App operator.
user
App user.
feeReceiver
The party that will receive the fee for using the Utility services.
lockedAmuletCids
Coins locked to the operator which are used to pay fees.
currentLockedAmuletAmountCc
Current amount of locked CC held as part of the commercial agreement.
utilityFees
The fee that the user will pay for using the Utility services.
dso
Reference to the DSO party (Decentralized Synchronizer Operations).
Choice Archive
Controller: operator, user
Returns: ()
(no fields)
Choice CommercialAgreement_Bill
Trigger a payment of the agreed fee for performing a billing on behalf of the user.
Controller: operator
Returns: CommercialAgreement_Bill_Result
Field
Type
Description
transferContext
Context for CC transfers.
transferPreapprovalCid
ContractId TransferPreapproval
Preapproval from a party to receive the fee. If the fee payment should be a featured transfer, ensure that the TransferPreapproval contains a featuredAppRight.
paymentTransferContext
Context for preapproved CC transfers.
Choice CommercialAgreement_LockCoin
Lock coins (for future fee payments) to the operator. This increases (or decreases) the deposit to reach the specified target amount.
Controller: user
Returns: CommercialAgreement_LockCoin_Result
Field
Type
Description
targetAmount
Lock coins so that the deposit reaches this target amount of totally locked coin.
coinCids
Coins to lock.
transferContext
Context for CC transfers.
Choice CommercialAgreement_Modify
Modify the commercial agreement. It keeps the operator, user, dso and deposit unchanged.
Controller: operator
Returns: CommercialAgreement_Modify_Result
Field
Type
Description
feeReceiver
The party that will receive the fee for using the Utility services.
utilityFees
The fee that the user will pay for using the Utility services.
Choice CommercialAgreement_Revoke
Revoke the commercial agreement (and unlock the deposit).
Controller: actor
Returns: CommercialAgreement_Revoke_Result
Field
Type
Description
transferContext
Reference data for unlocking the deposit.
actor
Data Types
data CommercialAgreement_Bill_Result
Result of
CommercialAgreement_Bill
.CommercialAgreement_Bill_Result
Field
Type
Description
commercialAgreementCid
The updated commercial agreeement after billing.
data CommercialAgreement_LockCoin_Result
Result of
CommercialAgreement_LockCoin_Result
.CommercialAgreement_LockCoin_Result
Field
Type
Description
commercialAgreementCid
The updated commercial agreeement after locking coin.
data CommercialAgreement_Modify_Result
Result of
CommercialAgreement_Modify
.CommercialAgreement_Modify_Result
Field
Type
Description
commercialAgreementCid
The modified commercial agreeement.
data CommercialAgreement_Revoke_Result
Result of
CommercialAgreement_Revoke
.CommercialAgreement_Revoke_Result
Field
Type
Description
unlockedDeposit
The unlocked deposit.
Functions
- unlockCoins
: AppTransferContext -> ContractId LockedAmulet -> Update (ContractId Amulet)
Unlock an existing deposit and return the unlocked coins.
- unlockDeposit
: AppTransferContext -> ContractId LockedAmulet -> Update TransferInput
Unlock an existing deposit and return the coin as InputAmulet for a transfer.
- minutesToRelTime
-
Convert a number of minutes to a
RelTime
.
- verifyAmulet
: Party -> ContractId Amulet -> Update Decimal
Verify the DSO party of a given Amulet and return the amount.
- verifyAmulets
: Party -> [ContractId Amulet] -> Update Decimal
Verify a list of Amulets and return the total amount.
- fetchAndValidateBillingContext
: Party -> Party -> AppTransferContext -> Update BillingContext
Fetch the billing context components from the ledger and validate them.