From 032c4c7a996a7e3d8452ef7f880afa8151ab660b Mon Sep 17 00:00:00 2001 From: Alfredo Garcia Date: Wed, 16 Oct 2019 14:59:49 -0300 Subject: [PATCH] add precision to son vesting amount --- libraries/chain/include/graphene/chain/config.hpp | 2 +- tests/tests/son_operations_tests.cpp | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/libraries/chain/include/graphene/chain/config.hpp b/libraries/chain/include/graphene/chain/config.hpp index 16f528a7..9b0ff036 100644 --- a/libraries/chain/include/graphene/chain/config.hpp +++ b/libraries/chain/include/graphene/chain/config.hpp @@ -232,7 +232,7 @@ #define TOURNAMENT_MAX_START_TIME_IN_FUTURE (60*60*24*7*4) // 1 month #define TOURNAMENT_MAX_START_DELAY (60*60*24*7) // 1 week #define MIN_SON_MEMBER_COUNT 15 -#define SON_VESTING_AMOUNT 50 // 50 PPY +#define SON_VESTING_AMOUNT (50*GRAPHENE_BLOCKCHAIN_PRECISION) // 50 PPY #define SON_VESTING_PERIOD (60*60*24*30) // 2 days #define SWEEPS_DEFAULT_DISTRIBUTION_PERCENTAGE (2*GRAPHENE_1_PERCENT) diff --git a/tests/tests/son_operations_tests.cpp b/tests/tests/son_operations_tests.cpp index 64ce7bba..1e143d77 100644 --- a/tests/tests/son_operations_tests.cpp +++ b/tests/tests/son_operations_tests.cpp @@ -22,8 +22,8 @@ BOOST_AUTO_TEST_CASE( create_son_test ) { upgrade_to_lifetime_member(alice); upgrade_to_lifetime_member(bob); - transfer( committee_account, alice_id, asset( 100000 ) ); - transfer( committee_account, bob_id, asset( 100000 ) ); + transfer( committee_account, alice_id, asset( 1000*GRAPHENE_BLOCKCHAIN_PRECISION ) ); + transfer( committee_account, bob_id, asset( 1000*GRAPHENE_BLOCKCHAIN_PRECISION ) ); set_expiration(db, trx); std::string test_url = "https://create_son_test"; @@ -34,14 +34,14 @@ BOOST_AUTO_TEST_CASE( create_son_test ) { vesting_balance_create_operation op; op.creator = alice_id; op.owner = alice_id; - op.amount = asset(10); + op.amount = asset(10*GRAPHENE_BLOCKCHAIN_PRECISION); op.balance_type = vesting_balance_type::son; trx.operations.push_back(op); // amount in the son balance need to be at least 50 GRAPHENE_REQUIRE_THROW( PUSH_TX( db, trx ), fc::exception ); - op.amount = asset(50); + op.amount = asset(50*GRAPHENE_BLOCKCHAIN_PRECISION); trx.clear(); trx.operations.push_back(op); @@ -50,9 +50,9 @@ BOOST_AUTO_TEST_CASE( create_son_test ) { auto deposit_vesting = db.get(ptx.operation_results[0].get()); - BOOST_CHECK_EQUAL(deposit(db).balance.amount.value, 50); + BOOST_CHECK_EQUAL(deposit(db).balance.amount.value, 50*GRAPHENE_BLOCKCHAIN_PRECISION); auto now = db.head_block_time(); - BOOST_CHECK_EQUAL(deposit(db).is_withdraw_allowed(now, asset(50)), false); // cant withdraw + BOOST_CHECK_EQUAL(deposit(db).is_withdraw_allowed(now, asset(50*GRAPHENE_BLOCKCHAIN_PRECISION)), false); // cant withdraw } generate_block(); set_expiration(db, trx); @@ -63,7 +63,7 @@ BOOST_AUTO_TEST_CASE( create_son_test ) { vesting_balance_create_operation op; op.creator = alice_id; op.owner = alice_id; - op.amount = asset(1); + op.amount = asset(1*GRAPHENE_BLOCKCHAIN_PRECISION); op.balance_type = vesting_balance_type::normal; op.validate();