Skip to content

Comments

Setup LBP to swap DPI for DAI#792

Merged
thomas-waite merged 20 commits intodevelopfrom
sell-dpi
May 16, 2022
Merged

Setup LBP to swap DPI for DAI#792
thomas-waite merged 20 commits intodevelopfrom
sell-dpi

Conversation

@thomas-waite
Copy link
Contributor

@thomas-waite thomas-waite commented May 10, 2022

Summary

Long time horizon LBP to swap DPI for DAI. Pull DAI from the Compound DAI PCV deposit and use to fund the swapper.

Preferring an LBP over a sell-only PSM as there is low on-chain liquidity compared to the amount we want to sell (selling ~$3.7m, with 24hr DEX trading volume of ~$800k). A PSM would have no limit on the rate at which DPI could be sold, potentially allowing the price to be significantly negatively affected.

The exchange issuance mechanism provided by Set was considered (unwind the DPI into underlying, then sell the underlying on Uniswap/Sushiswap), but it has high slippage of ~11%.

Pools available for arbitrage

There is only one other DPI pool available on Balancer. The arbitrage on this LBP will be against the Uniswap pool containing DPI.

There will therefore be a chain of arb bots required across AMMs and that in combination with gas prices being elevated means the arbing process will be less efficient. Slippage will be higher and it will cost the protocol more than for other LBPs.

LBP Parameters:

  • Small weight: 5%
  • Large weight: 95%
  • Frequency (i.e. duration of swap): 1 month

@thomas-waite thomas-waite self-assigned this May 10, 2022
@thomas-waite thomas-waite requested a review from a team as a code owner May 10, 2022 23:58
@thomas-waite thomas-waite changed the title [WIP] Setup LBP to swap DPI for DAI Setup LBP to swap DPI for DAI May 13, 2022
Copy link
Contributor

@eswak eswak left a comment

Choose a reason for hiding this comment

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

PR looks good to me if we happen to go for an LBP

I'm neutral and think a redeem-only PSM would be ok too.

Don't have a strong opinion either way.

const dpiToDaiSwapper = await BalancerLBPSwapperFactory.deploy(
addresses.core,
{
_oracle: addresses.chainlinkDpiUsdOracleWrapper,
Copy link
Contributor

@Joeysantoro Joeysantoro May 13, 2022

Choose a reason for hiding this comment

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

did you check the oracle's direction. in other words what is the initial swap price and is inverting the oracle appropriate

Copy link
Contributor

Choose a reason for hiding this comment

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

I think its fine, and can be changed if need be later

Copy link
Contributor Author

@thomas-waite thomas-waite May 16, 2022

Choose a reason for hiding this comment

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

Yep I did, it reports the price of DPI in terms of DAI so does not need inverting. It currently reports 96216077210000000000 which is 96.2 DAI - close to the coingecko DPI price of ~$96.12

await time.increase(await contracts.dpiToDaiSwapper.remainingTime());
expect(await contracts.dpiToDaiSwapper.isTimeEnded()).to.be.true;

const signer = await getImpersonatedSigner(addresses.optimisticTimelock); // TODO: TribalCouncil should grant itself SWAP_ADMIN_ROLE
Copy link
Contributor

Choose a reason for hiding this comment

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

do you need to add this? Dao could grant

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done. Had the DAO take admin of SWAP_ADMIN_ROLE role back temporarily to grant the role to the TribalCouncil timelock. Then returned admin control to SWAP_ADMIN_ROLE

Joeysantoro
Joeysantoro previously approved these changes May 13, 2022
Copy link
Contributor

@Joeysantoro Joeysantoro left a comment

Choose a reason for hiding this comment

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

Approved this assuming the span is shrunk to 2 weeks. The other things can be a separate PR

Comment on lines 54 to 61
target: 'core',
values: '0',
method: 'createRole(bytes32,bytes32)',
arguments: [
'0x471cfe1a44bf1b786db7d7104d51e6728ed7b90a35394ad7cc424adf8ed16816', // SWAP_ADMIN_ROLE
'0x899bd46557473cb80307a9dabc297131ced39608330a2d29b2d52b660c03923e' // GOVERN_ROLE
],
description: 'Transfer admin of SWAP_ADMIN_ROLE to GOVERNOR, so it can be granted to the TribalCouncil'
Copy link
Contributor

Choose a reason for hiding this comment

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

just grant DAO timelock the ROLE_ADMIN.. Shouldn't be changing roles like this

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yep good point, missed that it already had ROLE_ADMIN so this was redundant

@thomas-waite thomas-waite merged commit adb1a5c into develop May 16, 2022
@thomas-waite thomas-waite deleted the sell-dpi branch May 16, 2022 21:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants