hegic/contracts-v1

Dependancy on external price feeds

Opened this issue · 0 comments

The whitepaper says: Maintenance and execution of hedge contracts do not depend on the external price feeds.

But the code of payProfit is:

    function payProfit(Option memory option)
        internal
        override
        returns (uint profit)
    {
        uint currentPrice = uint(priceProvider.latestAnswer());
        require(option.strike <= currentPrice, "Current price is too low");
        profit = currentPrice.sub(option.strike).mul(option.amount).div(currentPrice);
        pool.send(option.holder, profit);
        unlockFunds(option);
    }

If the price feed is wrong, hegic will send huge amount of token by mistake.