tangofinance
Skip to content

How Yield Generation Works

Asset support

Which assets each stock's strategy holds, from its one stock to its default and registered stablecoins, how it swaps between stablecoins, and how it reads prices.

Each stock's strategy holds a small, fixed set of assets. It has one stock, which people supply and which sets the value of their shares. It has one default stablecoin, which it borrows and keeps its accounts in. It may also register a few more stablecoins to lend. This page explains each one, how the strategy swaps between stablecoins, and how it reads prices. Using a vault explains the contract that holds them.

Key points

  • Each contract holds exactly one stock, its underlying, fixed when it is deployed.
  • The default stablecoin is fixed at deployment too. The strategy borrows only that stablecoin, and keeps its stablecoin book in it.
  • The curator can register up to four stablecoins in all, behind its delay. The operator swaps between them within a tolerance checked against oracle prices.
  • Share value reads no price. Prices are read to check swaps and harvests and to value stablecoins other than the default.

The stock

The underlying is the stock people supply. It is set when the contract is deployed and can never change. A deposit must deliver exactly the amount asked for, so the contract refuses a token that takes a fee on transfer or delivers a different amount.

The contract works with any token that has a price feed and a money market lending stablecoins against it. On tango.finance, every underlying is a tokenized stock. Which stocks can be supplied is shown on Home.

Stablecoins

The default stablecoin

The default stablecoin is the network's main stablecoin, such as USDC. It is set when the contract is deployed and can never be removed. Every borrow venue must lend this stablecoin, and the stablecoin book is kept in its units. Harvests and rebuys spend it, and donations are made in it.

Registered stablecoins

The curator can register other stablecoins, up to four in all including the default. Without a price feed, a registered stablecoin counts as zero in the book. The contract refuses to register a token that is the stock, the share token, the swapper, one of the venues or a borrow venue's protocol. Every lending venue must lend a registered stablecoin.

A stablecoin can be removed only when no lending venue lends it and none of it is held. Both adding and removing wait the curator's delay. See Timelocks.

Swaps between stablecoins

The operator can swap one registered stablecoin for another, for example to lend at a venue that pays more in a different stablecoin. Every swap follows the same rules:

  • It spends only stablecoin held idle, and must be between two different registered stablecoins.
  • It runs through the swapper, a small contract that only the contract holding the stock can call. The swapper holds tokens only while a swap runs, and the contract measures exactly what came back.
  • What comes back must be worth at least what went in, less the swap tolerance, at oracle prices. The contract caps the tolerance at 5%. The curator sets it, behind its delay.
  • A swap that would leave the stablecoin book in deficit is refused, unless it makes an existing deficit smaller, such as selling a stablecoin that is losing its peg.
  • A swap needs fresh prices for both stablecoins. With a stale price, it is refused.

A harvest is a swap the other way, from the default stablecoin into the stock. It has its own harvest tolerance, also capped at 5%. See How your stock compounds.

How prices are read

Each stock's contract has a price oracle with one Chainlink-style price feed per asset, quoting it in US dollars. The curator sets each feed and how old its answer may be, behind its delay. The oracle refuses a feed that cannot give a price when it is set.

Where a price is usedWhat happens if it is stale
Share valueNo price is used
Valuing stablecoins other than the default in the bookThat stablecoin counts as zero
Checking a swap, harvest or rebuyThe step is refused
Paying a forced withdrawal's shortfall back in kindThat position is skipped

Money markets use their own price oracles to decide liquidations, not this one. A borrow venue's price can differ from the contract's feed.

When is a price stale?

A price is stale when the feed's answer is older than its allowed age, is zero or negative, is dated in the future, or cannot be read at all. On a network with a sequencer, the single node that orders transactions, the oracle also reads a sequencer uptime feed. It treats every price as stale while the sequencer is down, and for a grace period after it comes back.

Price feeds for tokenized stocks may not update outside trading hours, so a stock's price can stay unchanged over a weekend or holiday and then move in one step. See Risks.

How many of each

Asset or venueMost the contract can register
Stock1, fixed at deployment
Stablecoins, including the default4
Lending venues8
Borrow venues4

The contract fixes these limits, so every valuation and every forced withdrawal runs in bounded gas.