未验证 提交 818fa8cb 编写于 作者: D Daniel Larimer 提交者: GitHub

Merge pull request #3114 from EOSIO/2888-rename-EOS-to-SYS

Rename "EOS" symbol in eosio.system to "SYS"
......@@ -180,6 +180,18 @@ endif()
add_subdirectory( externals )
if ("${CORE_SYMBOL_NAME}" STREQUAL "")
set( CORE_SYMBOL_NAME "SYS" )
endif()
string(TOUPPER ${CORE_SYMBOL_NAME} CORE_SYMBOL_NAME)
string(LENGTH ${CORE_SYMBOL_NAME} CORE_SYMBOL_NAME_LENGTH)
if (CORE_SYMBOL_NAME_LENGTH GREATER 7)
message(FATAL_ERROR "CORE_SYMBOL_NAME lenght must be a between 1 and 7 characters")
endif()
message( STATUS "Using ${CORE_SYMBOL_NAME} as CORE symbol name")
include(wasm)
add_subdirectory( libraries )
......
......@@ -35,7 +35,7 @@ class dice : public eosio::contract {
//@abi action
void offerbet(const asset& bet, const account_name player, const checksum256& commitment) {
eosio_assert( bet.symbol == S(4,EOS) , "only EOS token allowed" );
eosio_assert( bet.symbol == CORE_SYMBOL, "only core token allowed" );
eosio_assert( bet.is_valid(), "invalid bet" );
eosio_assert( bet.amount > 0, "must bet positive quantity" );
......
......@@ -119,9 +119,9 @@ namespace eosiosystem {
* This action will buy an exact amount of ram and bill the payer the current market price.
*/
void system_contract::buyrambytes( account_name payer, account_name receiver, uint32_t bytes ) {
auto itr = _rammarket.find(S(4,RAMEOS));
auto itr = _rammarket.find(S(4,RAMCORE));
auto tmp = *itr;
auto eosout = tmp.convert( asset(bytes,S(0,RAM)), S(4,EOS) );
auto eosout = tmp.convert( asset(bytes,S(0,RAM)), CORE_SYMBOL );
buyram( payer, receiver, eosout );
}
......@@ -148,7 +148,7 @@ namespace eosiosystem {
int64_t bytes_out;
auto itr = _rammarket.find(S(4,RAMEOS));
auto itr = _rammarket.find(S(4,RAMCORE));
_rammarket.modify( itr, 0, [&]( auto& es ) {
bytes_out = es.convert( quant, S(0,RAM) ).amount;
});
......@@ -190,10 +190,10 @@ namespace eosiosystem {
eosio_assert( res_itr->ram_bytes >= bytes, "insufficient quota" );
asset tokens_out;
auto itr = _rammarket.find(S(4,RAMEOS));
auto itr = _rammarket.find(S(4,RAMCORE));
_rammarket.modify( itr, 0, [&]( auto& es ) {
/// the cast to int64_t of bytes is safe because we certify bytes is <= quota which is limited by prior purchases
tokens_out = es.convert( asset(bytes,S(0,RAM)), S(4,EOS) );
tokens_out = es.convert( asset(bytes,S(0,RAM)), CORE_SYMBOL);
});
_gstate.total_ram_bytes_reserved -= bytes;
......
......@@ -19,18 +19,18 @@ namespace eosiosystem {
//print( "construct system\n" );
_gstate = _global.exists() ? _global.get() : get_default_parameters();
auto itr = _rammarket.find(S(4,RAMEOS));
auto itr = _rammarket.find(S(4,RAMCORE));
if( itr == _rammarket.end() ) {
auto system_token_supply = eosio::token(N(eosio.token)).get_supply(eosio::symbol_type(system_token_symbol).name()).amount;
if( system_token_supply > 0 ) {
itr = _rammarket.emplace( _self, [&]( auto& m ) {
m.supply.amount = 100000000000000ll;
m.supply.symbol = S(4,RAMEOS);
m.supply.symbol = S(4,RAMCORE);
m.base.balance.amount = int64_t(_gstate.free_ram());
m.base.balance.symbol = S(0,RAM);
m.quote.balance.amount = system_token_supply / 1000;
m.quote.balance.symbol = S(4,EOS);
m.quote.balance.symbol = CORE_SYMBOL;
});
}
} else {
......@@ -58,7 +58,7 @@ namespace eosiosystem {
eosio_assert( max_ram_size > _gstate.total_ram_bytes_reserved, "attempt to set max below reserved" );
auto delta = int64_t(max_ram_size) - int64_t(_gstate.max_ram_size);
auto itr = _rammarket.find(S(4,RAMEOS));
auto itr = _rammarket.find(S(4,RAMCORE));
/**
* Increase or decrease the amount of ram for sale based upon the change in max
......
......@@ -113,7 +113,7 @@ namespace eosiosystem {
// static constexpr uint32_t max_inflation_rate = 5; // 5% annual inflation
static constexpr uint32_t seconds_per_day = 24 * 3600;
static constexpr uint64_t system_token_symbol = S(4,EOS);
static constexpr uint64_t system_token_symbol = CORE_SYMBOL;
class system_contract : public native {
private:
......
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/core_symbol.hpp.in ${CMAKE_CURRENT_SOURCE_DIR}/core_symbol.hpp)
add_wast_library(TARGET eosiolib
INCLUDE_FOLDERS "${STANDARD_INCLUDE_FOLDERS}" ${CMAKE_SOURCE_DIR}/externals/magic_get/include
DESTINATION_FOLDER ${CMAKE_CURRENT_BINARY_DIR}
)
)
\ No newline at end of file
......@@ -2,119 +2,19 @@
#include <eosiolib/serialize.hpp>
#include <eosiolib/print.hpp>
#include <eosiolib/system.h>
#include <eosiolib/symbol.hpp>
#include <tuple>
#include <limits>
namespace eosio {
static constexpr uint64_t string_to_symbol( uint8_t precision, const char* str ) {
uint32_t len = 0;
while( str[len] ) ++len;
uint64_t result = 0;
for( uint32_t i = 0; i < len; ++i ) {
if( str[i] < 'A' || str[i] > 'Z' ) {
/// ERRORS?
} else {
result |= (uint64_t(str[i]) << (8*(1+i)));
}
}
result |= uint64_t(precision);
return result;
}
#define S(P,X) ::eosio::string_to_symbol(P,#X)
typedef uint64_t symbol_name;
static constexpr bool is_valid_symbol( symbol_name sym ) {
sym >>= 8;
for( int i = 0; i < 7; ++i ) {
char c = (char)(sym & 0xff);
if( !('A' <= c && c <= 'Z') ) return false;
sym >>= 8;
if( !(sym & 0xff) ) {
do {
sym >>= 8;
if( (sym & 0xff) ) return false;
++i;
} while( i < 7 );
}
}
return true;
}
static constexpr uint32_t symbol_name_length( symbol_name tmp ) {
tmp >>= 8; /// skip precision
uint32_t length = 0;
while( tmp & 0xff && length <= 7) {
++length;
tmp >>= 8;
}
return length;
}
struct symbol_type {
symbol_name value;
symbol_type() { }
symbol_type(symbol_name s): value(s) { }
bool is_valid()const { return is_valid_symbol( value ); }
uint64_t precision()const { return value & 0xff; }
uint64_t name()const { return value >> 8; }
uint32_t name_length()const { return symbol_name_length( value ); }
operator symbol_name()const { return value; }
void print(bool show_precision=true)const {
if( show_precision ){
::eosio::print(precision());
prints(",");
}
auto sym = value;
sym >>= 8;
for( int i = 0; i < 7; ++i ) {
char c = (char)(sym & 0xff);
if( !c ) return;
prints_l(&c, 1 );
sym >>= 8;
}
}
EOSLIB_SERIALIZE( symbol_type, (value) )
};
struct extended_symbol : public symbol_type
{
extended_symbol( symbol_name s = 0, account_name c = 0 ):symbol_type{s},contract(c){}
account_name contract;
void print()const {
symbol_type::print();
prints("@");
printn( contract );
}
friend bool operator == ( const extended_symbol& a, const extended_symbol& b ) {
return std::tie( a.value, a.contract ) == std::tie( b.value, b.contract );
}
friend bool operator != ( const extended_symbol& a, const extended_symbol& b ) {
return std::tie( a.value, a.contract ) != std::tie( b.value, b.contract );
}
EOSLIB_SERIALIZE( extended_symbol, (value)(contract) )
};
struct asset {
int64_t amount;
symbol_type symbol;
static constexpr int64_t max_amount = (1LL << 62) - 1;
explicit asset( int64_t a = 0, symbol_name s = S(4,EOS))
explicit asset( int64_t a = 0, symbol_type s = CORE_SYMBOL )
:amount(a),symbol{s}
{
eosio_assert( is_amount_within_range(), "magnitude of asset amount must be less than 2^62" );
......
/** @file
* @copyright defined in eos/LICENSE.txt
*
* \warning This file is machine generated. DO NOT EDIT. See core_symbol.hpp.in for changes.
*/
#define CORE_SYMBOL S(4,SYS)
/** @file
* @copyright defined in eos/LICENSE.txt
*
* \warning This file is machine generated. DO NOT EDIT. See core_symbol.hpp.in for changes.
*/
#define CORE_SYMBOL S(4,${CORE_SYMBOL_NAME})
\ No newline at end of file
#pragma once
#include <eosiolib/core_symbol.hpp>
#include <eosiolib/serialize.hpp>
#include <eosiolib/print.hpp>
#include <eosiolib/system.h>
#include <tuple>
#include <limits>
namespace eosio {
static constexpr uint64_t string_to_symbol( uint8_t precision, const char* str ) {
uint32_t len = 0;
while( str[len] ) ++len;
uint64_t result = 0;
for( uint32_t i = 0; i < len; ++i ) {
if( str[i] < 'A' || str[i] > 'Z' ) {
/// ERRORS?
} else {
result |= (uint64_t(str[i]) << (8*(1+i)));
}
}
result |= uint64_t(precision);
return result;
}
#define S(P,X) ::eosio::string_to_symbol(P,#X)
typedef uint64_t symbol_name;
static constexpr bool is_valid_symbol( symbol_name sym ) {
sym >>= 8;
for( int i = 0; i < 7; ++i ) {
char c = (char)(sym & 0xff);
if( !('A' <= c && c <= 'Z') ) return false;
sym >>= 8;
if( !(sym & 0xff) ) {
do {
sym >>= 8;
if( (sym & 0xff) ) return false;
++i;
} while( i < 7 );
}
}
return true;
}
static constexpr uint32_t symbol_name_length( symbol_name tmp ) {
tmp >>= 8; /// skip precision
uint32_t length = 0;
while( tmp & 0xff && length <= 7) {
++length;
tmp >>= 8;
}
return length;
}
struct symbol_type {
symbol_name value;
symbol_type() { }
symbol_type(symbol_name s): value(s) { }
bool is_valid()const { return is_valid_symbol( value ); }
uint64_t precision()const { return value & 0xff; }
uint64_t name()const { return value >> 8; }
uint32_t name_length()const { return symbol_name_length( value ); }
operator symbol_name()const { return value; }
void print(bool show_precision=true)const {
if( show_precision ){
::eosio::print(precision());
prints(",");
}
auto sym = value;
sym >>= 8;
for( int i = 0; i < 7; ++i ) {
char c = (char)(sym & 0xff);
if( !c ) return;
prints_l(&c, 1 );
sym >>= 8;
}
}
EOSLIB_SERIALIZE( symbol_type, (value) )
};
struct extended_symbol : public symbol_type
{
extended_symbol( symbol_name s = 0, account_name c = 0 ):symbol_type{s},contract(c){}
account_name contract;
void print()const {
symbol_type::print();
prints("@");
printn( contract );
}
friend bool operator == ( const extended_symbol& a, const extended_symbol& b ) {
return std::tie( a.value, a.contract ) == std::tie( b.value, b.contract );
}
friend bool operator != ( const extended_symbol& a, const extended_symbol& b ) {
return std::tie( a.value, a.contract ) != std::tie( b.value, b.contract );
}
EOSLIB_SERIALIZE( extended_symbol, (value)(contract) )
};
} /// namespace eosio
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/include/eosio/chain/core_symbol.hpp.in ${CMAKE_CURRENT_SOURCE_DIR}/include/eosio/chain/core_symbol.hpp)
file(GLOB HEADERS "include/eosio/chain/*.hpp" "include/eosio/chain/contracts/*.hpp")
## SORT .cpp by most likely to change / break compile
......
......@@ -21,13 +21,15 @@ int64_t asset::precision()const {
}
string asset::to_string()const {
string result = fc::to_string( static_cast<int64_t>(amount) / precision());
string sign = amount < 0 ? "-" : "";
int64_t abs_amount = std::abs(amount);
string result = fc::to_string( static_cast<int64_t>(abs_amount) / precision());
if( decimals() )
{
auto fract = static_cast<int64_t>(amount) % precision();
auto fract = static_cast<int64_t>(abs_amount) % precision();
result += "." + fc::to_string(precision() + fract).erase(0,1);
}
return result + " " + symbol_name();
return sign + result + " " + symbol_name();
}
asset asset::from_string(const string& from)
......
......@@ -7,13 +7,6 @@
#include <eosio/chain/types.hpp>
#include <eosio/chain/symbol.hpp>
/// eos with 4 digits of precision
#define EOS_SYMBOL_VALUE (int64_t(4) | (uint64_t('E') << 8) | (uint64_t('O') << 16) | (uint64_t('S') << 24))
static const eosio::chain::symbol EOS_SYMBOL(EOS_SYMBOL_VALUE);
/// Defined to be largest power of 10 that fits in 53 bits of precision
#define EOS_MAX_SHARE_SUPPLY int64_t(1'000'000'000'000'000ll)
namespace eosio { namespace chain {
/**
......@@ -29,7 +22,7 @@ struct asset
{
static constexpr int64_t max_amount = (1LL << 62) - 1;
explicit asset(share_type a = 0, symbol id = EOS_SYMBOL) :amount(a), sym(id) {
explicit asset(share_type a = 0, symbol id = symbol(CORE_SYMBOL)) :amount(a), sym(id) {
EOS_ASSERT( is_amount_within_range(), asset_type_exception, "magnitude of asset amount must be less than 2^62" );
EOS_ASSERT( sym.valid(), asset_type_exception, "invalid symbol" );
}
......
/** @file
* @copyright defined in eos/LICENSE.txt
*
* \warning This file is machine generated. DO NOT EDIT. See core_symbol.hpp.in for changes.
*/
#define CORE_SYMBOL SY(4,SYS)
#define CORE_SYMBOL_NAME "SYS"
/** @file
* @copyright defined in eos/LICENSE.txt
*
* \warning This file is machine generated. DO NOT EDIT. See core_symbol.hpp.in for changes.
*/
#define CORE_SYMBOL SY(4,${CORE_SYMBOL_NAME})
#define CORE_SYMBOL_NAME "${CORE_SYMBOL_NAME}"
\ No newline at end of file
......@@ -5,6 +5,7 @@
#pragma once
#include <fc/exception/exception.hpp>
#include <eosio/chain/types.hpp>
#include <eosio/chain/core_symbol.hpp>
#include <string>
#include <functional>
......@@ -65,7 +66,7 @@ namespace eosio {
explicit symbol(uint8_t p, const char* s): m_value(string_to_symbol(p, s)) {
FC_ASSERT(valid(), "invalid symbol: ${s}", ("s",s));
}
explicit symbol(uint64_t v = SY(4, EOS)): m_value(v) {
explicit symbol(uint64_t v = CORE_SYMBOL): m_value(v) {
FC_ASSERT(valid(), "invalid symbol: ${name}", ("name",name()));
}
static symbol from_string(const string& from)
......
......@@ -24,6 +24,8 @@ std::ostream& operator<<( std::ostream& osm, const fc::variant_object& v );
std::ostream& operator<<( std::ostream& osm, const fc::variant_object::entry& e );
eosio::chain::asset core_from_string(const std::string& s);
namespace boost { namespace test_tools { namespace tt_detail {
template<>
......
......@@ -7,6 +7,10 @@
#include <eosio.bios/eosio.bios.wast.hpp>
#include <eosio.bios/eosio.bios.abi.hpp>
eosio::chain::asset core_from_string(const std::string& s) {
return eosio::chain::asset::from_string(s + " " CORE_SYMBOL_NAME);
}
namespace eosio { namespace testing {
bool expect_assert_message(const fc::exception& ex, string expected) {
......
......@@ -22,6 +22,8 @@ target_include_directories( plugin_test PUBLIC ${CMAKE_SOURCE_DIR}/plugins/net_p
add_dependencies(plugin_test asserter test_api test_api_mem test_api_db test_api_multi_index exchange proxy identity identity_test stltest infinite eosio.system eosio.token eosio.bios test.inline multi_index_test noop dice eosio.msig)
#
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/core_symbol.py.in ${CMAKE_CURRENT_SOURCE_DIR}/core_symbol.py)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/p2p_tests/sync/test.sh ${CMAKE_CURRENT_BINARY_DIR}/p2p_tests/sync/test.sh COPYONLY)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/p2p_tests/dawn_515/test.sh ${CMAKE_CURRENT_BINARY_DIR}/p2p_tests/dawn_515/test.sh COPYONLY)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/trans_sync_across_mixed_cluster_test.sh ${CMAKE_CURRENT_BINARY_DIR}/trans_sync_across_mixed_cluster_test.sh COPYONLY)
......@@ -30,6 +32,7 @@ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/distributed-transactions-remote-test.
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/sample-cluster-map.json ${CMAKE_CURRENT_BINARY_DIR}/sample-cluster-map.json COPYONLY)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/restart-scenarios-test.py ${CMAKE_CURRENT_BINARY_DIR}/restart-scenarios-test.py COPYONLY)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/testUtils.py ${CMAKE_CURRENT_BINARY_DIR}/testUtils.py COPYONLY)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/core_symbol.py ${CMAKE_CURRENT_BINARY_DIR}/core_symbol.py COPYONLY)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/nodeos_run_test.py ${CMAKE_CURRENT_BINARY_DIR}/nodeos_run_test.py COPYONLY)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/nodeos_run_remote_test.py ${CMAKE_CURRENT_BINARY_DIR}/nodeos_run_remote_test.py COPYONLY)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/consensus-validation-malicious-producers.py ${CMAKE_CURRENT_BINARY_DIR}/consensus-validation-malicious-producers.py COPYONLY)
......
CORE_SYMBOL='SYS'
CORE_SYMBOL='${CORE_SYMBOL_NAME}'
\ No newline at end of file
......@@ -15,6 +15,7 @@ import re
Print=testUtils.Utils.Print
errorExit=testUtils.Utils.errorExit
from core_symbol import CORE_SYMBOL
def cmdError(name, cmdCode=0, exitNow=False):
msg="FAILURE - %s%s" % (name, ("" if cmdCode == 0 else (" returned error code %d" % cmdCode)))
......@@ -255,7 +256,7 @@ try:
if not node.verifyAccount(testeraAccount):
errorExit("FAILURE - account creation failed.", raw=True)
transferAmount="97.5321 EOS"
transferAmount="97.5321 {0}".format(CORE_SYMBOL)
Print("Transfer funds %s from account %s to %s" % (transferAmount, defproduceraAccount.name, testeraAccount.name))
if node.transferFunds(defproduceraAccount, testeraAccount, transferAmount, "test transfer") is None:
cmdError("%s transfer" % (ClientName))
......@@ -269,7 +270,7 @@ try:
cmdError("FAILURE - transfer failed")
errorExit("Transfer verification failed. Excepted %s, actual: %s" % (expectedAmount, actualAmount))
transferAmount="0.0100 EOS"
transferAmount="0.0100 {0}".format(CORE_SYMBOL)
Print("Force transfer funds %s from account %s to %s" % (
transferAmount, defproduceraAccount.name, testeraAccount.name))
if node.transferFunds(defproduceraAccount, testeraAccount, transferAmount, "test transfer", force=True) is None:
......@@ -277,7 +278,7 @@ try:
errorExit("Failed to force transfer funds %d from account %s to %s" % (
transferAmount, defproduceraAccount.name, testeraAccount.name))
expectedAmount="97.5421 EOS"
expectedAmount="97.5421 {0}".format(CORE_SYMBOL)
Print("Verify transfer, Expected: %s" % (expectedAmount))
actualAmount=node.getAccountEosBalanceStr(testeraAccount.name)
if expectedAmount != actualAmount:
......@@ -298,7 +299,7 @@ try:
cmdError("%s wallet unlock" % (ClientName))
errorExit("Failed to unlock wallet %s" % (testWallet.name))
transferAmount="97.5311 EOS"
transferAmount="97.5311 {0}".format(CORE_SYMBOL)
Print("Transfer funds %s from account %s to %s" % (
transferAmount, testeraAccount.name, currencyAccount.name))
trans=node.transferFunds(testeraAccount, currencyAccount, transferAmount, "test transfer a->b")
......@@ -308,7 +309,7 @@ try:
transferAmount, testeraAccount.name, currencyAccount.name))
transId=testUtils.Node.getTransId(trans)
expectedAmount="98.0311 EOS" # 5000 initial deposit
expectedAmount="98.0311 {0}".format(CORE_SYMBOL) # 5000 initial deposit
Print("Verify transfer, Expected: %s" % (expectedAmount))
actualAmount=node.getAccountEosBalanceStr(currencyAccount.name)
if expectedAmount != actualAmount:
......
......@@ -5,6 +5,8 @@ import time
import copy
import threading
from core_symbol import CORE_SYMBOL
class StressNetwork:
speeds=[1,5,10,30,60,100,500]
sec=10
......@@ -50,7 +52,7 @@ class StressNetwork:
print("issue currency0000 into %s" % (acc1.name))
contract="eosio"
action="issue"
data="{\"to\":\"" + acc1.name + "\",\"quantity\":\"1000000.0000 EOS\"}"
data="{\"to\":\"" + acc1.name + "\",\"quantity\":\"1000000.0000 "+CORE_SYMBOL+"\"}"
opts="--permission eosio@active"
tr=node.pushMessage(contract, action, data, opts)
trid = node.getTransId(tr[1])
......
......@@ -17,6 +17,8 @@ import random
import json
import shlex
from core_symbol import CORE_SYMBOL
###########################################################################################
class Utils:
Debug=False
......@@ -537,9 +539,10 @@ class Node(object):
# Create & initialize account and return creation transactions. Return transaction json object
def createInitializeAccount(self, account, creatorAccount, stakedDeposit=1000, waitForTransBlock=False):
cmd='%s %s system newaccount -j %s %s %s %s --stake-net "100 EOS" --stake-cpu "100 EOS" --buy-ram-EOS "100 EOS"' % (
cmd='%s %s system newaccount -j %s %s %s %s --stake-net "100 %s" --stake-cpu "100 %s" --buy-ram-EOS "100 %s"' % (
Utils.EosClientPath, self.endpointArgs, creatorAccount.name, account.name,
account.ownerPublicKey, account.activePublicKey)
account.ownerPublicKey, account.activePublicKey,
CORE_SYMBOL, CORE_SYMBOL, CORE_SYMBOL)
if Utils.Debug: Utils.Print("cmd: %s" % (cmd))
trans=None
......@@ -553,7 +556,7 @@ class Node(object):
if stakedDeposit > 0:
self.waitForTransIdOnNode(transId) # seems like account creation needs to be finlized before transfer can happen
trans = self.transferFunds(creatorAccount, account, "%0.04f EOS" % (stakedDeposit/10000), "init")
trans = self.transferFunds(creatorAccount, account, "%0.04f %s" % (stakedDeposit/10000, CORE_SYMBOL), "init")
transId=Node.getTransId(trans)
if waitForTransBlock and not self.waitForTransIdOnNode(transId):
......@@ -580,7 +583,7 @@ class Node(object):
if stakedDeposit > 0:
self.waitForTransIdOnNode(transId) # seems like account creation needs to be finlized before transfer can happen
trans = self.transferFunds(creatorAccount, account, "%0.04f EOS" % (stakedDeposit/10000), "init")
trans = self.transferFunds(creatorAccount, account, "%0.04f %s" % (stakedDeposit/10000, CORE_SYMBOL), "init")
transId=Node.getTransId(trans)
if waitForTransBlock and not self.waitForTransIdOnNode(transId):
......@@ -786,7 +789,7 @@ class Node(object):
return servants
def getAccountEosBalanceStr(self, scope):
"""Returns EOS currency0000 account balance from cleos get table command. Returned balance is string following syntax "98.0311 EOS". """
"""Returns EOS currency0000 account balance from cleos get table command. Returned balance is string following syntax "98.0311 SYS". """
assert isinstance(scope, str)
if not self.enableMongo:
amount=self.getNodeAccountBalance("eosio.token", scope)
......@@ -1927,7 +1930,7 @@ class Cluster(object):
contract=eosioTokenAccount.name
Utils.Print("push create action to %s contract" % (contract))
action="create"
data="{\"issuer\":\"%s\",\"maximum_supply\":\"1000000000.0000 EOS\",\"can_freeze\":\"0\",\"can_recall\":\"0\",\"can_whitelist\":\"0\"}" % (eosioTokenAccount.name)
data="{\"issuer\":\"%s\",\"maximum_supply\":\"1000000000.0000 %s\",\"can_freeze\":\"0\",\"can_recall\":\"0\",\"can_whitelist\":\"0\"}" % (eosioTokenAccount.name, CORE_SYMBOL)
opts="--permission %s@active" % (contract)
trans=biosNode.pushMessage(contract, action, data, opts)
if trans is None or not trans[0]:
......@@ -1941,7 +1944,7 @@ class Cluster(object):
contract=eosioTokenAccount.name
Utils.Print("push issue action to %s contract" % (contract))
action="issue"
data="{\"to\":\"%s\",\"quantity\":\"1000000000.0000 EOS\",\"memo\":\"initial issue\"}" % (eosioAccount.name)
data="{\"to\":\"%s\",\"quantity\":\"1000000000.0000 %s\",\"memo\":\"initial issue\"}" % (eosioAccount.name, CORE_SYMBOL)
opts="--permission %s@active" % (contract)
trans=biosNode.pushMessage(contract, action, data, opts)
if trans is None or not trans[0]:
......@@ -1953,7 +1956,7 @@ class Cluster(object):
transId=Node.getTransId(trans[1])
biosNode.waitForTransIdOnNode(transId)
expectedAmount="1000000000.0000 EOS"
expectedAmount="1000000000.0000 {0}".format(CORE_SYMBOL)
Utils.Print("Verify eosio issue, Expected: %s" % (expectedAmount))
actualAmount=biosNode.getAccountEosBalanceStr(eosioAccount.name)
if expectedAmount != actualAmount:
......@@ -1973,7 +1976,7 @@ class Cluster(object):
Node.validateTransaction(trans)
initialFunds="1000000.0000 EOS"
initialFunds="1000000.0000 {0}".format(CORE_SYMBOL)
Utils.Print("Transfer initial fund %s to individual accounts." % (initialFunds))
trans=None
contract=eosioTokenAccount.name
......
......@@ -1870,8 +1870,8 @@ BOOST_AUTO_TEST_CASE(general)
{
"publickey" : "EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV",
"publickey_arr" : ["EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV","EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV","EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV"],
"asset" : "100.0000 EOS",
"asset_arr" : ["100.0000 EOS","100.0000 EOS"],
"asset" : "100.0000 SYS",
"asset_arr" : ["100.0000 SYS","100.0000 SYS"],
"string" : "ola ke ase",
"string_arr" : ["ola ke ase","ola ke desi"],
......
......@@ -143,6 +143,7 @@ public:
return r;
}
auto undelegate_bandwidth( name from, name receiver, asset net, asset cpu ) {
auto r = base_tester::push_action(N(eosio), N(undelegatebw), from, mvo()
("from", from )
......@@ -155,7 +156,7 @@ public:
}
asset get_balance( const account_name& act ) {
return get_currency_balance(N(eosio.token), symbol(SY(4,EOS)), act);
return get_currency_balance(N(eosio.token), symbol(CORE_SYMBOL), act);
}
void set_code_abi(const account_name& account, const char* wast, const char* abi, const private_key_type* signer = nullptr) {
......@@ -200,11 +201,12 @@ BOOST_FIXTURE_TEST_CASE( bootseq_test, bootseq_tester ) {
const auto& eosio_token_acc = get<account_object, by_name>(N(eosio.token));
BOOST_TEST(eosio_token_acc.privileged == true);
// Create EOS tokens in eosio.token, set its manager as eosio
auto max_supply = asset::from_string("10000000000.0000 EOS"); /// 1x larger than 1B initial tokens
auto initial_supply = asset::from_string("1000000000.0000 EOS"); /// 1x larger than 1B initial tokens
// Create SYS tokens in eosio.token, set its manager as eosio
auto max_supply = core_from_string("10000000000.0000"); /// 1x larger than 1B initial tokens
auto initial_supply = core_from_string("1000000000.0000"); /// 1x larger than 1B initial tokens
create_currency(N(eosio.token), config::system_account_name, max_supply);
// Issue the genesis supply of 1 billion EOS tokens to eosio.system
// Issue the genesis supply of 1 billion SYS tokens to eosio.system
issue(N(eosio.token), config::system_account_name, config::system_account_name, initial_supply);
auto actual = get_balance(config::system_account_name);
......@@ -319,7 +321,7 @@ BOOST_FIXTURE_TEST_CASE( bootseq_test, bootseq_tester ) {
BOOST_REQUIRE(control->head_block_time().time_since_epoch() < first_june_2028);
// This should thrown an error, since block one can only unstake all his stake after 10 years
BOOST_REQUIRE_THROW(undelegate_bandwidth(N(b1), N(b1), asset::from_string("49999500.0000 EOS"), asset::from_string("49999500.0000 EOS")), assert_exception);
BOOST_REQUIRE_THROW(undelegate_bandwidth(N(b1), N(b1), core_from_string("49999500.0000"), core_from_string("49999500.0000")), assert_exception);
// Skip 10 years
produce_block(first_june_2028 - control->head_block_time().time_since_epoch());
......@@ -328,13 +330,14 @@ BOOST_FIXTURE_TEST_CASE( bootseq_test, bootseq_tester ) {
register_producer(pro);
}
// Block one should be able to unstake all his stake now
undelegate_bandwidth(N(b1), N(b1), asset::from_string("49999500.0000 EOS"), asset::from_string("49999500.0000 EOS"));
undelegate_bandwidth(N(b1), N(b1), core_from_string("49999500.0000"), core_from_string("49999500.0000"));
return;
produce_blocks(7000); /// produce blocks until virutal bandwidth can acomadate a small user
wlog("minow" );
votepro( N(minow1), {N(p1), N(p2)} );
#warning Complete this test
} FC_LOG_AND_RETHROW()
}
......
......@@ -275,18 +275,18 @@ BOOST_FIXTURE_TEST_CASE(test_symbol, TESTER) try {
}
{
symbol eos(4, "EOS");
BOOST_REQUIRE_EQUAL(EOS_SYMBOL_VALUE, eos.value());
BOOST_REQUIRE_EQUAL("4,EOS", eos.to_string());
BOOST_REQUIRE_EQUAL("EOS", eos.name());
BOOST_REQUIRE_EQUAL(4, eos.decimals());
symbol sys(4, "SYS");
BOOST_REQUIRE_EQUAL(SY(4,SYS), sys.value());
BOOST_REQUIRE_EQUAL("4,SYS", sys.to_string());
BOOST_REQUIRE_EQUAL("SYS", sys.name());
BOOST_REQUIRE_EQUAL(4, sys.decimals());
}
// default is "4,EOS"
// default is "4,${CORE_SYMBOL_NAME}"
{
symbol def;
BOOST_REQUIRE_EQUAL(4, def.decimals());
BOOST_REQUIRE_EQUAL("EOS", def.name());
BOOST_REQUIRE_EQUAL(CORE_SYMBOL_NAME, def.name());
}
// from string
{
......@@ -359,6 +359,7 @@ BOOST_FIXTURE_TEST_CASE(test_symbol, TESTER) try {
BOOST_REQUIRE_EQUAL(a.amount, 100000000000000);
BOOST_REQUIRE_EQUAL(a.decimals(), 5);
BOOST_REQUIRE_EQUAL(a.symbol_name(), "CUR");
BOOST_REQUIRE_EQUAL(a.to_string(), "1000000000.00000 CUR");
}
// Valid asset
......@@ -367,6 +368,7 @@ BOOST_FIXTURE_TEST_CASE(test_symbol, TESTER) try {
BOOST_REQUIRE_EQUAL(a.amount, 100000000000000);
BOOST_REQUIRE_EQUAL(a.decimals(), 5);
BOOST_REQUIRE_EQUAL(a.symbol_name(), "CUR");
BOOST_REQUIRE_EQUAL(a.to_string(), "1000000000.00000 CUR");
}
// Negative asset
......@@ -375,6 +377,7 @@ BOOST_FIXTURE_TEST_CASE(test_symbol, TESTER) try {
BOOST_REQUIRE_EQUAL(a.amount, -100000000010);
BOOST_REQUIRE_EQUAL(a.decimals(), 5);
BOOST_REQUIRE_EQUAL(a.symbol_name(), "CUR");
BOOST_REQUIRE_EQUAL(a.to_string(), "-1000000.00010 CUR");
}
// Negative asset below 1
......@@ -383,6 +386,16 @@ BOOST_FIXTURE_TEST_CASE(test_symbol, TESTER) try {
BOOST_REQUIRE_EQUAL(a.amount, -100);
BOOST_REQUIRE_EQUAL(a.decimals(), 5);
BOOST_REQUIRE_EQUAL(a.symbol_name(), "CUR");
BOOST_REQUIRE_EQUAL(a.to_string(), "-0.00100 CUR");
}
// Negative asset below 1
{
asset a = asset::from_string("-0.0001 PPP");
BOOST_REQUIRE_EQUAL(a.amount, -1);
BOOST_REQUIRE_EQUAL(a.decimals(), 4);
BOOST_REQUIRE_EQUAL(a.symbol_name(), "PPP");
BOOST_REQUIRE_EQUAL(a.to_string(), "-0.0001 PPP");
}
} FC_LOG_AND_RETHROW() /// test_symbol
......
......@@ -237,18 +237,18 @@ BOOST_FIXTURE_TEST_CASE( dice_test, dice_tester ) try {
push_action(N(eosio.token), N(create), N(eosio.token), mvo()
("issuer", "eosio.token")
("maximum_supply", "1000000000.0000 EOS")
("maximum_supply", core_from_string("1000000000.0000"))
);
push_action(N(eosio.token), N(issue), N(eosio.token), mvo()
("to", "eosio")
("quantity", "1000000000.0000 EOS")
("quantity", core_from_string("1000000000.0000"))
("memo", "")
);
transfer( N(eosio), N(alice), "10000.0000 EOS", "", N(eosio.token) );
transfer( N(eosio), N(bob), "10000.0000 EOS", "", N(eosio.token) );
transfer( N(eosio), N(carol), "10000.0000 EOS", "", N(eosio.token) );
transfer( N(eosio), N(alice), core_from_string("10000.0000"), "", N(eosio.token) );
transfer( N(eosio), N(bob), core_from_string("10000.0000"), "", N(eosio.token) );
transfer( N(eosio), N(carol), core_from_string("10000.0000"), "", N(eosio.token) );
produce_block();
......@@ -257,54 +257,54 @@ BOOST_FIXTURE_TEST_CASE( dice_test, dice_tester ) try {
produce_block();
// Alice deposits 1000 EOS
deposit( N(alice), asset::from_string("1000.0000 EOS"));
// Alice deposits 1000
deposit( N(alice), core_from_string("1000.0000"));
produce_block();
BOOST_REQUIRE_EQUAL( balance_of(N(alice)), asset::from_string("1000.0000 EOS"));
BOOST_REQUIRE_EQUAL( balance_of(N(alice)), core_from_string("1000.0000"));
BOOST_REQUIRE_EQUAL( open_games(N(alice)), 0);
// Alice tries to bet 0 EOS (fail)
// Alice tries to bet 0 (fail)
// secret : 9b886346e1351d4144d0b8392a975612eb0f8b6de7eae1cc9bcc55eb52be343c
BOOST_CHECK_THROW( offer_bet( N(alice), asset::from_string("0.0000 EOS"),
BOOST_CHECK_THROW( offer_bet( N(alice), core_from_string("0.0000"),
commitment_for("9b886346e1351d4144d0b8392a975612eb0f8b6de7eae1cc9bcc55eb52be343c")
), fc::exception);
// Alice bets 10 EOS (success)
// Alice bets 10 (success)
// secret : 0ba044d2833758ee2c8f24d8a3f70c82c334abe6ce13219a4cf3b862abb03c46
offer_bet( N(alice), asset::from_string("10.0000 EOS"),
offer_bet( N(alice), core_from_string("10.0000"),
commitment_for("0ba044d2833758ee2c8f24d8a3f70c82c334abe6ce13219a4cf3b862abb03c46")
);
produce_block();
// Bob tries to bet using a secret previously used by Alice (fail)
// secret : 00000000000000000000000000000002c334abe6ce13219a4cf3b862abb03c46
BOOST_CHECK_THROW( offer_bet( N(bob), asset::from_string("10.0000 EOS"),
BOOST_CHECK_THROW( offer_bet( N(bob), core_from_string("10.0000"),
commitment_for("0ba044d2833758ee2c8f24d8a3f70c82c334abe6ce13219a4cf3b862abb03c46")
), fc::exception);
produce_block();
// Alice tries to bet 1000 EOS (fail)
// Alice tries to bet 1000 (fail)
// secret : a512f6b1b589a8906d574e9de74a529e504a5c53a760f0991a3e00256c027971
BOOST_CHECK_THROW( offer_bet( N(alice), asset::from_string("1000.0000 EOS"),
BOOST_CHECK_THROW( offer_bet( N(alice), core_from_string("1000.0000"),
commitment_for("a512f6b1b589a8906d574e9de74a529e504a5c53a760f0991a3e00256c027971")
), fc::exception);
produce_block();
// Bob tries to bet 90 EOS without deposit
// Bob tries to bet 90 without deposit
// secret : 4facfc98932dde46fdc4403125a16337f6879a842a7ff8b0dc8e1ecddd59f3c8
BOOST_CHECK_THROW( offer_bet( N(bob), asset::from_string("90.0000 EOS"),
BOOST_CHECK_THROW( offer_bet( N(bob), core_from_string("90.0000"),
commitment_for("4facfc98932dde46fdc4403125a16337f6879a842a7ff8b0dc8e1ecddd59f3c8")
), fc::exception);
produce_block();
// Bob deposits 500 EOS
deposit( N(bob), asset::from_string("500.0000 EOS"));
BOOST_REQUIRE_EQUAL( balance_of(N(bob)), asset::from_string("500.0000 EOS"));
// Bob deposits 500
deposit( N(bob), core_from_string("500.0000"));
BOOST_REQUIRE_EQUAL( balance_of(N(bob)), core_from_string("500.0000"));
// Bob bets 11 EOS (success)
// Bob bets 11 (success)
// secret : eec3272712d974c474a3e7b4028b53081344a5f50008e9ccf918ba0725a8d784
offer_bet( N(bob), asset::from_string("11.0000 EOS"),
offer_bet( N(bob), core_from_string("11.0000"),
commitment_for("eec3272712d974c474a3e7b4028b53081344a5f50008e9ccf918ba0725a8d784")
);
produce_block();
......@@ -314,12 +314,12 @@ BOOST_FIXTURE_TEST_CASE( dice_test, dice_tester ) try {
cancel_offer( N(bob), commitment_for("eec3272712d974c474a3e7b4028b53081344a5f50008e9ccf918ba0725a8d784") );
BOOST_REQUIRE_EQUAL( open_offers(N(bob)), 0);
// Carol deposits 300 EOS
deposit( N(carol), asset::from_string("300.0000 EOS"));
// Carol deposits 300
deposit( N(carol), core_from_string("300.0000"));
// Carol bets 10 EOS (success)
// Carol bets 10 (success)
// secret : 3efb4bd5e19b780f4980c919330c0306f8157f93db1fc72c7cefec63e0e7f37a
offer_bet( N(carol), asset::from_string("10.0000 EOS"),
offer_bet( N(carol), core_from_string("10.0000"),
commitment_for("3efb4bd5e19b780f4980c919330c0306f8157f93db1fc72c7cefec63e0e7f37a")
);
produce_block();
......@@ -330,7 +330,7 @@ BOOST_FIXTURE_TEST_CASE( dice_test, dice_tester ) try {
BOOST_REQUIRE_EQUAL( open_games(N(carol)), 1);
BOOST_REQUIRE_EQUAL( open_offers(N(carol)), 0);
BOOST_REQUIRE_EQUAL( game_bet(1), asset::from_string("10.0000 EOS"));
BOOST_REQUIRE_EQUAL( game_bet(1), core_from_string("10.0000"));
// Alice tries to cancel a nonexistent bet (fail)
......@@ -376,31 +376,31 @@ BOOST_FIXTURE_TEST_CASE( dice_test, dice_tester ) try {
BOOST_REQUIRE_EQUAL( open_games(N(alice)), 0);
BOOST_REQUIRE_EQUAL( open_offers(N(alice)), 0);
BOOST_REQUIRE_EQUAL( balance_of(N(alice)), asset::from_string("1010.0000 EOS"));
BOOST_REQUIRE_EQUAL( balance_of(N(alice)), core_from_string("1010.0000"));
BOOST_REQUIRE_EQUAL( open_games(N(carol)), 0);
BOOST_REQUIRE_EQUAL( open_offers(N(carol)), 0);
BOOST_REQUIRE_EQUAL( balance_of(N(carol)), asset::from_string("290.0000 EOS"));
BOOST_REQUIRE_EQUAL( balance_of(N(carol)), core_from_string("290.0000"));
// Alice withdraw 1009 EOS (success)
withdraw( N(alice), asset::from_string("1009.0000 EOS"));
BOOST_REQUIRE_EQUAL( balance_of(N(alice)), asset::from_string("1.0000 EOS"));
// Alice withdraw 1009 (success)
withdraw( N(alice), core_from_string("1009.0000"));
BOOST_REQUIRE_EQUAL( balance_of(N(alice)), core_from_string("1.0000"));
BOOST_REQUIRE_EQUAL(
get_currency_balance(N(eosio.token), EOS_SYMBOL, N(alice)),
asset::from_string("10009.0000 EOS")
get_currency_balance(N(eosio.token), symbol(CORE_SYMBOL), N(alice)),
core_from_string("10009.0000")
);
// Alice withdraw 2 EOS (fail)
BOOST_CHECK_THROW( withdraw( N(alice), asset::from_string("2.0000 EOS")),
// Alice withdraw 2 (fail)
BOOST_CHECK_THROW( withdraw( N(alice), core_from_string("2.0000")),
fc::exception);
// Alice withdraw 1 EOS (success)
withdraw( N(alice), asset::from_string("1.0000 EOS"));
// Alice withdraw 1 (success)
withdraw( N(alice), core_from_string("1.0000"));
BOOST_REQUIRE_EQUAL(
get_currency_balance(N(eosio.token), EOS_SYMBOL, N(alice)),
asset::from_string("10010.0000 EOS")
get_currency_balance(N(eosio.token), symbol(CORE_SYMBOL), N(alice)),
core_from_string("10010.0000")
);
// Verify alice account was deleted
......
此差异已折叠。
......@@ -62,14 +62,14 @@ BOOST_AUTO_TEST_CASE( forking ) try {
auto cr = c.push_action( N(eosio.token), N(create), N(eosio.token), mutable_variant_object()
("issuer", "eosio" )
("maximum_supply", "10000000.0000 EOS")
("maximum_supply", core_from_string("10000000.0000"))
);
wdump((fc::json::to_pretty_string(cr)));
cr = c.push_action( N(eosio.token), N(issue), N(eosio), mutable_variant_object()
("to", "dan" )
("quantity", "100.0000 EOS")
("quantity", core_from_string("100.0000"))
("memo", "")
);
......
......@@ -53,7 +53,7 @@ public:
}
transaction_trace_ptr create_account_with_resources( account_name a, account_name creator, asset ramfunds, bool multisig,
asset net = asset::from_string("10.0000 EOS"), asset cpu = asset::from_string("10.0000 EOS") ) {
asset net = core_from_string("10.0000"), asset cpu = core_from_string("10.0000") ) {
signed_transaction trx;
set_transaction_headers(trx);
......@@ -97,17 +97,14 @@ public:
void create_currency( name contract, name manager, asset maxsupply ) {
auto act = mutable_variant_object()
("issuer", manager )
("maximum_supply", maxsupply )
("can_freeze", 0)
("can_recall", 0)
("can_whitelist", 0);
("maximum_supply", maxsupply );
base_tester::push_action(contract, N(create), contract, act );
}
void issue( name to, const string& amount, name manager = config::system_account_name ) {
void issue( name to, const asset& amount, name manager = config::system_account_name ) {
base_tester::push_action( N(eosio.token), N(issue), manager, mutable_variant_object()
("to", to )
("quantity", asset::from_string(amount) )
("quantity", amount )
("memo", "")
);
}
......@@ -120,7 +117,7 @@ public:
);
}
asset get_balance( const account_name& act ) {
//return get_currency_balance( config::system_account_name, symbol(SY(4,EOS)), act );
//return get_currency_balance( config::system_account_name, symbol(CORE_SYMBOL), act );
//temporary code. current get_currency_balancy uses table name N(accounts) from currency.h
//generic_currency table name is N(account).
const auto& db = control->db();
......@@ -129,14 +126,14 @@ public:
// the balance is implied to be 0 if either the table or row does not exist
if (tbl) {
const auto *obj = db.find<key_value_object, by_scope_primary>(boost::make_tuple(tbl->id, symbol(SY(4,EOS)).to_symbol_code()));
const auto *obj = db.find<key_value_object, by_scope_primary>(boost::make_tuple(tbl->id, symbol(CORE_SYMBOL).to_symbol_code()));
if (obj) {
// balance is the first field in the serialization
fc::datastream<const char *> ds(obj->value.data(), obj->value.size());
fc::raw::unpack(ds, result);
}
}
return asset( result, symbol(SY(4,EOS)) );
return asset( result, symbol(CORE_SYMBOL) );
}
transaction_trace_ptr push_action( const account_name& signer, const action_name& name, const variant_object& data, bool auth = true ) {
......@@ -421,20 +418,20 @@ BOOST_FIXTURE_TEST_CASE( update_system_contract_all_approve, eosio_msig_tester )
set_code( N(eosio.token), eosio_token_wast );
set_abi( N(eosio.token), eosio_token_abi );
create_currency( N(eosio.token), config::system_account_name, asset::from_string("10000000000.0000 EOS") );
issue(config::system_account_name, "1000000000.0000 EOS");
BOOST_REQUIRE_EQUAL( asset::from_string("1000000000.0000 EOS"), get_balance( "eosio" ) );
create_currency( N(eosio.token), config::system_account_name, core_from_string("10000000000.0000") );
issue(config::system_account_name, core_from_string("1000000000.0000"));
BOOST_REQUIRE_EQUAL( core_from_string("1000000000.0000"), get_balance( "eosio" ) );
set_code( config::system_account_name, eosio_system_wast );
set_abi( config::system_account_name, eosio_system_abi );
produce_blocks();
create_account_with_resources( N(alice1111111), N(eosio), asset::from_string("1.0000 EOS"), false );
create_account_with_resources( N(bob111111111), N(eosio), asset::from_string("0.4500 EOS"), false );
create_account_with_resources( N(carol1111111), N(eosio), asset::from_string("1.0000 EOS"), false );
create_account_with_resources( N(alice1111111), N(eosio), core_from_string("1.0000"), false );
create_account_with_resources( N(bob111111111), N(eosio), core_from_string("0.4500"), false );
create_account_with_resources( N(carol1111111), N(eosio), core_from_string("1.0000"), false );
BOOST_REQUIRE_EQUAL( asset::from_string("1000000000.0000 EOS"), get_balance( "eosio" ) );
BOOST_REQUIRE_EQUAL( core_from_string("1000000000.0000"), get_balance( "eosio" ) );
vector<permission_level> perm = { { N(alice), config::active_name }, { N(bob), config::active_name },
{N(carol), config::active_name} };
......@@ -508,7 +505,7 @@ BOOST_FIXTURE_TEST_CASE( update_system_contract_all_approve, eosio_msig_tester )
BOOST_REQUIRE_EQUAL( transaction_receipt::executed, trace->receipt->status );
// can't create account because system contract was replace by the test_api contract
BOOST_REQUIRE_EXCEPTION(create_account_with_resources( N(alice1111112), N(eosio), asset::from_string("1.0000 EOS"), false ),
BOOST_REQUIRE_EXCEPTION(create_account_with_resources( N(alice1111112), N(eosio), core_from_string("1.0000"), false ),
fc::assert_exception,
[](const fc::exception& e) {
return expect_assert_message(e, "condition: assertion failed: Unknown Test");
......@@ -532,20 +529,20 @@ BOOST_FIXTURE_TEST_CASE( update_system_contract_major_approve, eosio_msig_tester
set_code( N(eosio.token), eosio_token_wast );
set_abi( N(eosio.token), eosio_token_abi );
create_currency( N(eosio.token), config::system_account_name, asset::from_string("10000000000.0000 EOS") );
issue(config::system_account_name, "1000000000.0000 EOS");
BOOST_REQUIRE_EQUAL( asset::from_string("1000000000.0000 EOS"), get_balance( "eosio" ) );
create_currency( N(eosio.token), config::system_account_name, core_from_string("10000000000.0000") );
issue(config::system_account_name, core_from_string("1000000000.0000"));
BOOST_REQUIRE_EQUAL( core_from_string("1000000000.0000"), get_balance( "eosio" ) );
set_code( config::system_account_name, eosio_system_wast );
set_abi( config::system_account_name, eosio_system_abi );
produce_blocks();
create_account_with_resources( N(alice1111111), N(eosio), asset::from_string("1.0000 EOS"), false );
create_account_with_resources( N(bob111111111), N(eosio), asset::from_string("0.4500 EOS"), false );
create_account_with_resources( N(carol1111111), N(eosio), asset::from_string("1.0000 EOS"), false );
create_account_with_resources( N(alice1111111), N(eosio), core_from_string("1.0000"), false );
create_account_with_resources( N(bob111111111), N(eosio), core_from_string("0.4500"), false );
create_account_with_resources( N(carol1111111), N(eosio), core_from_string("1.0000"), false );
BOOST_REQUIRE_EQUAL( asset::from_string("1000000000.0000 EOS"), get_balance( "eosio" ) );
BOOST_REQUIRE_EQUAL( core_from_string("1000000000.0000"), get_balance( "eosio" ) );
vector<permission_level> perm = { { N(alice), config::active_name }, { N(bob), config::active_name },
{N(carol), config::active_name}, {N(apple), config::active_name}};
......@@ -634,7 +631,7 @@ BOOST_FIXTURE_TEST_CASE( update_system_contract_major_approve, eosio_msig_tester
BOOST_REQUIRE_EQUAL( transaction_receipt::executed, trace->receipt->status );
// can't create account because system contract was replace by the test_api contract
BOOST_REQUIRE_EXCEPTION(create_account_with_resources( N(alice1111112), N(eosio), asset::from_string("1.0000 EOS"), false ),
BOOST_REQUIRE_EXCEPTION(create_account_with_resources( N(alice1111112), N(eosio), core_from_string("1.0000"), false ),
fc::assert_exception,
[](const fc::exception& e) {
return expect_assert_message(e, "condition: assertion failed: Unknown Test");
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册