Skip to content
102 changes: 102 additions & 0 deletions docs/exit-markets.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
= Exit markets

To understand the implied risk of a coverage pool, and to dampen the deleterious
effects of short-term underwriter behavior, we introduce exit markets.

Exit markets allow underwriters to express their time preference when
withdrawing. Rather than require all withdrawals to suffer a fixed delay,
underwriters can withdraw more quickly for a price, in competition with each
other.

Exit markets smooth out coverage pool liquidity and the discontinuity of
fixed-delay withdrawals, and expose a proxy for the short-term risk of the
pool — the withdrawal fee curve.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see a value for underwriters being able to exit the pool early but it is not entirely clear to me how the exit market will smooth the liquidity and why is it better for the pool compared to a fixed withdrawal period.

If all underwriters wait for P before withdrawing tokens, it is the same as waiting for a fixed withdrawal period.

If some underwriters do not wait for P, their withdrawal fees fuel up the pool, but even though the pool has shrunk - it has lower liquidity than it would have in the case of a fixed withdrawal period.

For example, let's say I deposited 100 WETH into the pool. At P/2 I decided to withdraw. I had to leave 30% of my tokens in the pool. We can say that the pool earned 30 WETH. But at the same time, for the remaining P/2 its liquidity shrunk by 70 WETH.

Copy link
Member Author

@mhluongo mhluongo Mar 20, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If some underwriters do not wait for P, their withdrawal fees fuel up the pool, but even though the pool has shrunk - it has lower liquidity than it would have in the case of a fixed withdrawal period.

The assumption is that allowing quicker withdrawals will lead to greater total liquidity over the lifetime of a pool, compared to a fixed period pool, because the structure is more friendly to underwriters who are giving up opportunity cost.


== Mechanism

Instead of a fixed withdrawal delay, collateral pools are paramaterized with a
cost-free withdrawal period, `P`. This period is how long it takes for a
withdrawal to clear, when funds are no longer at risk and can be freely removed
from the collateral pool.

One way to turn this into a market is for the pool to continually "auction off"
immediate withdrawals. The pool shouldn't auction off more immediate withdrawals
than some pool-specific risk parameter; it can auction off more at some time
between now and `P`, but it's unclear how much more.

Auctioning off immediate withdrawal excludes an important risk counter-signal:
deposits.

=== A physical analog

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In pedant-land, I'm pretty sure even though it's strictly the same, “analogue” is the generally-used spelling in noun form 😬

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I was going for "analogy"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No the word is the right fit, and the spelling is also right, just not the commonly-used one.


To develop intuition, consider a fixed arm on a hinge.

<pic>

Forces up and down along the arm counteract each other based on their position
along the arm and their magnitude perpendicular to the arm. Multiplied together,
the position and magnitude yield the moment of force, or torque.

<pic>

If we assign the arm the length of the cost-free withdrawal period, `P`, and
place the origin at the hinge, each force perpendicular to the arm can represent
a withdrawal or a deposit; the moment arm for each represents the immediacy of a
withdrawal, and the magnitude of the force represents the amount to be deposited
or withdrawn, relative to the outstanding underwriter tokens in the pool, `U`.

All perpendicular forces along the fixed arm can be aggregated into one value,
the torque. "Maximum" torque on the arm would be all the tokens `U` multiplied
by the cost-free period `P`. Maximum torque means the pool is drained of all
collateral immediately.

<pic with rubber band>

A feedback mechanism to limit maximum torque works like a rubber band on the
arm.

This analog makes a few things clear.

There's an obvious aggregate of deposits and withdrawals in the analog in
torque, or *withdrawal immediacy*. Withdrawal immediacy can be measured in
percent-pool-days.

The analog as presented only holds at a snapshot in time. As time moves on, each
force moves closer to the origin / hinge, lessening torque or withdrawal
immediacy from the pool.

Finally, the analog presents the question: what happens in the face of net
positive deposits over a period? Is there a fixed platform above the arm,
preventing periods of net positives from counting toward withdrawal immediacy?
Or does a similar rubber-band like feedback mechanism apply?

=== Details

Given a pool with total assets `A`, outstanding underwriter tokens `U`, and
cost-free withdrawal period `P`, we can draw a curve between withdrawal
immediacy (percent-pool-days) and underwriter tokens.

<pic>

An underwriter withdrawing the entire pool, immediately, costs the entire
underwriter token supply `U` — not something a rational player would do.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because it implies a gain of 0 underlying assets and a loss of U, so a total loss, right?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feels like it may be worth being explicit about that.

Copy link

@eth-r eth-r Feb 19, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By continuity we may not be able to do this; if we want the cost of withdrawing x + y tokens at once to equal the cost of withdrawing x tokens and then y tokens later in the same block it implies that withdrawing any amount immediately must cost the entire withdrawn amount

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And if we don't have continuity, it's possible to withdraw the entire pool immediately without losing the entire token supply by splitting up the withdrawal into smaller withdrawals unless we prevent immediate withdrawals altogether and bundle withdrawals together across one or more blocks

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If Uniswap can do it, we can do it 😄

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's too Friday evening for me to articulate this precisely, but isn't how Uniswap does it that you have assets A and B, and the pool has T tokens issued so that A * B = T^2 * K, so if you try to get all A assets out you have to pay infinity B tokens in, but if you pay in 100% of T tokens you get 100% of both A and B out of it?

Withdrawing the entire pool at period `P` costs nothing.

A simple curve used by popular automated market makers is the constant product,
used as a constraint on the relationship between two sides of a market.

`x * y = k`

In an exit market, `x` is the supply of underwriter tokens paid toward
withdrawal fees over the sliding window `P`. `y`, on the other hand, is
withdrawal immediacy. To withdraw 50% of a pool in `P/2`, an underwriter must
swap underwriter tokens such that the pool constraint is maintained, "buying"
immediacy.

As time goes on, `y` grows linearly until it hits a max of `100% of the pool *
P days`, growing the curve constraint `k`. As withdrawals mature, `x` shrinks,
shrinking the curve constraint `k`.

As new funds enter the pool, `y` grows by `r * P` where `r` is the portion of
the pool the new funds represent, maintaining the constraint `k`. `y` never
exceeds `100% * P`.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did not have time to do any diligence on playing this out hehe.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some examples could be helpful. 😬 For example, at first, I thought y is just a function of time ("as the time goes on y grows linearly") but it is probably* a function of time and pool's liquidity ("As new funds enter the pool, y grows by r * P").

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I've struggled with this, I might need some tables.

63 changes: 31 additions & 32 deletions DESIGN.md → docs/overview.adoc
Original file line number Diff line number Diff line change
@@ -1,27 +1,26 @@
# Components
= Components
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Having a glossary would be super helpful.


## The collateral pool
== The collateral pool

The collateral pool is a collection of single-specific pools that share losses
The collateral pool is a collection of single asset pools that share losses
if coverage is required.

Each asset-specific pool accepts a single ERC-20 token as collateral, and
returns an underwriter token. For example, an asset-specific pool might accept
deposits in WETH in return for covETH underwriter tokens. Underwriter tokens
represent an ownership share in the underlying collateral of the asset-specific
pool.
Each asset pool accepts a single ERC-20 token as collateral, and returns an
underwriter token. For example, an asset pool might accept deposits in WETH in
return for covETH underwriter tokens. Underwriter tokens represent an ownership
share in the underlying collateral of the asset pool.

Entering the collateral pool exposes an underwriter to the shared risk of
liquidation across all asset-specific pools, but it *doesn't* require the
underwriter to enter into any positions relative to other assets in the pool.
If an underwriter deposits ETH into a collateral pool that accepts ETH and
WBTC, the underwriter isn't entering into a position relative to WBTC, or
suffering any sort of impermanent loss, as they would in an AMM.
liquidation across all asset pools, but it *doesn't* require the underwriter to
enter into any positions relative to other assets in the pool. If an underwriter
deposits ETH into a collateral pool that with ETH adn WBTC asset pools, the
underwriter isn't entering into a position relative to WBTC, or suffering any
sort of impermanent loss, as they would in an automated market maker.

Underwriters are still, however, entering into positions relative to the asset
the coverage pool is backing.

## The risk manager
== <<risk-manager.adoc,The risk manager>>

The risk manager is a person or smart contract with the exclusive right to
demand coverage from the pool.
Expand All @@ -33,23 +32,23 @@ position could bankrupt the collateral pool.

Coverage is always paid out in the pool's covered asset.

## The earnings pool
== <<rewards-pool.adoc,The rewards pool>>

The earnings pool is a collection of different assets that grows as underwriters
earn fees and refunds.
The rewards pool is a collection of different assets
that grows as underwriters earn fees and refunds.

The earnings pool mints a single earnings token, which is periodically
distributed to the collateral pool. Each asset in the collateral pool earns
based on its earnings rate.
The rewards pool mints a single rewards token, which is periodically
distributed across the collateral pool. Each asset pool in the collateral pool
earns based on its rewards rate.

Over a period of a week, if a collateral pool contains two assets — WBTC at a
earnings rate of 2, and ETH at an earnings rate of 1 — each will be allocated
earnings pool tokens at a rate of 2 to 1.
Over a period of a week, if a collateral pool contains two asset pools — WBTC at
a rewards rate of 2, and ETH at an rewards rate of 1 — each will be allocated
rewards pool tokens at a rate of 2 to 1.

As earnings accrue, earnings pool tokens can be withdrawn by underwriters and
redeemed for the underlying earnings.
As rewards accrue, rewards pool tokens can be withdrawn by underwriters and
redeemed for the underlying rewards.

# Efficient collateral liquidation
= Efficient collateral liquidation

When coverage is demanded by the risk manager, some part of the collateral
pool must be sold to obtain enough of the covered asset to fulfill the claim.
Expand All @@ -58,21 +57,21 @@ Liquidating the coverage pool fairly means selling a basket of assets, in a
fixed ratio, with good price discovery. For this reason, collateral is
liquidated using a Dutch auction.

The portion of each single-asset pool on offer will increase over time, slowing
until the entirety of the pool is on offer.
The portion of each asset pool on offer will increase over time, slowing until
the entirety of the pool is on offer.

The auction is meant to be flash-loan friendly, allowing easy integration with
AMMs and other liquidity sources.
AMMs (automated market makers) and other on-chain liquidity sources.

Once the entirety of the pool is on offer, the auction will remain open until a
buyer is found.

If the risk manager has made a fill-or-kill claim, the auction will expire and
notify the risk manager. If not, all funds will remain locked on offer.

# Governance and the market feedback loop
= Governance and the market feedback loop

# Solving early exits
= Solving early exits

Underwriters will always be able to front-run on-chain claims against the
coverage pool. Rational players can withdraw their liquidity and rewards
Expand All @@ -90,7 +89,7 @@ as increased risk of merchanism failure at transitions.

Instead of a fixed delay, we introduce exit markets.

## Exit markets
== <<exit-markets.adoc,Exit markets>>

At a given moment, whether or not a liquidation is ongoing, a mass exit from
the collateral pool implies a pending spike in risk.
Expand Down
86 changes: 86 additions & 0 deletions docs/rewards-pool.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
= The rewards pool

A rewards pool is a contract that accepts arbitrary assets and mints a single
reward token. Recipients of the reward token can at any time turn it in for a
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Assuming a rewards pool supports multiple tokens as rewards, and we're minting one type of token as a share of the rewards pool, how will we handle a situation when any of the rewards tokens is allocated at random points in time? The rewards pool won't pay attention to when a staker joined the coverage pool (what tokens were placed in the rewards pool at that point), only stake milliseconds matter, right?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm working on that part now — "depositing funds". What I'd like to do is make new entrants pay for the outstanding rewards rather than track entry per depositor.

For example, if you want covWBTC, and the WBTC pool has 100 reward tokens assigned to it, you pay some of your WBTC to account for that.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That sounds like it's going to have lots of annoying hidden complexity that could end up either gameable or discouraging pool entry, with the correct balance being hard to strike. Tracking rewards[depositor][token] seems easier even if it gets slightly more expensive with a wide variety of reward tokens.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your way breaks composability. If we do that we can't issue fungible underwriter token, or we issue them and they aren't reward yielding.

Give me a bit to write this up, I think I can convince you (and it's a generalization of exit markets)

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we have you pay in the reward tokens instead of the asset itself, so we don't need to worry about exchange rates between asset and rewards?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah that's the simpler design, but worse UX / adding a dependency. I'll try to cover both options

portion of the rewards in the pool.

A rewards pool maintains a governable list of recipients and relative reward
rates. For example, a rewards pool might have two recipients — a WETH
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm lost, who is the recipient: a staker of a coverage pool or the coverage pool?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

coverage_pool -- has --> 
    collateral_pool -- has --> many asset pools
    reward_pool -- has --> many recipients, mapping to asset pools

A single asset pool is a recipient. So we're talking on the order of 10 recipients, not 100s or 1000s

asset pool, and a WBTC asset pool, with respective reward rates of 1 and 2.

Rewards tokens are minted constantly over time and distributed according to the
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it a linear distribution? How will the rules for tokens releasing be defined, e.g. at each rewards tokens allocation, and be constant over a specific period? Would it be possible to top-up the rewards pool? Do we want to take an example of how TokenGeyser's rewards pools work?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So this will be different from TokenGeyser's rewards pool as the rewards pool won't distribute underlying reward tokens directly but mint tokens as a share in the whole rewards pool, right?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How will be the allocated rewards tokens unlocking? Will an unlocking period be defined on each allocation?

relative reward rates.

== Accounting for rewards distribution

Given the above scenario, at rewards pool creation. 3 rewards tokens are minted.
1 is reserved for the WETH asset pool, and 2 for the WBTC asset pool.

Every tick, an additional 3 rewards tokens are virtually minted.

.Virtual rewards
[frame="topbot",options="header"]
|==============================================
|Time | WETH virtual rewards | WBTC virtual rewards
|1 |1 |2
|2 |2 |4
|3 |3 |6
|4 |4 |8
|==============================================

At tick 5, if the rewards rates are changed, say to 1:1, the rewards tokens are
realized, then the virtual minting continues at the new rate.

.Virtual and real rewards

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Worth clarifying that this is with a change in rate at tick 5, or include that in the table. Might also be nice to progressively disclose with a version of the first table that adds real rewards before adding the change at tick 5.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Went with an explicit reward rate in the second table

[frame="topbot",options="header"]
|========================================================================================================
|Time | WETH virtual rewards | WETH real rewards | WBTC virtual rewards | WBTC real rewards | Reward rate
|1 |1 |1 |2 |2 | 2 : 1
|2 |2 |1 |4 |2 | 2 : 1
|3 |3 |1 |6 |2 | 2 : 1
|4 |4 |1 |8 |2 | 2 : 1
|5 |5 |5 |9 |9 | 1 : 1
|6 |6 |5 |10 |9 | 1 : 1
|7 |7 |5 |11 |9 | 1 : 1
|8 |8 |5 |12 |9 | 1 : 1
|========================================================================================================

Similarly, any rewards tokens that are exchanged and burned for the underlying
pool rewards realizes all reward token minting before the exchange occurs.

This structure should make it clear that reward pools scale in the number of
ongoing reward recipients — with implications for the <<on-chain-efficiency,
number of assets>> supported as collateral in a coverage pool.

== Relation to collateral pools

A coverage pool has a single rewards pool that receives and manages all
underwriter earnings. Each asset pool in the collateral pool is assigned a
relative rate in the rewards pool, establishing a way for governance to
incentivize different assets to target a particular collateral pool composition.

If an asset that's accepted as collateral by the coverage pool is intended as
underwriter rewards, it should first be deposited in its asset pool, and the
underwriter token sent to the rewards pool. Following this pattern means a more
capital-efficient coverage rewards mechanism, though it also means rewards are
subject to exit markets.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think I follow any of this paragraph...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding an example


For example, in a coverage pool meant to back claims denominated in `TBTC`, with
a collateral pool containing `WETH` and `WBTC`, any `ETH` earned by the
underwriters should be deposited into the reward pool as `covETH` rather than
`WETH`.

== On-chain efficiency

There are two bottlenecks in efficient runtime on the EVM with this structure.

The first is the number of reward recipients. Each rate change and reward token
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For example, a rewards pool might have two recipients — a WETH collateral pool, and a WBTC collateral pool, with respective reward rates of 1 and 2.

I was under an impression that coverage pools will be recipients of the rewards pool. Couldn't coverage pools be the recipients?

burn require iterating through all recipients, computing rewards, and minting
tokens. These costs are ultimately shouldered by reward beneficiaries, and place

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if there's a way to capture enough general information to handle this without iterating over everyone. I imagine there's been plenty of outside research done here without a better solution, though?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Iterating through everyone is an out-of-gas DoS attack vector, there has to be a way, otherwise, I am afraid it's a non-go. I wonder if we can reuse some logic from TokenGeyser contract - the usage case seems pretty similar. I stake my tokens in a pool, based on how long I stake, I receive rewards proportionally to other stakers in the pool.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm pretty sure we can either reuse the logic or make something similar. This should not be a practical obstacle for successful implementation.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed with @eth-r here. Tried to make it clear that I understand the attack in the doc @pdyraga 😉

We're designing a system where the number of individual asset pools is < 10. I'm envisioning the reward pool having that many recipients + / - 1 (we can also use this for tBTC v2 staking reward, thus the +1)

a ceiling on the number of simultaneous reward recipients.

The second is the number of different assets being distributed as reward. Anyone
can send a reward pool whatever tokens they'd like. Instead of using an allowlist
or pushing the cost onto reward token holders at redemption time, a short
denylist can be used to avoid mischief, and reward token holders can decide
which tokens they'd like to be sent at redemption.
84 changes: 84 additions & 0 deletions docs/risk-manager.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
= The risk manager

The risk manager holds a privileged role over the coverage pool. It maintains
the ability to claim coverage from the pool, liquidating enough collateral from
the pool to cover an outstanding obligation.

Because of the nature of the role, the risk manager is a critical component of
the coverage pool. Depending on the implementation, a risk manager can determine
whether to put assets at capped or uncapped risk; how quickly auctions should
put collateral up on offer; whether to end an auction early; and whether to
remunerate existing underwriters in the case of "extra" assets on hand from an
auction.

== An example pool

The tBTC v1 coverage pool has one purpose — to backstop the TBTC peg and
simplify the lives of signers by guaranteeing to take any outstanding TBTC
liquidation, trading TBTC for ETH.

Because we have no guaranteed bounds on the ETHBTC price, the risk to the pool
is technically uncapped; if the price of BTC suddenly 10x's relative to ETH, the
pool is still on the hook for a fixed amount of BTC. On the other hand, once the
pool takes a TBTC https://docs.keep.network/tbtc/#liquidation[liquidation
auction], the resulting ETH proceeds should be distributed back to the pool.

== Auctions

When the risk manager claims coverage, it specifies an amount denominated in
the asset the pool covers. An auction is opened across all assets in the
pool, increasing the portion of the pool on offer over time. Eventually, the
entire collateral pool is on offer.

For an auction to be filled, a participant pays the asking price, and in return

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

May be worth specifying “pays the asking price in the covered asset”?

receives a portion of each asset in the pool.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you mean by "a portion of each asset in the pool"? Does it refer to a portion of multiple types of assets across a collection of single-asset pools?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It means the portion of the pool on offer ( eg 3%) from each asset


Consider a collateral pool containing 10 WBTC and 100 WETH, and claim of 1 TBTC.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does an x% offer alway equal x% of each underlying single-asset pools, or is the relative weight adjustable between them?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No adjustable weights.


.A collateral pool under auction
[frame="topbot",options="header"]
|============================================
|Time | Offer | WBTC on offer | WETH on offer
|1 |1% |0.1 |1
|2 |2% |0.2 |2
|3 |3% |0.3 |3
|4 |4% |0.4 |4
|5 |5% |0.5 |5
|6 |6% |0.6 |6
|7 |7% |0.7 |7
|8 |8% |0.8 |8
|9 |8% |0.9 |9
|10 |10% |1 |10
|============================================

For simplicity, assume WBTC and TBTC trade at parity. Regardless of the ETH/WBTC
exchange rate, there is a point between `t=1` and `t=10` where it makes sense to
buy all assets on offer.

