跳转到内容

How lending works

此内容尚不支持你的语言。

Tako lends the pool’s Gram to validators for one validation round at a time. Any validator can bid; the pool funds the bids that pay it the most per Gram.

sequenceDiagram
    participant V as Validator
    participant T as Treasury
    participant L as Loan
    participant E as Elector
    V->>T: RequestLoan (collateral, signed stake request)
    Note over T: requests wait until the decision window
    T->>L: StakeLoan (principal + collateral)
    L->>E: new_stake
    Note over E: validation round, then the stake stays frozen
    L->>E: recover_stake (anyone can trigger)
    E->>L: stake + reward
    L->>T: LoanReturned
    T->>V: payout: collateral and the validator's share

Before each election you send RequestLoan to the treasury with:

  • amount: the loan you want, between the pool’s minimum and maximum;
  • minAmount: the smallest loan you accept if the pool can fund you only partly;
  • minPayment: the least you promise the pool for this round, at least minRateBps of the amount;
  • collateral: attached as value, your own stake that goes to the Elector with the loan;
  • a signed stake request for the Elector, signed for the address of your loan contract. That address is derived in advance, so you can sign before the loan exists.

A new request replaces your previous one and refunds its collateral. When the round is full, a better request pushes out the worst one, and its collateral is returned.

In a window before the Elector’s deadline, anyone sends DecideRound and gets a bounty for it. The treasury funds requests from the highest minPayment / amount down until the budget runs out. The last one may be funded partly. Everyone else gets their collateral back.

The budget is the smaller of the pool’s free Gram and about half of the pool. A stake works one round and then stays frozen through the next, so the pool lends half in odd rounds and half in even ones.

A loan plus collateral never exceeds the Elector’s max_stake, because the Elector would not return the excess.

The treasury deploys a Loan contract for you in the masterchain and sends it the principal and your collateral. The Loan sends your stake request to the Elector. The Elector keeps 1 Gram of the collateral as its confirmation, as it does for everyone.

After the round and the freeze, anyone can trigger recovery and earn a bounty. The Loan takes the stake back from the Elector and sends everything to the treasury, which splits it:

reward = what came back − principal − collateral
earned = reward × principal / (principal + collateral) ← the loan's part
pool = max(minPayment, earned × poolShare) ← poolShare is 97.25% on testnet
you = everything else

Your collateral’s reward is yours in full. With 700,000 Gram of your own and a 150,000 loan, the pool takes 97.25% of the 150/850 part of the reward, not of all of it.

Outcome Result
Normal round the pool gets its share of what the loan earned, at least minPayment; you get the rest
Stake rejected by the Elector minPayment is taken from your collateral, the rest comes back
Fine smaller than your collateral it comes out of your collateral
Fine larger than your collateral the insurance fund covers the excess first, then holders and claims share it
  • A validator node with mytonctrl in validator mode.
  • A wallet in the masterchain with your collateral and fees.
  • The Tako mode for mytonctrl, which does all of the above every election.