eosio::asset
#include <asset.hpp>
Public Functions
Name | |
---|---|
asset() | |
asset(int64_t a, class symbol s) | |
bool | is_amount_within_range() const |
bool | is_valid() const |
void | set_amount(int64_t a) |
char * | write_as_string(char begin, char end, bool dry_run =false) const Writes the asset as a string to the provided char buffer. |
std::string | to_string() const asset to std::string |
void | print() const Print the asset |
Public Attributes
Name | |
---|---|
int64_t | amount |
symbol | symbol |
constexpr int64_t | max_amount |
Detailed Description
struct eosio::asset;
Stores information for owner of asset
Public Functions Documentation
function asset
inline asset()
function asset
inline asset(
int64_t a,
class symbol s
)
Parameters:
- a - The amount of the asset
- s - The name of the symbol
Construct a new asset given the symbol name and the amount
function is_amount_within_range
inline bool is_amount_within_range() const
Return:
- true - if the amount doesn't exceed the max amount
- false - otherwise
Check if the amount doesn't exceed the max amount
function is_valid
inline bool is_valid() const
Return:
- true - if the asset is valid
- false - otherwise
Check if the asset is valid. A valid asset has its amount <= max_amount and its symbol name valid
function set_amount
inline void set_amount(
int64_t a
)
Parameters:
- a - New amount for the asset
Set the amount of the asset
function write_as_string
inline char * write_as_string(
char * begin,
char * end,
bool dry_run =false
) const
Writes the asset as a string to the provided char buffer.
Parameters:
- begin - The start of the char buffer
- end - Just past the end of the char buffer
- dry_run - If true, do not actually write anything into the range.
Return: char* - Just past the end of the last character that would be written assuming dry_run == false and end was large enough to provide sufficient space. (Meaning only applies if returned pointer >= begin.)
Precondition:
- is_valid() == true
- The range [begin, end) must be a valid range of memory to write to.
Postcondition: If the output string fits within the range [begin, end) and dry_run == false, the range [begin, returned pointer) contains the string representation of the asset. Nothing is written if dry_run == true or returned pointer > end (insufficient space) or if returned pointer < begin (overflow in calculating desired end).
Writes the asset as a string to the provided char buffer
function to_string
inline std::string to_string() const
asset to std::string
asset to std::string
function print
inline void print() const
Print the asset
Print the asset
Public Attributes Documentation
variable amount
int64_t amount = 0;
The amount of the asset
variable symbol
symbol symbol;
The symbol name of the asset
variable max_amount
static constexpr int64_t max_amount = (1LL << 62) - 1;
Maximum amount possible for this asset. It's capped to 2^62 - 1
Updated on 2022-12-05 at 15:38:08 +0000