An efficient on-chain implementation can allow partial and atomic fills, opening

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you mean by an atomic fill here?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

... and partial fill? 😆

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah---for completeness, I'm assuming “partial fill” means the ability to ship part of the covered asset to the pool and receive a commensurate part of the amount at auction.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

... yes re: "partial", and "atomic" means in the same sense that you can take the auction in one transaction, making it friendly for people using flash loans, and otherwise composable with the rest of Ethereum

up arbitrage opportunities with lower total liquidity requirements.

=== Auction velocity

In addition to claiming coverage and opening an auction, the risk manager
determines the parameters that govern the auction, including the velocity of the
falling price based on market conditions, and whether to withdraw a claim and

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Market conditions such as?

end an auction early.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this something you'd see tBTC using, or just an arbitrary feature that could be added to a generic coverage pool?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The velocity adjustment will like make it into both v1 and v2, and the early auction end is useful in v1

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could probably use some details on how these would apply to develop intuition here.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Practicing before I update the doc...

  • slowing the velocity of a falling price auction means you believe, for whatever reason, that you're close to the "market" price
  • speeding up means you think you have a way to go. If there's a mass exit attempt, maybe the auction should be sped up

I don't know if I'll be able to generally describe when exit markets can be used to speed or slow auctions in the first revision of coverage pools.

The last one (ending an auction) might happen in tBTC v1 if someone else takes a tBTC liquidation, and we no longer have reason to claim coverage.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it!


A risk manager might slow the velocity of a falling price auction because it
believes that the auction is close to "market" price. Alternatively, a manager
might speed up an auction because it believes the auction is far from "market".

Finally, a risk manager might decide to end an auction early if coverage is no
longer needed.

== Returning funds

If there are funds to return to the pool after a coverage claim, a risk manager
implementation can do one of two things

1. Deposit the funds in the rewards pool, effectively distributing them across
underwriters based on the relative reward rate, regardless of the asset.
2. Deposit the funds directly in the collateral pool, requiring funds to be
traded to match the existing collateral distribution, or intentionally
distributing funds in a way that favors a particular underwritten asset.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there an unspoken constraint here that the collateral pool should probably only handle auctions that repay in one of the underlying assets?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope, though there is an assumption that governance will know that the sum of the collateral in the pool is going to be paying out in a particular asset, and choose the acceptable collateral accordingly.

Neither version of tBTC would use the single-collateral version of 2. mentioned here, but it might make sense in both v1 and v2 to auction the pool for TBTC, get ETH, then have a strategy to Uniswap that back to to original asset composition