Skip to content

Conversation

@Alladin9393
Copy link
Collaborator

Change Description

Consensus Changes

  • Consensus Changes

API Changes

  • API Changes

Documentation Additions

  • Documentation Additions

@Alladin9393 Alladin9393 changed the title Account price based on rem.oracle Account price based on rem.oracle Jan 2, 2020
@Alladin9393 Alladin9393 requested a review from roman-tik January 2, 2020 22:27
@Alladin9393 Alladin9393 force-pushed the feature/account_price_based_on_oracle branch from 723ed51 to 3453220 Compare January 3, 2020 14:17
uint64_t system_contract::get_min_account_stake() {
eosio::remprice_idx remprice_table(oracle_account, oracle_account.value);
auto it = remprice_table.find(rem_usd_pair.value);
bool is_valid_price = (it != remprice_table.end()) && ((current_time_point() - it->last_update.to_time_point()) <= eosio::minutes(70));

Choose a reason for hiding this comment

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

70 minutes should be parametrized, let's avoid magic numbers

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@roman-tik, done.

auto it = remprice_table.find(rem_usd_pair.value);
bool is_valid_price = (it != remprice_table.end()) && ((current_time_point() - it->last_update.to_time_point()) <= eosio::minutes(70));

return is_valid_price ? std::min(uint64_t(min_account_price / it->price), _gstate.min_account_stake) : _gstate.min_account_stake;

Choose a reason for hiding this comment

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

make sure uint64_t(min_account_price / it->price) != 0

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@roman-tik, done.

@Alladin9393 Alladin9393 force-pushed the feature/account_price_based_on_oracle branch from 73bf797 to dbdd40d Compare February 3, 2020 13:44
@roman-tik roman-tik merged commit 46ede46 into develop Feb 3, 2020
@roman-tik roman-tik deleted the feature/account_price_based_on_oracle branch February 3, 2020 18:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants