Libre Bank is a Liquidity smart contract deployed on the KYC-Tezos network.
The purpose of this contract is to allow for trustless lending of XTZ to TzLibre. By capping the borrowed amount and by spreading the remaining counterparty risk among many depositors, this contract allows users to withdraw their own deposit at any time, should collateralization reach a threshold they’re not comfortable with.
TzLibre will borrow XTZ from the contract in order to increase its baking bonds. Larger baking bonds allow TzLibre to accept an ever growing number of delegations.
(owner: address)
: contract owner (TzLibre) address.(max_depositors: nat)
: maximum number of users.(min_deposit: tez)
: minimum allowed deposit amount.(withdraw_fee: nat)
: withdraw fee (expressed as a percentage) paid to the contract owner (TzLibre) by the user during withdrawal.(collat_coeff: nat)
: minimum collateralization, expressed as a percentage of deposits (e.g. if this value is set to 60% and users deposit a total of 100K XTZ on the contract, the contract owner can borrow up to 40K XTZ).
The contract allows 4 actions: 1) User deposit
, 2) User withdraw
, 3) Owner borrow
, 4) Owner payback
. None of these actions accepts any parameter (besides the transfer amount).
Triggered when a transaction of amount a
is sent to the contract by a user.
$ tezos-client transfer <a> from <user-address> to <libre-bank>
Triggered by a depositor to withdraw funds. To trigger this action the depositor must send a transaction to the contract, with amount in the interval [0, 1] XTZ (if >0 it will be paid back along with the withdrawal amount).
$ tezos-client transfer 0 from <user-address> to <libre-bank>
Triggered by contract owner (TzLibre) to borrow funds from the contract. The maximum amount that can be borrowed is computed as (1 - collat_coef) * total_deposited_funds
.
$ tezos-client transfer 0 from <owner-address> to <libre-bank>
Triggered by contract owner (TzLibre) to deposit funds back into the contract.
$ tezos-client transfer <payback-amount> from <owner-address> to <libre-bank>