TempleDAO
Search…
Temple AMM and Mechanics
Many of TEMPLE’s core mechanics have been integrated into TempleDAO’s custom DEX, on which TEMPLE trades (currently TEMPLE-FRAX is the only trading pair).
The DEX has three modes of operation:
  1. 1.
    Regular trading (Standard AMM): Buys and sells are routed to a standard constant-product AMM.
  2. 2.
    Absorbing excess buy pressure (Temple Growth, Safe Harvest): a portion of buys are routed to the constant-product AMM, and the rest is sent to the treasury, which mints new TEMPLE to give the buyer. Sells are routed entirely to the constant-product AMM.
  3. 3.
    Defending the Intrinsic Value (Temple Defend): Sells are routed entirely to the treasury, meaning the treasury buys TEMPLE directly from the sellers for the intrinsic value and then burns it. Buys are routed entirely to the V2 AMM. This makes the Intrinsic Value the “floor price” of TEMPLE.
#1 Regular trading is the standard operating condition of the AMM and needs no further explanation, but let’s explore #2 and #3 in more detail.

2: Temple Growth - Absorbing Excess Buy Pressure

Threshold Price

The key question here is, how exactly do you decide when buying pressure is “excessive”?
Temple’s DEX does this by using a threshold price. Simply put, if the price is below the threshold price, then buy pressure isn’t “excessive”. If price is above the threshold price, then a portion of buy pressure is absorbed into the treasury.
The threshold price is calculated using the following formula:
Every time TEMPLE is bought, the AMM checks if 0.98 * (the current price) is greater than the Threshold Price. If it is, then it sets the threshold price to 0.98 * (the current price). Otherwise, the threshold price remains the same. The threshold price also gradually decreases over time according to a power function. This function is similar to 1/x where x is the time that has passed.
The result of this is that whenever there’s a large surge in buy pressure, the price rises until it hits the threshold price, and then the price and threshold price rise together, with the threshold price always being 2% lower. Whenever market price falls below threshold, the threshold price will continue to go down until eventually either the market price rises above it again, or the threshold price falls below market price.
Since a portion of each buy is routed to the treasury when the price is above the threshold, the slippage each buyer experiences on the AMM is reduced when buying above threshold. This means that TEMPLE’s price goes up slower when it’s above the threshold, preventing massive spikes.

Routing Buys to the Treasury

When price is below threshold, buys are routed entirely to the AMM, meaning the Temple DEX behaves exactly like other AMM DEXs like Uniswap. When the price is above threshold, a portion of each buy is routed to the treasury.
The amount of each buy that is routed to the treasury depends on the price relative to IV. Currently, when the price is at $2 or below, 0% of buys are routed to the treasury, even if price is above threshold. At $10, 80% of buys are routed to the treasury. The amount that is routed to the treasury varies linearly between these two price points.
So for example if the price is $5 and above threshold, then 50% of each buy would be routed to the treasury.
When FRAX is routed to the treasury, the treasury mints new TEMPLE to give to the buyer. The treasury periodically harvests the FRAX it accumulates from AMM buys.

Safe Harvest

Safe Harvest is the process by which TempleDAO mints new TEMPLE tokens while ensuring that Intrinsic Value grows. As new FRAX comes into the treasury, it periodically calculates how many TEMPLE tokens it can mint without diluting the Intrinsic Value, and then mints less than this amount, causing the Intrinsic Value grows.
For example, suppose the treasury holds $1000, and the fully-diluted supply of TEMPLE is 1000. This would mean the intrinsic value of TEMPLE is $1000/1000, or $1. Now let’s say the price of TEMPLE is $5, and $100 of FRAX just came into the treasury as a result of someone buying.
Since $100 came in at a price of $5, 20 TEMPLE (100/5) had to be minted and given to the buyer. So $20 of the $100 that just came in must be used to back the TEMPLE tokens given to the buyer.
With the remaining $80, the treasury can mint up to an additional 80 TEMPLE tokens. Any more than this, and the intrinsic value of TEMPLE would start to go down.
But it can also mint less than 80, in which case the Intrinsic Value goes up.
As of this writing, the treasury mints 20% less than the maximum it can mint when new FRAX comes in. And all of the minted tokens are then distributed to various pools:
  • 43.75% to the staking rewards pool, to be distributed to stakers over time
  • 12.5% to the bonus rewards pool, to be distributed to Templars participating in FAITH
  • 18.75% to be added as liquidity to the LP pool
  • 25% to the DAO for funding development
Going back to our previous example, this would mean minting 64 TEMPLE tokens. The Intrinsic Value would then increase to ($1000 + 100)/(1000+20+64) = $1100/1084 = $1.015. And the 64 tokens minted during Safe Harvest would be distributed according to the percentages outlined above.

3: Defending the Intrinsic Value

When the price of Temple falls below the Intrinsic Value ($0.65 at the time of this writing but will go up over time) the protocol guarantees that it will buy Temple tokens from sellers at IV, which it then burns to keep the price above that threshold. IV is thus a hard floor for the price of Temple that is written into the smart contract of the protocol.

Temple Defend

Another mechanic built into Temple which kicks in if the price goes below IV. Temple Defend will allow traders to buy from decentralised exchanges and sell their tokens to the Protocol at the floor price (IV). They do this by staking their tokens with the protocol when Temple defend is in effect, and a cool-down period kicks in. At the end of this period sellers have the option (but not the obligation) to sell at IV price. In practice this means that you could buy Temple from a DEX at lower than IV price, sell those tokens to the AMM for a profit, but then still have the option to redeem those tokens back from the protocol after the cool-down period if the price of Temple goes back up again. It’s a win-win for you and the protocol.

Temple Devotion (coming soon)