Skip to content

Instantly share code, notes, and snippets.

View stablexbt's full-sized avatar
🎯
Focusing

Ark stablexbt

🎯
Focusing
View GitHub Profile
asset token::get_balance( account_name owner, symbol_name sym )const
{
accounts accountstable( _self, owner );
const auto& ac = accountstable.get( sym );
return ac.balance;
}
asset token::get_supply( symbol_name sym )const
{
stats statstable( _self, sym );
const auto& st = statstable.get( sym );
return st.supply;
}
public:
using contract::contract;
[[eosio::action]]
void create( name issuer,
asset maximum_supply);
[[eosio::action]]
void issue( name to, asset quantity, string memo );
private:
struct [[eosio::table]] account {
asset balance;
uint64_t primary_key()const { return balance.symbol.code().raw(); }
};
struct [[eosio::table]] currency_stats {
asset supply;
asset max_supply;
#include <eosiolib/eosio.hpp>
#include <eosiolib/print.hpp>
using namespace eosio;
class hello : public eosio::contract {
public:
using contract::contract;
void hi() {
print( "Hello, World");
}
};
{
"expiration": "...",
"region": 0,
"ref_block_num": ...,
"ref_block_prefix": ...,
"net_usage_words": ..,
"kcpu_usage": ..,
"delay_sec": 0,
"context_free_actions": [],
"actions": [{
@stablexbt
stablexbt / EOSIO_token.hpp
Last active March 9, 2019 15:03
EOSIO Token interface library file
#pragma once
#include <eosiolib/asset.hpp>
#include <eosiolib/eosio.hpp>
#include <string>
namespace eosiosystem {
class system_contract;
}
@stablexbt
stablexbt / EOSIO_token.cpp
Last active March 9, 2019 16:15
EOS Blockchain smart contract for Token deployment (ERC20 equivalent smart contract on EOS)
#include "eosio.token.hpp"
namespace eosio {
void token::create( name issuer,
asset maximum_supply )
{
require_auth( _self );
auto sym = maximum_supply.symbol;
pragma solidity ^0.4.20;
contract poe {
mapping(string => uint) proof;
event Exists(string data, uint blockNumber);
function prove(string data) constant public returns (uint) {
return proof[data];
}
#include <eosiolib/eosio.hpp>
#include <eosiolib/transaction.h>
#include <string>
#include <eosiolib/crypto.h>
using std::string;
using eosio::key256;
using namespace eosio;