Hot answers tagged

2

It's a bug. eosio::symbol::print needs to call eosio::printl, but calls eosio::print by mistake. The PR on following link fixes this: https://github.com/EOSIO/eosio.cdt/pull/552


2

No, but it should be fairly easy to implement as a smart contract, especially given bancor will be running on the platform as well. https://www.prnewswire.com/news-releases/eosio-blockchain-to-implement-the-bancor-protocol-300602995.html


1

In nodeos, eosio::chain::symbol only accepts decimals under 18 digits, but eosio::symbol in CDT doesn't check its precision. Of course, during [de]serialization, the inner value of symbol is managed by eosio::chain::symbol, so error occurs, but if you instantiate symbol or asset in contract, it can have more that 18 digits. I think eosio::symbol::is_valid ...


1

An asset must be expressed in terms of an integer, even if the asset itself will have decimal points. Therefore asset a(1, symbol("EOS", 4)); refers to the smallest possible positive amount of EOS you could have (because 1 is the smallest integer larger than zero). Given that you have 4 decimal places, this corresponds to 0.0001 EOS. If you want to ...


1

EOS use int64_t to represent the amount, so there is no decimal. In order to represent the precision, the symbol type has a precision represent the decimal. eg: asset a(10, symbol("TST", 0); means amount 10, precision 0(the symbol specify the precision is 0), so it will be TST asset a(10, symbol("TST", 2)); means amount 10, precision 2,so it ...


1

void contract::getsymbol(string sym) { symbol_type symb = string_to_symbol(4,sym.c_str()); print("Symbol is ", sym); print(symb.name()); }


1

You can create your custom struct in code and add EOSIO_SERIALIZE to it. After, you can use it in your contract action parameters like this: void funcname(const account_name account, st_data_req request); Then when you push your action, you may use JSON just like in this example: '["acctname", {"structval1": 12.123123,"structval2": 29.123123}]' Answering ...


1

The functionality of the system contracts are built in and can't be changed unless there is consensus amongst the BPs. However, for your own contract you can create actions and the serializer will figure out what arguments it should take. For example: \\\@abi action void mycontract::test(int x, string y); EOSIO_ABI( eosio::mycontract, (test) ) or with ...


Only top voted, non community-wiki answers of a minimum length are eligible