Fix cli_wallet referrer percentage type #449
This commit is contained in:
parent
09855166a2
commit
47585a6b9a
2 changed files with 11 additions and 6 deletions
|
|
@ -620,8 +620,9 @@ class wallet_api
|
||||||
* portion of the user's transaction fees. This can be the
|
* portion of the user's transaction fees. This can be the
|
||||||
* same as the registrar_account if there is no referrer.
|
* same as the registrar_account if there is no referrer.
|
||||||
* @param referrer_percent the percentage (0 - 100) of the new user's transaction fees
|
* @param referrer_percent the percentage (0 - 100) of the new user's transaction fees
|
||||||
* not claimed by the blockchain that will be distributed to the
|
* not claimed by the blockchain that will be distributed to the
|
||||||
* referrer; the rest will be sent to the registrar
|
* referrer; the rest will be sent to the registrar. Will be
|
||||||
|
* multiplied by GRAPHENE_1_PERCENT when constructing the transaction.
|
||||||
* @param broadcast true to broadcast the transaction on the network
|
* @param broadcast true to broadcast the transaction on the network
|
||||||
* @returns the signed transaction registering the account
|
* @returns the signed transaction registering the account
|
||||||
*/
|
*/
|
||||||
|
|
@ -630,7 +631,7 @@ class wallet_api
|
||||||
public_key_type active,
|
public_key_type active,
|
||||||
string registrar_account,
|
string registrar_account,
|
||||||
string referrer_account,
|
string referrer_account,
|
||||||
uint8_t referrer_percent,
|
uint32_t referrer_percent,
|
||||||
bool broadcast = false);
|
bool broadcast = false);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -849,13 +849,17 @@ public:
|
||||||
public_key_type active,
|
public_key_type active,
|
||||||
string registrar_account,
|
string registrar_account,
|
||||||
string referrer_account,
|
string referrer_account,
|
||||||
uint8_t referrer_percent,
|
uint32_t referrer_percent,
|
||||||
bool broadcast = false)
|
bool broadcast = false)
|
||||||
{ try {
|
{ try {
|
||||||
FC_ASSERT( !self.is_locked() );
|
FC_ASSERT( !self.is_locked() );
|
||||||
FC_ASSERT( is_valid_name(name) );
|
FC_ASSERT( is_valid_name(name) );
|
||||||
account_create_operation account_create_op;
|
account_create_operation account_create_op;
|
||||||
|
|
||||||
|
// #449 referrer_percent is on 0-100 scale, if user has larger
|
||||||
|
// number it means their script is using GRAPHENE_100_PERCENT scale
|
||||||
|
// instead of 0-100 scale.
|
||||||
|
FC_ASSERT( referrer_percent <= 100 );
|
||||||
// TODO: process when pay_from_account is ID
|
// TODO: process when pay_from_account is ID
|
||||||
|
|
||||||
account_object registrar_account_object =
|
account_object registrar_account_object =
|
||||||
|
|
@ -867,7 +871,7 @@ public:
|
||||||
account_object referrer_account_object =
|
account_object referrer_account_object =
|
||||||
this->get_account( referrer_account );
|
this->get_account( referrer_account );
|
||||||
account_create_op.referrer = referrer_account_object.id;
|
account_create_op.referrer = referrer_account_object.id;
|
||||||
account_create_op.referrer_percent = referrer_percent;
|
account_create_op.referrer_percent = uint16_t( referrer_percent * GRAPHENE_1_PERCENT );
|
||||||
|
|
||||||
account_create_op.registrar = registrar_account_id;
|
account_create_op.registrar = registrar_account_id;
|
||||||
account_create_op.name = name;
|
account_create_op.name = name;
|
||||||
|
|
@ -2876,7 +2880,7 @@ signed_transaction wallet_api::register_account(string name,
|
||||||
public_key_type active_pubkey,
|
public_key_type active_pubkey,
|
||||||
string registrar_account,
|
string registrar_account,
|
||||||
string referrer_account,
|
string referrer_account,
|
||||||
uint8_t referrer_percent,
|
uint32_t referrer_percent,
|
||||||
bool broadcast)
|
bool broadcast)
|
||||||
{
|
{
|
||||||
return my->register_account( name, owner_pubkey, active_pubkey, registrar_account, referrer_account, referrer_percent, broadcast );
|
return my->register_account( name, owner_pubkey, active_pubkey, registrar_account, referrer_account, referrer_percent, broadcast );
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue