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

reduce bp number to 5 #14

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

# can.contracts

## Version : 1.2.0
Expand Down
4 changes: 2 additions & 2 deletions contracts/eosio.system/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ The naming convention is codeaccount::actionname followed by a list of paramters
- **from** owner account name
- **amount** amount of tokens to be used for purchase
- 'amount' tokens are taken out of 'from' REX fund.
- User must vote for at least 15 producers or delegate vote to proxy before buying REX.
- User must vote for at least 5 producers or delegate vote to proxy before buying REX.
- Tokens used in purchase are added to user's voting power.
- Bought REX cannot be sold before 4 days counting from end of day of purchase.
- Storage change is billed to 'from' account.
Expand All @@ -85,7 +85,7 @@ The naming convention is codeaccount::actionname followed by a list of paramters
- **receiver** account name that tokens have previously been staked to
- **from_net** amount of tokens to be unstaked from NET bandwidth and used for REX purchase
- **from_cpu** amount of tokens to be unstaked from CPU bandwidth and used for REX purchase
- User must vote for at least 15 producers or delegate vote to proxy before buying REX.
- User must vote for at least 5 producers or delegate vote to proxy before buying REX.
- Tokens used in purchase are added to user's voting power.
- Bought REX cannot be sold before 4 days counting from end of day of purchase.
- Storage change is billed to 'owner' account.
Expand Down
6 changes: 3 additions & 3 deletions contracts/eosio.system/include/eosio.system/eosio.system.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -708,7 +708,7 @@ namespace eosiosystem {
* @param amount - amount of tokens taken out of 'from' REX fund.
*
* @pre A voting requirement must be satisfied before action can be executed.
* @pre User must vote for at least 15 producers or delegate vote to proxy before buying REX.
* @pre User must vote for at least 5 producers or delegate vote to proxy before buying REX.
*
* @post User votes are updated following this action.
* @post Tokens used in purchase are added to user's voting power.
Expand All @@ -727,7 +727,7 @@ namespace eosiosystem {
* @param from_cpu - amount of tokens to be unstaked from CPU bandwidth and used for REX purchase.
*
* @pre A voting requirement must be satisfied before action can be executed.
* @pre User must vote for at least 15 producers or delegate vote to proxy before buying REX.
* @pre User must vote for at least 5 producers or delegate vote to proxy before buying REX.
*
* @post User votes are updated following this action.
* @post Tokens used in purchase are added to user's voting power.
Expand Down Expand Up @@ -1233,7 +1233,7 @@ namespace eosiosystem {
void update_rex_pool();
void update_resource_limits( const name& from, const name& receiver, int64_t delta_net, int64_t delta_cpu );
void check_voting_requirement( const name& owner,
const char* error_msg = "must vote for at least 15 producers or for a proxy before buying REX" )const;
const char* error_msg = "must vote for at least 5 producers or for a proxy before buying REX" )const;
rex_order_outcome fill_rex_order( const rex_balance_table::const_iterator& bitr, const asset& rex );
asset update_rex_account( const name& owner, const asset& proceeds, const asset& unstake_quant, bool force_vote_update = false );
void channel_to_rex( const name& from, const asset& amount );
Expand Down
4 changes: 2 additions & 2 deletions contracts/eosio.system/ricardian/eosio.system.contracts.md.in
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ summary: '{{nowrap from}} buys REX tokens in exchange for {{nowrap amount}} and
icon: @ICON_BASE_URL@/@REX_ICON_URI@
---

{{amount}} is taken out of {{from}}’s REX fund and used to purchase REX tokens at the current market exchange rate. In order for the action to succeed, {{from}} must have voted for a proxy or at least 15 block producers. {{amount}} is added to {{from}}’s vote stake.
{{amount}} is taken out of {{from}}’s REX fund and used to purchase REX tokens at the current market exchange rate. In order for the action to succeed, {{from}} must have voted for a proxy or at least 5 block producers. {{amount}} is added to {{from}}’s vote stake.

A sell order of the purchased amount can only be initiated after waiting for the maturity period of 4 to 5 days to pass. Even then, depending on the market conditions, the initiated sell order may not be executed immediately.

Expand Down Expand Up @@ -631,7 +631,7 @@ summary: '{{nowrap owner}} buys REX tokens in exchange for tokens currently stak
icon: @ICON_BASE_URL@/@REX_ICON_URI@
---

{{from_net}} and {{from_cpu}} are withdrawn from {{receiver}}’s NET and CPU bandwidths respectively. These funds are used to purchase REX tokens at the current market exchange rate. In order for the action to succeed, {{owner}} must have voted for a proxy or at least 15 block producers.
{{from_net}} and {{from_cpu}} are withdrawn from {{receiver}}’s NET and CPU bandwidths respectively. These funds are used to purchase REX tokens at the current market exchange rate. In order for the action to succeed, {{owner}} must have voted for a proxy or at least 5 block producers.

A sell order of the purchased amount can only be initiated after waiting for the maturity period of 4 to 5 days to pass. Even then, depending on the market conditions, the initiated sell order may not be executed immediately.

Expand Down
4 changes: 2 additions & 2 deletions contracts/eosio.system/src/rex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@ namespace eosiosystem {
}

/**
* @brief Checks if account satisfies voting requirement (voting for a proxy or 15 producers)
* @brief Checks if account satisfies voting requirement (voting for a proxy or 5 producers)
* for buying REX
*
* @param owner - account buying or already holding REX tokens
Expand All @@ -421,7 +421,7 @@ namespace eosiosystem {
void system_contract::check_voting_requirement( const name& owner, const char* error_msg )const
{
auto vitr = _voters.find( owner.value );
check( vitr != _voters.end() && ( vitr->proxy || 15 <= vitr->producers.size() ), error_msg );
check( vitr != _voters.end() && ( vitr->proxy || 5 <= vitr->producers.size() ), error_msg );
}

/**
Expand Down
6 changes: 3 additions & 3 deletions contracts/eosio.system/src/voting.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,9 @@ namespace eosiosystem {

using value_type = std::pair<eosio::producer_authority, uint16_t>;
std::vector< value_type > top_producers;
top_producers.reserve(15);
top_producers.reserve(5);

for( auto it = idx.cbegin(); it != idx.cend() && top_producers.size() < 15 && 0 < it->total_votes && it->active(); ++it ) {
for( auto it = idx.cbegin(); it != idx.cend() && top_producers.size() < 5 && 0 < it->total_votes && it->active(); ++it ) {
top_producers.emplace_back(
eosio::producer_authority{
.producer_name = it->owner,
Expand Down Expand Up @@ -205,7 +205,7 @@ namespace eosiosystem {
update_votes( voter_name, proxy, producers, true );
auto rex_itr = _rexbalance.find( voter_name.value );
if( rex_itr != _rexbalance.end() && rex_itr->rex_balance.amount > 0 ) {
check_voting_requirement( voter_name, "voter holding REX tokens must vote for at least 15 producers or for a proxy" );
check_voting_requirement( voter_name, "voter holding REX tokens must vote for at least 5 producers or for a proxy" );
}
}

Expand Down
2 changes: 1 addition & 1 deletion contracts/eosio.wrap/include/eosio.wrap/eosio.wrap.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ namespace eosio {
* eosio.wrap contract simplifies Block Producer superuser actions by making them more readable and easier to audit.

* It does not grant block producers any additional powers that do not already exist within the
* system. Currently, 15/21 block producers can already change an account's keys or modify an
* system. Currently, 4/5 block producers can already change an account's keys or modify an
* account's contract at the request of ECAF or an account's owner. However, the current method
* is opaque and leaves undesirable side effects on specific system accounts.
* eosio.wrap allows for a cleaner method of implementing these important governance actions.
Expand Down