İçeriğe geç

Architecture

Bu içerik henüz dilinizde mevcut değil.

Tako is a set of Tolk contracts on TON. The treasury holds the pool; everything else either holds one user’s state or forwards money for a single purpose.

Contract Chain Role
Treasury basechain jetton master of takoGRAM, pool accounting, claims collection, lending, governance
Share wallet basechain, owner’s shard TEP-74 wallet holding takoGRAM
Claim basechain a queued withdrawal of a fixed Gram amount, a transferable TEP-62 NFT
Loan masterchain, one per validator and round stakes at the Elector and returns everything to the treasury
Prize vault basechain holds takoGRAM, keeps deposits whole, draws the yield
Group factory basechain one prize vault per Telegram chat at a derived address
Migrator basechain, one per source pool turns tsTON, Stakee tokens or hGRAM into takoGRAM
Timelock basechain governor of the treasury and vaults, delays every action
Badges basechain soulbound TEP-85 badges

The treasury is its own jetton master. Supply and pooled Gram live in one storage, so the rate always changes atomically with them.

flowchart LR
    U[User] -- Gram --> T[Treasury]
    T -- mint --> W[Share wallet]
    W -- burn --> T
    T -- instant Gram --> U
    T -- deploy --> C[Claim]
    C -- redeem --> T
    T -- principal --> L[Loan]
    L -- new_stake / recover --> E[Elector]
    L -- everything back --> T
    W -- takoGRAM --> V[Prize vault]
    V -- rate query --> T
Flow Messages
Stake user → treasury → share wallet (mint), excess back to the user
Instant withdrawal user → share wallet (burn) → treasury → user
Queued withdrawal user → share wallet → treasury → claim (deploy), excess back
Redeem anyone → claim → treasury → claim → owner, the claim self-destructs

Every handler first reserves what the contract keeps, then sends the rest. Users pay exact costs and get the remainder back.

  • The treasury throws on a burn: the wallet restores the balance from the bounce.
  • The treasury lacks liquidity when a claim is redeemed: the claim resets from the bounce and can be retried.
  • Minting or deploying a claim fails: the treasury reads the original message from the bounce and refunds the user.

One migrator is deployed per source pool. A user sends the source token to it, and one transfer ends with takoGRAM in the user’s wallet:

  1. The migrator receives the transfer from its own wallet of that token, opens a ticket and asks the source pool for an instant withdrawal.
  2. The source pays the Gram back at once. The migrator accepts the payout only in the form and from the sender its source uses.
  3. The migrator pays the relayer, if any, and stakes the rest for the recipient.
Tonstakers, Stakee Hipo
Withdrawal asked burn with fill_or_kill, no waiting for round end unstake_tokens with mode: instant
Payout withdrawal from the pool withdrawal_notification from the migrator’s own hGRAM wallet
No liquidity the pool mints the tokens back the tokens roll back; the migrator returns them

Whatever goes wrong, tokens or Gram go back to their owner: a bounced burn, a paused treasury, a transfer below get_migration_fee, tokens sent to the migrator of another source. A refund the forward cannot pay for is kept as a stranded ticket that its owner can retry.

Contracts log events as external messages whose destination is the topic. The indexer reads them; the generated reference lists each contract’s events.

DrawRevealed makes a draw checkable from outside: the randomness is the SHA-256 of the drand signature, and the first winner holds the ticket randomness mod principal.