forked from steemit/steem
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor to_steem(), to_sbd(), is_comment_payout_dust() out of database
- Loading branch information
1 parent
0d258d2
commit 4f6dca7
Showing
4 changed files
with
47 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#pragma once | ||
|
||
#include <steemit/protocol/asset.hpp> | ||
|
||
namespace steemit { namespace chain { namespace util { | ||
|
||
using steemit::protocol::asset; | ||
using steemit::protocol::price; | ||
|
||
inline asset to_sbd( const price& p, const asset& steem ) | ||
{ | ||
FC_ASSERT( steem.symbol == STEEM_SYMBOL ); | ||
if( p.is_null() ) | ||
return asset( 0, SBD_SYMBOL ); | ||
return steem * p; | ||
} | ||
|
||
inline asset to_steem( const price& p, const asset& sbd ) | ||
{ | ||
FC_ASSERT( sbd.symbol == SBD_SYMBOL ); | ||
if( p.is_null() ) | ||
return asset( 0, STEEM_SYMBOL ); | ||
return sbd * p; | ||
} | ||
|
||
} } } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#pragma once | ||
|
||
#include <steemit/chain/util/asset.hpp> | ||
|
||
#include <steemit/protocol/config.hpp> | ||
|
||
namespace steemit { namespace chain { namespace util { | ||
|
||
inline bool is_comment_payout_dust( const price& p, uint64_t steem_payout ) | ||
{ | ||
return to_sbd( p, asset( steem_payout, STEEM_SYMBOL ) ) < STEEMIT_MIN_PAYOUT_SBD; | ||
} | ||
|
||
} } } |