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

[Note] - CompoundPricer depends on ChainlinkPricer being finalized for safe usage #258

Open
aleone opened this issue Oct 4, 2020 · 1 comment
Assignees
Labels
enhancement New feature or request

Comments

@aleone
Copy link
Contributor

aleone commented Oct 4, 2020

CompoundPricer requires that ChainlinkPricer's dispute period is over and the price is finalized before running and calculating the cToken exchange rate in USD or requires that the dispute period for the CompoundPricer is longer than the ChainlinkPricer.

This sets the cToken/USD price, which depends on getExpiryPrice to calculate the cToken/USD fx rate
if we set the if the CompoundPricer price and then the ChainlinkPricer's price of the underlying asset changes via a dispute, our cToken/USD fx rate is wrong

    function setExpiryPriceInOracle(uint256 _expiryTimestamp) external {
        (uint256 underlyingPriceExpiry, ) = oracle.getExpiryPrice(address(underlying), _expiryTimestamp);
        require(underlyingPriceExpiry > 0, "CompoundPricer: underlying price not set yet");
        uint256 cTokenPrice = _underlyingPriceToCtokenPrice(underlyingPriceExpiry);/
        oracle.setExpiryPrice(address(cToken), _expiryTimestamp, cTokenPrice);
    }

Two solutions:

  1. Require that the dispute for CompoundPricer is greater or equal to than the ChainlinkPricer that it depends on (either via code or via checks off chain before deploying).
  2. Have CompoundPricer check the dispute period of the underlying asset and only allow a setExpiryPriceInOracle when the dispute period has ended, that would allow a dispute period of 0 for CompoundPricer.
  3. Require that disputes in underlying assets in compound style pricers reset the dispute period for the compound pricer.

I think solution 1 is fine and just ensure we deploy correctly, this is more of a note, but need to be careful with the deployed parameters for this.

@haythemsellami haythemsellami added the enhancement New feature or request label Oct 4, 2020
@aparnakr aparnakr closed this as completed Oct 4, 2020
@aparnakr aparnakr reopened this Oct 14, 2020
@haythemsellami
Copy link
Member

Related: #306

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

No branches or pull requests

4 participants