Increase Collateral

Liquidity needs to be liquid

Payment streams do not need to be fully collateralised. This is an important feature because large deals are capital intensive and full collateral could be prohibitive.

Semi-collateralised escrows need to be increased easily by the payers. The code below shows how this is done.

Approve

First, the payer must approve a transfer from their balance to the escrow account equal to the amount that the escrow is to be increased with:

const amount = toUint256WithFelts((BigInt('1,000'.replace(/,/g, ''))).toString())

await account0.invoke(
  txEscrowContract, 
  'approve', 
  { spender: txFlowContract.address, amount: amount}, 
  { maxFee: FEE}
)

Second, call the custom flow function to increase the escrow for a specific flow identified by the variable "id" below.

let tokenId = toUint256WithFelts("0")
await account0.invoke(
    txEscrowContract, 
    'increase', 
    { 
        tokenId: tokenId, 
        amount: amount 
    }, 
    { maxFee: FEE}
  )

Next is about decreasing collateral.

Last updated