Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Atomic curve creation/seeding & ctdl/wbtc curve pool address set into oracles #198

Open
wants to merge 20 commits into
base: main
Choose a base branch
from

Conversation

petrovska-petro
Copy link

Tackles #196

Context

For the atomic launch, we have the blocker of not having the curve pool address. This contract should resolve it in the following way.

Idea, it is from the gov msig to call the launch(uint256 citadelToLiquidty, uint256 wbtcToLiquidity), prior the initial supply have being mined and also gov msig have the KRs funds. So, over the msig the amounts to seed the pool are calculated and passed as arguments and also do a direct transfer into this contract to be able to exec all the steps.

@sajanrajdev
Copy link
Contributor

@petrovska-petro, according to CI there seems to be Linting/compiling errors. Also, will create a ticket to add tests for this asap.

@petrovska-petro
Copy link
Author

@petrovska-petro, according to CI there seems to be Linting/compiling errors. Also, will create a ticket to add tests for this asap.

compiling errors should be resolved now with latest commits. linting seems not to get sorted despite of running npm run prettier:solidity locally prior to push


function _setCurvePoolInOracles(address _ctdlWbtcCurvePool) internal {
for (uint256 i = 0; i < _oracles.length(); i++) {
IMedianOracleProvider(_oracles.at(i)).setCurvePool(
Copy link
Contributor

Choose a reason for hiding this comment

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

Where is setCurvePool implemented?

Copy link
Contributor

Choose a reason for hiding this comment

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

The premise here was to allow the setting of the curve pool after creation, so the contracts can be deployed before this process. Due to the benefits of immutables, I suggest moving to a Factory pattern where this contract deploys the oracles itself.

Copy link
Author

Choose a reason for hiding this comment

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

At the end in the latest commits we decided for the contract itself to deploy the oracles using the curve pool address directly. So we did not end up adding this new method

@shuklaayush
Copy link
Contributor

Maybe I'm missing something, but why don't we just deploy the oracles after the pool has been deployed?

src/AtomicLaunch.sol Outdated Show resolved Hide resolved
src/AtomicLaunch.sol Outdated Show resolved Hide resolved
src/AtomicLaunch.sol Outdated Show resolved Hide resolved
Copy link
Collaborator

@Fatimanaz Fatimanaz left a comment

Choose a reason for hiding this comment

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

LGTM!

src/AtomicLaunch.sol Outdated Show resolved Hide resolved
src/AtomicLaunch.sol Outdated Show resolved Hide resolved
src/AtomicLaunch.sol Outdated Show resolved Hide resolved
src/AtomicLaunch.sol Outdated Show resolved Hide resolved
petrovska-petro and others added 4 commits June 15, 2022 11:40
Co-authored-by: Ayush Shukla <shuklaayush247@gmail.com>
Co-authored-by: Ayush Shukla <shuklaayush247@gmail.com>
Co-authored-by: Ayush Shukla <shuklaayush247@gmail.com>
Copy link
Collaborator

@Fatimanaz Fatimanaz left a comment

Choose a reason for hiding this comment

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

LGTM!

Copy link
Contributor

@sajanrajdev sajanrajdev left a comment

Choose a reason for hiding this comment

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

Confirmed chainlink feed addresses:
wBTC/BTC: https://data.chain.link/ethereum/mainnet/crypto-other/wbtc-btc
BTC/ETH: https://data.chain.link/ethereum/mainnet/crypto-eth/btc-eth
ETH/USD: https://data.chain.link/ethereum/mainnet/crypto-usd/eth-usd
FRAX/USD: https://data.chain.link/ethereum/mainnet/stablecoins/frax-usd
FRAX/ETH: https://data.chain.link/ethereum/mainnet/crypto-eth/frax-eth
USDC/ETH: https://data.chain.link/ethereum/mainnet/stablecoins/usdc-eth
USDC/USD: https://data.chain.link/ethereum/mainnet/stablecoins/usdc-usd
BADGER/ETH: https://data.chain.link/ethereum/mainnet/crypto-eth/badger-eth
BADGER/USD: https://data.chain.link/ethereum/mainnet/crypto-usd/badger-usd
CVX/ETH: https://data.chain.link/ethereum/mainnet/crypto-eth/cvx-eth
CVX/USD: https://data.chain.link/ethereum/mainnet/crypto-usd/cvx-usd
wBTC/USD: https://data.chain.link/ethereum/mainnet/crypto-usd/btc-usd (Actually BTC/USD - Should be safe imo)

Example of inital price calc with latest feed:
(2088673700000 * 1e18) / (1e8) / 21 = 99460652380952380952 (994.6 CTDL buys 1 wBTC) - LGTM

Oracle deployment funtions LGTM

Atomic launch test was adapted to use the newly introduced contract ofr the curve pool launch setup.

@Fatimanaz, as a separate test, the deployed oracles should also be checked. The test should ensure that oracles were deployed correctly witht the right parameters, that they can be integrated to the infra and that the adapters produce the correct results. Will create a separate ticket for this as this test will live better in a separate test suite anyway.

Note: Linter doesn't detect any errors locally so the failing CI is likely due to env issues.
image

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants