Design of the "price gated timelock" model #1377
Replies: 1 comment 17 replies
|
Thanks Andrei for posting the discussion.
I reckon your assumption that through allowlist, we will be managing a few tokens per chain. Chainlink offers support for multiple tokens on each network. For ex. on Arbitrum, Chainlink supports 500 tokens. If its between managing 10,000s of allowlist over isolating risk to a single stream, I would vote for isolating risk for a single stream. And I think through our UI, both senders and recipients will be able to detect if the provided oracle is a valid Chainlink address or not. As for the design, there is no You are correct that Let me know what you think now. |
Uh oh!
There was an error while loading. Please reload this page.
Problem
We don't have a consensus on the design here: #1280
Solution
TBD
Currently, we are using a Chainlink oracle for the minimum fee calculation in USD, and we don't even have a price feed for the native tokens of the chains we are deployed on, which means that the tokens supported by this new model would be limited. See the ones available here.
In order to implement the "price-gated timelocks" model, we would need to use oracles as well.
@smol-ninja mentioned in the issue above that the oracle addresses can be passed as input to the
createfunction, as there is an assumption that the parties (sender & recipient) trust each other.This option, IMO, brings security considerations to us as well. The main reason is that we would have an early (before any state update) "interaction" operation during the
cancelandwithdrawfunctions with a contract that we don't know about beforehand. For example, consider the following scenario with a malicious oracle:cancelis called and thestreamedAmountOffunction calls the oracle to get the pricewithdrawfunction and then itslatestRoundPricefunctionwithdrawalso callsstreamedAmountOf, which calls the oracle to get the pricewithdrawfunction and returns a price greater than the target price, allowing to fully withdraw the deposited amountwithdrawexecution passes and transfers tokens out of the lockup contractlatestRoundPrice- in the initialcancelfunction call - returns a price lower than the target price, making the refundable amount greater than 0, thus transfers more tokens out of the lockup contract than depositedThe scenario above may be fixed by disallowing cancelable streams for the price-gated model and adding
nonReentrantto thewithdrawfunction, but the idea of having an interaction with a contract that we do not explicitly "allow" is a no-go, IMO.The version I suggested, which adds medium to high maintenance overhead, is to have an allowlist system for oracles.
@sablier-labs/evm let me know what you think
All reactions