> For the complete documentation index, see [llms.txt](https://credit-guild.gitbook.io/introduction/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://credit-guild.gitbook.io/introduction/staking.md).

# Staking

The Ethereum Credit Guild uses a gauge staking system to determine the relative debt ceilings of the lending terms in the same market (a market is a 'gauge type' at the smart-contract level).

The providers of first-loss capital (`GUILD` stakers or `gToken` stakers through the `SurplusGuildMinter`) determine the relative debt ceilings of the lending term (which collateral assets are lenders exposed to, at what rate, at which borrow ratio), along with the **tolerance**, which provides 'wiggle room' for the market to grow and efficiently distribute liquidity.

By default, when a `LendingTerm` is onboarded (i.e. becomes a non-deprecated gauge in the `GUILD` token at the smart-contract level), it has a debt ceiling of `0`. As `GUILD` gets staked in the gauge, the debt ceiling increases. This means that `GUILD` holders collectively decide of the relative debt ceiling of all terms.

As an example, a system with 2 users (`GUILD` holders) and 2 gauges (lending terms):\
-> User A votes 1000 tokens for gauge A, 1000 tokens for gauge B\
-> User B votes 100 tokens for gauge A, 5000 tokens for gauge B\
-> The total votes is 1000 + 1000 + 100 + 5000 = 7100\
-> The gauge A weight is 1000 + 100 = 1100\
-> The gauge B weight is 1000 + 5000 = 6000\
-> The system will target 1100 / 7100 \~= 15% of the debt ceiling for gauge A, and \~85% for gauge B

The debt ceiling is the maximum number of borrowable `gToken`for a given term.

First loss capital stakers earn a % of the interest paid by borrowers (this is a governable parameter set per-market), as well as GUILD rewards, and are subject to slashing in case of loss. Stakers can change their vote at any time, *unless the liquidity on the term they are voting for is fully utilized*. If liquidity is fully utilized, stakers must either wait for borrowers to repay, or offboard the lending term and close the associated loans.
