|Author||Justin J Moses|
Allow all views to return even when rates are stale.
Change the current logic which errors out on when reading effective values when rates are stale to instead simply returning the value even if stale.
v2.0.0 “Multicurrency” release, the
effectiveValue of some
amount from one synth into another has been a
view function which throws when either the
dest currency is stale.
Synthetix.transferableSynthetix are also views impacted by stale prices.
This original approach was designed to indicate to any users of the system that it was in an invalid state and not useable.
However, this feature breaks dApps and scripts as it’s not intuitive that a readable view function would revert. Instead, for better compatiblity, I propose that we always return answers for views and simply put the onus on our mutible functions to do the checks.
This means dApp writers need to be checking for the flag:
Synthetix.anySynthRateStale() to know if the system is unusable.
- The following views will no longer error out
- Synthetix to be given a new function
anySynthRateStale()indicating if any synth is stale.
- For mutative functions issue and burn functions:
- add a
- and ensure the
SNXrate is not stale
- add a
- For an
exchange(), add a
destare both not stale
- For an SNX
SNXrate not stale
The mutative functions above are to be explicitly given the checks that they rely on in the views they read.
Copyright and related rights waived via CC0.