-
Notifications
You must be signed in to change notification settings - Fork 465
Conversation
c6b7cbc
to
f56278c
Compare
|
|
||
int256 latestPrice = IChainlinkAggregator(oracle).latestAnswer(); | ||
require( | ||
latestPrice >= stopPrice && latestPrice <= limitPrice, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we just rename these minPrice
and maxPrice
? It's less opinionated, which matters depending on if this is a buy or sell order.
|
||
uint256 latestTimestamp = IChainlinkAggregator(oracle).latestTimestamp(); | ||
require( | ||
now.safeSub(latestTimestamp) <= priceFreshness, // solhint-disable-line not-rely-on-time |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: we use block.timestamp
instead of now
throughout the rest of the codebase.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a pretty interesting parameter. In what scenarios do you see it being most useful?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can imagine arb bots monitoring the mempool for updates to the aggregator's price, which would serve as an indicator for arb opportunities on these stop-limit orders. The price freshness parameter would mitigate this was my thought
747c973
to
be1f300
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One small change, then LGTM!
|
||
contract ChainlinkStopLimit { | ||
|
||
using LibSafeMath for uint256; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like we don't use this anymore.
c2f469f
to
6d11a8d
Compare
* Encodes the given stop limit data parameters into StaticCall asset data so that it can be used | ||
* in a 0x order. | ||
*/ | ||
export function encodeStopLimiStaticCallData( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
encodeStopLimiStaticCallData
⟶ encodeStopLimitStaticCallData
🇨🇦
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lgtm! One minor 🇨🇦 fix. Also, are we planning to do a mainnet integration test?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks p p good
9f46fa9
to
6361dbd
Compare
Description
Implements stop-limit orders at a StaticCall target, using Chainlink as an on-chain price oracle.
Testing instructions
Types of changes
Checklist:
[WIP]
if necessary.