未验证 提交 93291c8a 编写于 作者: L luchiagogogo 提交者: GitHub

Merge pull request #2 from big4david/feature/ytaseo

Feature/ytaseo
......@@ -209,7 +209,7 @@ include(utils)
add_subdirectory( externals )
if ("${CORE_SYMBOL_NAME}" STREQUAL "")
set( CORE_SYMBOL_NAME "SYS" )
set( CORE_SYMBOL_NAME "YTA" )
endif()
string(TOUPPER ${CORE_SYMBOL_NAME} CORE_SYMBOL_NAME)
......
#include "eosio.system.hpp"
#include <eosiolib/print.hpp>
#include <eosio.token/eosio.token.hpp>
namespace eosiosystem {
const int64_t min_pervote_daily_pay = 100'0000;
const int64_t min_activated_stake = 150'000'000'0000;
const double continuous_rate = 0.04879; // 5% annual rate
const double perblock_rate = 0.0025; // 0.25%
const double standby_rate = 0.0075; // 0.75%
const uint32_t blocks_per_year = 52*7*24*2*3600; // half seconds per year
const uint32_t seconds_per_year = 52*7*24*3600;
const uint32_t blocks_per_day = 2 * 24 * 3600;
......@@ -16,6 +13,27 @@ namespace eosiosystem {
const uint64_t useconds_per_day = 24 * 3600 * uint64_t(1000000);
const uint64_t useconds_per_year = seconds_per_year*1000000ll;
const int64_t block_initial_timestamp = 1551369600ll; // epoch year 2019.03.01 unix timestamp 1551369600s
//yta seo total= yta_seo_year[i] * YTA_SEO_BASE
const uint32_t YTA_SEO_BASE = 10'0000;
const double YTA_PRECISION =10000.0000;
const uint32_t yta_seo_year[62] = {
1000, 900, 800, 700,
600, 600, 500, 500,
400, 400, 300, 300,
200, 200, 200,
100, 100, 100,
90, 90, 90,
80, 80, 80,
70, 70, 70, 70,
60, 60, 60, 60,
50, 50, 50, 50, 50,
40, 40, 40, 40, 40,
30, 30, 30, 30, 30,
20, 20, 20, 20, 20,
10, 10, 10, 10, 10,
9, 9, 9, 9, 9
};
void system_contract::onblock( block_timestamp timestamp, account_name producer ) {
using namespace eosio;
......@@ -73,27 +91,36 @@ namespace eosiosystem {
eosio_assert( _gstate.total_activated_stake >= min_activated_stake,
"cannot claim rewards until the chain is activated (at least 15% of all tokens participate in voting)" );
auto ct = current_time();
eosio_assert( ct - prod.last_claim_time > useconds_per_day, "already claimed rewards within past day" );
//eosio_assert( ct - prod.last_claim_time > useconds_per_day, "already claimed rewards within past day" );
const asset token_supply = token( N(eosio.token)).get_supply(symbol_type(system_token_symbol).name() );
const auto usecs_since_last_fill = ct - _gstate.last_pervote_bucket_fill;
print("usecs_since_last_fill: ", usecs_since_last_fill, "\n");
print("_gstate.last_pervote_bucket_fill: ", _gstate.last_pervote_bucket_fill, "\n");
print("now(): ", now(), "\n");
int idx_year = (int)((now()- block_initial_timestamp) / seconds_per_year);
auto seo_token = yta_seo_year[idx_year] * YTA_SEO_BASE;
print("idx_year: ", idx_year, "\n");
print("yta_seo_year[idx_year]: ", yta_seo_year[idx_year], "\n");
print( "token_supply: ", token_supply, "\n");
print("seo_token: ", seo_token, "\n");
if( usecs_since_last_fill > 0 && _gstate.last_pervote_bucket_fill > 0 ) {
auto new_tokens = static_cast<int64_t>( (continuous_rate * double(token_supply.amount) * double(usecs_since_last_fill)) / double(useconds_per_year) );
auto to_producers = new_tokens / 5;
auto to_savings = new_tokens - to_producers;
auto new_tokens = static_cast<int64_t>(seo_token * YTA_PRECISION * double(usecs_since_last_fill)/double(useconds_per_year));
print("new_token: ", new_tokens, "\n");
auto to_producers = new_tokens;
auto to_per_block_pay = to_producers / 4;
auto to_per_vote_pay = to_producers - to_per_block_pay;
INLINE_ACTION_SENDER(eosio::token, issue)( N(eosio.token), {{N(eosio),N(active)}},
{N(eosio), asset(new_tokens), std::string("issue tokens for producer pay and savings")} );
INLINE_ACTION_SENDER(eosio::token, transfer)( N(eosio.token), {N(eosio),N(active)},
{ N(eosio), N(eosio.saving), asset(to_savings), "unallocated inflation" } );
INLINE_ACTION_SENDER(eosio::token, transfer)( N(eosio.token), {N(eosio),N(active)},
{ N(eosio), N(eosio.bpay), asset(to_per_block_pay), "fund per-block bucket" } );
......
......@@ -11,7 +11,7 @@
namespace eosio { namespace chain {
genesis_state::genesis_state() {
initial_timestamp = fc::time_point::from_iso_string( "2018-06-01T12:00:00" );
initial_timestamp = fc::time_point::from_iso_string( "2019-03-01T12:00:00" );
initial_key = fc::variant(eosio_root_key).as<public_key_type>();
}
......
......@@ -52,7 +52,8 @@
printf "\\t- Yum installation found at %s.\\n" "${YUM}"
printf "\\tUpdating YUM repository...\\n"
if ! sudo "${YUM}" -y update > /dev/null 2>&1; then
#if ! sudo "${YUM}" -y update > /dev/null 2>&1; then
if ! true;then
printf "\\t!! YUM update failed !!\\n"
printf "\\tExiting now.\\n"
exit 1;
......@@ -178,7 +179,8 @@
case $yn in
[Yy]* )
printf "\\tInstalling dependencies\\n\\n"
if ! sudo "${YUM}" -y install ${DEP}; then
#if ! sudo "${YUM}" -y install ${DEP}; then
if ! true;then
printf "\\t!! YUM dependency installation failed !!\\n"
printf "\\tExiting now.\\n"
exit 1;
......
......@@ -296,7 +296,7 @@ def stepSetSystemContract():
sleep(1)
run(args.cleos + 'push action eosio setpriv' + jsonArg(['eosio.msig', 1]) + '-p eosio@active')
def stepInitSystemContract():
run(args.cleos + 'push action eosio init' + jsonArg(['0', '4,SYS']) + '-p eosio@active')
run(args.cleos + 'push action eosio init' + jsonArg(['0', '4,YTA']) + '-p eosio@active')
sleep(1)
def stepCreateStakedAccounts():
createStakedAccounts(0, len(accounts))
......@@ -336,7 +336,7 @@ commands = [
('c', 'contracts', stepInstallSystemContracts, True, "Install system contracts (token, msig)"),
('t', 'tokens', stepCreateTokens, True, "Create tokens"),
('S', 'sys-contract', stepSetSystemContract, True, "Set system contract"),
('I', 'init-sys-contract', stepInitSystemContract, True, "Initialiaze system contract"),
#('I', 'init-sys-contract', stepInitSystemContract, True, "Initialiaze system contract"),
('T', 'stake', stepCreateStakedAccounts, True, "Create staked accounts"),
('p', 'reg-prod', stepRegProducers, True, "Register producers"),
('P', 'start-prod', stepStartProducers, True, "Start producers"),
......@@ -359,7 +359,7 @@ parser.add_argument('--nodes-dir', metavar='', help="Path to nodes directory", d
parser.add_argument('--genesis', metavar='', help="Path to genesis.json", default="./genesis.json")
parser.add_argument('--wallet-dir', metavar='', help="Path to wallet directory", default='./wallet/')
parser.add_argument('--log-path', metavar='', help="Path to log file", default='./output.log')
parser.add_argument('--symbol', metavar='', help="The eosio.system symbol", default='SYS')
parser.add_argument('--symbol', metavar='', help="The eosio.system symbol", default='YTA')
parser.add_argument('--user-limit', metavar='', help="Max number of users. (0 = no limit)", type=int, default=3000)
parser.add_argument('--max-user-keys', metavar='', help="Maximum user keys to import into wallet", type=int, default=10)
parser.add_argument('--ram-funds', metavar='', help="How much funds for each user to spend on ram", type=float, default=0.1)
......
{
"initial_timestamp": "2018-03-02T12:00:00.000",
"initial_timestamp": "2019-03-01T12:00:00.000",
"initial_key": "EOS8Znrtgwt8TfpmbVpTKvA2oB8Nqey625CLN8bCN3TEbgx86Dsvr",
"initial_configuration": {
"max_block_net_usage": 1048576,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册