Libre Bank
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore
README.org
deploy.sh
libre-bank.liq
libre-bank.liq.tz
run.sh

README.org

Libre Bank

Libre Bank is a Liquidity smart contract deployed on the KYC-Tezos network.

Overview

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.

Purpose

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.

Initialization parameters

  • (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).

Usage

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).

User deposit

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>

User withdraw

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>

Owner borrow

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>

Owner payback

Triggered by contract owner (TzLibre) to deposit funds back into the contract.

$ tezos-client transfer <payback-amount> from <owner-address> to <libre-bank>