提交 c5f52118 编写于 作者: L learnforpractice

avoid overwrite old database value when republish smart contract

上级 b360c186
......@@ -39,8 +39,12 @@ using namespace TOKEN_NAME;
extern "C" {
void init() {
account owned_account;
//Initialize currency account only if it does not exist
if ( !accounts::get( owned_account, N(currency) )) {
store_account( N(currency), account( currency_tokens(1000ll*1000ll*1000ll) ) );
}
}
/// The apply method implements the dispatch of events to this contract
void apply( uint64_t code, uint64_t action ) {
......
......@@ -41,8 +41,12 @@ using namespace infinite;
extern "C" {
void init() {
account owned_account;
//Initialize currency account only if it does not exist
if ( !accounts::get( owned_account, N(currency) )) {
store_account( N(currency), account( currency_tokens(1000ll*1000ll*1000ll) ) );
}
}
/// The apply method implements the dispatch of events to this contract
void apply( uint64_t code, uint64_t action ) {
......
......@@ -101,9 +101,13 @@ using namespace TOKEN_NAME;
extern "C" {
void init() {
account owned_account;
//Initialize storage account only if it does not exist
if ( !accounts::get( owned_account, N(storage) )) {
// How do we initialize the storage capacity? By how much here?
accounts::store( account( storage_tokens(1000ll*1000ll*1000ll) ), N(storage) );
}
}
/// The apply method implements the dispatch of events to this contract
void apply( uint64_t code, uint64_t action ) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册