Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/oracle spread #150

Merged
merged 19 commits into from
Jun 4, 2019
Merged

Feature/oracle spread #150

merged 19 commits into from
Jun 4, 2019

Conversation

dokwon
Copy link
Contributor

@dokwon dokwon commented Jun 4, 2019

Overview

This PR is intended to reduce odds of exploitation in the oracle / swap mechanism. #133 covers the overview of the relevant discussion.

This PR is WIP, and needs updates on unit tests.

Summary of changes

  • Add bidirectional Luna supply change cap. Previously, we placed a cap on Luna inflation at 1% daily. We now enforce a Luna inflation/deflation cap change at 0.5%. This prevents large divesting attacks, as well as reducing odds of a consensus attack in case the oracle fails and a malicious user is able to get access to a large amount of Luna tokens.
  • Add bidirectional Luna swap spreads: For trades involving Luna, we now charge a 2-10% swap spread, which gets larger as luna supply change trends to its daily change cap on either side. We err on the side of caution to reduce the odds of an attack in the early days of the network.
  • Change oracle reward scheme: Previously, oracle ballot winners were rewarded on a monthly basis when the treasury would be settled with 10% of seigniorage during the time period. We are now using the Luna swap spreads that we charge from Luna <> Terra swaps to reward oracle voters in the previous vote period (1 minute). TODO: figure out a way to smooth out oracle returns as there may be heavy swap volume in particular periods
  • Swaps halt immediately after an illiquid oracle vote: Previously we've persisted the swap rate of a currency in the store for 10 illiquid votes (drop threshold logic) in order to provided continuity during choppy oracle votes. Now, we stop swaps for currencies after any illiquid vote to prevent a misaligned pricing from providing undue arbitrage opportunities.

Miscellaneous refactor points

  • MiningRewardBurden parameter in the treasury has now changed from 20% to 90%. This is to reflect the Terra pre-mine in stability operations, and we no longer need to place a heavy reliance on the budget module
  • Budget claim rewards should now be moved from the treasury module to the budget module (WIP)

@dokwon dokwon self-assigned this Jun 4, 2019
@dokwon dokwon requested review from yun-yeo and hanjukim and removed request for yun-yeo June 4, 2019 02:47
@dokwon dokwon added enhancement New feature or request must Mustfix for target release. test Testing labels Jun 4, 2019
x/market/keeper.go Outdated Show resolved Hide resolved
Copy link
Contributor Author

@dokwon dokwon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

small changes

@yun-yeo yun-yeo merged commit 87d5b82 into develop Jun 4, 2019
dokwon added a commit that referenced this pull request Jun 4, 2019
@dokwon dokwon deleted the feature/oracle-spread branch June 4, 2019 18:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request must Mustfix for target release. test Testing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants