BitShares-Core  7.0.2
BitShares blockchain node software and command-line wallet software
withdraw_permission.cpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015 Cryptonomex, Inc., and contributors.
3  *
4  * The MIT License
5  *
6  * Permission is hereby granted, free of charge, to any person obtaining a copy
7  * of this software and associated documentation files (the "Software"), to deal
8  * in the Software without restriction, including without limitation the rights
9  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10  * copies of the Software, and to permit persons to whom the Software is
11  * furnished to do so, subject to the following conditions:
12  *
13  * The above copyright notice and this permission notice shall be included in
14  * all copies or substantial portions of the Software.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22  * THE SOFTWARE.
23  */
25 
26 #include <fc/io/raw.hpp>
27 
28 namespace graphene { namespace protocol {
29 
31 {
33  FC_ASSERT( fee.amount >= 0 );
37 }
38 
40 {
43  FC_ASSERT( fee.amount >= 0 );
44 }
45 
47 {
48  share_type core_fee_required = k.fee;
49  if( memo )
50  core_fee_required += calculate_data_fee( fc::raw::pack_size(memo), k.price_per_kbyte );
51  return core_fee_required;
52 }
53 
55 {
56  FC_ASSERT( fee.amount >= 0 );
59  //TODO: better bounds checking on these values
62 }
63 
65 {
66  FC_ASSERT( fee.amount >= 0 );
68 }
69 
70 } } // graphene::protocol
71 
graphene::protocol::withdraw_permission_create_operation::withdrawal_period_sec
uint32_t withdrawal_period_sec
Length of the withdrawal period in seconds.
Definition: withdraw_permission.hpp:62
graphene::protocol::withdraw_permission_claim_operation::memo
optional< memo_data > memo
Memo for withdraw_from_account. Should generally be encrypted with withdraw_from_account->memo_key.
Definition: withdraw_permission.hpp:138
graphene::protocol::withdraw_permission_update_operation
Update an existing withdraw permission.
Definition: withdraw_permission.hpp:83
graphene::protocol::withdraw_permission_create_operation::fee
asset fee
Definition: withdraw_permission.hpp:54
graphene::protocol::withdraw_permission_create_operation::periods_until_expiration
uint32_t periods_until_expiration
The number of withdrawal periods this permission is valid for.
Definition: withdraw_permission.hpp:64
graphene::protocol::withdraw_permission_claim_operation::withdraw_from_account
account_id_type withdraw_from_account
Must match withdraw_permission->withdraw_from_account.
Definition: withdraw_permission.hpp:132
graphene::protocol::withdraw_permission_delete_operation::fee
asset fee
Definition: withdraw_permission.hpp:157
graphene::protocol::withdraw_permission_claim_operation::amount_to_withdraw
asset amount_to_withdraw
Amount to withdraw. Must not exceed withdraw_permission->withdrawal_limit.
Definition: withdraw_permission.hpp:136
graphene::protocol::withdraw_permission_update_operation::validate
void validate() const
Definition: withdraw_permission.cpp:30
graphene::protocol::withdraw_permission_claim_operation::fee_params_t::price_per_kbyte
uint32_t price_per_kbyte
Definition: withdraw_permission.hpp:124
graphene::protocol::withdraw_permission_delete_operation::withdraw_from_account
account_id_type withdraw_from_account
Must match withdrawal_permission->withdraw_from_account. This account pays the fee.
Definition: withdraw_permission.hpp:159
graphene::protocol::withdraw_permission_create_operation::validate
void validate() const
Definition: withdraw_permission.cpp:54
GRAPHENE_IMPLEMENT_EXTERNAL_SERIALIZATION
#define GRAPHENE_IMPLEMENT_EXTERNAL_SERIALIZATION(type)
Definition: types.hpp:86
graphene::protocol::withdraw_permission_delete_operation::authorized_account
account_id_type authorized_account
The account previously authorized to make withdrawals. Must match withdrawal_permission->authorized_a...
Definition: withdraw_permission.hpp:161
graphene::protocol::withdraw_permission_claim_operation::withdraw_to_account
account_id_type withdraw_to_account
Must match withdraw_permision->authorized_account.
Definition: withdraw_permission.hpp:134
graphene::protocol::withdraw_permission_claim_operation::fee_params_t
Definition: withdraw_permission.hpp:122
graphene::protocol::withdraw_permission_claim_operation
Withdraw from an account which has published a withdrawal permission.
Definition: withdraw_permission.hpp:120
graphene::protocol::withdraw_permission_claim_operation::validate
void validate() const
Definition: withdraw_permission.cpp:39
graphene::protocol::withdraw_permission_update_operation::authorized_account
account_id_type authorized_account
The account authorized to make withdrawals. Must match permission_to_update->authorized_account.
Definition: withdraw_permission.hpp:91
graphene::protocol::withdraw_permission_update_operation::fee_params_t
Definition: withdraw_permission.hpp:85
graphene::protocol::base_operation::calculate_data_fee
static uint64_t calculate_data_fee(uint64_t bytes, uint64_t price_per_kbyte)
Definition: operations.cpp:33
graphene::protocol::withdraw_permission_create_operation
Create a new withdrawal permission.
Definition: withdraw_permission.hpp:50
graphene::protocol::withdraw_permission_update_operation::fee
asset fee
Definition: withdraw_permission.hpp:87
graphene::protocol::withdraw_permission_claim_operation::calculate_fee
share_type calculate_fee(const fee_params_t &k) const
Definition: withdraw_permission.cpp:46
graphene::protocol::withdraw_permission_create_operation::authorized_account
account_id_type authorized_account
The account authorized to make withdrawals from withdraw_from_account.
Definition: withdraw_permission.hpp:58
graphene::protocol::withdraw_permission_update_operation::withdrawal_limit
asset withdrawal_limit
New maximum amount the withdrawer is allowed to charge per withdrawal period.
Definition: withdraw_permission.hpp:95
graphene::protocol::withdraw_permission_create_operation::fee_params_t
Definition: withdraw_permission.hpp:52
fc::raw::pack_size
size_t pack_size(const T &v)
Definition: raw.hpp:757
graphene::protocol::withdraw_permission_delete_operation
Delete an existing withdrawal permission.
Definition: withdraw_permission.hpp:153
FC_ASSERT
#define FC_ASSERT(TEST,...)
Checks a condition and throws an assert_exception if the test is FALSE.
Definition: exception.hpp:345
graphene::protocol::withdraw_permission_delete_operation::validate
void validate() const
Definition: withdraw_permission.cpp:64
graphene::protocol::withdraw_permission_claim_operation::fee
asset fee
Paid by withdraw_to_account.
Definition: withdraw_permission.hpp:128
graphene::protocol::withdraw_permission_update_operation::periods_until_expiration
uint32_t periods_until_expiration
The new number of withdrawal periods for which this permission will be valid.
Definition: withdraw_permission.hpp:101
graphene::protocol::withdraw_permission_update_operation::withdrawal_period_sec
uint32_t withdrawal_period_sec
New length of the period between withdrawals.
Definition: withdraw_permission.hpp:97
graphene::protocol::asset::amount
share_type amount
Definition: asset.hpp:36
withdraw_permission.hpp
graphene::protocol::withdraw_permission_delete_operation::fee_params_t
Definition: withdraw_permission.hpp:155
graphene::protocol::withdraw_permission_claim_operation::fee_params_t::fee
uint64_t fee
Definition: withdraw_permission.hpp:123
graphene::protocol::withdraw_permission_update_operation::withdraw_from_account
account_id_type withdraw_from_account
This account pays the fee. Must match permission_to_update->withdraw_from_account.
Definition: withdraw_permission.hpp:89
graphene::protocol::withdraw_permission_create_operation::withdrawal_limit
asset withdrawal_limit
The maximum amount authorized_account is allowed to withdraw in a given withdrawal period.
Definition: withdraw_permission.hpp:60
graphene
Definition: api.cpp:48
raw.hpp
fc::safe
Definition: safe.hpp:26
graphene::protocol::withdraw_permission_create_operation::withdraw_from_account
account_id_type withdraw_from_account
The account authorizing withdrawals from its balances.
Definition: withdraw_permission.hpp:56