# Saves up to N most recent values from an FTSO oracle with a cooldown between each sample. # # The strat takes 0 input and offers an auction as a bounty, paying more the longer the # strat has been off cooldown for. This mitigates unpredictable gas costs without significantly # overpaying the counterparty for the service of sampling the FTSO. # # The strat intentionally does no trading itself, it merely samples data and stores it under # a predictable set of keys. Other strats can then be written that are read-only over these # keys, keeping the overall system decoupled and easy to manage. As long as the sampler # vault has enough WFLR in it to cover gas, there is an incentive for solvers to keep sampling # indefinitely every time the strat comes off cooldown. tokens: eusdt: network: flare address: 0x96B41289D90444B8adD57e6F265DB5aE8651DF29 decimals: 6 wflr: network: flare address: 0x1D80c49BbBCd1C0911346656B529DF9E5c2F783d decimals: 18 orders: flare: # vault-id is generated on cli `openssl rand -hex 32` inputs: # Input is irrelevant because we always set the IO ratio to 0. - token: eusdt vault-id: 0xb39eed084711b7e383c97ae5a9e0aa76e01f7a641457726ebfd912fe33dd67f5 outputs: - token: wflr vault-id: 0xb39eed084711b7e383c97ae5a9e0aa76e01f7a641457726ebfd912fe33dd67f5 scenarios: flare: runs: 1 bindings: flare-sub-parser: 0xe4064e894DB4bfB9F3A64882aECB2715DC34FaF4 samples-count: 5 cooldown: 120 bounty-base: 2e17 # 1e17 / 3600 = 0.1 FLR per hour bounty-rate: 27777777777777 # There's not really anything to chart without overcomplicating the # strat itself in ways that would obfuscate the core lesson of the example. charts: flare: deployments: flare: order: flare scenario: flare --- #samples-count !Number of samples to collect from the FTSO. #cooldown !Minimum time in seconds that must elapse between samples. #bounty-base !Minimum bounty to offer for each sample in WFLR. #bounty-rate !Per second bounty increase. #calculate-io using-words-from 0xAfD94467d2eC43D9aD39f835BA758b61b2f41A0E 0x50fB1Be59721E7A2a3434dDd726d53780bfDe344 ftso-price: ftso-current-price-usd("FLR" 3600), index: int-mod(get("index") samples-count), :set("index" int-add(index 1)), :set(hash("base" index) ftso-price), last-update-time: any(get("last-update-time") block-timestamp()), last-update-ago: int-sub(block-timestamp() last-update-time), :ensure( any(greater-than-or-equal-to(last-update-ago cooldown) is-zero(get("initialize"))) "Cooling down." ), :set("initialize" 1), :set("last-update-time" block-timestamp()), /* linear auction for the bounty to mitigate unpredictable gas spikes */ bounty: decimal18-linear-growth( bounty-base bounty-rate int-to-decimal18(int-saturating-sub(last-update-ago cooldown)) ), /* 0 io ratio means no input required from the counterparty for them to receive the bounty */ io-ratio: 0; #handle-io :;