diff --git a/.circleci/config.yml b/.circleci/config.yml index eb596de..d215edd 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -9,9 +9,10 @@ jobs: docker: # specify the version you desire here # use `-browsers` prefix for selenium tests, e.g. `3.6.1-browsers` - - image: bcelebci/ore-protocol + - image: openrightsexchange/ore-chain:v1.8.7 environment: PIPENV_VENV_IN_PROJECT: true + steps: - checkout @@ -35,11 +36,7 @@ jobs: - run: name: run tests command: | - tests/build_and_test.sh - python3 tests/standard_token.py - python3 tests/rights_registry.py - python3 tests/instrument.py - python3 tests/usage_log.py + ./test.sh cleos - store_artifacts: path: test-reports diff --git a/.gitignore b/.gitignore index 8e2502a..402eaa9 100644 --- a/.gitignore +++ b/.gitignore @@ -31,6 +31,7 @@ *.out *.app build/* +contracts/build/* #other .DS_Store @@ -42,3 +43,7 @@ scripts/scriptout/* scripts/importkeys_prod.sh scripts/importkeys_staging.sh staging_keys + +contracts/build/* + +*/build/* diff --git a/README.md b/README.md index 470ad7f..7710683 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,11 @@ - +[![CircleCI](https://circleci.com/gh/API-market/ore-protocol/tree/master.svg?style=svg)](https://circleci.com/gh/API-market/ore-protocol/tree/master) # ORE protocol The ORE Protocol is a blockchain-hosted API that provides a developer-friendly way to define any digital asset (or any physical asset with an online digital representation) and to trade and control access to these protected resources. +### Token Economics Upgrade (2021-01-03) + +The ORE Network designed to provide simpler approach for managing account resources (tiers) and to incentivize staking ORE tokens (via creating accounts, instruments etc..). Token Economics Upgrade enables these features, allowing stakers to claim rewards just like BPs (once a month). Click [here](./scripts/2020-12_TokenEconomicsUpgrade) to see upgrade details ### Rights Token (aka Instrument) A non-fungible 'Rights Token' can enable access to one or more protected resources. It specifies which resources are available, how much each costs to access, and how to access them. These tokens can be stored in a blockchain 'wallet' and presented to the ORE Protocol to retrieve an endpoint and access token. Payment to access a resource (when required) is made as a real-time micropayment using the stable 'CPU' token. diff --git a/contracts/CMakeLists.txt b/contracts/CMakeLists.txt new file mode 100755 index 0000000..c2ac0aa --- /dev/null +++ b/contracts/CMakeLists.txt @@ -0,0 +1,45 @@ +cmake_minimum_required(VERSION 3.5) +project(eosio_contracts VERSION 1.5.2) + +set(EOSIO_CDT_VERSION_MIN "1.4") +set(EOSIO_CDT_VERSION_SOFT_MAX "1.6") +#set(EOSIO_CDT_VERSION_HARD_MAX "") + +find_package(eosio.cdt) + +### Check the version of eosio.cdt +set(VERSION_MATCH_ERROR_MSG "") +EOSIO_CHECK_VERSION(VERSION_OUTPUT "${EOSIO_CDT_VERSION}" + "${EOSIO_CDT_VERSION_MIN}" + "${EOSIO_CDT_VERSION_SOFT_MAX}" + "${EOSIO_CDT_VERSION_HARD_MAX}" + VERSION_MATCH_ERROR_MSG) +if(VERSION_OUTPUT STREQUAL "MATCH") + message(STATUS "Using eosio.cdt version ${EOSIO_CDT_VERSION}") +elseif(VERSION_OUTPUT STREQUAL "WARN") + message(WARNING "Using eosio.cdt version ${EOSIO_CDT_VERSION} even though it exceeds the maximum supported version of ${EOSIO_CDT_VERSION_SOFT_MAX}; continuing with configuration, however build may fail.\nIt is recommended to use eosio.cdt version ${EOSIO_CDT_VERSION_SOFT_MAX}.x") +else() # INVALID OR MISMATCH + message(FATAL_ERROR "Found eosio.cdt version ${EOSIO_CDT_VERSION} but it does not satisfy version requirements: ${VERSION_MATCH_ERROR_MSG}\nPlease use eosio.cdt version ${EOSIO_CDT_VERSION_SOFT_MAX}.x") +endif(VERSION_OUTPUT STREQUAL "MATCH") + +if(CMAKE_BUILD_TYPE STREQUAL "Debug") + set(TEST_BUILD_TYPE "Debug") + set(CMAKE_BUILD_TYPE "Release") +else() + set(TEST_BUILD_TYPE ${CMAKE_BUILD_TYPE}) +endif() + +add_subdirectory(ore.apptoken) +add_subdirectory(ore.system) +#add_subdirectory(ore.standard_token) +add_subdirectory(ore.rights_registry) +add_subdirectory(ore.instrument) +add_subdirectory(ore.usage_log) + + +if (APPLE) + set(OPENSSL_ROOT "/usr/local/opt/openssl") +elseif (UNIX) + set(OPENSSL_ROOT "/usr/include/openssl") +endif() +set(SECP256K1_ROOT "/usr/local") diff --git a/contracts/build.sh b/contracts/build.sh new file mode 100755 index 0000000..f088cf6 --- /dev/null +++ b/contracts/build.sh @@ -0,0 +1,20 @@ +#! /bin/bash + +printf "\t=========== Building eosio.contracts ===========\n\n" + +CURDIRNAME=${PWD##*/} + +if [ $CURDIRNAME != 'contracts' ] +then + cd contracts +fi + +RED='\033[0;31m' +NC='\033[0m' + +CORES=`getconf _NPROCESSORS_ONLN` +mkdir -p build +pushd build &> /dev/null +cmake ../ +make -j${CORES} +popd &> /dev/null diff --git a/contracts/ore.apptoken/CMakeLists.txt b/contracts/ore.apptoken/CMakeLists.txt new file mode 100644 index 0000000..3b75e5a --- /dev/null +++ b/contracts/ore.apptoken/CMakeLists.txt @@ -0,0 +1,9 @@ +add_contract(ore.apptoken ore.apptoken ${CMAKE_CURRENT_SOURCE_DIR}/src/ore.apptoken.cpp) + +target_include_directories(ore.apptoken.wasm + PUBLIC + ${CMAKE_CURRENT_SOURCE_DIR}/include) + +set_target_properties(ore.apptoken.wasm + PROPERTIES + RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}") diff --git a/contracts/ore.apptoken/include/ore.apptoken.hpp b/contracts/ore.apptoken/include/ore.apptoken.hpp new file mode 100644 index 0000000..b9a094c --- /dev/null +++ b/contracts/ore.apptoken/include/ore.apptoken.hpp @@ -0,0 +1,88 @@ +#pragma once + +#include +#include + +#include + +using namespace eosio; +using namespace std; + +using std::string; + +/** + * eosio.token contract defines the structures and actions that allow users to create, issue, and manage + * tokens on EOSIO based blockchains. + */ +class [[eosio::contract("ore.apptoken")]] apptoken : public eosio::contract +{ +public: + apptoken( name receiver, name code, datastream ds): contract(receiver, code, ds) {} + + /** + * Allows `issuer` account to create a token in supply of `maximum_supply`. If validation is successful a new entry in statstable for token symbol scope gets created. + * + * @param issuer - the account that creates the token, + * @param maximum_supply - the maximum supply set for the token created. + * + * @pre Token symbol has to be valid, + * @pre Token symbol must not be already created, + * @pre maximum_supply has to be smaller than the maximum supply allowed by the system: 1^62 - 1. + * @pre Maximum supply must be positive; + */ + ACTION create(const name &issuer, + const asset &maximum_supply); + ACTION issue(const name &to, const asset &quantity, const string &memo); + ACTION retire(const asset &quantity, const string &memo); + ACTION transfer(const name &from, + const name &to, + const asset &quantity, + const string &memo); + ACTION open(const name &owner, const symbol &symbol, const name &ram_payer); + + ACTION close(const name &owner, const symbol &symbol); + + static asset get_supply(const name &token_contract_account, const symbol_code &sym_code) + { + stats statstable(token_contract_account, sym_code.raw()); + const auto &st = statstable.get(sym_code.raw()); + return st.supply; + } + + static asset get_balance(const name &token_contract_account, const name &owner, const symbol_code &sym_code) + { + accounts accountstable(token_contract_account, owner.value); + const auto &ac = accountstable.get(sym_code.raw()); + return ac.balance; + } + + using create_action = eosio::action_wrapper<"create"_n, &apptoken::create>; + using issue_action = eosio::action_wrapper<"issue"_n, &apptoken::issue>; + using retire_action = eosio::action_wrapper<"retire"_n, &apptoken::retire>; + using transfer_action = eosio::action_wrapper<"transfer"_n, &apptoken::transfer>; + using open_action = eosio::action_wrapper<"open"_n, &apptoken::open>; + using close_action = eosio::action_wrapper<"close"_n, &apptoken::close>; + +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; + name issuer; + + uint64_t primary_key() const { return supply.symbol.code().raw(); } + }; + + typedef eosio::multi_index<"accounts"_n, account> accounts; + typedef eosio::multi_index<"stat"_n, currency_stats> stats; + + void sub_balance(const name &owner, const asset &value); + void add_balance(const name &owner, const asset &value, const name &ram_payer); +}; diff --git a/contracts/ore.apptoken/src/ore.apptoken.cpp b/contracts/ore.apptoken/src/ore.apptoken.cpp new file mode 100644 index 0000000..4ada4c8 --- /dev/null +++ b/contracts/ore.apptoken/src/ore.apptoken.cpp @@ -0,0 +1,159 @@ +#include "../include/ore.apptoken.hpp" + +using namespace eosio; + +ACTION apptoken::create( const name& issuer, + const asset& maximum_supply ) +{ + require_auth( name("system.ore")); + + auto sym = maximum_supply.symbol; + check( sym.is_valid(), "invalid symbol name [apptoken.create]" ); + check( maximum_supply.is_valid(), "invalid supply [apptoken.create]"); + check( maximum_supply.amount > 0, "max-supply must be positive [apptoken.create]"); + + stats statstable( get_self(), sym.code().raw() ); + auto existing = statstable.find( sym.code().raw() ); + check( existing == statstable.end(), "token with symbol already exists [apptoken.create]" ); + + statstable.emplace( get_self(), [&]( auto& s ) { + s.supply.symbol = maximum_supply.symbol; + s.max_supply = maximum_supply; + s.issuer = issuer; + }); +} + +ACTION apptoken::issue( const name& to, const asset& quantity, const string& memo ) +{ + auto sym = quantity.symbol; + check( sym.is_valid(), "invalid symbol name [apptoken.issue]" ); + check( memo.size() <= 256, "memo has more than 256 bytes [apptoken.issue]" ); + + stats statstable( get_self(), sym.code().raw() ); + auto existing = statstable.find( sym.code().raw() ); + check( existing != statstable.end(), "token with symbol does not exist, create token before issue [apptoken.issue]" ); + const auto& st = *existing; + check( to == st.issuer, "tokens can only be issued to issuer account [apptoken.issue]" ); + + require_auth( st.issuer ); + check( quantity.is_valid(), "invalid quantity [apptoken.issue]" ); + check( quantity.amount > 0, "must issue positive quantity [apptoken.issue]" ); + + check( quantity.symbol == st.supply.symbol, "symbol precision mismatch [apptoken.issue]" ); + check( quantity.amount <= st.max_supply.amount - st.supply.amount, "quantity exceeds available supply [apptoken.issue]"); + + statstable.modify( st, same_payer, [&]( auto& s ) { + s.supply += quantity; + }); + + add_balance( st.issuer, quantity, st.issuer ); +} + +ACTION apptoken::retire( const asset& quantity, const string& memo ) +{ + auto sym = quantity.symbol; + check( sym.is_valid(), "invalid symbol name [apptoken.retire]" ); + check( memo.size() <= 256, "memo has more than 256 bytes [apptoken.retire]" ); + + stats statstable( get_self(), sym.code().raw() ); + auto existing = statstable.find( sym.code().raw() ); + check( existing != statstable.end(), "token with symbol does not exist [apptoken.retire]" ); + const auto& st = *existing; + + require_auth( st.issuer ); + check( quantity.is_valid(), "invalid quantity [apptoken.retire]" ); + check( quantity.amount > 0, "must retire positive quantity [apptoken.retire]" ); + + check( quantity.symbol == st.supply.symbol, "symbol precision mismatch [apptoken.retire]" ); + + statstable.modify( st, same_payer, [&]( auto& s ) { + s.supply -= quantity; + }); + + sub_balance( st.issuer, quantity ); +} + +ACTION apptoken::transfer( const name& from, + const name& to, + const asset& quantity, + const string& memo ) +{ + check( from != to, "cannot transfer to self [apptoken.transfer]" ); + require_auth( from ); + check( is_account( to ), "to account does not exist [apptoken.transfer]"); + auto sym = quantity.symbol.code(); + stats statstable( get_self(), sym.raw() ); + const auto& st = statstable.get( sym.raw() ); + + require_recipient( from ); + require_recipient( to ); + + check( quantity.is_valid(), "invalid quantity [apptoken.transfer]" ); + check( quantity.amount > 0, "must transfer positive quantity [apptoken.transfer]" ); + check( quantity.symbol == st.supply.symbol, "symbol precision mismatch [apptoken.transfer]" ); + check( memo.size() <= 256, "memo has more than 256 bytes [apptoken.transfer]" ); + + auto payer = has_auth( to ) ? to : from; + + sub_balance( from, quantity ); + add_balance( to, quantity, payer ); +} + +void apptoken::sub_balance( const name& owner, const asset& value ) { + accounts from_acnts( get_self(), owner.value ); + + const auto& from = from_acnts.get( value.symbol.code().raw(), "no balance object found [apptoken.sub_balance]" ); + check( from.balance.amount >= value.amount, "overdrawn balance [apptoken.sub_balance]" ); + + from_acnts.modify( from, owner, [&]( auto& a ) { + a.balance -= value; + }); +} + +void apptoken::add_balance( const name& owner, const asset& value, const name& ram_payer ) +{ + accounts to_acnts( get_self(), owner.value ); + auto to = to_acnts.find( value.symbol.code().raw() ); + if( to == to_acnts.end() ) { + to_acnts.emplace( ram_payer, [&]( auto& a ){ + a.balance = value; + }); + } else { + to_acnts.modify( to, same_payer, [&]( auto& a ) { + a.balance += value; + }); + } +} + +ACTION apptoken::open( const name& owner, const symbol& symbol, const name& ram_payer ) +{ + require_auth( ram_payer ); + + check( is_account( owner ), "owner account does not exist [apptoken.open]" ); + + auto sym_code_raw = symbol.code().raw(); + stats statstable( get_self(), sym_code_raw ); + const auto& st = statstable.get( sym_code_raw, "symbol does not exist [apptoken.open]" ); + check( st.supply.symbol == symbol, "symbol precision mismatch [apptoken.open]" ); + + accounts acnts( get_self(), owner.value ); + auto it = acnts.find( sym_code_raw ); + if( it == acnts.end() ) { + acnts.emplace( ram_payer, [&]( auto& a ){ + a.balance = asset{0, symbol}; + }); + } +} + +ACTION apptoken::close( const name& owner, const symbol& symbol ) +{ + require_auth( owner ); + accounts acnts( get_self(), owner.value ); + auto it = acnts.find( symbol.code().raw() ); + check( it != acnts.end(), "Balance row already deleted or never existed. Action won't have any effect. [apptoken.close]" ); + check( it->balance.amount == 0, "Cannot close because the balance is not zero. [apptoken.close]" ); + acnts.erase( it ); +} + + +EOSIO_DISPATCH(apptoken, (create)(issue)(transfer)(open)(close)(retire)) \ No newline at end of file diff --git a/contracts/ore.instrument/CMakeLists.txt b/contracts/ore.instrument/CMakeLists.txt new file mode 100755 index 0000000..b50b40b --- /dev/null +++ b/contracts/ore.instrument/CMakeLists.txt @@ -0,0 +1,8 @@ +add_contract(ore.instrument ore.instrument ${CMAKE_CURRENT_SOURCE_DIR}/src/ore.instrument.cpp) +target_include_directories(ore.instrument.wasm + PUBLIC + ${CMAKE_CURRENT_SOURCE_DIR}/include) + +set_target_properties(ore.instrument.wasm + PROPERTIES + RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}") diff --git a/contracts/ore.instrument/ore.instrument.hpp b/contracts/ore.instrument/include/ore.instrument.hpp old mode 100644 new mode 100755 similarity index 90% rename from contracts/ore.instrument/ore.instrument.hpp rename to contracts/ore.instrument/include/ore.instrument.hpp index eb8c1ab..08e72b9 --- a/contracts/ore.instrument/ore.instrument.hpp +++ b/contracts/ore.instrument/include/ore.instrument.hpp @@ -4,12 +4,12 @@ #include #include -#include "eosiolib/eosio.hpp" -#include "eosiolib/asset.hpp" -#include "eosiolib/print.hpp" -#include "eosiolib/transaction.hpp" -#include "eosiolib/time.hpp" -#include "../ore.rights_registry/ore.rights_registry.hpp" +#include +#include +#include +#include +#include +#include "ore.rights_registry.hpp" using namespace eosio; using namespace std; @@ -26,12 +26,12 @@ class [[eosio::contract("ore.instrument")]] instrument : public eosio::contract string description; string instrument_template; string security_type; - vector parameter_rules; - vector rights; + vector parameter_rules; + vector rights; uint64_t parent_instrument_id; //example input for data: considerations - vector data; + vector data; string encrypted_by; uint8_t mutability; // 0- immutable, 1- only datesi 2- all }; @@ -123,7 +123,6 @@ class [[eosio::contract("ore.instrument")]] instrument : public eosio::contract } //actions - ACTION approve(name from, name to, uint64_t token_id); ACTION mint(name minter, name owner, instrument_data instrument, uint64_t start_time, uint64_t end_time, uint64_t instrumentId); ACTION checkright(name minter, name issuer, string rightname, uint64_t deferred_transaction_id); ACTION update(name updater, string instrument_template, instrument_data instrument, uint64_t instrument_id, uint64_t start_time, uint64_t end_time); @@ -140,7 +139,7 @@ instrument::token instrument::find_token_by_id(uint64_t id) auto tok = _tokens.find(id); if (tok == _tokens.end()) - eosio_assert(false, "token not found"); + check(false, "token not found"); return token{ tok->id, @@ -170,7 +169,7 @@ instrument::token instrument::find_token_by_template(string instrument_template) auto hashtable = _tokens.get_index<"templatehash"_n>(); auto item = hashtable.find(hashStringToInt(instrument_template)); if (item == hashtable.end()) - eosio_assert(false, "instrument with given template not found"); + check(false, "instrument with given template not found"); return {item->id, item->owner, item->minted_by, @@ -220,8 +219,8 @@ void instrument::transfer_balances(name from, name to, uint64_t instrument_id, i { auto fromitr = _account.find(from.value); - eosio_assert(fromitr != _account.end(), "Sender account doesn't exists"); - eosio_assert(fromitr->balance > 0, "Sender account's balance is 0"); + check(fromitr != _account.end(), "Sender account doesn't exists"); + check(fromitr->balance > 0, "Sender account's balance is 0"); _account.modify(fromitr, same_payer, [&](auto &a) { a.balance -= amount; diff --git a/contracts/ore.rights_registry/ore.rights_registry.hpp b/contracts/ore.instrument/include/ore.rights_registry.hpp old mode 100644 new mode 100755 similarity index 89% rename from contracts/ore.rights_registry/ore.rights_registry.hpp rename to contracts/ore.instrument/include/ore.rights_registry.hpp index 602a962..8472868 --- a/contracts/ore.rights_registry/ore.rights_registry.hpp +++ b/contracts/ore.instrument/include/ore.rights_registry.hpp @@ -5,8 +5,8 @@ #pragma once #include -#include "eosiolib/eosio.hpp" -#include "../ore_types/ore_types.hpp" +#include +#include "ore.types.h" using namespace eosio; using namespace std; @@ -22,7 +22,7 @@ class [[eosio::contract("ore.rights_registry")]] rights_registry : public eosio: uint64_t id; string right_name; name owner; - vector urls; + vector urls; vector issuer_whitelist; uint64_t primary_key() const { return id; } @@ -35,7 +35,7 @@ class [[eosio::contract("ore.rights_registry")]] rights_registry : public eosio: public: right_registration_index _rights; - ACTION upsertright(name owner, string &right_name, vector urls, vector issuer_whitelist); + ACTION upsertright(name owner, string &right_name, vector urls, vector issuer_whitelist); ACTION deleteright(name owner, string &right_name); diff --git a/contracts/ore.instrument/include/ore.types.h b/contracts/ore.instrument/include/ore.types.h new file mode 100755 index 0000000..de9b22f --- /dev/null +++ b/contracts/ore.instrument/include/ore.types.h @@ -0,0 +1,78 @@ +#pragma once + +#include +#include + +using namespace std; +using namespace eosio; + +namespace oretypes { + struct args + { + string name; + string value; + }; + + // this struct is used to specify parameter_rules in an instrument + // for type such as required and locked, there is no value. Hence pass in an empty string as value. + struct param_type + { + string type; + vector values; + }; + + struct endpoint_url + { + string base_right; + string url; + string method; + vector matches_params; + uint64_t token_life_span; + bool is_default; + }; + + struct params + { + vector params; + }; + + struct url_params + { + vector url_params; + }; + + //right in instrument + struct right + { + string right_name; + string description; + string price_in_cpu; + vector additional_url_params; + }; + + //right in right registry + struct right_param + { + string right_name; + vector urls; + vector whitelist; + }; + + struct api_voucher_params + { + string right_name; + params additional_url_params; + }; + + struct offer_params + { + string right_name; + string right_description; + string right_price_in_cpu; + string api_name; + string api_description; + string api_price_in_cpu; + string api_payment_model; + string api_additional_url_params; + }; +} \ No newline at end of file diff --git a/contracts/ore.instrument/ore.instrument.cpp b/contracts/ore.instrument/src/ore.instrument.cpp old mode 100644 new mode 100755 similarity index 86% rename from contracts/ore.instrument/ore.instrument.cpp rename to contracts/ore.instrument/src/ore.instrument.cpp index 61f5fdc..14a36c0 --- a/contracts/ore.instrument/ore.instrument.cpp +++ b/contracts/ore.instrument/src/ore.instrument.cpp @@ -1,4 +1,4 @@ -#include "ore.instrument.hpp" +#include "../include/ore.instrument.hpp" using namespace eosio; /* @@ -23,8 +23,8 @@ ACTION instrument::mint(name minter, name owner, instrument_data instrument, // Checking if the minter has the required authorization require_auth(minter); - string msg = "owner account does not exist " + owner.to_string(); - eosio_assert(is_account(owner), msg.c_str()); + string msg = "owner account does not exist " + owner.to_string() + "[instrument.mint]"; + check(is_account(owner), msg.c_str()); // if an instrument_template name is passed-in, look from an instrument with the same name on the chain // ...if one exists, the new instrument will be a copy of that one @@ -34,7 +34,7 @@ ACTION instrument::mint(name minter, name owner, instrument_data instrument, if (instrument.rights.size() == 0) { - eosio_assert(false, "Right array is empty"); + check(false, "Right array is empty [instrument.mint]"); } // If instrumentId value passed as 0, next available primate key will be automatically assigned as instrumentId @@ -54,7 +54,7 @@ ACTION instrument::mint(name minter, name owner, instrument_data instrument, { auto institr = _tokens.find(instrumentId); // If an id value specified (other than 0) and the id already exists in the table, assertion will be thrown - eosio_assert(institr == _tokens.end(), "instrumentId exists!"); + check(institr == _tokens.end(), "instrumentId exists! [instrument.mint]"); } // ------- Copy an existing intstrument from a template @@ -151,7 +151,7 @@ ACTION instrument::createinst(name minter, name owner, uint64_t instrumentId, in _account.emplace(_self, [&](auto &a) { a.owner = owner; a.balance = 0; - print("new instrument account: ", a.primary_key(), "\n"); + print("new instrument account: ", a.primary_key(), " [instrument.createinst] \n"); }); accountitr = _account.find(owner.value); } @@ -165,7 +165,7 @@ ACTION instrument::createinst(name minter, name owner, uint64_t instrumentId, in a.id = instrumentId; a.owner = owner; a.minted_by = minter; - a.minted_at = now();; + a.minted_at = current_time_point().sec_since_epoch(); a.instrument = instrument; a.revoked = false; a.start_time = start_time; @@ -191,7 +191,7 @@ ACTION instrument::createinst(name minter, name owner, uint64_t instrumentId, in a.id = instrumentId; a.owner = owner; a.minted_by = a.minted_by; - a.minted_at = now(); + a.minted_at = current_time_point().sec_since_epoch(); a.instrument = instrument; a.revoked = false; a.start_time = start_time; @@ -227,8 +227,8 @@ ACTION instrument::checkright(name minter, name issuer, string rightname, uint64 { cancel_deferred(deferred_transaction_id); } - msg = "right:" + rightname + " doesn't exist"; - eosio_assert(rightitr.owner.value != 0, msg.c_str()); + msg = "right:" + rightname + " doesn't exist [instrument.checkright]"; + check(rightitr.owner.value != 0, msg.c_str()); } // check if the minter of the instrument is the issuer of the right @@ -244,7 +244,7 @@ ACTION instrument::checkright(name minter, name issuer, string rightname, uint64 cancel_deferred(deferred_transaction_id); } msg = "Attempt to create instrument with right: " + rightname + " by minter: " + minter.to_string() + " who isn't whitelisted or owner of right"; - eosio_assert(false, msg.c_str()); + check(false, msg.c_str()); } } @@ -261,7 +261,7 @@ ACTION instrument::checkright(name minter, name issuer, string rightname, uint64 cancel_deferred(deferred_transaction_id); } msg = "Attempt to create instrument with right: " + rightname + " by issuer: " + issuer.to_string() + " who isn't whitelisted or owner of right"; - eosio_assert(false, msg.c_str()); + check(false, msg.c_str()); } } } @@ -292,11 +292,11 @@ ACTION instrument::update(name updater, string instrument_template, instrument_d item = find_token_by_template(instrument_template); } - eosio_assert(item.owner == updater || item.minted_by == updater, "updater acccount doesn't have the authority to change start/emd time of the instrument"); + check(item.owner == updater || item.minted_by == updater, "updater acccount doesn't have the authority to change start/emd time of the instrument [instrument.update]"); - eosio_assert(item.revoked == false, "Token is already revoked"); + check(item.revoked == false, "Token is already revoked [instrument.update]"); - eosio_assert(item.instrument.mutability == 1 || item.instrument.mutability == 2, "the instrument to be updated is immutable"); + check(item.instrument.mutability == 1 || item.instrument.mutability == 2, "the instrument to be updated is immutable [instrument.update]"); rights_registry rights_contract("rights.ore"_n,"rights.ore"_n,_ds); @@ -391,14 +391,14 @@ ACTION instrument::transfer(name sender, name to, uint64_t instrument_id) //find token auto tokenitr = _tokens.find(instrument_id); - msg = "Instrument Id" + to_string(instrument_id) + "doesn't exist"; - eosio_assert(tokenitr != _tokens.end(), msg.c_str()); + msg = "Instrument Id" + to_string(instrument_id) + "doesn't exist [instrument.transfer]"; + check(tokenitr != _tokens.end(), msg.c_str()); - msg = "Sender account is not allowed to transfer the instrument " + sender.to_string(); - eosio_assert(tokenitr->owner == sender, msg.c_str()); + msg = "Sender account is not allowed to transfer the instrument " + sender.to_string() + " [instrument.transfer]"; + check(tokenitr->owner == sender, msg.c_str()); - msg = "Instrument Id " + to_string(instrument_id) + " has been previously revoked"; - eosio_assert(tokenitr->revoked == false, msg.c_str()); + msg = "Instrument Id " + to_string(instrument_id) + " has been previously revoked [instrument.transfer]"; + check(tokenitr->revoked == false, msg.c_str()); // transfer balance in the accounts table transfer_balances(sender, to, instrument_id); @@ -421,14 +421,14 @@ ACTION instrument::revoke(name revoker, uint64_t instrument_id) //Checking if the token exists. auto tokenitr = _tokens.find(instrument_id); - msg = "Instrument Id" + to_string(instrument_id) + "doesn't exist"; - eosio_assert(tokenitr != _tokens.end(), msg.c_str()); + msg = "Instrument Id" + to_string(instrument_id) + "doesn't exist [instrument.revoke]"; + check(tokenitr != _tokens.end(), msg.c_str()); - msg = "The account " + revoker.to_string() + "doesn't have authority to revoke the instrument"; - eosio_assert(tokenitr->owner == revoker, msg.c_str()); + msg = "The account " + revoker.to_string() + "doesn't have authority to revoke the instrument [instrument.revoke]"; + check(tokenitr->owner == revoker, msg.c_str()); - msg = "Instrument Id" + to_string(instrument_id) + "has been previously revoked"; - eosio_assert(tokenitr->revoked == false, msg.c_str()); + msg = "Instrument Id" + to_string(instrument_id) + "has been previously revoked [instrument.revoke]"; + check(tokenitr->revoked == false, msg.c_str()); _tokens.modify(tokenitr, same_payer, [&](auto &t) { t.revoked = true; @@ -449,14 +449,14 @@ ACTION instrument::burn(name burner, uint64_t instrument_id) // Checking if the token exists. auto tokenitr = _tokens.find(instrument_id); - msg = "Instrument Id" + to_string(instrument_id) + "doesn't exist"; - eosio_assert(tokenitr != _tokens.end(), msg.c_str()); + msg = "Instrument Id" + to_string(instrument_id) + "doesn't exist [instrument.burn]"; + check(tokenitr != _tokens.end(), msg.c_str()); - msg = "The account " + burner.to_string() + "doesn't have authority to burn the instrument"; - eosio_assert(tokenitr->owner == burner, msg.c_str()); + msg = "The account " + burner.to_string() + "doesn't have authority to burn the instrument [instrument.burn]"; + check(tokenitr->owner == burner, msg.c_str()); - msg = "Instrument Id" + to_string(instrument_id) + "is not mutable and cannot be burned."; - eosio_assert(tokenitr->instrument.mutability == 2, msg.c_str()); + msg = "Instrument Id" + to_string(instrument_id) + "is not mutable and cannot be burned [instrument.burn]"; + check(tokenitr->instrument.mutability == 2, msg.c_str()); transfer_balances(burner, same_payer, instrument_id); sub_balance(burner, asset(10000, symbol(symbol_code("OREINST"),4))); @@ -477,14 +477,14 @@ ACTION instrument::create(name issuer, // auto sym = "maximum_supply.symbol"; eosio::symbol sym = symbol(symbol_code("OREINST"),4); - eosio_assert(maximum_supply.symbol == sym, "symbol name must be ORINST"); - eosio_assert(sym.is_valid(), "invalid symbol name"); - eosio_assert(maximum_supply.is_valid(), "invalid supply"); - eosio_assert(maximum_supply.amount > 0, "max-supply must be positive"); + check(maximum_supply.symbol == sym, "symbol name must be ORINST [instrument.create]"); + check(sym.is_valid(), "invalid symbol name [instrument.create]"); + check(maximum_supply.is_valid(), "invalid supply [instrument.create]"); + check(maximum_supply.amount > 0, "max-supply must be positive [instrument.create]"); stats statstable(_self, sym.code().raw()); auto existing = statstable.find(sym.code().raw()); - eosio_assert(existing == statstable.end(), "token with symbol already exists"); + check(existing == statstable.end(), "token with symbol already exists [instrument.create]"); statstable.emplace(_self, [&](auto &s) { s.supply.symbol = sym; @@ -500,20 +500,20 @@ ACTION instrument::create(name issuer, ACTION instrument::issue(name to, asset quantity, string memo) { auto sym = quantity.symbol; - eosio_assert(sym.is_valid(), "invalid symbol name"); - eosio_assert(memo.size() <= 256, "memo has more than 256 bytes"); + check(sym.is_valid(), "invalid symbol name [instrument.issue]"); + check(memo.size() <= 256, "memo has more than 256 bytes [instrument.issue]"); stats statstable(_self, sym.code().raw()); auto existing = statstable.find(sym.code().raw()); - eosio_assert(existing != statstable.end(), "token with symbol does not exist, create token before issue"); + check(existing != statstable.end(), "token with symbol does not exist, create token before issue [instrument.issue]"); const auto &st = *existing; require_auth(st.issuer); - eosio_assert(quantity.is_valid(), "invalid quantity"); - eosio_assert(quantity.amount > 0, "must issue positive quantity"); + check(quantity.is_valid(), "invalid quantity [instrument.issue]"); + check(quantity.amount > 0, "must issue positive quantity [instrument.issue]"); - eosio_assert(quantity.symbol == st.supply.symbol, "symbol precision mismatch"); - eosio_assert(quantity.amount <= st.max_supply.amount - st.supply.amount, "quantity exceeds available supply"); + check(quantity.symbol == st.supply.symbol, "symbol precision mismatch [instrument.issue]"); + check(quantity.amount <= st.max_supply.amount - st.supply.amount, "quantity exceeds available supply [instrument.issue]"); statstable.modify(st, same_payer, [&](auto &s) { s.supply += quantity; @@ -537,7 +537,7 @@ void instrument::sub_balance(name owner, asset value) accounts from_acnts(_self, owner.value); const auto &from = from_acnts.get(value.symbol.code().raw(), "no balance object found"); - eosio_assert(from.balance.amount >= value.amount, "overdrawn balance"); + check(from.balance.amount >= value.amount, "overdrawn balance [instrument.sub_balance]"); if (from.balance.amount == value.amount) { diff --git a/contracts/ore.rights_registry/--url b/contracts/ore.rights_registry/--url deleted file mode 100644 index 413349a..0000000 --- a/contracts/ore.rights_registry/--url +++ /dev/null @@ -1,11 +0,0 @@ - - - - - Error 411 (Length Required)!!1 - - -

411. That’s an error. -

POST requests require a Content-length header. That’s all we know. diff --git a/contracts/ore.rights_registry/CMakeLists.txt b/contracts/ore.rights_registry/CMakeLists.txt new file mode 100755 index 0000000..a88339e --- /dev/null +++ b/contracts/ore.rights_registry/CMakeLists.txt @@ -0,0 +1,8 @@ +add_contract(ore.rights_registry ore.rights_registry ${CMAKE_CURRENT_SOURCE_DIR}/src/ore.rights_registry.cpp) +target_include_directories(ore.rights_registry.wasm + PUBLIC + ${CMAKE_CURRENT_SOURCE_DIR}/include) + +set_target_properties(ore.rights_registry.wasm + PROPERTIES + RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}") diff --git a/contracts/ore.rights_registry/include/ore.rights_registry.hpp b/contracts/ore.rights_registry/include/ore.rights_registry.hpp new file mode 100755 index 0000000..8472868 --- /dev/null +++ b/contracts/ore.rights_registry/include/ore.rights_registry.hpp @@ -0,0 +1,63 @@ +/** + * @file + * @copyright defined in eos/LICENSE.txt + */ +#pragma once +#include + +#include +#include "ore.types.h" + +using namespace eosio; +using namespace std; + +class [[eosio::contract("ore.rights_registry")]] rights_registry : public eosio::contract +{ + public: + using contract::contract; + rights_registry( name receiver, name code, datastream ds): contract(receiver, code, ds), _rights(receiver, receiver.value){} + + TABLE right_reg + { + uint64_t id; + string right_name; + name owner; + vector urls; + vector issuer_whitelist; + + uint64_t primary_key() const { return id; } + + EOSLIB_SERIALIZE(right_reg, (id)(right_name)(owner)(urls)(issuer_whitelist)) + }; + + typedef eosio::multi_index<"rights"_n, right_reg>right_registration_index; + + public: + right_registration_index _rights; + + ACTION upsertright(name owner, string &right_name, vector urls, vector issuer_whitelist); + + ACTION deleteright(name owner, string &right_name); + + inline static uint64_t hashStr(const string &strkey) + { + return hash{}(strkey); + } + + right_reg find_right_by_name(string right_name) + { + auto rightitr = _rights.find(hashStr(right_name)); + + if (rightitr == _rights.end()) + { + return right_reg{0}; + } + + return right_reg{ + rightitr->id, + rightitr->right_name, + rightitr->owner, + rightitr->urls, + rightitr->issuer_whitelist}; + } +}; \ No newline at end of file diff --git a/contracts/ore.rights_registry/include/ore.types.h b/contracts/ore.rights_registry/include/ore.types.h new file mode 100755 index 0000000..0d8ce00 --- /dev/null +++ b/contracts/ore.rights_registry/include/ore.types.h @@ -0,0 +1,78 @@ +#pragma once + +/*#include */ +#include + +using namespace std; +using namespace eosio; + +namespace oretypes { + struct args + { + string name; + string value; + }; + + // this struct is used to specify parameter_rules in an instrument + // for type such as required and locked, there is no value. Hence pass in an empty string as value. + struct param_type + { + string type; + vector values; + }; + + struct endpoint_url + { + string base_right; + string url; + string method; + vector matches_params; + uint64_t token_life_span; + bool is_default; + }; + + struct params + { + vector params; + }; + + struct url_params + { + vector url_params; + }; + + //right in instrument + struct right + { + string right_name; + string description; + string price_in_cpu; + vector additional_url_params; + }; + + //right in right registry + struct right_param + { + string right_name; + vector urls; + vector whitelist; + }; + + struct api_voucher_params + { + string right_name; + params additional_url_params; + }; + + struct offer_params + { + string right_name; + string right_description; + string right_price_in_cpu; + string api_name; + string api_description; + string api_price_in_cpu; + string api_payment_model; + string api_additional_url_params; + }; +} \ No newline at end of file diff --git a/contracts/ore.rights_registry/ore.rights_registry.cpp b/contracts/ore.rights_registry/src/ore.rights_registry.cpp old mode 100644 new mode 100755 similarity index 85% rename from contracts/ore.rights_registry/ore.rights_registry.cpp rename to contracts/ore.rights_registry/src/ore.rights_registry.cpp index 5d2c9d5..4984fe1 --- a/contracts/ore.rights_registry/ore.rights_registry.cpp +++ b/contracts/ore.rights_registry/src/ore.rights_registry.cpp @@ -1,9 +1,9 @@ -#include "ore.rights_registry.hpp" +#include "../include/ore.rights_registry.hpp" using namespace eosio; // transfer action -ACTION rights_registry::upsertright(name owner, string &right_name, vector urls, vector issuer_whitelist) +ACTION rights_registry::upsertright(name owner, string &right_name, vector urls, vector issuer_whitelist) { require_auth(owner); @@ -25,7 +25,7 @@ ACTION rights_registry::upsertright(name owner, string &right_name, vectorowner == owner, msg.c_str()); + check(itr->owner == owner, msg.c_str()); _rights.modify(itr, owner, [&](auto &end) { end.urls = urls; @@ -44,7 +44,7 @@ ACTION rights_registry::deleteright(name owner, string &right_name) string msg = "The right " + right_name + " doesn't exist "; - eosio_assert(itr != _rights.end(), msg.c_str()); + check(itr != _rights.end(), msg.c_str()); _rights.erase(itr); } diff --git a/contracts/ore.standard_token/CMakeLists.txt b/contracts/ore.standard_token/CMakeLists.txt new file mode 100755 index 0000000..ce701d8 --- /dev/null +++ b/contracts/ore.standard_token/CMakeLists.txt @@ -0,0 +1,8 @@ +add_contract(ore.standard_token ore.standard_token ${CMAKE_CURRENT_SOURCE_DIR}/src/ore.standard_token.cpp) +target_include_directories(ore.standard_token.wasm + PUBLIC + ${CMAKE_CURRENT_SOURCE_DIR}/include) + +set_target_properties(ore.standard_token.wasm + PROPERTIES + RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}") diff --git a/contracts/ore.standard_token/ore.standard_token.hpp b/contracts/ore.standard_token/include/ore.standard_token.hpp old mode 100644 new mode 100755 similarity index 85% rename from contracts/ore.standard_token/ore.standard_token.hpp rename to contracts/ore.standard_token/include/ore.standard_token.hpp index 2aa875f..53213e7 --- a/contracts/ore.standard_token/ore.standard_token.hpp +++ b/contracts/ore.standard_token/include/ore.standard_token.hpp @@ -4,8 +4,8 @@ */ #pragma once -#include "eosiolib/asset.hpp" -#include "eosiolib/eosio.hpp" +#include "eosio/asset.hpp" +#include "eosio/eosio.hpp" #include @@ -19,7 +19,7 @@ namespace eosio using std::string; -class[[eosio::contract("ore.standard_token")]] token : public contract +class[[eosio::contract("ore.standard_token")]] oretoken : public contract { public: using contract::contract; @@ -103,15 +103,15 @@ class[[eosio::contract("ore.standard_token")]] token : public contract }; }; -void token::set_allowance(name from, name to, asset quantity, bool increment) +void oretoken::set_allowance(name from, name to, asset quantity, bool increment) { auto sym = quantity.symbol.code(); stats statstable(_self, sym.raw()); const auto &st = statstable.get(sym.raw()); - eosio_assert(quantity.is_valid(), "invalid quantity"); - eosio_assert(quantity.amount >= 0, "must transfer positive quantity"); - eosio_assert(quantity.symbol == st.supply.symbol, "symbol precision mismatch"); + check(quantity.is_valid(), "invalid quantity"); + check(quantity.amount >= 0, "must transfer positive quantity"); + check(quantity.symbol == st.supply.symbol, "symbol precision mismatch"); name key = to; @@ -137,13 +137,13 @@ void token::set_allowance(name from, name to, asset quantity, bool increment) } } -asset token::allowance_of(name from, name to) +asset oretoken::allowance_of(name from, name to) { _allowances allowances(_self, from.value); auto allowanceitr = allowances.find(to.value); - eosio_assert(allowanceitr != allowances.end(), "no allowance approved for this account"); + check(allowanceitr != allowances.end(), "no allowance approved for this account"); return allowanceitr->quantity; } diff --git a/contracts/ore.standard_token/ore.standard_token.cpp b/contracts/ore.standard_token/src/ore.standard_token.cpp old mode 100644 new mode 100755 similarity index 56% rename from contracts/ore.standard_token/ore.standard_token.cpp rename to contracts/ore.standard_token/src/ore.standard_token.cpp index 2d70bd6..a164b13 --- a/contracts/ore.standard_token/ore.standard_token.cpp +++ b/contracts/ore.standard_token/src/ore.standard_token.cpp @@ -13,24 +13,24 @@ * in the implementation of the same functions in ore.instrument contract. */ -#include "ore.standard_token.hpp" +#include "../include/ore.standard_token.hpp" namespace eosio { -ACTION token::create(name issuer, - asset maximum_supply) +ACTION oretoken::create(name issuer, + asset maximum_supply) { require_auth(_self); auto sym = maximum_supply.symbol; - eosio_assert(sym.is_valid(), "invalid symbol name"); - eosio_assert(maximum_supply.is_valid(), "invalid supply"); - eosio_assert(maximum_supply.amount > 0, "max-supply must be positive"); + check(sym.is_valid(), "invalid symbol name"); + check(maximum_supply.is_valid(), "invalid supply"); + check(maximum_supply.amount > 0, "max-supply must be positive"); stats statstable(_self, sym.code().raw()); auto existing = statstable.find(sym.code().raw()); - eosio_assert(existing == statstable.end(), "token with symbol already exists"); + check(existing == statstable.end(), "token with symbol already exists"); statstable.emplace(_self, [&](auto &s) { s.supply.symbol = maximum_supply.symbol; @@ -40,35 +40,35 @@ ACTION token::create(name issuer, } // The approve action is called by "from" account to authorize "to" account to call the transferfrom function on it's behalf -ACTION token::approve(name from, name to, asset quantity, string memo) +ACTION oretoken::approve(name from, name to, asset quantity, string memo) { require_auth(from); accounts from_acnts(_self, from.value); const auto &from_account = from_acnts.get(quantity.symbol.code().raw(), "no balance object found"); - eosio_assert(from_account.balance.amount >= quantity.amount, "amount being approved is more than the balance of the approver account"); + check(from_account.balance.amount >= quantity.amount, "amount being approved is more than the balance of the approver account"); set_allowance(from, to, quantity, true); } -ACTION token::issue(name to, asset quantity, string memo) +ACTION oretoken::issue(name to, asset quantity, string memo) { auto sym = quantity.symbol; - eosio_assert(sym.is_valid(), "invalid symbol name"); - eosio_assert(memo.size() <= 256, "memo has more than 256 bytes"); + check(sym.is_valid(), "invalid symbol name"); + check(memo.size() <= 256, "memo has more than 256 bytes"); stats statstable(_self, sym.code().raw()); auto existing = statstable.find(sym.code().raw()); - eosio_assert(existing != statstable.end(), "token with symbol does not exist, create token before issue"); + check(existing != statstable.end(), "token with symbol does not exist, create token before issue"); const auto &st = *existing; require_auth(st.issuer); - eosio_assert(quantity.is_valid(), "invalid quantity"); - eosio_assert(quantity.amount > 0, "must issue positive quantity"); + check(quantity.is_valid(), "invalid quantity"); + check(quantity.amount > 0, "must issue positive quantity"); - eosio_assert(quantity.symbol == st.supply.symbol, "symbol precision mismatch"); - eosio_assert(quantity.amount <= st.max_supply.amount - st.supply.amount, "quantity exceeds available supply"); + check(quantity.symbol == st.supply.symbol, "symbol precision mismatch"); + check(quantity.amount <= st.max_supply.amount - st.supply.amount, "quantity exceeds available supply"); statstable.modify(st, same_payer, [&](auto &s) { s.supply += quantity; @@ -80,24 +80,24 @@ ACTION token::issue(name to, asset quantity, string memo) { SEND_INLINE_ACTION(*this, transfer, {st.issuer, "active"_n}, {st.issuer, to, quantity, memo}); } -} +} // namespace eosio -ACTION token::retire(asset quantity, string memo) +ACTION oretoken::retire(asset quantity, string memo) { auto sym = quantity.symbol; - eosio_assert(sym.is_valid(), "invalid symbol name"); - eosio_assert(memo.size() <= 256, "memo has more than 256 bytes"); + check(sym.is_valid(), "invalid symbol name"); + check(memo.size() <= 256, "memo has more than 256 bytes"); stats statstable(_self, sym.code().raw()); auto existing = statstable.find(sym.code().raw()); - eosio_assert(existing != statstable.end(), "token with symbol does not exist"); + check(existing != statstable.end(), "token with symbol does not exist"); const auto &st = *existing; require_auth(st.issuer); - eosio_assert(quantity.is_valid(), "invalid quantity"); - eosio_assert(quantity.amount > 0, "must retire positive quantity"); + check(quantity.is_valid(), "invalid quantity"); + check(quantity.amount > 0, "must retire positive quantity"); - eosio_assert(quantity.symbol == st.supply.symbol, "symbol precision mismatch"); + check(quantity.symbol == st.supply.symbol, "symbol precision mismatch"); statstable.modify(st, same_payer, [&](auto &s) { s.supply -= quantity; @@ -106,14 +106,14 @@ ACTION token::retire(asset quantity, string memo) sub_balance(st.issuer, quantity); } -ACTION token::transfer(name from, - name to, - asset quantity, - string memo) +ACTION oretoken::transfer(name from, + name to, + asset quantity, + string memo) { - eosio_assert(from != to, "cannot transfer to self"); + check(from != to, "cannot transfer to self"); require_auth(from); - eosio_assert(is_account(to), "to account does not exist"); + check(is_account(to), "to account does not exist"); auto sym = quantity.symbol.code(); stats statstable(_self, sym.raw()); const auto &st = statstable.get(sym.raw()); @@ -121,10 +121,10 @@ ACTION token::transfer(name from, require_recipient(from); require_recipient(to); - eosio_assert(quantity.is_valid(), "invalid quantity"); - eosio_assert(quantity.amount > 0, "must transfer positive quantity"); - eosio_assert(quantity.symbol == st.supply.symbol, "symbol precision mismatch"); - eosio_assert(memo.size() <= 256, "memo has more than 256 bytes"); + check(quantity.is_valid(), "invalid quantity"); + check(quantity.amount > 0, "must transfer positive quantity"); + check(quantity.symbol == st.supply.symbol, "symbol precision mismatch"); + check(memo.size() <= 256, "memo has more than 256 bytes"); auto payer = has_auth(to) ? to : from; @@ -133,18 +133,18 @@ ACTION token::transfer(name from, } // This action is called by the approved "sender" account on behalf of the "from" account to transfer "quantity" to "to" account -ACTION token::transferfrom(name sender, name from, name to, asset quantity, string memo) +ACTION oretoken::transferfrom(name sender, name from, name to, asset quantity, string memo) { require_auth(sender); - auto allowance = token::allowance_of(from, sender); + auto allowance = oretoken::allowance_of(from, sender); print("The approved account ", name{sender}); print(" is transferring ", quantity); print(" from ", name{from}); print(" to ", name{to}); - eosio_assert(allowance.amount >= quantity.amount, "the amount being transferred is more than the approved amount"); + check(allowance.amount >= quantity.amount, "the amount being transferred is more than the approved amount"); add_balance(to, quantity, sender); sub_balance_from(sender, from, quantity); @@ -153,12 +153,12 @@ ACTION token::transferfrom(name sender, name from, name to, asset quantity, stri } // eosio.token standard sub_balance function -void token::sub_balance(name owner, asset value) +void oretoken::sub_balance(name owner, asset value) { accounts from_acnts(_self, owner.value); const auto &from = from_acnts.get(value.symbol.code().raw(), "no balance object found"); - eosio_assert(from.balance.amount >= value.amount, "overdrawn balance"); + check(from.balance.amount >= value.amount, "overdrawn balance"); { from_acnts.modify(from, owner, [&](auto &a) { @@ -168,19 +168,19 @@ void token::sub_balance(name owner, asset value) } // It is used by transfer_from account to specify the RAM payer as the "sender" account and not the "owner" account as in the sub_balance function -void token::sub_balance_from(name sender, name owner, asset value) +void oretoken::sub_balance_from(name sender, name owner, asset value) { accounts from_acnts(_self, owner.value); const auto &from = from_acnts.get(value.symbol.code().raw(), "no balance object found"); - eosio_assert(from.balance.amount >= value.amount, "overdrawn balance"); + check(from.balance.amount >= value.amount, "overdrawn balance"); from_acnts.modify(from, sender, [&](auto &a) { a.balance -= value; }); } -void token::add_balance(name owner, asset value, name ram_payer) +void oretoken::add_balance(name owner, asset value, name ram_payer) { accounts to_acnts(_self, owner.value); auto to = to_acnts.find(value.symbol.code().raw()); @@ -198,7 +198,7 @@ void token::add_balance(name owner, asset value, name ram_payer) } } -ACTION token::open(name owner, const symbol &symbol, name ram_payer) +ACTION oretoken::open(name owner, const symbol &symbol, name ram_payer) { require_auth(ram_payer); @@ -206,7 +206,7 @@ ACTION token::open(name owner, const symbol &symbol, name ram_payer) stats statstable(_self, sym_code_raw); const auto &st = statstable.get(sym_code_raw, "symbol does not exist"); - eosio_assert(st.supply.symbol == symbol, "symbol precision mismatch"); + check(st.supply.symbol == symbol, "symbol precision mismatch"); accounts acnts(_self, owner.value); auto it = acnts.find(sym_code_raw); @@ -218,16 +218,16 @@ ACTION token::open(name owner, const symbol &symbol, name ram_payer) } } -ACTION token::close(name owner, const symbol &symbol) +ACTION oretoken::close(name owner, const symbol &symbol) { require_auth(owner); accounts acnts(_self, owner.value); auto it = acnts.find(symbol.code().raw()); - eosio_assert(it != acnts.end(), "Balance row already deleted or never existed. Action won't have any effect."); - eosio_assert(it->balance.amount == 0, "Cannot close because the balance is not zero."); + check(it != acnts.end(), "Balance row already deleted or never existed. Action won't have any effect."); + check(it->balance.amount == 0, "Cannot close because the balance is not zero."); acnts.erase(it); } } // namespace eosio -EOSIO_DISPATCH( eosio::token, (create)(issue)(transfer)(approve)(transferfrom)(open)(close)(retire)) \ No newline at end of file +EOSIO_DISPATCH(eosio::oretoken, (create)(issue)(transfer)(approve)(transferfrom)(open)(close)(retire)) \ No newline at end of file diff --git a/contracts/ore.system/CMakeLists.txt b/contracts/ore.system/CMakeLists.txt new file mode 100755 index 0000000..0ccfe44 --- /dev/null +++ b/contracts/ore.system/CMakeLists.txt @@ -0,0 +1,8 @@ +add_contract(ore.system ore.system ${CMAKE_CURRENT_SOURCE_DIR}/src/ore.system.cpp) +target_include_directories(ore.system.wasm + PUBLIC + ${CMAKE_CURRENT_SOURCE_DIR}/include) + +set_target_properties(ore.system.wasm + PROPERTIES + RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}") diff --git a/contracts/ore.system/include/accounts.h b/contracts/ore.system/include/accounts.h new file mode 100755 index 0000000..4be2842 --- /dev/null +++ b/contracts/ore.system/include/accounts.h @@ -0,0 +1,36 @@ +#pragma once + +#include + +using namespace eosio; +namespace accounts { + + struct permission_level_weight { + permission_level permission; + uint16_t weight; + }; + + struct key_weight { + eosio::public_key key; + uint16_t weight; + }; + + struct wait_weight { + uint32_t wait_sec; + uint16_t weight; + }; + + struct authority { + uint32_t threshold = 0; + std::vector keys; + std::vector accounts; + std::vector waits; + }; + + struct newaccount { + name creator; + name name; + authority owner; + authority active; + }; +} diff --git a/contracts/ore.system/include/common.h b/contracts/ore.system/include/common.h new file mode 100755 index 0000000..d649d03 --- /dev/null +++ b/contracts/ore.system/include/common.h @@ -0,0 +1,188 @@ +#pragma once + +#include +//#include +#include + +using namespace eosio; +using std::string; +using std::vector; + +namespace common +{ + static const symbol S_RAM = symbol("RAMCORE", 4); + static const symbol core_symbol = symbol("SYS", 4); + static const symbol ore_symbol = symbol("ORE", 4); + static const name ore_system = name("oresystem"); + + /**********************************************/ + /*** ***/ + /*** RAM calculations ***/ + /*** ***/ + /**********************************************/ + + struct rammarket + { + asset supply; + + struct connector + { + asset balance; + double weight = .5; + }; + + connector base; + connector quote; + + uint64_t primary_key() const { return supply.symbol.raw(); } + }; + + typedef eosio::multi_index<"rammarket"_n, rammarket> RamInfo; + + struct blockchain_parameters { + uint64_t max_block_net_usage; + uint32_t target_block_net_usage_pct; + uint32_t max_transaction_net_usage; + uint32_t base_per_transaction_net_usage; + uint32_t net_usage_leeway; + uint32_t context_free_discount_net_usage_num; + uint32_t context_free_discount_net_usage_den; + uint32_t max_block_cpu_usage; + uint32_t target_block_cpu_usage_pct; + uint32_t max_transaction_cpu_usage; + uint32_t min_transaction_cpu_usage; + uint32_t max_transaction_lifetime; + uint32_t deferred_trx_expiration_window; + uint32_t max_transaction_delay; + uint32_t max_inline_action_size; + uint16_t max_inline_action_depth; + uint16_t max_authority_depth; + }; + + struct [[eosio::table("global"), eosio::contract("eosio.system")]] eosio_global_state : blockchain_parameters { + uint64_t free_ram()const { return max_ram_size - total_ram_bytes_reserved; } + + uint64_t max_ram_size = 64ll*1024 * 1024 * 1024; + uint64_t total_ram_bytes_reserved = 0; + int64_t total_ram_stake = 0; + + block_timestamp last_producer_schedule_update; + time_point last_pervote_bucket_fill; + int64_t pervote_bucket = 0; + int64_t perblock_bucket = 0; + uint32_t total_unpaid_blocks = 0; /// all blocks which have been produced but not paid + int64_t total_activated_stake = 0; + time_point thresh_activated_stake_time; + uint16_t last_producer_schedule_size = 0; + double total_producer_vote_weight = 0; /// the sum of all producer votes + block_timestamp last_name_close; + }; + typedef eosio::singleton<"global"_n, eosio_global_state> global; + + /*** + * Returns the price of ram for given bytes + */ + + asset getRamCost(uint64_t ram_bytes) + { + RamInfo ramInfo(name("eosio"), name("eosio").value); + auto ramData = ramInfo.find(S_RAM.raw()); + symbol coreSymbol = core_symbol; + check(ramData != ramInfo.end(), "Could not get RAM info"); + + uint64_t base = ramData->base.balance.amount; + uint64_t quote = ramData->quote.balance.amount; + return asset((((double)quote / base)) * ram_bytes, coreSymbol); + } + + float getRamUtilization() + { + global gtable(name("eosio"), name("eosio").value); + eosio_global_state _gstate = gtable.get(); + return (float)_gstate.total_ram_bytes_reserved / (float)_gstate.max_ram_size; + } + + struct user_resources + { + name owner; + asset net_weight; + asset cpu_weight; + int64_t ram_bytes = 0; + + bool is_empty() const { return net_weight.amount == 0 && cpu_weight.amount == 0 && ram_bytes == 0; } + uint64_t primary_key() const { return owner.value; } + }; + + typedef eosio::multi_index<"userres"_n, user_resources> user_resources_table; + + asset getAccountCpu(name account) + { + user_resources_table _userres(name("eosio"), account.value); + auto res_itr = _userres.find(account.value); + return res_itr->cpu_weight; + } + asset getAccountNet(name account) + { + user_resources_table _userres(name("eosio"), account.value); + auto res_itr = _userres.find(account.value); + return res_itr->net_weight; + } + uint64_t getAccountRamBytes(name account) + { + user_resources_table _userres(name("eosio"), account.value); + auto res_itr = _userres.find(account.value); + return res_itr->ram_bytes; + } + + struct account + { + asset balance; + + uint64_t primary_key() const { return balance.symbol.code().raw(); } + }; + typedef eosio::multi_index<"accounts"_n, account> balance_table; + + asset getSYSBalance(name account) + { + balance_table _balance(name("eosio.token"), account.value); + auto balance_itr = _balance.find(core_symbol.code().raw()); + if (balance_itr == _balance.end()) + { + return asset(0, core_symbol); + } + else + { + return balance_itr->balance; + } + } + + struct [[eosio::table]] stake_info + { + asset amount; + name staker; + + uint64_t primary_key() const { return amount.symbol.code().raw(); } + }; + typedef eosio::multi_index<"stakeinfo"_n, stake_info> stakeinfo; + + name getStakerName(name account){ + stakeinfo _info(name("eosio.token"), account.value); + auto stake_itr = _info.find(ore_symbol.code().raw()); + if(stake_itr == _info.end()){ + return name(""); + } else { + return stake_itr->staker; + } + } + + asset getStakedAmount(name account){ + stakeinfo _info(name("eosio.token"), account.value); + auto stake_itr = _info.find(ore_symbol.code().raw()); + if(stake_itr == _info.end()){ + return asset(0, ore_symbol); + } else { + return stake_itr->amount; + } + } + +}; // namespace common \ No newline at end of file diff --git a/contracts/ore.system/include/ore.system.hpp b/contracts/ore.system/include/ore.system.hpp new file mode 100755 index 0000000..10c5279 --- /dev/null +++ b/contracts/ore.system/include/ore.system.hpp @@ -0,0 +1,122 @@ +#include +#include +#include +#include "eosio/transaction.hpp" +#include "accounts.h" +#include "common.h" +using namespace eosio; +using namespace std; +using namespace accounts; +using namespace common; +class [[eosio::contract("ore.system")]] oresystem : public contract +{ +private: + TABLE prices + { + name pricename; + asset price; + uint64_t primary_key() const { return pricename.value; } + EOSLIB_SERIALIZE(prices, (pricename)(price)) + }; + typedef eosio::multi_index<"pricetable"_n, prices> pricetable; + + TABLE tiers + { + uint64_t key; + uint64_t ramfactor; // an integer value that represents a float number with 4 decimals ( eg. 10000 = 1.0000) + uint64_t rambytes; // initial amount of ram + asset netamount; // initial amount of net + asset cpuamount; // initial amount of cpu + + uint64_t primary_key() const { return key; } + EOSLIB_SERIALIZE(tiers, (key)(ramfactor)(rambytes)(netamount)(cpuamount)) + }; + typedef eosio::multi_index<"tiertable"_n, tiers> tiertable; + + TABLE tierinfo + { + uint64_t pricekey; + asset createprice; + + uint64_t primary_key() const { return pricekey; } + EOSLIB_SERIALIZE(tierinfo, (pricekey)(createprice)) + }; + + // May be erased when incentive is paid to referral account. + TABLE reflog + { + name referral; + name newaccount; + + uint64_t primary_key() const { return newaccount.value; } + EOSLIB_SERIALIZE(reflog, (referral)(newaccount)) + }; + + + TABLE refstats + { + uint64_t pricekey; + uint64_t count; + + uint64_t primary_key() const { return pricekey; } + EOSLIB_SERIALIZE(refstats, (pricekey)(count)) + }; + + /** + * Check Network Utilization < Emergency Threshold (%80) + * if threshold is exceeded increase the price exponentially + * IMPORTANT: emergency phase prices are temporary + * After upgraderam() is triggered and utilization normalizes back to < %50 + * stakers will be able to get refund for the extra amount they paid during emergency phase + */ + asset getPrice(name pricename) { + auto priceitr = _prices.find(pricename.value); + check(priceitr != _prices.end(), "No price found [oresystem.getPrice]"); + asset price; + float utilization = getRamUtilization(); + if(utilization < emergency_threshold ) { + price = priceitr->price; + } else { + price = priceitr->price; + price.amount = (uint64_t)(price.amount / ( 1 - ((utilization - emergency_threshold ) / (1.0F - emergency_threshold)))); + } + return price; + } + +public: + using contract::contract; + oresystem(name receiver, name code, datastream ds) + : contract(receiver, code, ds), _prices(receiver, receiver.value), _tiers(receiver, receiver.value) {} + + ACTION migrate(); + ACTION setprice(name pricename, asset price); + ACTION settier(uint64_t key, uint64_t ramfactor, uint64_t rambytes, asset netamount, asset cpuamount); + ACTION createoreacc(name creator, + name newname, + public_key &ownerkey, + public_key &activekey, + uint64_t tier, + name referral); + ACTION chgacctier(name payer, name account, uint64_t tier); + + ACTION createtoken(const name& payer, const asset& maximum_supply); + + pricetable _prices; + tiertable _tiers; + + typedef eosio::multi_index<"tierinfo"_n, tierinfo> tierinfotable; + typedef eosio::multi_index<"reflog"_n, reflog> referrallogtable; + typedef eosio::multi_index<"refstats"_n, refstats> referralstatstable; + + //possibly different accounts that has different uses + static constexpr name minimal_account_price{"minimalaccnt"_n}; + static constexpr name token_account{"eosio.token"_n}; + static constexpr name ore_system{"system.ore"_n}; + static constexpr name ore_lock{"lock.ore"_n}; + static constexpr name sys_lock{"lock.ore"_n}; + static constexpr name sys_payer{"system.ore"_n}; + static constexpr symbol ore_symbol = symbol(symbol_code("ORE"), 4); + static constexpr symbol sys_symbol = symbol(symbol_code("SYS"), 4); + + static constexpr float emergency_threshold = 0.8; +}; \ No newline at end of file diff --git a/contracts/ore.system/src/ore.system.cpp b/contracts/ore.system/src/ore.system.cpp new file mode 100755 index 0000000..59c6b70 --- /dev/null +++ b/contracts/ore.system/src/ore.system.cpp @@ -0,0 +1,372 @@ +#include "ore.system.hpp" + +// Migration +ACTION oresystem::migrate() +{ + require_auth(_self); + while(_prices.begin() != _prices.end()) { + _prices.erase(_prices.begin()); + } + auto priceitr = _prices.begin(); + check(priceitr == _prices.end(), "pricetable has to be empty for migration [oresystem.migrate]"); + auto tieritr = _tiers.begin(); + check(tieritr == _tiers.end(), "tiertable has to be empty for migration [oresystem.migrate]"); + + _prices.emplace(_self, [&](auto &p) { + p.pricename = minimal_account_price; + p.price = asset(100000, symbol(symbol_code("ORE"), 4)); + }); + + _tiers.emplace(_self, [&](auto &t) { + t.key = 1; + t.ramfactor = 10000; + t.rambytes = 4070; + t.netamount = asset(0, symbol(symbol_code("ORE"), 4)); + t.cpuamount = asset(0, symbol(symbol_code("ORE"), 4)); + }); +} + +// Setting or updating a price of an entity that can be bought on chain (i.e. accounts, instruments, tokens) +ACTION oresystem::setprice(name pricename, asset price) +{ + require_auth(_self); + + auto priceitr = _prices.find(pricename.value); + + if (priceitr == _prices.end()) + { + _prices.emplace(_self, [&](auto &p) { + p.pricename = pricename; + p.price = price; + }); + } + else + { + _prices.modify(priceitr, _self, [&](auto &p) { + p.price = price; + }); + } +} + +// Setting or updating a price of an entity that can be bought on chain (i.e. accounts, instruments, tokens) +ACTION oresystem::settier(uint64_t key, uint64_t ramfactor, uint64_t rambytes, asset netamount, asset cpuamount) +{ + require_auth(_self); + + auto tieritr = _tiers.find(key); + + if (tieritr == _tiers.end()) + { + _tiers.emplace(_self, [&](auto &t) { + t.key = key; + t.ramfactor = ramfactor; + t.rambytes = rambytes; + t.netamount = netamount; + t.cpuamount = cpuamount; + }); + } + else + { + _tiers.modify(tieritr, _self, [&](auto &t) { + t.ramfactor = ramfactor; + t.rambytes = rambytes; + t.netamount = netamount; + t.cpuamount = cpuamount; + }); + } +} + +ACTION oresystem::createoreacc(name creator, + name newname, + public_key &ownerkey, + public_key &activekey, + uint64_t tier, + name referral) +{ + require_auth(creator); + authority ownerauth{.threshold = 1, .keys = {key_weight{ownerkey, 1}}, .accounts = {}, .waits = {}}; + authority activeauth{.threshold = 1, .keys = {key_weight{activekey, 1}}, .accounts = {}, .waits = {}}; + + auto tieritr = _tiers.find(tier); + check(tieritr != _tiers.end(), "No tier found [oresystem.createoreacc]"); + + asset createprice = getPrice(minimal_account_price); + // Calculate createprice from minimal account price and tier requirements + createprice.amount = uint64_t((createprice.amount * tieritr->ramfactor) / 10000) + tieritr->netamount.amount + tieritr->cpuamount.amount; + + tierinfotable _tierinfo(_self, newname.value); + _tierinfo.emplace(_self, [&](auto &ti) { + ti.pricekey = tier; + ti.createprice = createprice; + }); + + if (referral != name("")) + { + referralstatstable _stats(_self, referral.value); + auto statsitr = _stats.find(tier); + + if (statsitr != _stats.end()) + { + _stats.modify(statsitr, _self, [&](auto &s) { + s.count += 1; + }); + } + else + { + _stats.emplace(_self, [&](auto &s) { + s.pricekey = tier; + s.count = 1; + }); + } + + referrallogtable _log(_self, _self.value); + _log.emplace(_self, [&](auto &l) { + l.newaccount = newname; + l.referral = referral; + }); + } + + action( + permission_level{get_self(), "active"_n}, + "eosio.token"_n, + "stake"_n, + make_tuple(creator, newname, createprice, std::string("ore staked"))) + .send(); + //*** + accounts::newaccount new_account = accounts::newaccount{ + .creator = sys_payer, + .name = newname, + .owner = ownerauth, + .active = activeauth}; + + action( + permission_level{sys_payer, "active"_n}, + "eosio"_n, + "newaccount"_n, + new_account) + .send(); + + action( + permission_level{sys_payer, "active"_n}, + "eosio"_n, + name("buyrambytes"), + make_tuple(sys_payer, newname, tieritr->rambytes)) + .send(); + + asset sys_stake_net, sys_stake_cpu; + sys_stake_net.amount = tieritr->netamount.amount; + sys_stake_cpu.amount = tieritr->cpuamount.amount; + sys_stake_net.symbol = sys_symbol; + sys_stake_cpu.symbol = sys_symbol; + if(sys_stake_net.amount > 0 || sys_stake_cpu.amount > 0) { + action( + permission_level{sys_payer, "active"_n}, + "eosio"_n, + name("delegatebw"), + make_tuple(sys_payer, newname, sys_stake_net, sys_stake_cpu, false)) + .send(); + } +} + + +ACTION oresystem::chgacctier(name payer, name account, uint64_t tier) +{ + require_auth(payer); + + auto newTierItr = _tiers.find(tier); + asset newprice = getPrice(minimal_account_price); + newprice.amount = uint64_t((newprice.amount * newTierItr->ramfactor) / 100) + newTierItr->netamount.amount + newTierItr->cpuamount.amount; + + asset currentCpu = getAccountCpu(account); + asset currentNet = getAccountNet(account); + uint64_t currentRambytes = getAccountRamBytes(account); + + asset cpuNetDelta; + cpuNetDelta.symbol = core_symbol; + uint64_t ramDelta; + if (newTierItr->cpuamount.amount > currentCpu.amount) + { + cpuNetDelta.amount = newTierItr->cpuamount.amount - currentCpu.amount; + action( + permission_level{sys_payer, "active"_n}, + "eosio"_n, + name("delegatebw"), + make_tuple(sys_payer, account, asset(0, core_symbol), cpuNetDelta, false)) + .send(); + } + else if (newTierItr->cpuamount.amount < currentCpu.amount) + { + cpuNetDelta.amount = currentCpu.amount - newTierItr->cpuamount.amount; + action( + permission_level{sys_payer, "active"_n}, + "eosio"_n, + name("undelegatebw"), + make_tuple(sys_payer, account, asset(0, core_symbol), cpuNetDelta)) + .send(); + } + if (newTierItr->netamount.amount > currentNet.amount) + { + cpuNetDelta.amount = newTierItr->netamount.amount - currentNet.amount; + action( + permission_level{sys_payer, "active"_n}, + "eosio"_n, + name("delegatebw"), + make_tuple(sys_payer, account, cpuNetDelta, asset(0, core_symbol), false)) + .send(); + } + else if (newTierItr->netamount.amount < currentNet.amount) + { + cpuNetDelta.amount = currentNet.amount - newTierItr->netamount.amount; + action( + permission_level{sys_payer, "active"_n}, + "eosio"_n, + name("undelegatebw"), + make_tuple(sys_payer, account, cpuNetDelta, asset(0, core_symbol))) + .send(); + } + if (newTierItr->rambytes > (currentRambytes + 14)) + { + ramDelta = newTierItr->rambytes - currentRambytes; + action( + permission_level{sys_payer, "active"_n}, + "eosio"_n, + name("buyrambytes"), + make_tuple(sys_payer, account, ramDelta)) + .send(); + } + else if ((newTierItr->rambytes + 14) < currentRambytes) + { + ramDelta = currentRambytes - newTierItr->rambytes; + action( + permission_level{sys_payer, "active"_n}, + "eosio"_n, + name("sellram"), + make_tuple(account, ramDelta)) + .send(); + } + asset orePriceDelta; + asset sysUsageDelta; + tierinfotable _tierinfo(_self, account.value); + auto oldTierInfoItr = _tierinfo.begin(); + name oldStaker = getStakerName(account); + if (oldTierInfoItr == _tierinfo.end()) + { + action( + permission_level{ore_system, "active"_n}, + "eosio.token"_n, + "stake"_n, + make_tuple(payer, account, newprice, std::string("ore staked"))) + .send(); + } + else if (oldStaker == name("")) + { + check(tier == oldTierInfoItr->pricekey, "This account needs to be migrated first. Call changetier with same tier. [oresystem.chgacctier]"); + action( + permission_level{ore_system, "active"_n}, + "eosio.token"_n, + "stake"_n, + make_tuple(payer, account, newprice, std::string("ore staked"))) + .send(); + if(ore_lock != payer) { + action( + permission_level{ore_lock, "active"_n}, + "eosio.token"_n, + "transfer"_n, + make_tuple(ore_lock, payer, oldTierInfoItr->createprice, std::string("ore unlocked - (migration)"))) + .send(); + } + _tierinfo.erase(oldTierInfoItr); + } + else + { + if (newprice > oldTierInfoItr->createprice) + { + if (oldStaker == payer) + { + orePriceDelta = newprice - oldTierInfoItr->createprice; + action( + permission_level{ore_system, "active"_n}, + "eosio.token"_n, + "stake"_n, + make_tuple(payer, account, orePriceDelta, std::string("ore staked"))) + .send(); + } + else + { + action( + permission_level{ore_system, "active"_n}, + "eosio.token"_n, + "unstake"_n, + make_tuple(oldStaker, account, oldTierInfoItr->createprice, std::string("ore unstaked"))) + .send(); + + action( + permission_level{ore_system, "active"_n}, + "eosio.token"_n, + "stake"_n, + make_tuple(payer, account, newprice, std::string("ore staked"))) + .send(); + } + } + else if (newprice < oldTierInfoItr->createprice) + { + check(payer == account, "To downgrade tier, payer has to be owner [oresystem.chgacctier]"); + if (oldStaker == account) + { + orePriceDelta = oldTierInfoItr->createprice - newprice; + action( + permission_level{ore_system, "active"_n}, + "eosio.token"_n, + "unstake"_n, + make_tuple(payer, account, orePriceDelta, std::string("ore unstaked"))) + .send(); + } + else + { + action( + permission_level{ore_system, "active"_n}, + "eosio.token"_n, + "unstake"_n, + make_tuple(oldStaker, account, oldTierInfoItr->createprice, std::string("ore unstaked"))) + .send(); + + action( + permission_level{ore_system, "active"_n}, + "eosio.token"_n, + "stake"_n, + make_tuple(account, account, newprice, std::string("ore staked"))) + .send(); + } + } + _tierinfo.erase(oldTierInfoItr); + } + + _tierinfo.emplace(sys_payer, [&](auto &t) { + t.pricekey = tier; + t.createprice = newprice; + }); +} + +ACTION oresystem::createtoken(const name& payer, const asset& maximum_supply) { + + asset price = getPrice(name("apptoken.ore")); + + action( + permission_level{payer, "active"_n}, + "eosio.token"_n, + "transfer"_n, + make_tuple(payer, ore_system, price, std::string("create token payment"))) + .send(); + + action( + permission_level{ore_system, "active"_n}, + "apptoken.ore"_n, + "create"_n, + make_tuple(payer, maximum_supply)) + .send(); + +} + +// namespace oresystem + +EOSIO_DISPATCH(oresystem, (migrate)(setprice)(settier)(createoreacc)(chgacctier)(createtoken)) \ No newline at end of file diff --git a/contracts/ore.usage_log/CMakeLists.txt b/contracts/ore.usage_log/CMakeLists.txt old mode 100644 new mode 100755 index 63d2373..3336a64 --- a/contracts/ore.usage_log/CMakeLists.txt +++ b/contracts/ore.usage_log/CMakeLists.txt @@ -1,8 +1,5 @@ -file(GLOB ABI_FILES "*.abi") -configure_file("${ABI_FILES}" "${CMAKE_CURRENT_BINARY_DIR}" COPYONLY) +add_contract(ore.usage_log ore.usage_log ${CMAKE_CURRENT_SOURCE_DIR}/src/ore.usage_log.cpp) -add_wast_executable(TARGET ore.usage_log - INCLUDE_FOLDERS "${STANDARD_INCLUDE_FOLDERS}" - LIBRARIES libc++ libc eosiolib - DESTINATION_FOLDER ${CMAKE_CURRENT_BINARY_DIR} -) +set_target_properties(ore.usage_log.wasm + PROPERTIES + RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}") diff --git a/contracts/ore.usage_log/ore.usage_log.cpp b/contracts/ore.usage_log/src/ore.usage_log.cpp old mode 100644 new mode 100755 similarity index 90% rename from contracts/ore.usage_log/ore.usage_log.cpp rename to contracts/ore.usage_log/src/ore.usage_log.cpp index 3f1ad53..a5c363b --- a/contracts/ore.usage_log/ore.usage_log.cpp +++ b/contracts/ore.usage_log/src/ore.usage_log.cpp @@ -1,6 +1,6 @@ -#include -#include -#include +#include +#include +#include #include #include @@ -35,8 +35,8 @@ class [[eosio::contract("ore.usage_log")]] usage_log : public eosio::contract { auto itr = _logs.find(hashStr(token_hash)); - string msg = "No log exist for the given pair of instrument id " + to_string(instrument_id) + " and access token hash " + token_hash + "\n"; - eosio_assert(itr != _logs.end(), msg.c_str()); + string msg = "No log exist for the given pair of instrument id " + to_string(instrument_id) + " and access token hash " + token_hash + " [usagelog.delete]\n"; + check(itr != _logs.end(), msg.c_str()); print("action:deletelog Log deleted for instrument id : " + to_string(instrument_id) + " and access token hash" + token_hash + "\n"); @@ -56,7 +56,7 @@ class [[eosio::contract("ore.usage_log")]] usage_log : public eosio::contract _counts.emplace(_self, [&](auto &a) { a.right_hash = right_hash; a.right_name = right_name; - a.last_usage_time = time_point_sec(now()); + a.last_usage_time = current_time_point(); //time_point_sec(now()); a.total_count = 1; a.total_cpu = cpu; }); @@ -64,7 +64,7 @@ class [[eosio::contract("ore.usage_log")]] usage_log : public eosio::contract else { _counts.modify(itr, _self, [&](auto &a) { - a.last_usage_time = time_point_sec(now()); + a.last_usage_time = current_time_point(); //time_point_sec(now()); a.total_count += 1; a.total_cpu += cpu; }); @@ -92,7 +92,7 @@ class [[eosio::contract("ore.usage_log")]] usage_log : public eosio::contract { uint64_t right_hash; string right_name; - time_point_sec last_usage_time; + time_point last_usage_time; uint64_t total_count; asset total_cpu; auto primary_key() const { return right_hash; } diff --git a/contracts/ore_types/ore_types.hpp b/contracts/ore_types/ore_types.hpp old mode 100644 new mode 100755 index 11a29dd..467b2fc --- a/contracts/ore_types/ore_types.hpp +++ b/contracts/ore_types/ore_types.hpp @@ -1,6 +1,6 @@ #pragma once -#include "eosiolib/transaction.hpp" +#include "eosio/transaction.hpp" #include using namespace std; diff --git a/scripts/2020-12_TokenEconomicsUpgrade/README.md b/scripts/2020-12_TokenEconomicsUpgrade/README.md new file mode 100644 index 0000000..2687161 --- /dev/null +++ b/scripts/2020-12_TokenEconomicsUpgrade/README.md @@ -0,0 +1,5 @@ +## Token Economics V2 Upgrade ## + +/test-environment contains files to generate (dockerized or local build) test EOSIO chain, deploy contracts to emulate pre-upgrade chain state. + +/upgrade contains the actual script that is used to deploy ORE v2 contracts (step1) also verification scripts to monitor chain's system status. \ No newline at end of file diff --git a/scripts/2020-12_TokenEconomicsUpgrade/test-environment/README.md b/scripts/2020-12_TokenEconomicsUpgrade/test-environment/README.md new file mode 100644 index 0000000..55c7f3f --- /dev/null +++ b/scripts/2020-12_TokenEconomicsUpgrade/test-environment/README.md @@ -0,0 +1,10 @@ +To test upgrade and verification, from /test-environment directory: + +```bash +#Run tests using pre-built docker images +./test.sh +``` +```bash +#Run tests using local eosio software. (nodeos 1.8.7 & eosio.cdt 1.6.5 required) +./test.sh cleos +``` \ No newline at end of file diff --git a/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/Dockerfiles/build-eosio-testnet.dockerfile b/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/Dockerfiles/build-eosio-testnet.dockerfile new file mode 100644 index 0000000..f334000 --- /dev/null +++ b/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/Dockerfiles/build-eosio-testnet.dockerfile @@ -0,0 +1,38 @@ +FROM ubuntu:18.04 + +RUN apt-get update && apt-get install -y curl libicu60 libusb-1.0-0 libcurl3-gnutls git cmake g++ nodejs npm nano + +# Install EOSIO +RUN curl -LO https://github.com/EOSIO/eos/releases/download/v1.8.9/eosio_1.8.9-1-ubuntu-18.04_amd64.deb \ + && dpkg -i eosio_1.8.9-1-ubuntu-18.04_amd64.deb + +# Download and unpackage EOSIO.CDT 1.4.1 +# RUN curl -o /eosio.cdt/eosio.cdt-1.4.1.x86_64.deb --create-dirs -L https://github.com/EOSIO/eosio.cdt/releases/download/v1.4.1/eosio.cdt-1.4.1.x86_64.deb \ +# && dpkg-deb -x /eosio.cdt/eosio.cdt-1.4.1.x86_64.deb /eosio.cdt/v1.4.1 + +# Download and unpackage EOSIO.CDT 1.5.0 + RUN curl -o /eosio.cdt/eosio.cdt_1.5.0-1_amd64.deb --create-dirs -L https://github.com/EOSIO/eosio.cdt/releases/download/v1.5.0/eosio.cdt_1.5.0-1_amd64.deb \ + && dpkg-deb -x /eosio.cdt/eosio.cdt_1.5.0-1_amd64.deb /eosio.cdt/v1.5.0 + +# Download and unpackage EOSIO.CDT 1.6.3 +RUN curl -o /eosio.cdt/eosio.cdt_1.6.3-1-ubuntu-18.04_amd64.deb --create-dirs -L https://github.com/EOSIO/eosio.cdt/releases/download/v1.6.3/eosio.cdt_1.6.3-1-ubuntu-18.04_amd64.deb \ + && dpkg-deb -x /eosio.cdt/eosio.cdt_1.6.3-1-ubuntu-18.04_amd64.deb /eosio.cdt/v1.6.3 + +# Download and unpackage EOSIO.CDT 1.7.0 +RUN curl -o /eosio.cdt/eosio.cdt_1.7.0-1-ubuntu-18.04_amd64.deb --create-dirs -L https://github.com/EOSIO/eosio.cdt/releases/download/v1.7.0/eosio.cdt_1.7.0-1-ubuntu-18.04_amd64.deb \ + && dpkg-deb -x /eosio.cdt/eosio.cdt_1.7.0-1-ubuntu-18.04_amd64.deb /eosio.cdt/v1.7.0 + +# Download EOSIO.Contracts +RUN curl -LO https://github.com/EOSIO/eosio.contracts/archive/v1.8.3.tar.gz && tar -xzvf v1.8.3.tar.gz --one-top-level=eosio.contracts --strip-components 1 + +# Activate EOSIO.CDT 1.6.3 +RUN cp -rf /eosio.cdt/v1.6.3/usr/* /usr/ + +# Build EOSIO.Contracts +RUN cd /eosio.contracts/ && mkdir build && cd build && cmake .. && make all + +# Download ORE.Contracts +# RUN git clone https://github.com/API-market/eosio.contracts /ore.contracts/ + +# Build ORE.Contracts +# RUN cd /ore.contracts/ && git checkout ore && mkdir -p build && rm -rf build/* && sed -i "s/make\s-j\s\$CPU_CORES/make -j \$CPU_CORES contracts_project/" build.sh && ./build.sh -e /usr/opt/eosio/1.8.9/ -c /eosio.cdt/v1.6.3/usr/ diff --git a/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/Dockerfiles/docker-compose-ore.yml b/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/Dockerfiles/docker-compose-ore.yml new file mode 100644 index 0000000..5fd7e36 --- /dev/null +++ b/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/Dockerfiles/docker-compose-ore.yml @@ -0,0 +1,42 @@ +version: '3' + +services: + + ore-main: + container_name: ore-main + hostname: ore-main + build: + context: . + dockerfile: build-eosio-testnet.dockerfile + image: openrightsexchange/ore-chain:v1.8.7 + command: nodeos --data-dir /data --config-dir /data --config config.ini --logconf /data/logging.json --genesis-json /data/genesis.json >> /data/nodeos.log + stop_grace_period: 1m0s + networks: + - testnet + volumes: + - ../data/:/data/ + - ../contracts-v1/:/root/contracts-v1 + - ../contracts-v2/:/root/contracts-v2 + - ../../../../../contracts/:/root/contracts + ports: + - '8889:8888' + depends_on: + - ore-wallet + + ore-wallet: + container_name: ore-wallet + hostname: ore-wallet + build: + context: . + dockerfile: build-eosio-testnet.dockerfile + image: openrightsexchange/ore-chain:v1.8.7 + command: keosd --http-server-address=0.0.0.0:8901 --http-validate-host 0 --verbose-http-errors --unlock-timeout=9999999 + networks: + - testnet + volumes: + - ../data/:/data/ + ports: + - '8902:8901' + +networks: + testnet: diff --git a/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/contracts-v1/CreateEscrow/createescrow.abi b/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/contracts-v1/CreateEscrow/createescrow.abi new file mode 100644 index 0000000..ef37069 --- /dev/null +++ b/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/contracts-v1/CreateEscrow/createescrow.abi @@ -0,0 +1,717 @@ +{ + "____comment": "This file was generated with eosio-abigen. DO NOT EDIT ", + "version": "eosio::abi/1.1", + "types": [], + "structs": [ + { + "name": "airdropdata", + "base": "", + "fields": [ + { + "name": "contract", + "type": "name" + }, + { + "name": "balance", + "type": "asset" + }, + { + "name": "amount", + "type": "asset" + } + ] + }, + { + "name": "balances", + "base": "", + "fields": [ + { + "name": "memo", + "type": "uint64" + }, + { + "name": "contributors", + "type": "contributors[]" + }, + { + "name": "total_balance", + "type": "asset" + }, + { + "name": "origin", + "type": "string" + }, + { + "name": "timestamp", + "type": "uint64" + } + ] + }, + { + "name": "clean", + "base": "", + "fields": [] + }, + { + "name": "cleanreg", + "base": "", + "fields": [] + }, + { + "name": "cleantoken", + "base": "", + "fields": [] + }, + { + "name": "contributors", + "base": "", + "fields": [ + { + "name": "contributor", + "type": "name" + }, + { + "name": "balance", + "type": "asset" + }, + { + "name": "rex_balance", + "type": "asset" + }, + { + "name": "total_spent", + "type": "asset" + }, + { + "name": "total_staked", + "type": "asset" + }, + { + "name": "total_spent_rex", + "type": "asset" + }, + { + "name": "ram_contribution_percent", + "type": "int32" + }, + { + "name": "totalaccounts", + "type": "int32" + }, + { + "name": "createdaccounts", + "type": "int32" + } + ] + }, + { + "name": "create", + "base": "", + "fields": [ + { + "name": "memo", + "type": "string" + }, + { + "name": "account", + "type": "name" + }, + { + "name": "ownerkey", + "type": "public_key" + }, + { + "name": "activekey", + "type": "public_key" + }, + { + "name": "origin", + "type": "string" + }, + { + "name": "referral", + "type": "name" + } + ] + }, + { + "name": "define", + "base": "", + "fields": [ + { + "name": "owner", + "type": "name" + }, + { + "name": "dapp", + "type": "string" + }, + { + "name": "ram_bytes", + "type": "uint64" + }, + { + "name": "net", + "type": "asset" + }, + { + "name": "cpu", + "type": "asset" + }, + { + "name": "pricekey", + "type": "uint64" + }, + { + "name": "airdrop", + "type": "airdropdata" + }, + { + "name": "use_rex", + "type": "bool" + }, + { + "name": "rex", + "type": "rexdata" + } + ] + }, + { + "name": "fundcpuloan", + "base": "", + "fields": [ + { + "name": "from", + "type": "name" + }, + { + "name": "to", + "type": "name" + }, + { + "name": "quantity", + "type": "asset" + }, + { + "name": "origin", + "type": "string" + } + ] + }, + { + "name": "fundnetloan", + "base": "", + "fields": [ + { + "name": "from", + "type": "name" + }, + { + "name": "to", + "type": "name" + }, + { + "name": "quantity", + "type": "asset" + }, + { + "name": "origin", + "type": "string" + } + ] + }, + { + "name": "init", + "base": "", + "fields": [ + { + "name": "symbol", + "type": "symbol" + }, + { + "name": "newaccountcontract", + "type": "name" + }, + { + "name": "newaccountaction", + "type": "name" + }, + { + "name": "minimumram", + "type": "uint64" + } + ] + }, + { + "name": "ping", + "base": "", + "fields": [ + { + "name": "from", + "type": "name" + } + ] + }, + { + "name": "reclaim", + "base": "", + "fields": [ + { + "name": "reclaimer", + "type": "name" + }, + { + "name": "dapp", + "type": "string" + }, + { + "name": "sym", + "type": "string" + } + ] + }, + { + "name": "refundstakes", + "base": "", + "fields": [ + { + "name": "from", + "type": "name" + }, + { + "name": "origin", + "type": "string" + } + ] + }, + { + "name": "registryStruct", + "base": "", + "fields": [ + { + "name": "owner", + "type": "name" + }, + { + "name": "dapp", + "type": "string" + }, + { + "name": "ram_bytes", + "type": "uint64" + }, + { + "name": "net", + "type": "asset" + }, + { + "name": "cpu", + "type": "asset" + }, + { + "name": "custodians", + "type": "name[]" + }, + { + "name": "pricekey", + "type": "uint64" + }, + { + "name": "use_rex", + "type": "bool" + }, + { + "name": "airdrop", + "type": "airdropdata?" + }, + { + "name": "rex", + "type": "rexdata?" + } + ] + }, + { + "name": "rentcpu", + "base": "", + "fields": [ + { + "name": "from", + "type": "name" + }, + { + "name": "to", + "type": "name" + }, + { + "name": "origin", + "type": "string" + } + ] + }, + { + "name": "rentnet", + "base": "", + "fields": [ + { + "name": "from", + "type": "name" + }, + { + "name": "to", + "type": "name" + }, + { + "name": "origin", + "type": "string" + } + ] + }, + { + "name": "rexdata", + "base": "", + "fields": [ + { + "name": "net_loan_payment", + "type": "asset" + }, + { + "name": "net_loan_fund", + "type": "asset" + }, + { + "name": "cpu_loan_payment", + "type": "asset" + }, + { + "name": "cpu_loan_fund", + "type": "asset" + } + ] + }, + { + "name": "stake", + "base": "", + "fields": [ + { + "name": "from", + "type": "name" + }, + { + "name": "to", + "type": "name" + }, + { + "name": "origin", + "type": "string" + }, + { + "name": "net", + "type": "asset" + }, + { + "name": "cpu", + "type": "asset" + } + ] + }, + { + "name": "token", + "base": "", + "fields": [ + { + "name": "S_SYS", + "type": "symbol" + }, + { + "name": "newaccountcontract", + "type": "name" + }, + { + "name": "newaccountaction", + "type": "name" + }, + { + "name": "min_ram", + "type": "uint64" + } + ] + }, + { + "name": "topuploans", + "base": "", + "fields": [ + { + "name": "from", + "type": "name" + }, + { + "name": "to", + "type": "name" + }, + { + "name": "cpuquantity", + "type": "asset" + }, + { + "name": "netquantity", + "type": "asset" + }, + { + "name": "origin", + "type": "string" + } + ] + }, + { + "name": "unstake", + "base": "", + "fields": [ + { + "name": "from", + "type": "name" + }, + { + "name": "to", + "type": "name" + }, + { + "name": "origin", + "type": "string" + } + ] + }, + { + "name": "unstakeStruct", + "base": "", + "fields": [ + { + "name": "reclaimer", + "type": "name" + }, + { + "name": "net_balance", + "type": "asset" + }, + { + "name": "cpu_balance", + "type": "asset" + }, + { + "name": "dapp", + "type": "string" + }, + { + "name": "origin", + "type": "uint64" + } + ] + }, + { + "name": "unstakecpu", + "base": "", + "fields": [ + { + "name": "from", + "type": "name" + }, + { + "name": "to", + "type": "name" + }, + { + "name": "origin", + "type": "string" + } + ] + }, + { + "name": "unstakedBalStruct", + "base": "", + "fields": [ + { + "name": "balance", + "type": "asset" + } + ] + }, + { + "name": "unstakenet", + "base": "", + "fields": [ + { + "name": "from", + "type": "name" + }, + { + "name": "to", + "type": "name" + }, + { + "name": "origin", + "type": "string" + } + ] + }, + { + "name": "whitelist", + "base": "", + "fields": [ + { + "name": "owner", + "type": "name" + }, + { + "name": "account", + "type": "name" + }, + { + "name": "dapp", + "type": "string" + } + ] + } + ], + "actions": [ + { + "name": "clean", + "type": "clean", + "ricardian_contract": "" + }, + { + "name": "cleanreg", + "type": "cleanreg", + "ricardian_contract": "" + }, + { + "name": "cleantoken", + "type": "cleantoken", + "ricardian_contract": "" + }, + { + "name": "create", + "type": "create", + "ricardian_contract": "" + }, + { + "name": "define", + "type": "define", + "ricardian_contract": "" + }, + { + "name": "fundcpuloan", + "type": "fundcpuloan", + "ricardian_contract": "" + }, + { + "name": "fundnetloan", + "type": "fundnetloan", + "ricardian_contract": "" + }, + { + "name": "init", + "type": "init", + "ricardian_contract": "" + }, + { + "name": "ping", + "type": "ping", + "ricardian_contract": "" + }, + { + "name": "reclaim", + "type": "reclaim", + "ricardian_contract": "" + }, + { + "name": "refundstakes", + "type": "refundstakes", + "ricardian_contract": "" + }, + { + "name": "rentcpu", + "type": "rentcpu", + "ricardian_contract": "" + }, + { + "name": "rentnet", + "type": "rentnet", + "ricardian_contract": "" + }, + { + "name": "stake", + "type": "stake", + "ricardian_contract": "" + }, + { + "name": "topuploans", + "type": "topuploans", + "ricardian_contract": "" + }, + { + "name": "unstake", + "type": "unstake", + "ricardian_contract": "" + }, + { + "name": "unstakecpu", + "type": "unstakecpu", + "ricardian_contract": "" + }, + { + "name": "unstakenet", + "type": "unstakenet", + "ricardian_contract": "" + }, + { + "name": "whitelist", + "type": "whitelist", + "ricardian_contract": "" + } + ], + "tables": [ + { + "name": "balances", + "type": "balances", + "index_type": "i64", + "key_names": [], + "key_types": [] + }, + { + "name": "contributors", + "type": "contributors", + "index_type": "i64", + "key_names": [], + "key_types": [] + }, + { + "name": "registry", + "type": "registryStruct", + "index_type": "i64", + "key_names": [], + "key_types": [] + }, + { + "name": "token", + "type": "token", + "index_type": "i64", + "key_names": [], + "key_types": [] + }, + { + "name": "totalreclaim", + "type": "unstakedBalStruct", + "index_type": "i64", + "key_names": [], + "key_types": [] + }, + { + "name": "unstaked", + "type": "unstakeStruct", + "index_type": "i64", + "key_names": [], + "key_types": [] + } + ], + "ricardian_clauses": [], + "variants": [] +} \ No newline at end of file diff --git a/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/contracts-v1/CreateEscrow/createescrow.wasm b/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/contracts-v1/CreateEscrow/createescrow.wasm new file mode 100755 index 0000000..943fc92 Binary files /dev/null and b/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/contracts-v1/CreateEscrow/createescrow.wasm differ diff --git a/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/contracts-v1/eosio.contracts/eosio.bios/eosio.bios.abi b/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/contracts-v1/eosio.contracts/eosio.bios/eosio.bios.abi new file mode 100644 index 0000000..e0cabc4 --- /dev/null +++ b/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/contracts-v1/eosio.contracts/eosio.bios/eosio.bios.abi @@ -0,0 +1,522 @@ +{ + "____comment": "This file was generated with eosio-abigen. DO NOT EDIT Sun Nov 29 15:45:12 2020", + "version": "eosio::abi/1.1", + "structs": [ + { + "name": "abi_hash", + "base": "", + "fields": [ + { + "name": "owner", + "type": "name" + }, + { + "name": "hash", + "type": "checksum256" + } + ] + }, + { + "name": "authority", + "base": "", + "fields": [ + { + "name": "threshold", + "type": "uint32" + }, + { + "name": "keys", + "type": "key_weight[]" + }, + { + "name": "accounts", + "type": "permission_level_weight[]" + }, + { + "name": "waits", + "type": "wait_weight[]" + } + ] + }, + { + "name": "blockchain_parameters", + "base": "", + "fields": [ + { + "name": "max_block_net_usage", + "type": "uint64" + }, + { + "name": "target_block_net_usage_pct", + "type": "uint32" + }, + { + "name": "max_transaction_net_usage", + "type": "uint32" + }, + { + "name": "base_per_transaction_net_usage", + "type": "uint32" + }, + { + "name": "net_usage_leeway", + "type": "uint32" + }, + { + "name": "context_free_discount_net_usage_num", + "type": "uint32" + }, + { + "name": "context_free_discount_net_usage_den", + "type": "uint32" + }, + { + "name": "max_block_cpu_usage", + "type": "uint32" + }, + { + "name": "target_block_cpu_usage_pct", + "type": "uint32" + }, + { + "name": "max_transaction_cpu_usage", + "type": "uint32" + }, + { + "name": "min_transaction_cpu_usage", + "type": "uint32" + }, + { + "name": "max_transaction_lifetime", + "type": "uint32" + }, + { + "name": "deferred_trx_expiration_window", + "type": "uint32" + }, + { + "name": "max_transaction_delay", + "type": "uint32" + }, + { + "name": "max_inline_action_size", + "type": "uint32" + }, + { + "name": "max_inline_action_depth", + "type": "uint16" + }, + { + "name": "max_authority_depth", + "type": "uint16" + } + ] + }, + { + "name": "canceldelay", + "base": "", + "fields": [ + { + "name": "canceling_auth", + "type": "permission_level" + }, + { + "name": "trx_id", + "type": "checksum256" + } + ] + }, + { + "name": "deleteauth", + "base": "", + "fields": [ + { + "name": "account", + "type": "name" + }, + { + "name": "permission", + "type": "name" + } + ] + }, + { + "name": "key_weight", + "base": "", + "fields": [ + { + "name": "key", + "type": "public_key" + }, + { + "name": "weight", + "type": "uint16" + } + ] + }, + { + "name": "linkauth", + "base": "", + "fields": [ + { + "name": "account", + "type": "name" + }, + { + "name": "code", + "type": "name" + }, + { + "name": "type", + "type": "name" + }, + { + "name": "requirement", + "type": "name" + } + ] + }, + { + "name": "newaccount", + "base": "", + "fields": [ + { + "name": "creator", + "type": "name" + }, + { + "name": "name", + "type": "name" + }, + { + "name": "owner", + "type": "authority" + }, + { + "name": "active", + "type": "authority" + } + ] + }, + { + "name": "onerror", + "base": "", + "fields": [ + { + "name": "sender_id", + "type": "uint128" + }, + { + "name": "sent_trx", + "type": "bytes" + } + ] + }, + { + "name": "permission_level", + "base": "", + "fields": [ + { + "name": "actor", + "type": "name" + }, + { + "name": "permission", + "type": "name" + } + ] + }, + { + "name": "permission_level_weight", + "base": "", + "fields": [ + { + "name": "permission", + "type": "permission_level" + }, + { + "name": "weight", + "type": "uint16" + } + ] + }, + { + "name": "producer_key", + "base": "", + "fields": [ + { + "name": "producer_name", + "type": "name" + }, + { + "name": "block_signing_key", + "type": "public_key" + } + ] + }, + { + "name": "reqauth", + "base": "", + "fields": [ + { + "name": "from", + "type": "name" + } + ] + }, + { + "name": "setabi", + "base": "", + "fields": [ + { + "name": "account", + "type": "name" + }, + { + "name": "abi", + "type": "bytes" + } + ] + }, + { + "name": "setalimits", + "base": "", + "fields": [ + { + "name": "account", + "type": "name" + }, + { + "name": "ram_bytes", + "type": "int64" + }, + { + "name": "net_weight", + "type": "int64" + }, + { + "name": "cpu_weight", + "type": "int64" + } + ] + }, + { + "name": "setcode", + "base": "", + "fields": [ + { + "name": "account", + "type": "name" + }, + { + "name": "vmtype", + "type": "uint8" + }, + { + "name": "vmversion", + "type": "uint8" + }, + { + "name": "code", + "type": "bytes" + } + ] + }, + { + "name": "setglimits", + "base": "", + "fields": [ + { + "name": "ram", + "type": "uint64" + }, + { + "name": "net", + "type": "uint64" + }, + { + "name": "cpu", + "type": "uint64" + } + ] + }, + { + "name": "setparams", + "base": "", + "fields": [ + { + "name": "params", + "type": "blockchain_parameters" + } + ] + }, + { + "name": "setpriv", + "base": "", + "fields": [ + { + "name": "account", + "type": "name" + }, + { + "name": "is_priv", + "type": "uint8" + } + ] + }, + { + "name": "setprods", + "base": "", + "fields": [ + { + "name": "schedule", + "type": "producer_key[]" + } + ] + }, + { + "name": "unlinkauth", + "base": "", + "fields": [ + { + "name": "account", + "type": "name" + }, + { + "name": "code", + "type": "name" + }, + { + "name": "type", + "type": "name" + } + ] + }, + { + "name": "updateauth", + "base": "", + "fields": [ + { + "name": "account", + "type": "name" + }, + { + "name": "permission", + "type": "name" + }, + { + "name": "parent", + "type": "name" + }, + { + "name": "auth", + "type": "authority" + } + ] + }, + { + "name": "wait_weight", + "base": "", + "fields": [ + { + "name": "wait_sec", + "type": "uint32" + }, + { + "name": "weight", + "type": "uint16" + } + ] + } + ], + "types": [], + "actions": [ + { + "name": "canceldelay", + "type": "canceldelay", + "ricardian_contract": "" + }, + { + "name": "deleteauth", + "type": "deleteauth", + "ricardian_contract": "" + }, + { + "name": "linkauth", + "type": "linkauth", + "ricardian_contract": "" + }, + { + "name": "newaccount", + "type": "newaccount", + "ricardian_contract": "" + }, + { + "name": "onerror", + "type": "onerror", + "ricardian_contract": "" + }, + { + "name": "reqauth", + "type": "reqauth", + "ricardian_contract": "" + }, + { + "name": "setabi", + "type": "setabi", + "ricardian_contract": "" + }, + { + "name": "setalimits", + "type": "setalimits", + "ricardian_contract": "" + }, + { + "name": "setcode", + "type": "setcode", + "ricardian_contract": "" + }, + { + "name": "setglimits", + "type": "setglimits", + "ricardian_contract": "" + }, + { + "name": "setparams", + "type": "setparams", + "ricardian_contract": "" + }, + { + "name": "setpriv", + "type": "setpriv", + "ricardian_contract": "" + }, + { + "name": "setprods", + "type": "setprods", + "ricardian_contract": "" + }, + { + "name": "unlinkauth", + "type": "unlinkauth", + "ricardian_contract": "" + }, + { + "name": "updateauth", + "type": "updateauth", + "ricardian_contract": "" + } + ], + "tables": [ + { + "name": "abihash", + "type": "abi_hash", + "index_type": "i64", + "key_names": [], + "key_types": [] + } + ], + "ricardian_clauses": [], + "variants": [], + "abi_extensions": [] +} \ No newline at end of file diff --git a/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/contracts-v1/eosio.contracts/eosio.bios/eosio.bios.wasm b/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/contracts-v1/eosio.contracts/eosio.bios/eosio.bios.wasm new file mode 100755 index 0000000..ea62431 Binary files /dev/null and b/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/contracts-v1/eosio.contracts/eosio.bios/eosio.bios.wasm differ diff --git a/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/contracts-v1/eosio.contracts/eosio.msig/eosio.msig.abi b/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/contracts-v1/eosio.contracts/eosio.msig/eosio.msig.abi new file mode 100644 index 0000000..c93a503 --- /dev/null +++ b/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/contracts-v1/eosio.contracts/eosio.msig/eosio.msig.abi @@ -0,0 +1,360 @@ +{ + "____comment": "This file was generated with eosio-abigen. DO NOT EDIT Sun Nov 29 15:45:15 2020", + "version": "eosio::abi/1.1", + "structs": [ + { + "name": "action", + "base": "", + "fields": [ + { + "name": "account", + "type": "name" + }, + { + "name": "name", + "type": "name" + }, + { + "name": "authorization", + "type": "permission_level[]" + }, + { + "name": "data", + "type": "bytes" + } + ] + }, + { + "name": "approval", + "base": "", + "fields": [ + { + "name": "level", + "type": "permission_level" + }, + { + "name": "time", + "type": "time_point" + } + ] + }, + { + "name": "approvals_info", + "base": "", + "fields": [ + { + "name": "version", + "type": "uint8" + }, + { + "name": "proposal_name", + "type": "name" + }, + { + "name": "requested_approvals", + "type": "approval[]" + }, + { + "name": "provided_approvals", + "type": "approval[]" + } + ] + }, + { + "name": "approve", + "base": "", + "fields": [ + { + "name": "proposer", + "type": "name" + }, + { + "name": "proposal_name", + "type": "name" + }, + { + "name": "level", + "type": "permission_level" + }, + { + "name": "proposal_hash", + "type": "checksum256$" + } + ] + }, + { + "name": "cancel", + "base": "", + "fields": [ + { + "name": "proposer", + "type": "name" + }, + { + "name": "proposal_name", + "type": "name" + }, + { + "name": "canceler", + "type": "name" + } + ] + }, + { + "name": "exec", + "base": "", + "fields": [ + { + "name": "proposer", + "type": "name" + }, + { + "name": "proposal_name", + "type": "name" + }, + { + "name": "executer", + "type": "name" + } + ] + }, + { + "name": "extension", + "base": "", + "fields": [ + { + "name": "type", + "type": "uint16" + }, + { + "name": "data", + "type": "bytes" + } + ] + }, + { + "name": "invalidate", + "base": "", + "fields": [ + { + "name": "account", + "type": "name" + } + ] + }, + { + "name": "invalidation", + "base": "", + "fields": [ + { + "name": "account", + "type": "name" + }, + { + "name": "last_invalidation_time", + "type": "time_point" + } + ] + }, + { + "name": "old_approvals_info", + "base": "", + "fields": [ + { + "name": "proposal_name", + "type": "name" + }, + { + "name": "requested_approvals", + "type": "permission_level[]" + }, + { + "name": "provided_approvals", + "type": "permission_level[]" + } + ] + }, + { + "name": "permission_level", + "base": "", + "fields": [ + { + "name": "actor", + "type": "name" + }, + { + "name": "permission", + "type": "name" + } + ] + }, + { + "name": "proposal", + "base": "", + "fields": [ + { + "name": "proposal_name", + "type": "name" + }, + { + "name": "packed_transaction", + "type": "bytes" + } + ] + }, + { + "name": "propose", + "base": "", + "fields": [ + { + "name": "proposer", + "type": "name" + }, + { + "name": "proposal_name", + "type": "name" + }, + { + "name": "requested", + "type": "permission_level[]" + }, + { + "name": "trx", + "type": "transaction" + } + ] + }, + { + "name": "transaction", + "base": "transaction_header", + "fields": [ + { + "name": "context_free_actions", + "type": "action[]" + }, + { + "name": "actions", + "type": "action[]" + }, + { + "name": "transaction_extensions", + "type": "extension[]" + } + ] + }, + { + "name": "transaction_header", + "base": "", + "fields": [ + { + "name": "expiration", + "type": "time_point_sec" + }, + { + "name": "ref_block_num", + "type": "uint16" + }, + { + "name": "ref_block_prefix", + "type": "uint32" + }, + { + "name": "max_net_usage_words", + "type": "varuint32" + }, + { + "name": "max_cpu_usage_ms", + "type": "uint8" + }, + { + "name": "delay_sec", + "type": "varuint32" + } + ] + }, + { + "name": "unapprove", + "base": "", + "fields": [ + { + "name": "proposer", + "type": "name" + }, + { + "name": "proposal_name", + "type": "name" + }, + { + "name": "level", + "type": "permission_level" + } + ] + } + ], + "types": [], + "actions": [ + { + "name": "approve", + "type": "approve", + "ricardian_contract": "" + }, + { + "name": "cancel", + "type": "cancel", + "ricardian_contract": "" + }, + { + "name": "exec", + "type": "exec", + "ricardian_contract": "" + }, + { + "name": "invalidate", + "type": "invalidate", + "ricardian_contract": "" + }, + { + "name": "propose", + "type": "propose", + "ricardian_contract": "" + }, + { + "name": "unapprove", + "type": "unapprove", + "ricardian_contract": "" + } + ], + "tables": [ + { + "name": "approvals", + "type": "old_approvals_info", + "index_type": "i64", + "key_names": [], + "key_types": [] + }, + { + "name": "approvals2", + "type": "approvals_info", + "index_type": "i64", + "key_names": [], + "key_types": [] + }, + { + "name": "invals", + "type": "invalidation", + "index_type": "i64", + "key_names": [], + "key_types": [] + }, + { + "name": "proposal", + "type": "proposal", + "index_type": "i64", + "key_names": [], + "key_types": [] + } + ], + "ricardian_clauses": [], + "variants": [], + "abi_extensions": [] +} \ No newline at end of file diff --git a/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/contracts-v1/eosio.contracts/eosio.msig/eosio.msig.wasm b/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/contracts-v1/eosio.contracts/eosio.msig/eosio.msig.wasm new file mode 100755 index 0000000..dda2a34 Binary files /dev/null and b/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/contracts-v1/eosio.contracts/eosio.msig/eosio.msig.wasm differ diff --git a/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/contracts-v1/eosio.contracts/eosio.system/eosio.system.abi b/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/contracts-v1/eosio.contracts/eosio.system/eosio.system.abi new file mode 100644 index 0000000..e423101 --- /dev/null +++ b/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/contracts-v1/eosio.contracts/eosio.system/eosio.system.abi @@ -0,0 +1,1369 @@ +{ + "____comment": "This file was generated with eosio-abigen. DO NOT EDIT Sun Nov 29 15:45:21 2020", + "version": "eosio::abi/1.1", + "structs": [ + { + "name": "abi_hash", + "base": "", + "fields": [ + { + "name": "owner", + "type": "name" + }, + { + "name": "hash", + "type": "checksum256" + } + ] + }, + { + "name": "authority", + "base": "", + "fields": [ + { + "name": "threshold", + "type": "uint32" + }, + { + "name": "keys", + "type": "key_weight[]" + }, + { + "name": "accounts", + "type": "permission_level_weight[]" + }, + { + "name": "waits", + "type": "wait_weight[]" + } + ] + }, + { + "name": "bid_refund", + "base": "", + "fields": [ + { + "name": "bidder", + "type": "name" + }, + { + "name": "amount", + "type": "asset" + } + ] + }, + { + "name": "bidname", + "base": "", + "fields": [ + { + "name": "bidder", + "type": "name" + }, + { + "name": "newname", + "type": "name" + }, + { + "name": "bid", + "type": "asset" + } + ] + }, + { + "name": "bidrefund", + "base": "", + "fields": [ + { + "name": "bidder", + "type": "name" + }, + { + "name": "newname", + "type": "name" + } + ] + }, + { + "name": "block_header", + "base": "", + "fields": [ + { + "name": "timestamp", + "type": "uint32" + }, + { + "name": "producer", + "type": "name" + }, + { + "name": "confirmed", + "type": "uint16" + }, + { + "name": "previous", + "type": "checksum256" + }, + { + "name": "transaction_mroot", + "type": "checksum256" + }, + { + "name": "action_mroot", + "type": "checksum256" + }, + { + "name": "schedule_version", + "type": "uint32" + }, + { + "name": "new_producers", + "type": "producer_schedule?" + } + ] + }, + { + "name": "blockchain_parameters", + "base": "", + "fields": [ + { + "name": "max_block_net_usage", + "type": "uint64" + }, + { + "name": "target_block_net_usage_pct", + "type": "uint32" + }, + { + "name": "max_transaction_net_usage", + "type": "uint32" + }, + { + "name": "base_per_transaction_net_usage", + "type": "uint32" + }, + { + "name": "net_usage_leeway", + "type": "uint32" + }, + { + "name": "context_free_discount_net_usage_num", + "type": "uint32" + }, + { + "name": "context_free_discount_net_usage_den", + "type": "uint32" + }, + { + "name": "max_block_cpu_usage", + "type": "uint32" + }, + { + "name": "target_block_cpu_usage_pct", + "type": "uint32" + }, + { + "name": "max_transaction_cpu_usage", + "type": "uint32" + }, + { + "name": "min_transaction_cpu_usage", + "type": "uint32" + }, + { + "name": "max_transaction_lifetime", + "type": "uint32" + }, + { + "name": "deferred_trx_expiration_window", + "type": "uint32" + }, + { + "name": "max_transaction_delay", + "type": "uint32" + }, + { + "name": "max_inline_action_size", + "type": "uint32" + }, + { + "name": "max_inline_action_depth", + "type": "uint16" + }, + { + "name": "max_authority_depth", + "type": "uint16" + } + ] + }, + { + "name": "buyram", + "base": "", + "fields": [ + { + "name": "payer", + "type": "name" + }, + { + "name": "receiver", + "type": "name" + }, + { + "name": "quant", + "type": "asset" + } + ] + }, + { + "name": "buyrambytes", + "base": "", + "fields": [ + { + "name": "payer", + "type": "name" + }, + { + "name": "receiver", + "type": "name" + }, + { + "name": "bytes", + "type": "uint32" + } + ] + }, + { + "name": "canceldelay", + "base": "", + "fields": [ + { + "name": "canceling_auth", + "type": "permission_level" + }, + { + "name": "trx_id", + "type": "checksum256" + } + ] + }, + { + "name": "claimrewards", + "base": "", + "fields": [ + { + "name": "owner", + "type": "name" + } + ] + }, + { + "name": "connector", + "base": "", + "fields": [ + { + "name": "balance", + "type": "asset" + }, + { + "name": "weight", + "type": "float64" + } + ] + }, + { + "name": "delegatebw", + "base": "", + "fields": [ + { + "name": "from", + "type": "name" + }, + { + "name": "receiver", + "type": "name" + }, + { + "name": "stake_net_quantity", + "type": "asset" + }, + { + "name": "stake_cpu_quantity", + "type": "asset" + }, + { + "name": "transfer", + "type": "bool" + } + ] + }, + { + "name": "delegated_bandwidth", + "base": "", + "fields": [ + { + "name": "from", + "type": "name" + }, + { + "name": "to", + "type": "name" + }, + { + "name": "net_weight", + "type": "asset" + }, + { + "name": "cpu_weight", + "type": "asset" + } + ] + }, + { + "name": "deleteauth", + "base": "", + "fields": [ + { + "name": "account", + "type": "name" + }, + { + "name": "permission", + "type": "name" + } + ] + }, + { + "name": "eosio_global_state", + "base": "blockchain_parameters", + "fields": [ + { + "name": "max_ram_size", + "type": "uint64" + }, + { + "name": "total_ram_bytes_reserved", + "type": "uint64" + }, + { + "name": "total_ram_stake", + "type": "int64" + }, + { + "name": "last_producer_schedule_update", + "type": "block_timestamp_type" + }, + { + "name": "last_pervote_bucket_fill", + "type": "time_point" + }, + { + "name": "pervote_bucket", + "type": "int64" + }, + { + "name": "perblock_bucket", + "type": "int64" + }, + { + "name": "total_unpaid_blocks", + "type": "uint32" + }, + { + "name": "total_activated_stake", + "type": "int64" + }, + { + "name": "thresh_activated_stake_time", + "type": "time_point" + }, + { + "name": "last_producer_schedule_size", + "type": "uint16" + }, + { + "name": "total_producer_vote_weight", + "type": "float64" + }, + { + "name": "last_name_close", + "type": "block_timestamp_type" + } + ] + }, + { + "name": "eosio_global_state2", + "base": "", + "fields": [ + { + "name": "new_ram_per_block", + "type": "uint16" + }, + { + "name": "last_ram_increase", + "type": "block_timestamp_type" + }, + { + "name": "last_block_num", + "type": "block_timestamp_type" + }, + { + "name": "total_producer_votepay_share", + "type": "float64" + }, + { + "name": "revision", + "type": "uint8" + } + ] + }, + { + "name": "eosio_global_state3", + "base": "", + "fields": [ + { + "name": "last_vpay_state_update", + "type": "time_point" + }, + { + "name": "total_vpay_share_change_rate", + "type": "float64" + } + ] + }, + { + "name": "exchange_state", + "base": "", + "fields": [ + { + "name": "supply", + "type": "asset" + }, + { + "name": "base", + "type": "connector" + }, + { + "name": "quote", + "type": "connector" + } + ] + }, + { + "name": "init", + "base": "", + "fields": [ + { + "name": "version", + "type": "varuint32" + }, + { + "name": "core", + "type": "symbol" + } + ] + }, + { + "name": "key_weight", + "base": "", + "fields": [ + { + "name": "key", + "type": "public_key" + }, + { + "name": "weight", + "type": "uint16" + } + ] + }, + { + "name": "linkauth", + "base": "", + "fields": [ + { + "name": "account", + "type": "name" + }, + { + "name": "code", + "type": "name" + }, + { + "name": "type", + "type": "name" + }, + { + "name": "requirement", + "type": "name" + } + ] + }, + { + "name": "name_bid", + "base": "", + "fields": [ + { + "name": "newname", + "type": "name" + }, + { + "name": "high_bidder", + "type": "name" + }, + { + "name": "high_bid", + "type": "int64" + }, + { + "name": "last_bid_time", + "type": "time_point" + } + ] + }, + { + "name": "newaccount", + "base": "", + "fields": [ + { + "name": "creator", + "type": "name" + }, + { + "name": "name", + "type": "name" + }, + { + "name": "owner", + "type": "authority" + }, + { + "name": "active", + "type": "authority" + } + ] + }, + { + "name": "onblock", + "base": "", + "fields": [ + { + "name": "header", + "type": "block_header" + } + ] + }, + { + "name": "onerror", + "base": "", + "fields": [ + { + "name": "sender_id", + "type": "uint128" + }, + { + "name": "sent_trx", + "type": "bytes" + } + ] + }, + { + "name": "permission_level", + "base": "", + "fields": [ + { + "name": "actor", + "type": "name" + }, + { + "name": "permission", + "type": "name" + } + ] + }, + { + "name": "permission_level_weight", + "base": "", + "fields": [ + { + "name": "permission", + "type": "permission_level" + }, + { + "name": "weight", + "type": "uint16" + } + ] + }, + { + "name": "producer_info", + "base": "", + "fields": [ + { + "name": "owner", + "type": "name" + }, + { + "name": "total_votes", + "type": "float64" + }, + { + "name": "producer_key", + "type": "public_key" + }, + { + "name": "is_active", + "type": "bool" + }, + { + "name": "url", + "type": "string" + }, + { + "name": "unpaid_blocks", + "type": "uint32" + }, + { + "name": "last_claim_time", + "type": "time_point" + }, + { + "name": "location", + "type": "uint16" + } + ] + }, + { + "name": "producer_info2", + "base": "", + "fields": [ + { + "name": "owner", + "type": "name" + }, + { + "name": "votepay_share", + "type": "float64" + }, + { + "name": "last_votepay_share_update", + "type": "time_point" + } + ] + }, + { + "name": "producer_key", + "base": "", + "fields": [ + { + "name": "producer_name", + "type": "name" + }, + { + "name": "block_signing_key", + "type": "public_key" + } + ] + }, + { + "name": "producer_schedule", + "base": "", + "fields": [ + { + "name": "version", + "type": "uint32" + }, + { + "name": "producers", + "type": "producer_key[]" + } + ] + }, + { + "name": "refund", + "base": "", + "fields": [ + { + "name": "owner", + "type": "name" + } + ] + }, + { + "name": "refund_request", + "base": "", + "fields": [ + { + "name": "owner", + "type": "name" + }, + { + "name": "request_time", + "type": "time_point_sec" + }, + { + "name": "net_amount", + "type": "asset" + }, + { + "name": "cpu_amount", + "type": "asset" + } + ] + }, + { + "name": "regproducer", + "base": "", + "fields": [ + { + "name": "producer", + "type": "name" + }, + { + "name": "producer_key", + "type": "public_key" + }, + { + "name": "url", + "type": "string" + }, + { + "name": "location", + "type": "uint16" + } + ] + }, + { + "name": "regproxy", + "base": "", + "fields": [ + { + "name": "proxy", + "type": "name" + }, + { + "name": "isproxy", + "type": "bool" + } + ] + }, + { + "name": "rmvproducer", + "base": "", + "fields": [ + { + "name": "producer", + "type": "name" + } + ] + }, + { + "name": "sellram", + "base": "", + "fields": [ + { + "name": "account", + "type": "name" + }, + { + "name": "bytes", + "type": "int64" + } + ] + }, + { + "name": "setabi", + "base": "", + "fields": [ + { + "name": "account", + "type": "name" + }, + { + "name": "abi", + "type": "bytes" + } + ] + }, + { + "name": "setacctcpu", + "base": "", + "fields": [ + { + "name": "account", + "type": "name" + }, + { + "name": "cpu_weight", + "type": "int64?" + } + ] + }, + { + "name": "setacctnet", + "base": "", + "fields": [ + { + "name": "account", + "type": "name" + }, + { + "name": "net_weight", + "type": "int64?" + } + ] + }, + { + "name": "setacctram", + "base": "", + "fields": [ + { + "name": "account", + "type": "name" + }, + { + "name": "ram_bytes", + "type": "int64?" + } + ] + }, + { + "name": "setalimits", + "base": "", + "fields": [ + { + "name": "account", + "type": "name" + }, + { + "name": "ram_bytes", + "type": "int64" + }, + { + "name": "net_weight", + "type": "int64" + }, + { + "name": "cpu_weight", + "type": "int64" + } + ] + }, + { + "name": "setcode", + "base": "", + "fields": [ + { + "name": "account", + "type": "name" + }, + { + "name": "vmtype", + "type": "uint8" + }, + { + "name": "vmversion", + "type": "uint8" + }, + { + "name": "code", + "type": "bytes" + } + ] + }, + { + "name": "setparams", + "base": "", + "fields": [ + { + "name": "params", + "type": "blockchain_parameters" + } + ] + }, + { + "name": "setpriv", + "base": "", + "fields": [ + { + "name": "account", + "type": "name" + }, + { + "name": "is_priv", + "type": "uint8" + } + ] + }, + { + "name": "setram", + "base": "", + "fields": [ + { + "name": "max_ram_size", + "type": "uint64" + } + ] + }, + { + "name": "setramrate", + "base": "", + "fields": [ + { + "name": "bytes_per_block", + "type": "uint16" + } + ] + }, + { + "name": "undelegatebw", + "base": "", + "fields": [ + { + "name": "from", + "type": "name" + }, + { + "name": "receiver", + "type": "name" + }, + { + "name": "unstake_net_quantity", + "type": "asset" + }, + { + "name": "unstake_cpu_quantity", + "type": "asset" + } + ] + }, + { + "name": "unlinkauth", + "base": "", + "fields": [ + { + "name": "account", + "type": "name" + }, + { + "name": "code", + "type": "name" + }, + { + "name": "type", + "type": "name" + } + ] + }, + { + "name": "unregprod", + "base": "", + "fields": [ + { + "name": "producer", + "type": "name" + } + ] + }, + { + "name": "updateauth", + "base": "", + "fields": [ + { + "name": "account", + "type": "name" + }, + { + "name": "permission", + "type": "name" + }, + { + "name": "parent", + "type": "name" + }, + { + "name": "auth", + "type": "authority" + } + ] + }, + { + "name": "updtrevision", + "base": "", + "fields": [ + { + "name": "revision", + "type": "uint8" + } + ] + }, + { + "name": "user_resources", + "base": "", + "fields": [ + { + "name": "owner", + "type": "name" + }, + { + "name": "net_weight", + "type": "asset" + }, + { + "name": "cpu_weight", + "type": "asset" + }, + { + "name": "ram_bytes", + "type": "int64" + } + ] + }, + { + "name": "voteproducer", + "base": "", + "fields": [ + { + "name": "voter", + "type": "name" + }, + { + "name": "proxy", + "type": "name" + }, + { + "name": "producers", + "type": "name[]" + } + ] + }, + { + "name": "voter_info", + "base": "", + "fields": [ + { + "name": "owner", + "type": "name" + }, + { + "name": "proxy", + "type": "name" + }, + { + "name": "producers", + "type": "name[]" + }, + { + "name": "staked", + "type": "int64" + }, + { + "name": "last_vote_weight", + "type": "float64" + }, + { + "name": "proxied_vote_weight", + "type": "float64" + }, + { + "name": "is_proxy", + "type": "bool" + }, + { + "name": "flags1", + "type": "uint32" + }, + { + "name": "reserved2", + "type": "uint32" + }, + { + "name": "reserved3", + "type": "asset" + } + ] + }, + { + "name": "wait_weight", + "base": "", + "fields": [ + { + "name": "wait_sec", + "type": "uint32" + }, + { + "name": "weight", + "type": "uint16" + } + ] + } + ], + "types": [], + "actions": [ + { + "name": "bidname", + "type": "bidname", + "ricardian_contract": "" + }, + { + "name": "bidrefund", + "type": "bidrefund", + "ricardian_contract": "" + }, + { + "name": "buyram", + "type": "buyram", + "ricardian_contract": "" + }, + { + "name": "buyrambytes", + "type": "buyrambytes", + "ricardian_contract": "" + }, + { + "name": "canceldelay", + "type": "canceldelay", + "ricardian_contract": "" + }, + { + "name": "claimrewards", + "type": "claimrewards", + "ricardian_contract": "" + }, + { + "name": "delegatebw", + "type": "delegatebw", + "ricardian_contract": "" + }, + { + "name": "deleteauth", + "type": "deleteauth", + "ricardian_contract": "" + }, + { + "name": "init", + "type": "init", + "ricardian_contract": "" + }, + { + "name": "linkauth", + "type": "linkauth", + "ricardian_contract": "" + }, + { + "name": "newaccount", + "type": "newaccount", + "ricardian_contract": "" + }, + { + "name": "onblock", + "type": "onblock", + "ricardian_contract": "" + }, + { + "name": "onerror", + "type": "onerror", + "ricardian_contract": "" + }, + { + "name": "refund", + "type": "refund", + "ricardian_contract": "" + }, + { + "name": "regproducer", + "type": "regproducer", + "ricardian_contract": "" + }, + { + "name": "regproxy", + "type": "regproxy", + "ricardian_contract": "" + }, + { + "name": "rmvproducer", + "type": "rmvproducer", + "ricardian_contract": "" + }, + { + "name": "sellram", + "type": "sellram", + "ricardian_contract": "" + }, + { + "name": "setabi", + "type": "setabi", + "ricardian_contract": "" + }, + { + "name": "setacctcpu", + "type": "setacctcpu", + "ricardian_contract": "" + }, + { + "name": "setacctnet", + "type": "setacctnet", + "ricardian_contract": "" + }, + { + "name": "setacctram", + "type": "setacctram", + "ricardian_contract": "" + }, + { + "name": "setalimits", + "type": "setalimits", + "ricardian_contract": "" + }, + { + "name": "setcode", + "type": "setcode", + "ricardian_contract": "" + }, + { + "name": "setparams", + "type": "setparams", + "ricardian_contract": "" + }, + { + "name": "setpriv", + "type": "setpriv", + "ricardian_contract": "" + }, + { + "name": "setram", + "type": "setram", + "ricardian_contract": "" + }, + { + "name": "setramrate", + "type": "setramrate", + "ricardian_contract": "" + }, + { + "name": "undelegatebw", + "type": "undelegatebw", + "ricardian_contract": "" + }, + { + "name": "unlinkauth", + "type": "unlinkauth", + "ricardian_contract": "" + }, + { + "name": "unregprod", + "type": "unregprod", + "ricardian_contract": "" + }, + { + "name": "updateauth", + "type": "updateauth", + "ricardian_contract": "" + }, + { + "name": "updtrevision", + "type": "updtrevision", + "ricardian_contract": "" + }, + { + "name": "voteproducer", + "type": "voteproducer", + "ricardian_contract": "" + } + ], + "tables": [ + { + "name": "abihash", + "type": "abi_hash", + "index_type": "i64", + "key_names": [], + "key_types": [] + }, + { + "name": "bidrefunds", + "type": "bid_refund", + "index_type": "i64", + "key_names": [], + "key_types": [] + }, + { + "name": "delband", + "type": "delegated_bandwidth", + "index_type": "i64", + "key_names": [], + "key_types": [] + }, + { + "name": "global", + "type": "eosio_global_state", + "index_type": "i64", + "key_names": [], + "key_types": [] + }, + { + "name": "global2", + "type": "eosio_global_state2", + "index_type": "i64", + "key_names": [], + "key_types": [] + }, + { + "name": "global3", + "type": "eosio_global_state3", + "index_type": "i64", + "key_names": [], + "key_types": [] + }, + { + "name": "namebids", + "type": "name_bid", + "index_type": "i64", + "key_names": [], + "key_types": [] + }, + { + "name": "producers", + "type": "producer_info", + "index_type": "i64", + "key_names": [], + "key_types": [] + }, + { + "name": "producers2", + "type": "producer_info2", + "index_type": "i64", + "key_names": [], + "key_types": [] + }, + { + "name": "rammarket", + "type": "exchange_state", + "index_type": "i64", + "key_names": [], + "key_types": [] + }, + { + "name": "refunds", + "type": "refund_request", + "index_type": "i64", + "key_names": [], + "key_types": [] + }, + { + "name": "userres", + "type": "user_resources", + "index_type": "i64", + "key_names": [], + "key_types": [] + }, + { + "name": "voters", + "type": "voter_info", + "index_type": "i64", + "key_names": [], + "key_types": [] + } + ], + "ricardian_clauses": [], + "variants": [], + "abi_extensions": [] +} \ No newline at end of file diff --git a/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/contracts-v1/eosio.contracts/eosio.system/eosio.system.wasm b/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/contracts-v1/eosio.contracts/eosio.system/eosio.system.wasm new file mode 100755 index 0000000..c40498c Binary files /dev/null and b/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/contracts-v1/eosio.contracts/eosio.system/eosio.system.wasm differ diff --git a/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/contracts-v1/eosio.contracts/eosio.token/eosio.token.abi b/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/contracts-v1/eosio.contracts/eosio.token/eosio.token.abi new file mode 100644 index 0000000..5585998 --- /dev/null +++ b/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/contracts-v1/eosio.contracts/eosio.token/eosio.token.abi @@ -0,0 +1,186 @@ +{ + "____comment": "This file was generated with eosio-abigen. DO NOT EDIT Sun Nov 29 15:45:13 2020", + "version": "eosio::abi/1.1", + "structs": [ + { + "name": "account", + "base": "", + "fields": [ + { + "name": "balance", + "type": "asset" + } + ] + }, + { + "name": "close", + "base": "", + "fields": [ + { + "name": "owner", + "type": "name" + }, + { + "name": "symbol", + "type": "symbol" + } + ] + }, + { + "name": "create", + "base": "", + "fields": [ + { + "name": "issuer", + "type": "name" + }, + { + "name": "maximum_supply", + "type": "asset" + } + ] + }, + { + "name": "currency_stats", + "base": "", + "fields": [ + { + "name": "supply", + "type": "asset" + }, + { + "name": "max_supply", + "type": "asset" + }, + { + "name": "issuer", + "type": "name" + } + ] + }, + { + "name": "issue", + "base": "", + "fields": [ + { + "name": "to", + "type": "name" + }, + { + "name": "quantity", + "type": "asset" + }, + { + "name": "memo", + "type": "string" + } + ] + }, + { + "name": "open", + "base": "", + "fields": [ + { + "name": "owner", + "type": "name" + }, + { + "name": "symbol", + "type": "symbol" + }, + { + "name": "ram_payer", + "type": "name" + } + ] + }, + { + "name": "retire", + "base": "", + "fields": [ + { + "name": "quantity", + "type": "asset" + }, + { + "name": "memo", + "type": "string" + } + ] + }, + { + "name": "transfer", + "base": "", + "fields": [ + { + "name": "from", + "type": "name" + }, + { + "name": "to", + "type": "name" + }, + { + "name": "quantity", + "type": "asset" + }, + { + "name": "memo", + "type": "string" + } + ] + } + ], + "types": [], + "actions": [ + { + "name": "close", + "type": "close", + "ricardian_contract": "" + }, + { + "name": "create", + "type": "create", + "ricardian_contract": "" + }, + { + "name": "issue", + "type": "issue", + "ricardian_contract": "" + }, + { + "name": "open", + "type": "open", + "ricardian_contract": "" + }, + { + "name": "retire", + "type": "retire", + "ricardian_contract": "" + }, + { + "name": "transfer", + "type": "transfer", + "ricardian_contract": "" + } + ], + "tables": [ + { + "name": "accounts", + "type": "account", + "index_type": "i64", + "key_names": [], + "key_types": [] + }, + { + "name": "stat", + "type": "currency_stats", + "index_type": "i64", + "key_names": [], + "key_types": [] + } + ], + "ricardian_clauses": [], + "variants": [], + "abi_extensions": [] +} \ No newline at end of file diff --git a/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/contracts-v1/eosio.contracts/eosio.token/eosio.token.wasm b/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/contracts-v1/eosio.contracts/eosio.token/eosio.token.wasm new file mode 100755 index 0000000..a3e02af Binary files /dev/null and b/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/contracts-v1/eosio.contracts/eosio.token/eosio.token.wasm differ diff --git a/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/contracts-v1/eosio.contracts/eosio.wrap/eosio.wrap.abi b/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/contracts-v1/eosio.contracts/eosio.wrap/eosio.wrap.abi new file mode 100644 index 0000000..05a5f91 --- /dev/null +++ b/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/contracts-v1/eosio.contracts/eosio.wrap/eosio.wrap.abi @@ -0,0 +1,130 @@ +{ + "____comment": "This file was generated with eosio-abigen. DO NOT EDIT Sun Nov 29 15:45:11 2020", + "version": "eosio::abi/1.1", + "structs": [ + { + "name": "action", + "base": "", + "fields": [ + { + "name": "account", + "type": "name" + }, + { + "name": "name", + "type": "name" + }, + { + "name": "authorization", + "type": "permission_level[]" + }, + { + "name": "data", + "type": "bytes" + } + ] + }, + { + "name": "exec", + "base": "", + "fields": [ + { + "name": "executer", + "type": "name" + }, + { + "name": "trx", + "type": "transaction" + } + ] + }, + { + "name": "extension", + "base": "", + "fields": [ + { + "name": "type", + "type": "uint16" + }, + { + "name": "data", + "type": "bytes" + } + ] + }, + { + "name": "permission_level", + "base": "", + "fields": [ + { + "name": "actor", + "type": "name" + }, + { + "name": "permission", + "type": "name" + } + ] + }, + { + "name": "transaction", + "base": "transaction_header", + "fields": [ + { + "name": "context_free_actions", + "type": "action[]" + }, + { + "name": "actions", + "type": "action[]" + }, + { + "name": "transaction_extensions", + "type": "extension[]" + } + ] + }, + { + "name": "transaction_header", + "base": "", + "fields": [ + { + "name": "expiration", + "type": "time_point_sec" + }, + { + "name": "ref_block_num", + "type": "uint16" + }, + { + "name": "ref_block_prefix", + "type": "uint32" + }, + { + "name": "max_net_usage_words", + "type": "varuint32" + }, + { + "name": "max_cpu_usage_ms", + "type": "uint8" + }, + { + "name": "delay_sec", + "type": "varuint32" + } + ] + } + ], + "types": [], + "actions": [ + { + "name": "exec", + "type": "exec", + "ricardian_contract": "" + } + ], + "tables": [], + "ricardian_clauses": [], + "variants": [], + "abi_extensions": [] +} \ No newline at end of file diff --git a/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/contracts-v1/eosio.contracts/eosio.wrap/eosio.wrap.wasm b/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/contracts-v1/eosio.contracts/eosio.wrap/eosio.wrap.wasm new file mode 100755 index 0000000..e9c17cb Binary files /dev/null and b/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/contracts-v1/eosio.contracts/eosio.wrap/eosio.wrap.wasm differ diff --git a/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/contracts-v1/ore-protocol/ore.apptoken/ore.apptoken.abi b/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/contracts-v1/ore-protocol/ore.apptoken/ore.apptoken.abi new file mode 100644 index 0000000..afbe954 --- /dev/null +++ b/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/contracts-v1/ore-protocol/ore.apptoken/ore.apptoken.abi @@ -0,0 +1,185 @@ +{ + "____comment": "This file was generated with eosio-abigen. DO NOT EDIT ", + "version": "eosio::abi/1.1", + "types": [], + "structs": [ + { + "name": "account", + "base": "", + "fields": [ + { + "name": "balance", + "type": "asset" + } + ] + }, + { + "name": "close", + "base": "", + "fields": [ + { + "name": "owner", + "type": "name" + }, + { + "name": "symbol", + "type": "symbol" + } + ] + }, + { + "name": "create", + "base": "", + "fields": [ + { + "name": "issuer", + "type": "name" + }, + { + "name": "maximum_supply", + "type": "asset" + } + ] + }, + { + "name": "currency_stats", + "base": "", + "fields": [ + { + "name": "supply", + "type": "asset" + }, + { + "name": "max_supply", + "type": "asset" + }, + { + "name": "issuer", + "type": "name" + } + ] + }, + { + "name": "issue", + "base": "", + "fields": [ + { + "name": "to", + "type": "name" + }, + { + "name": "quantity", + "type": "asset" + }, + { + "name": "memo", + "type": "string" + } + ] + }, + { + "name": "open", + "base": "", + "fields": [ + { + "name": "owner", + "type": "name" + }, + { + "name": "symbol", + "type": "symbol" + }, + { + "name": "ram_payer", + "type": "name" + } + ] + }, + { + "name": "retire", + "base": "", + "fields": [ + { + "name": "quantity", + "type": "asset" + }, + { + "name": "memo", + "type": "string" + } + ] + }, + { + "name": "transfer", + "base": "", + "fields": [ + { + "name": "from", + "type": "name" + }, + { + "name": "to", + "type": "name" + }, + { + "name": "quantity", + "type": "asset" + }, + { + "name": "memo", + "type": "string" + } + ] + } + ], + "actions": [ + { + "name": "close", + "type": "close", + "ricardian_contract": "" + }, + { + "name": "create", + "type": "create", + "ricardian_contract": "" + }, + { + "name": "issue", + "type": "issue", + "ricardian_contract": "" + }, + { + "name": "open", + "type": "open", + "ricardian_contract": "" + }, + { + "name": "retire", + "type": "retire", + "ricardian_contract": "" + }, + { + "name": "transfer", + "type": "transfer", + "ricardian_contract": "" + } + ], + "tables": [ + { + "name": "accounts", + "type": "account", + "index_type": "i64", + "key_names": [], + "key_types": [] + }, + { + "name": "stat", + "type": "currency_stats", + "index_type": "i64", + "key_names": [], + "key_types": [] + } + ], + "ricardian_clauses": [], + "variants": [] +} \ No newline at end of file diff --git a/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/contracts-v1/ore-protocol/ore.apptoken/ore.apptoken.wasm b/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/contracts-v1/ore-protocol/ore.apptoken/ore.apptoken.wasm new file mode 100755 index 0000000..a331e17 Binary files /dev/null and b/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/contracts-v1/ore-protocol/ore.apptoken/ore.apptoken.wasm differ diff --git a/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/contracts-v1/ore-protocol/ore.instrument/ore.instrument.abi b/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/contracts-v1/ore-protocol/ore.instrument/ore.instrument.abi new file mode 100644 index 0000000..eacd126 --- /dev/null +++ b/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/contracts-v1/ore-protocol/ore.instrument/ore.instrument.abi @@ -0,0 +1,478 @@ +{ + "____comment": "This file was generated with eosio-abigen. DO NOT EDIT ", + "version": "eosio::abi/1.1", + "types": [], + "structs": [ + { + "name": "accountbalance", + "base": "", + "fields": [ + { + "name": "balance", + "type": "asset" + } + ] + }, + { + "name": "accountdata", + "base": "", + "fields": [ + { + "name": "owner", + "type": "name" + }, + { + "name": "balance", + "type": "uint64" + }, + { + "name": "instruments", + "type": "uint64[]" + } + ] + }, + { + "name": "args", + "base": "", + "fields": [ + { + "name": "name", + "type": "string" + }, + { + "name": "value", + "type": "string" + } + ] + }, + { + "name": "burn", + "base": "", + "fields": [ + { + "name": "burner", + "type": "name" + }, + { + "name": "token_id", + "type": "uint64" + } + ] + }, + { + "name": "checkright", + "base": "", + "fields": [ + { + "name": "minter", + "type": "name" + }, + { + "name": "issuer", + "type": "name" + }, + { + "name": "rightname", + "type": "string" + }, + { + "name": "deferred_transaction_id", + "type": "uint64" + } + ] + }, + { + "name": "create", + "base": "", + "fields": [ + { + "name": "issuer", + "type": "name" + }, + { + "name": "maximum_supply", + "type": "asset" + } + ] + }, + { + "name": "createinst", + "base": "", + "fields": [ + { + "name": "minter", + "type": "name" + }, + { + "name": "owner", + "type": "name" + }, + { + "name": "instrumentId", + "type": "uint64" + }, + { + "name": "instrument", + "type": "instrument_data" + }, + { + "name": "start_time", + "type": "uint64" + }, + { + "name": "end_time", + "type": "uint64" + } + ] + }, + { + "name": "currencystat", + "base": "", + "fields": [ + { + "name": "supply", + "type": "asset" + }, + { + "name": "max_supply", + "type": "asset" + }, + { + "name": "issuer", + "type": "name" + } + ] + }, + { + "name": "instrument_data", + "base": "", + "fields": [ + { + "name": "issuer", + "type": "name" + }, + { + "name": "instrument_class", + "type": "string" + }, + { + "name": "description", + "type": "string" + }, + { + "name": "instrument_template", + "type": "string" + }, + { + "name": "security_type", + "type": "string" + }, + { + "name": "parameter_rules", + "type": "param_type[]" + }, + { + "name": "rights", + "type": "right[]" + }, + { + "name": "parent_instrument_id", + "type": "uint64" + }, + { + "name": "data", + "type": "args[]" + }, + { + "name": "encrypted_by", + "type": "string" + }, + { + "name": "mutability", + "type": "uint8" + } + ] + }, + { + "name": "issue", + "base": "", + "fields": [ + { + "name": "to", + "type": "name" + }, + { + "name": "quantity", + "type": "asset" + }, + { + "name": "memo", + "type": "string" + } + ] + }, + { + "name": "mint", + "base": "", + "fields": [ + { + "name": "minter", + "type": "name" + }, + { + "name": "owner", + "type": "name" + }, + { + "name": "instrument", + "type": "instrument_data" + }, + { + "name": "start_time", + "type": "uint64" + }, + { + "name": "end_time", + "type": "uint64" + }, + { + "name": "instrumentId", + "type": "uint64" + } + ] + }, + { + "name": "param_type", + "base": "", + "fields": [ + { + "name": "type", + "type": "string" + }, + { + "name": "values", + "type": "args[]" + } + ] + }, + { + "name": "params", + "base": "", + "fields": [ + { + "name": "params", + "type": "args[]" + } + ] + }, + { + "name": "revoke", + "base": "", + "fields": [ + { + "name": "revoker", + "type": "name" + }, + { + "name": "token_id", + "type": "uint64" + } + ] + }, + { + "name": "right", + "base": "", + "fields": [ + { + "name": "right_name", + "type": "string" + }, + { + "name": "description", + "type": "string" + }, + { + "name": "price_in_cpu", + "type": "string" + }, + { + "name": "additional_url_params", + "type": "params[]" + } + ] + }, + { + "name": "token", + "base": "", + "fields": [ + { + "name": "id", + "type": "uint64" + }, + { + "name": "owner", + "type": "name" + }, + { + "name": "minted_by", + "type": "name" + }, + { + "name": "minted_at", + "type": "uint64" + }, + { + "name": "instrument", + "type": "instrument_data" + }, + { + "name": "revoked", + "type": "bool" + }, + { + "name": "start_time", + "type": "uint64" + }, + { + "name": "end_time", + "type": "uint64" + }, + { + "name": "template_hash", + "type": "uint64" + }, + { + "name": "class_hash", + "type": "uint64" + } + ] + }, + { + "name": "transfer", + "base": "", + "fields": [ + { + "name": "sender", + "type": "name" + }, + { + "name": "to", + "type": "name" + }, + { + "name": "token_id", + "type": "uint64" + } + ] + }, + { + "name": "update", + "base": "", + "fields": [ + { + "name": "updater", + "type": "name" + }, + { + "name": "instrument_template", + "type": "string" + }, + { + "name": "instrument", + "type": "instrument_data" + }, + { + "name": "instrument_id", + "type": "uint64" + }, + { + "name": "start_time", + "type": "uint64" + }, + { + "name": "end_time", + "type": "uint64" + } + ] + } + ], + "actions": [ + { + "name": "burn", + "type": "burn", + "ricardian_contract": "" + }, + { + "name": "checkright", + "type": "checkright", + "ricardian_contract": "" + }, + { + "name": "create", + "type": "create", + "ricardian_contract": "" + }, + { + "name": "createinst", + "type": "createinst", + "ricardian_contract": "" + }, + { + "name": "issue", + "type": "issue", + "ricardian_contract": "" + }, + { + "name": "mint", + "type": "mint", + "ricardian_contract": "" + }, + { + "name": "revoke", + "type": "revoke", + "ricardian_contract": "" + }, + { + "name": "transfer", + "type": "transfer", + "ricardian_contract": "" + }, + { + "name": "update", + "type": "update", + "ricardian_contract": "" + } + ], + "tables": [ + { + "name": "account", + "type": "accountdata", + "index_type": "i64", + "key_names": [], + "key_types": [] + }, + { + "name": "accounts", + "type": "accountbalance", + "index_type": "i64", + "key_names": [], + "key_types": [] + }, + { + "name": "stat", + "type": "currencystat", + "index_type": "i64", + "key_names": [], + "key_types": [] + }, + { + "name": "tokens", + "type": "token", + "index_type": "i64", + "key_names": [], + "key_types": [] + } + ], + "ricardian_clauses": [], + "variants": [] +} \ No newline at end of file diff --git a/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/contracts-v1/ore-protocol/ore.instrument/ore.instrument.wasm b/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/contracts-v1/ore-protocol/ore.instrument/ore.instrument.wasm new file mode 100755 index 0000000..93891af Binary files /dev/null and b/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/contracts-v1/ore-protocol/ore.instrument/ore.instrument.wasm differ diff --git a/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/contracts-v1/ore-protocol/ore.rights_registry/ore.rights_registry.abi b/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/contracts-v1/ore-protocol/ore.rights_registry/ore.rights_registry.abi new file mode 100644 index 0000000..1ffe335 --- /dev/null +++ b/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/contracts-v1/ore-protocol/ore.rights_registry/ore.rights_registry.abi @@ -0,0 +1,136 @@ +{ + "____comment": "This file was generated with eosio-abigen. DO NOT EDIT ", + "version": "eosio::abi/1.1", + "types": [], + "structs": [ + { + "name": "args", + "base": "", + "fields": [ + { + "name": "name", + "type": "string" + }, + { + "name": "value", + "type": "string" + } + ] + }, + { + "name": "deleteright", + "base": "", + "fields": [ + { + "name": "owner", + "type": "name" + }, + { + "name": "right_name", + "type": "string" + } + ] + }, + { + "name": "endpoint_url", + "base": "", + "fields": [ + { + "name": "base_right", + "type": "string" + }, + { + "name": "url", + "type": "string" + }, + { + "name": "method", + "type": "string" + }, + { + "name": "matches_params", + "type": "args[]" + }, + { + "name": "token_life_span", + "type": "uint64" + }, + { + "name": "is_default", + "type": "bool" + } + ] + }, + { + "name": "right_reg", + "base": "", + "fields": [ + { + "name": "id", + "type": "uint64" + }, + { + "name": "right_name", + "type": "string" + }, + { + "name": "owner", + "type": "name" + }, + { + "name": "urls", + "type": "endpoint_url[]" + }, + { + "name": "issuer_whitelist", + "type": "name[]" + } + ] + }, + { + "name": "upsertright", + "base": "", + "fields": [ + { + "name": "owner", + "type": "name" + }, + { + "name": "right_name", + "type": "string" + }, + { + "name": "urls", + "type": "endpoint_url[]" + }, + { + "name": "issuer_whitelist", + "type": "name[]" + } + ] + } + ], + "actions": [ + { + "name": "deleteright", + "type": "deleteright", + "ricardian_contract": "" + }, + { + "name": "upsertright", + "type": "upsertright", + "ricardian_contract": "" + } + ], + "tables": [ + { + "name": "rights", + "type": "right_reg", + "index_type": "i64", + "key_names": [], + "key_types": [] + } + ], + "ricardian_clauses": [], + "variants": [] +} \ No newline at end of file diff --git a/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/contracts-v1/ore-protocol/ore.rights_registry/ore.rights_registry.wasm b/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/contracts-v1/ore-protocol/ore.rights_registry/ore.rights_registry.wasm new file mode 100755 index 0000000..5e895d5 Binary files /dev/null and b/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/contracts-v1/ore-protocol/ore.rights_registry/ore.rights_registry.wasm differ diff --git a/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/contracts-v1/ore-protocol/ore.standard_token/ore.standard_token.abi b/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/contracts-v1/ore-protocol/ore.standard_token/ore.standard_token.abi new file mode 100644 index 0000000..c26b593 --- /dev/null +++ b/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/contracts-v1/ore-protocol/ore.standard_token/ore.standard_token.abi @@ -0,0 +1,264 @@ +{ + "____comment": "This file was generated with eosio-abigen. DO NOT EDIT ", + "version": "eosio::abi/1.1", + "types": [], + "structs": [ + { + "name": "account", + "base": "", + "fields": [ + { + "name": "balance", + "type": "asset" + } + ] + }, + { + "name": "allowance", + "base": "", + "fields": [ + { + "name": "to", + "type": "name" + }, + { + "name": "quantity", + "type": "asset" + } + ] + }, + { + "name": "approve", + "base": "", + "fields": [ + { + "name": "from", + "type": "name" + }, + { + "name": "to", + "type": "name" + }, + { + "name": "quantity", + "type": "asset" + }, + { + "name": "memo", + "type": "string" + } + ] + }, + { + "name": "close", + "base": "", + "fields": [ + { + "name": "owner", + "type": "name" + }, + { + "name": "symbol", + "type": "symbol" + } + ] + }, + { + "name": "create", + "base": "", + "fields": [ + { + "name": "issuer", + "type": "name" + }, + { + "name": "maximum_supply", + "type": "asset" + } + ] + }, + { + "name": "currencystat", + "base": "", + "fields": [ + { + "name": "supply", + "type": "asset" + }, + { + "name": "max_supply", + "type": "asset" + }, + { + "name": "issuer", + "type": "name" + } + ] + }, + { + "name": "issue", + "base": "", + "fields": [ + { + "name": "to", + "type": "name" + }, + { + "name": "quantity", + "type": "asset" + }, + { + "name": "memo", + "type": "string" + } + ] + }, + { + "name": "open", + "base": "", + "fields": [ + { + "name": "owner", + "type": "name" + }, + { + "name": "symbol", + "type": "symbol" + }, + { + "name": "ram_payer", + "type": "name" + } + ] + }, + { + "name": "retire", + "base": "", + "fields": [ + { + "name": "quantity", + "type": "asset" + }, + { + "name": "memo", + "type": "string" + } + ] + }, + { + "name": "transfer", + "base": "", + "fields": [ + { + "name": "from", + "type": "name" + }, + { + "name": "to", + "type": "name" + }, + { + "name": "quantity", + "type": "asset" + }, + { + "name": "memo", + "type": "string" + } + ] + }, + { + "name": "transferfrom", + "base": "", + "fields": [ + { + "name": "sender", + "type": "name" + }, + { + "name": "from", + "type": "name" + }, + { + "name": "to", + "type": "name" + }, + { + "name": "quantity", + "type": "asset" + }, + { + "name": "memo", + "type": "string" + } + ] + } + ], + "actions": [ + { + "name": "approve", + "type": "approve", + "ricardian_contract": "" + }, + { + "name": "close", + "type": "close", + "ricardian_contract": "" + }, + { + "name": "create", + "type": "create", + "ricardian_contract": "" + }, + { + "name": "issue", + "type": "issue", + "ricardian_contract": "" + }, + { + "name": "open", + "type": "open", + "ricardian_contract": "" + }, + { + "name": "retire", + "type": "retire", + "ricardian_contract": "" + }, + { + "name": "transfer", + "type": "transfer", + "ricardian_contract": "" + }, + { + "name": "transferfrom", + "type": "transferfrom", + "ricardian_contract": "" + } + ], + "tables": [ + { + "name": "accounts", + "type": "account", + "index_type": "i64", + "key_names": [], + "key_types": [] + }, + { + "name": "allowances", + "type": "allowance", + "index_type": "i64", + "key_names": [], + "key_types": [] + }, + { + "name": "stat", + "type": "currencystat", + "index_type": "i64", + "key_names": [], + "key_types": [] + } + ], + "ricardian_clauses": [], + "variants": [] +} \ No newline at end of file diff --git a/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/contracts-v1/ore-protocol/ore.standard_token/ore.standard_token.wasm b/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/contracts-v1/ore-protocol/ore.standard_token/ore.standard_token.wasm new file mode 100755 index 0000000..cccf320 Binary files /dev/null and b/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/contracts-v1/ore-protocol/ore.standard_token/ore.standard_token.wasm differ diff --git a/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/contracts-v1/ore-protocol/ore.system/ore.system.abi b/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/contracts-v1/ore-protocol/ore.system/ore.system.abi new file mode 100644 index 0000000..bb8e4c8 --- /dev/null +++ b/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/contracts-v1/ore-protocol/ore.system/ore.system.abi @@ -0,0 +1,236 @@ +{ + "____comment": "This file was generated with eosio-abigen. DO NOT EDIT ", + "version": "eosio::abi/1.1", + "types": [], + "structs": [ + { + "name": "chgacctier", + "base": "", + "fields": [ + { + "name": "payer", + "type": "name" + }, + { + "name": "account", + "type": "name" + }, + { + "name": "pricekey", + "type": "uint64" + } + ] + }, + { + "name": "createoreacc", + "base": "", + "fields": [ + { + "name": "creator", + "type": "name" + }, + { + "name": "newname", + "type": "name" + }, + { + "name": "ownerkey", + "type": "public_key" + }, + { + "name": "activekey", + "type": "public_key" + }, + { + "name": "pricekey", + "type": "uint64" + }, + { + "name": "referral", + "type": "name" + } + ] + }, + { + "name": "createtoken", + "base": "", + "fields": [ + { + "name": "payer", + "type": "name" + }, + { + "name": "maximum_supply", + "type": "asset" + } + ] + }, + { + "name": "oreprice", + "base": "", + "fields": [ + { + "name": "key", + "type": "uint64" + }, + { + "name": "createprice", + "type": "asset" + }, + { + "name": "rambytes", + "type": "uint64" + }, + { + "name": "netamount", + "type": "asset" + }, + { + "name": "cpuamount", + "type": "asset" + } + ] + }, + { + "name": "reflog", + "base": "", + "fields": [ + { + "name": "referral", + "type": "name" + }, + { + "name": "newaccount", + "type": "name" + } + ] + }, + { + "name": "refstats", + "base": "", + "fields": [ + { + "name": "pricekey", + "type": "uint64" + }, + { + "name": "count", + "type": "uint64" + } + ] + }, + { + "name": "setprice", + "base": "", + "fields": [ + { + "name": "createprice", + "type": "asset" + }, + { + "name": "rambytes", + "type": "uint64" + }, + { + "name": "netamount", + "type": "asset" + }, + { + "name": "cpuamount", + "type": "asset" + }, + { + "name": "pricekey", + "type": "uint64" + } + ] + }, + { + "name": "tierinfo", + "base": "", + "fields": [ + { + "name": "pricekey", + "type": "uint64" + }, + { + "name": "createprice", + "type": "asset" + } + ] + }, + { + "name": "tokenprice", + "base": "", + "fields": [ + { + "name": "tokenprice", + "type": "asset" + }, + { + "name": "tokenkey", + "type": "name" + } + ] + } + ], + "actions": [ + { + "name": "chgacctier", + "type": "chgacctier", + "ricardian_contract": "" + }, + { + "name": "createoreacc", + "type": "createoreacc", + "ricardian_contract": "" + }, + { + "name": "createtoken", + "type": "createtoken", + "ricardian_contract": "" + }, + { + "name": "setprice", + "type": "setprice", + "ricardian_contract": "" + }, + { + "name": "tokenprice", + "type": "tokenprice", + "ricardian_contract": "" + } + ], + "tables": [ + { + "name": "pricetable", + "type": "oreprice", + "index_type": "i64", + "key_names": [], + "key_types": [] + }, + { + "name": "reflog", + "type": "reflog", + "index_type": "i64", + "key_names": [], + "key_types": [] + }, + { + "name": "refstats", + "type": "refstats", + "index_type": "i64", + "key_names": [], + "key_types": [] + }, + { + "name": "tierinfo", + "type": "tierinfo", + "index_type": "i64", + "key_names": [], + "key_types": [] + } + ], + "ricardian_clauses": [], + "variants": [] +} \ No newline at end of file diff --git a/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/contracts-v1/ore-protocol/ore.system/ore.system.wasm b/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/contracts-v1/ore-protocol/ore.system/ore.system.wasm new file mode 100755 index 0000000..e0d3dba Binary files /dev/null and b/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/contracts-v1/ore-protocol/ore.system/ore.system.wasm differ diff --git a/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/contracts-v1/ore-protocol/ore.usage_log/ore.usage_log.abi b/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/contracts-v1/ore-protocol/ore.usage_log/ore.usage_log.abi new file mode 100644 index 0000000..0781355 --- /dev/null +++ b/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/contracts-v1/ore-protocol/ore.usage_log/ore.usage_log.abi @@ -0,0 +1,152 @@ +{ + "____comment": "This file was generated with eosio-abigen. DO NOT EDIT ", + "version": "eosio::abi/1.1", + "types": [], + "structs": [ + { + "name": "callcount", + "base": "", + "fields": [ + { + "name": "right_hash", + "type": "uint64" + }, + { + "name": "right_name", + "type": "string" + }, + { + "name": "last_usage_time", + "type": "time_point_sec" + }, + { + "name": "total_count", + "type": "uint64" + }, + { + "name": "total_cpu", + "type": "asset" + } + ] + }, + { + "name": "createlog", + "base": "", + "fields": [ + { + "name": "instrument_id", + "type": "uint64" + }, + { + "name": "right_name", + "type": "string" + }, + { + "name": "token_hash", + "type": "string" + }, + { + "name": "timestamp", + "type": "uint64" + } + ] + }, + { + "name": "deletelog", + "base": "", + "fields": [ + { + "name": "instrument_id", + "type": "uint64" + }, + { + "name": "token_hash", + "type": "string" + } + ] + }, + { + "name": "log", + "base": "", + "fields": [ + { + "name": "instrument_id", + "type": "uint64" + }, + { + "name": "right_hash", + "type": "uint64" + }, + { + "name": "right_name", + "type": "string" + }, + { + "name": "action_type", + "type": "bool" + }, + { + "name": "token_hash", + "type": "uint64" + }, + { + "name": "timestamp", + "type": "uint64" + } + ] + }, + { + "name": "updatecount", + "base": "", + "fields": [ + { + "name": "instrument_id", + "type": "uint64" + }, + { + "name": "right_name", + "type": "string" + }, + { + "name": "cpu", + "type": "asset" + } + ] + } + ], + "actions": [ + { + "name": "createlog", + "type": "createlog", + "ricardian_contract": "" + }, + { + "name": "deletelog", + "type": "deletelog", + "ricardian_contract": "" + }, + { + "name": "updatecount", + "type": "updatecount", + "ricardian_contract": "" + } + ], + "tables": [ + { + "name": "counts", + "type": "callcount", + "index_type": "i64", + "key_names": [], + "key_types": [] + }, + { + "name": "logs", + "type": "log", + "index_type": "i64", + "key_names": [], + "key_types": [] + } + ], + "ricardian_clauses": [], + "variants": [] +} \ No newline at end of file diff --git a/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/contracts-v1/ore-protocol/ore.usage_log/ore.usage_log.wasm b/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/contracts-v1/ore-protocol/ore.usage_log/ore.usage_log.wasm new file mode 100755 index 0000000..35ee2c1 Binary files /dev/null and b/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/contracts-v1/ore-protocol/ore.usage_log/ore.usage_log.wasm differ diff --git a/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/contracts-v2/CreateEscrow/createescrow.abi b/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/contracts-v2/CreateEscrow/createescrow.abi new file mode 100644 index 0000000..ef37069 --- /dev/null +++ b/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/contracts-v2/CreateEscrow/createescrow.abi @@ -0,0 +1,717 @@ +{ + "____comment": "This file was generated with eosio-abigen. DO NOT EDIT ", + "version": "eosio::abi/1.1", + "types": [], + "structs": [ + { + "name": "airdropdata", + "base": "", + "fields": [ + { + "name": "contract", + "type": "name" + }, + { + "name": "balance", + "type": "asset" + }, + { + "name": "amount", + "type": "asset" + } + ] + }, + { + "name": "balances", + "base": "", + "fields": [ + { + "name": "memo", + "type": "uint64" + }, + { + "name": "contributors", + "type": "contributors[]" + }, + { + "name": "total_balance", + "type": "asset" + }, + { + "name": "origin", + "type": "string" + }, + { + "name": "timestamp", + "type": "uint64" + } + ] + }, + { + "name": "clean", + "base": "", + "fields": [] + }, + { + "name": "cleanreg", + "base": "", + "fields": [] + }, + { + "name": "cleantoken", + "base": "", + "fields": [] + }, + { + "name": "contributors", + "base": "", + "fields": [ + { + "name": "contributor", + "type": "name" + }, + { + "name": "balance", + "type": "asset" + }, + { + "name": "rex_balance", + "type": "asset" + }, + { + "name": "total_spent", + "type": "asset" + }, + { + "name": "total_staked", + "type": "asset" + }, + { + "name": "total_spent_rex", + "type": "asset" + }, + { + "name": "ram_contribution_percent", + "type": "int32" + }, + { + "name": "totalaccounts", + "type": "int32" + }, + { + "name": "createdaccounts", + "type": "int32" + } + ] + }, + { + "name": "create", + "base": "", + "fields": [ + { + "name": "memo", + "type": "string" + }, + { + "name": "account", + "type": "name" + }, + { + "name": "ownerkey", + "type": "public_key" + }, + { + "name": "activekey", + "type": "public_key" + }, + { + "name": "origin", + "type": "string" + }, + { + "name": "referral", + "type": "name" + } + ] + }, + { + "name": "define", + "base": "", + "fields": [ + { + "name": "owner", + "type": "name" + }, + { + "name": "dapp", + "type": "string" + }, + { + "name": "ram_bytes", + "type": "uint64" + }, + { + "name": "net", + "type": "asset" + }, + { + "name": "cpu", + "type": "asset" + }, + { + "name": "pricekey", + "type": "uint64" + }, + { + "name": "airdrop", + "type": "airdropdata" + }, + { + "name": "use_rex", + "type": "bool" + }, + { + "name": "rex", + "type": "rexdata" + } + ] + }, + { + "name": "fundcpuloan", + "base": "", + "fields": [ + { + "name": "from", + "type": "name" + }, + { + "name": "to", + "type": "name" + }, + { + "name": "quantity", + "type": "asset" + }, + { + "name": "origin", + "type": "string" + } + ] + }, + { + "name": "fundnetloan", + "base": "", + "fields": [ + { + "name": "from", + "type": "name" + }, + { + "name": "to", + "type": "name" + }, + { + "name": "quantity", + "type": "asset" + }, + { + "name": "origin", + "type": "string" + } + ] + }, + { + "name": "init", + "base": "", + "fields": [ + { + "name": "symbol", + "type": "symbol" + }, + { + "name": "newaccountcontract", + "type": "name" + }, + { + "name": "newaccountaction", + "type": "name" + }, + { + "name": "minimumram", + "type": "uint64" + } + ] + }, + { + "name": "ping", + "base": "", + "fields": [ + { + "name": "from", + "type": "name" + } + ] + }, + { + "name": "reclaim", + "base": "", + "fields": [ + { + "name": "reclaimer", + "type": "name" + }, + { + "name": "dapp", + "type": "string" + }, + { + "name": "sym", + "type": "string" + } + ] + }, + { + "name": "refundstakes", + "base": "", + "fields": [ + { + "name": "from", + "type": "name" + }, + { + "name": "origin", + "type": "string" + } + ] + }, + { + "name": "registryStruct", + "base": "", + "fields": [ + { + "name": "owner", + "type": "name" + }, + { + "name": "dapp", + "type": "string" + }, + { + "name": "ram_bytes", + "type": "uint64" + }, + { + "name": "net", + "type": "asset" + }, + { + "name": "cpu", + "type": "asset" + }, + { + "name": "custodians", + "type": "name[]" + }, + { + "name": "pricekey", + "type": "uint64" + }, + { + "name": "use_rex", + "type": "bool" + }, + { + "name": "airdrop", + "type": "airdropdata?" + }, + { + "name": "rex", + "type": "rexdata?" + } + ] + }, + { + "name": "rentcpu", + "base": "", + "fields": [ + { + "name": "from", + "type": "name" + }, + { + "name": "to", + "type": "name" + }, + { + "name": "origin", + "type": "string" + } + ] + }, + { + "name": "rentnet", + "base": "", + "fields": [ + { + "name": "from", + "type": "name" + }, + { + "name": "to", + "type": "name" + }, + { + "name": "origin", + "type": "string" + } + ] + }, + { + "name": "rexdata", + "base": "", + "fields": [ + { + "name": "net_loan_payment", + "type": "asset" + }, + { + "name": "net_loan_fund", + "type": "asset" + }, + { + "name": "cpu_loan_payment", + "type": "asset" + }, + { + "name": "cpu_loan_fund", + "type": "asset" + } + ] + }, + { + "name": "stake", + "base": "", + "fields": [ + { + "name": "from", + "type": "name" + }, + { + "name": "to", + "type": "name" + }, + { + "name": "origin", + "type": "string" + }, + { + "name": "net", + "type": "asset" + }, + { + "name": "cpu", + "type": "asset" + } + ] + }, + { + "name": "token", + "base": "", + "fields": [ + { + "name": "S_SYS", + "type": "symbol" + }, + { + "name": "newaccountcontract", + "type": "name" + }, + { + "name": "newaccountaction", + "type": "name" + }, + { + "name": "min_ram", + "type": "uint64" + } + ] + }, + { + "name": "topuploans", + "base": "", + "fields": [ + { + "name": "from", + "type": "name" + }, + { + "name": "to", + "type": "name" + }, + { + "name": "cpuquantity", + "type": "asset" + }, + { + "name": "netquantity", + "type": "asset" + }, + { + "name": "origin", + "type": "string" + } + ] + }, + { + "name": "unstake", + "base": "", + "fields": [ + { + "name": "from", + "type": "name" + }, + { + "name": "to", + "type": "name" + }, + { + "name": "origin", + "type": "string" + } + ] + }, + { + "name": "unstakeStruct", + "base": "", + "fields": [ + { + "name": "reclaimer", + "type": "name" + }, + { + "name": "net_balance", + "type": "asset" + }, + { + "name": "cpu_balance", + "type": "asset" + }, + { + "name": "dapp", + "type": "string" + }, + { + "name": "origin", + "type": "uint64" + } + ] + }, + { + "name": "unstakecpu", + "base": "", + "fields": [ + { + "name": "from", + "type": "name" + }, + { + "name": "to", + "type": "name" + }, + { + "name": "origin", + "type": "string" + } + ] + }, + { + "name": "unstakedBalStruct", + "base": "", + "fields": [ + { + "name": "balance", + "type": "asset" + } + ] + }, + { + "name": "unstakenet", + "base": "", + "fields": [ + { + "name": "from", + "type": "name" + }, + { + "name": "to", + "type": "name" + }, + { + "name": "origin", + "type": "string" + } + ] + }, + { + "name": "whitelist", + "base": "", + "fields": [ + { + "name": "owner", + "type": "name" + }, + { + "name": "account", + "type": "name" + }, + { + "name": "dapp", + "type": "string" + } + ] + } + ], + "actions": [ + { + "name": "clean", + "type": "clean", + "ricardian_contract": "" + }, + { + "name": "cleanreg", + "type": "cleanreg", + "ricardian_contract": "" + }, + { + "name": "cleantoken", + "type": "cleantoken", + "ricardian_contract": "" + }, + { + "name": "create", + "type": "create", + "ricardian_contract": "" + }, + { + "name": "define", + "type": "define", + "ricardian_contract": "" + }, + { + "name": "fundcpuloan", + "type": "fundcpuloan", + "ricardian_contract": "" + }, + { + "name": "fundnetloan", + "type": "fundnetloan", + "ricardian_contract": "" + }, + { + "name": "init", + "type": "init", + "ricardian_contract": "" + }, + { + "name": "ping", + "type": "ping", + "ricardian_contract": "" + }, + { + "name": "reclaim", + "type": "reclaim", + "ricardian_contract": "" + }, + { + "name": "refundstakes", + "type": "refundstakes", + "ricardian_contract": "" + }, + { + "name": "rentcpu", + "type": "rentcpu", + "ricardian_contract": "" + }, + { + "name": "rentnet", + "type": "rentnet", + "ricardian_contract": "" + }, + { + "name": "stake", + "type": "stake", + "ricardian_contract": "" + }, + { + "name": "topuploans", + "type": "topuploans", + "ricardian_contract": "" + }, + { + "name": "unstake", + "type": "unstake", + "ricardian_contract": "" + }, + { + "name": "unstakecpu", + "type": "unstakecpu", + "ricardian_contract": "" + }, + { + "name": "unstakenet", + "type": "unstakenet", + "ricardian_contract": "" + }, + { + "name": "whitelist", + "type": "whitelist", + "ricardian_contract": "" + } + ], + "tables": [ + { + "name": "balances", + "type": "balances", + "index_type": "i64", + "key_names": [], + "key_types": [] + }, + { + "name": "contributors", + "type": "contributors", + "index_type": "i64", + "key_names": [], + "key_types": [] + }, + { + "name": "registry", + "type": "registryStruct", + "index_type": "i64", + "key_names": [], + "key_types": [] + }, + { + "name": "token", + "type": "token", + "index_type": "i64", + "key_names": [], + "key_types": [] + }, + { + "name": "totalreclaim", + "type": "unstakedBalStruct", + "index_type": "i64", + "key_names": [], + "key_types": [] + }, + { + "name": "unstaked", + "type": "unstakeStruct", + "index_type": "i64", + "key_names": [], + "key_types": [] + } + ], + "ricardian_clauses": [], + "variants": [] +} \ No newline at end of file diff --git a/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/contracts-v2/CreateEscrow/createescrow.wasm b/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/contracts-v2/CreateEscrow/createescrow.wasm new file mode 100755 index 0000000..63d2a72 Binary files /dev/null and b/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/contracts-v2/CreateEscrow/createescrow.wasm differ diff --git a/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/contracts-v2/eosio.contracts/eosio.system/eosio.system.abi b/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/contracts-v2/eosio.contracts/eosio.system/eosio.system.abi new file mode 100644 index 0000000..d4fa397 --- /dev/null +++ b/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/contracts-v2/eosio.contracts/eosio.system/eosio.system.abi @@ -0,0 +1,2122 @@ +{ + "____comment": "This file was generated with eosio-abigen. DO NOT EDIT ", + "version": "eosio::abi/1.1", + "types": [], + "structs": [ + { + "name": "abi_hash", + "base": "", + "fields": [ + { + "name": "owner", + "type": "name" + }, + { + "name": "hash", + "type": "checksum256" + } + ] + }, + { + "name": "activate", + "base": "", + "fields": [ + { + "name": "feature_digest", + "type": "checksum256" + } + ] + }, + { + "name": "authority", + "base": "", + "fields": [ + { + "name": "threshold", + "type": "uint32" + }, + { + "name": "keys", + "type": "key_weight[]" + }, + { + "name": "accounts", + "type": "permission_level_weight[]" + }, + { + "name": "waits", + "type": "wait_weight[]" + } + ] + }, + { + "name": "bid_refund", + "base": "", + "fields": [ + { + "name": "bidder", + "type": "name" + }, + { + "name": "amount", + "type": "asset" + } + ] + }, + { + "name": "bidname", + "base": "", + "fields": [ + { + "name": "bidder", + "type": "name" + }, + { + "name": "newname", + "type": "name" + }, + { + "name": "bid", + "type": "asset" + } + ] + }, + { + "name": "bidrefund", + "base": "", + "fields": [ + { + "name": "bidder", + "type": "name" + }, + { + "name": "newname", + "type": "name" + } + ] + }, + { + "name": "block_header", + "base": "", + "fields": [ + { + "name": "timestamp", + "type": "uint32" + }, + { + "name": "producer", + "type": "name" + }, + { + "name": "confirmed", + "type": "uint16" + }, + { + "name": "previous", + "type": "checksum256" + }, + { + "name": "transaction_mroot", + "type": "checksum256" + }, + { + "name": "action_mroot", + "type": "checksum256" + }, + { + "name": "schedule_version", + "type": "uint32" + }, + { + "name": "new_producers", + "type": "producer_schedule?" + } + ] + }, + { + "name": "blockchain_parameters", + "base": "", + "fields": [ + { + "name": "max_block_net_usage", + "type": "uint64" + }, + { + "name": "target_block_net_usage_pct", + "type": "uint32" + }, + { + "name": "max_transaction_net_usage", + "type": "uint32" + }, + { + "name": "base_per_transaction_net_usage", + "type": "uint32" + }, + { + "name": "net_usage_leeway", + "type": "uint32" + }, + { + "name": "context_free_discount_net_usage_num", + "type": "uint32" + }, + { + "name": "context_free_discount_net_usage_den", + "type": "uint32" + }, + { + "name": "max_block_cpu_usage", + "type": "uint32" + }, + { + "name": "target_block_cpu_usage_pct", + "type": "uint32" + }, + { + "name": "max_transaction_cpu_usage", + "type": "uint32" + }, + { + "name": "min_transaction_cpu_usage", + "type": "uint32" + }, + { + "name": "max_transaction_lifetime", + "type": "uint32" + }, + { + "name": "deferred_trx_expiration_window", + "type": "uint32" + }, + { + "name": "max_transaction_delay", + "type": "uint32" + }, + { + "name": "max_inline_action_size", + "type": "uint32" + }, + { + "name": "max_inline_action_depth", + "type": "uint16" + }, + { + "name": "max_authority_depth", + "type": "uint16" + } + ] + }, + { + "name": "buyram", + "base": "", + "fields": [ + { + "name": "payer", + "type": "name" + }, + { + "name": "receiver", + "type": "name" + }, + { + "name": "quant", + "type": "asset" + } + ] + }, + { + "name": "buyrambytes", + "base": "", + "fields": [ + { + "name": "payer", + "type": "name" + }, + { + "name": "receiver", + "type": "name" + }, + { + "name": "bytes", + "type": "uint32" + } + ] + }, + { + "name": "buyrex", + "base": "", + "fields": [ + { + "name": "from", + "type": "name" + }, + { + "name": "amount", + "type": "asset" + } + ] + }, + { + "name": "canceldelay", + "base": "", + "fields": [ + { + "name": "canceling_auth", + "type": "permission_level" + }, + { + "name": "trx_id", + "type": "checksum256" + } + ] + }, + { + "name": "claim", + "base": "", + "fields": [ + { + "name": "owner", + "type": "name" + } + ] + }, + { + "name": "claimrewards", + "base": "", + "fields": [ + { + "name": "owner", + "type": "name" + } + ] + }, + { + "name": "closerex", + "base": "", + "fields": [ + { + "name": "owner", + "type": "name" + } + ] + }, + { + "name": "cnclrexorder", + "base": "", + "fields": [ + { + "name": "owner", + "type": "name" + } + ] + }, + { + "name": "connector", + "base": "", + "fields": [ + { + "name": "balance", + "type": "asset" + }, + { + "name": "weight", + "type": "float64" + } + ] + }, + { + "name": "consolidate", + "base": "", + "fields": [ + { + "name": "owner", + "type": "name" + } + ] + }, + { + "name": "defcpuloan", + "base": "", + "fields": [ + { + "name": "from", + "type": "name" + }, + { + "name": "loan_num", + "type": "uint64" + }, + { + "name": "amount", + "type": "asset" + } + ] + }, + { + "name": "defnetloan", + "base": "", + "fields": [ + { + "name": "from", + "type": "name" + }, + { + "name": "loan_num", + "type": "uint64" + }, + { + "name": "amount", + "type": "asset" + } + ] + }, + { + "name": "delegatebw", + "base": "", + "fields": [ + { + "name": "from", + "type": "name" + }, + { + "name": "receiver", + "type": "name" + }, + { + "name": "stake_net_quantity", + "type": "asset" + }, + { + "name": "stake_cpu_quantity", + "type": "asset" + }, + { + "name": "transfer", + "type": "bool" + } + ] + }, + { + "name": "delegated_bandwidth", + "base": "", + "fields": [ + { + "name": "from", + "type": "name" + }, + { + "name": "to", + "type": "name" + }, + { + "name": "net_weight", + "type": "asset" + }, + { + "name": "cpu_weight", + "type": "asset" + } + ] + }, + { + "name": "deleteauth", + "base": "", + "fields": [ + { + "name": "account", + "type": "name" + }, + { + "name": "permission", + "type": "name" + } + ] + }, + { + "name": "deposit", + "base": "", + "fields": [ + { + "name": "owner", + "type": "name" + }, + { + "name": "amount", + "type": "asset" + } + ] + }, + { + "name": "eosio_global_state", + "base": "blockchain_parameters", + "fields": [ + { + "name": "max_ram_size", + "type": "uint64" + }, + { + "name": "total_ram_bytes_reserved", + "type": "uint64" + }, + { + "name": "total_ram_stake", + "type": "int64" + }, + { + "name": "last_producer_schedule_update", + "type": "block_timestamp_type" + }, + { + "name": "last_pervote_bucket_fill", + "type": "time_point" + }, + { + "name": "pervote_bucket", + "type": "int64" + }, + { + "name": "perblock_bucket", + "type": "int64" + }, + { + "name": "total_unpaid_blocks", + "type": "uint32" + }, + { + "name": "total_activated_stake", + "type": "int64" + }, + { + "name": "thresh_activated_stake_time", + "type": "time_point" + }, + { + "name": "last_producer_schedule_size", + "type": "uint16" + }, + { + "name": "total_producer_vote_weight", + "type": "float64" + }, + { + "name": "last_name_close", + "type": "block_timestamp_type" + } + ] + }, + { + "name": "eosio_global_state2", + "base": "", + "fields": [ + { + "name": "new_ram_per_block", + "type": "uint16" + }, + { + "name": "last_ram_increase", + "type": "block_timestamp_type" + }, + { + "name": "last_block_num", + "type": "block_timestamp_type" + }, + { + "name": "total_producer_votepay_share", + "type": "float64" + }, + { + "name": "revision", + "type": "uint8" + } + ] + }, + { + "name": "eosio_global_state3", + "base": "", + "fields": [ + { + "name": "last_vpay_state_update", + "type": "time_point" + }, + { + "name": "total_vpay_share_change_rate", + "type": "float64" + } + ] + }, + { + "name": "eosio_global_state4", + "base": "", + "fields": [ + { + "name": "continuous_rate", + "type": "float64" + }, + { + "name": "inflation_pay_factor", + "type": "int64" + }, + { + "name": "votepay_factor", + "type": "int64" + } + ] + }, + { + "name": "exchange_state", + "base": "", + "fields": [ + { + "name": "supply", + "type": "asset" + }, + { + "name": "base", + "type": "connector" + }, + { + "name": "quote", + "type": "connector" + } + ] + }, + { + "name": "fundcpuloan", + "base": "", + "fields": [ + { + "name": "from", + "type": "name" + }, + { + "name": "loan_num", + "type": "uint64" + }, + { + "name": "payment", + "type": "asset" + } + ] + }, + { + "name": "fundnetloan", + "base": "", + "fields": [ + { + "name": "from", + "type": "name" + }, + { + "name": "loan_num", + "type": "uint64" + }, + { + "name": "payment", + "type": "asset" + } + ] + }, + { + "name": "init", + "base": "", + "fields": [ + { + "name": "version", + "type": "varuint32" + }, + { + "name": "core", + "type": "symbol" + } + ] + }, + { + "name": "key_weight", + "base": "", + "fields": [ + { + "name": "key", + "type": "public_key" + }, + { + "name": "weight", + "type": "uint16" + } + ] + }, + { + "name": "linkauth", + "base": "", + "fields": [ + { + "name": "account", + "type": "name" + }, + { + "name": "code", + "type": "name" + }, + { + "name": "type", + "type": "name" + }, + { + "name": "requirement", + "type": "name" + } + ] + }, + { + "name": "mvfrsavings", + "base": "", + "fields": [ + { + "name": "owner", + "type": "name" + }, + { + "name": "rex", + "type": "asset" + } + ] + }, + { + "name": "mvtosavings", + "base": "", + "fields": [ + { + "name": "owner", + "type": "name" + }, + { + "name": "rex", + "type": "asset" + } + ] + }, + { + "name": "name_bid", + "base": "", + "fields": [ + { + "name": "newname", + "type": "name" + }, + { + "name": "high_bidder", + "type": "name" + }, + { + "name": "high_bid", + "type": "int64" + }, + { + "name": "last_bid_time", + "type": "time_point" + } + ] + }, + { + "name": "newaccount", + "base": "", + "fields": [ + { + "name": "creator", + "type": "name" + }, + { + "name": "name", + "type": "name" + }, + { + "name": "owner", + "type": "authority" + }, + { + "name": "active", + "type": "authority" + } + ] + }, + { + "name": "onblock", + "base": "", + "fields": [ + { + "name": "header", + "type": "block_header" + } + ] + }, + { + "name": "onerror", + "base": "", + "fields": [ + { + "name": "sender_id", + "type": "uint128" + }, + { + "name": "sent_trx", + "type": "bytes" + } + ] + }, + { + "name": "pair_time_point_sec_int64", + "base": "", + "fields": [ + { + "name": "key", + "type": "time_point_sec" + }, + { + "name": "value", + "type": "int64" + } + ] + }, + { + "name": "permission_level", + "base": "", + "fields": [ + { + "name": "actor", + "type": "name" + }, + { + "name": "permission", + "type": "name" + } + ] + }, + { + "name": "permission_level_weight", + "base": "", + "fields": [ + { + "name": "permission", + "type": "permission_level" + }, + { + "name": "weight", + "type": "uint16" + } + ] + }, + { + "name": "producer_info", + "base": "", + "fields": [ + { + "name": "owner", + "type": "name" + }, + { + "name": "total_votes", + "type": "float64" + }, + { + "name": "producer_key", + "type": "public_key" + }, + { + "name": "is_active", + "type": "bool" + }, + { + "name": "url", + "type": "string" + }, + { + "name": "unpaid_blocks", + "type": "uint32" + }, + { + "name": "last_claim_time", + "type": "time_point" + }, + { + "name": "location", + "type": "uint16" + } + ] + }, + { + "name": "producer_info2", + "base": "", + "fields": [ + { + "name": "owner", + "type": "name" + }, + { + "name": "votepay_share", + "type": "float64" + }, + { + "name": "last_votepay_share_update", + "type": "time_point" + } + ] + }, + { + "name": "producer_key", + "base": "", + "fields": [ + { + "name": "producer_name", + "type": "name" + }, + { + "name": "block_signing_key", + "type": "public_key" + } + ] + }, + { + "name": "producer_schedule", + "base": "", + "fields": [ + { + "name": "version", + "type": "uint32" + }, + { + "name": "producers", + "type": "producer_key[]" + } + ] + }, + { + "name": "refund", + "base": "", + "fields": [ + { + "name": "owner", + "type": "name" + } + ] + }, + { + "name": "refund_request", + "base": "", + "fields": [ + { + "name": "owner", + "type": "name" + }, + { + "name": "request_time", + "type": "time_point_sec" + }, + { + "name": "net_amount", + "type": "asset" + }, + { + "name": "cpu_amount", + "type": "asset" + } + ] + }, + { + "name": "regproducer", + "base": "", + "fields": [ + { + "name": "producer", + "type": "name" + }, + { + "name": "producer_key", + "type": "public_key" + }, + { + "name": "url", + "type": "string" + }, + { + "name": "location", + "type": "uint16" + } + ] + }, + { + "name": "regproxy", + "base": "", + "fields": [ + { + "name": "proxy", + "type": "name" + }, + { + "name": "isproxy", + "type": "bool" + } + ] + }, + { + "name": "rentcpu", + "base": "", + "fields": [ + { + "name": "from", + "type": "name" + }, + { + "name": "receiver", + "type": "name" + }, + { + "name": "loan_payment", + "type": "asset" + }, + { + "name": "loan_fund", + "type": "asset" + } + ] + }, + { + "name": "rentnet", + "base": "", + "fields": [ + { + "name": "from", + "type": "name" + }, + { + "name": "receiver", + "type": "name" + }, + { + "name": "loan_payment", + "type": "asset" + }, + { + "name": "loan_fund", + "type": "asset" + } + ] + }, + { + "name": "rex_balance", + "base": "", + "fields": [ + { + "name": "version", + "type": "uint8" + }, + { + "name": "owner", + "type": "name" + }, + { + "name": "vote_stake", + "type": "asset" + }, + { + "name": "rex_balance", + "type": "asset" + }, + { + "name": "matured_rex", + "type": "int64" + }, + { + "name": "rex_maturities", + "type": "pair_time_point_sec_int64[]" + } + ] + }, + { + "name": "rex_fund", + "base": "", + "fields": [ + { + "name": "version", + "type": "uint8" + }, + { + "name": "owner", + "type": "name" + }, + { + "name": "balance", + "type": "asset" + } + ] + }, + { + "name": "rex_loan", + "base": "", + "fields": [ + { + "name": "version", + "type": "uint8" + }, + { + "name": "from", + "type": "name" + }, + { + "name": "receiver", + "type": "name" + }, + { + "name": "payment", + "type": "asset" + }, + { + "name": "balance", + "type": "asset" + }, + { + "name": "total_staked", + "type": "asset" + }, + { + "name": "loan_num", + "type": "uint64" + }, + { + "name": "expiration", + "type": "time_point" + } + ] + }, + { + "name": "rex_order", + "base": "", + "fields": [ + { + "name": "version", + "type": "uint8" + }, + { + "name": "owner", + "type": "name" + }, + { + "name": "rex_requested", + "type": "asset" + }, + { + "name": "proceeds", + "type": "asset" + }, + { + "name": "stake_change", + "type": "asset" + }, + { + "name": "order_time", + "type": "time_point" + }, + { + "name": "is_open", + "type": "bool" + } + ] + }, + { + "name": "rex_pool", + "base": "", + "fields": [ + { + "name": "version", + "type": "uint8" + }, + { + "name": "total_lent", + "type": "asset" + }, + { + "name": "total_unlent", + "type": "asset" + }, + { + "name": "total_rent", + "type": "asset" + }, + { + "name": "total_lendable", + "type": "asset" + }, + { + "name": "total_rex", + "type": "asset" + }, + { + "name": "namebid_proceeds", + "type": "asset" + }, + { + "name": "loan_num", + "type": "uint64" + } + ] + }, + { + "name": "rex_return_buckets", + "base": "", + "fields": [ + { + "name": "version", + "type": "uint8" + }, + { + "name": "return_buckets", + "type": "pair_time_point_sec_int64[]" + } + ] + }, + { + "name": "rex_return_pool", + "base": "", + "fields": [ + { + "name": "version", + "type": "uint8" + }, + { + "name": "last_dist_time", + "type": "time_point_sec" + }, + { + "name": "pending_bucket_time", + "type": "time_point_sec" + }, + { + "name": "oldest_bucket_time", + "type": "time_point_sec" + }, + { + "name": "pending_bucket_proceeds", + "type": "int64" + }, + { + "name": "current_rate_of_increase", + "type": "int64" + }, + { + "name": "proceeds", + "type": "int64" + } + ] + }, + { + "name": "rexexec", + "base": "", + "fields": [ + { + "name": "user", + "type": "name" + }, + { + "name": "max", + "type": "uint16" + } + ] + }, + { + "name": "rmvproducer", + "base": "", + "fields": [ + { + "name": "producer", + "type": "name" + } + ] + }, + { + "name": "sellram", + "base": "", + "fields": [ + { + "name": "account", + "type": "name" + }, + { + "name": "bytes", + "type": "int64" + } + ] + }, + { + "name": "sellrex", + "base": "", + "fields": [ + { + "name": "from", + "type": "name" + }, + { + "name": "rex", + "type": "asset" + } + ] + }, + { + "name": "setabi", + "base": "", + "fields": [ + { + "name": "account", + "type": "name" + }, + { + "name": "abi", + "type": "bytes" + } + ] + }, + { + "name": "setacctcpu", + "base": "", + "fields": [ + { + "name": "account", + "type": "name" + }, + { + "name": "cpu_weight", + "type": "int64?" + } + ] + }, + { + "name": "setacctnet", + "base": "", + "fields": [ + { + "name": "account", + "type": "name" + }, + { + "name": "net_weight", + "type": "int64?" + } + ] + }, + { + "name": "setacctram", + "base": "", + "fields": [ + { + "name": "account", + "type": "name" + }, + { + "name": "ram_bytes", + "type": "int64?" + } + ] + }, + { + "name": "setalimits", + "base": "", + "fields": [ + { + "name": "account", + "type": "name" + }, + { + "name": "ram_bytes", + "type": "int64" + }, + { + "name": "net_weight", + "type": "int64" + }, + { + "name": "cpu_weight", + "type": "int64" + } + ] + }, + { + "name": "setcode", + "base": "", + "fields": [ + { + "name": "account", + "type": "name" + }, + { + "name": "vmtype", + "type": "uint8" + }, + { + "name": "vmversion", + "type": "uint8" + }, + { + "name": "code", + "type": "bytes" + } + ] + }, + { + "name": "setinflation", + "base": "", + "fields": [ + { + "name": "annual_rate", + "type": "int64" + }, + { + "name": "inflation_pay_factor", + "type": "int64" + }, + { + "name": "votepay_factor", + "type": "int64" + } + ] + }, + { + "name": "setparams", + "base": "", + "fields": [ + { + "name": "params", + "type": "blockchain_parameters" + } + ] + }, + { + "name": "setpriv", + "base": "", + "fields": [ + { + "name": "account", + "type": "name" + }, + { + "name": "is_priv", + "type": "uint8" + } + ] + }, + { + "name": "setram", + "base": "", + "fields": [ + { + "name": "max_ram_size", + "type": "uint64" + } + ] + }, + { + "name": "setramrate", + "base": "", + "fields": [ + { + "name": "bytes_per_block", + "type": "uint16" + } + ] + }, + { + "name": "setrex", + "base": "", + "fields": [ + { + "name": "balance", + "type": "asset" + } + ] + }, + { + "name": "undelegatebw", + "base": "", + "fields": [ + { + "name": "from", + "type": "name" + }, + { + "name": "receiver", + "type": "name" + }, + { + "name": "unstake_net_quantity", + "type": "asset" + }, + { + "name": "unstake_cpu_quantity", + "type": "asset" + } + ] + }, + { + "name": "unlinkauth", + "base": "", + "fields": [ + { + "name": "account", + "type": "name" + }, + { + "name": "code", + "type": "name" + }, + { + "name": "type", + "type": "name" + } + ] + }, + { + "name": "unregprod", + "base": "", + "fields": [ + { + "name": "producer", + "type": "name" + } + ] + }, + { + "name": "unstaketorex", + "base": "", + "fields": [ + { + "name": "owner", + "type": "name" + }, + { + "name": "receiver", + "type": "name" + }, + { + "name": "from_net", + "type": "asset" + }, + { + "name": "from_cpu", + "type": "asset" + } + ] + }, + { + "name": "updateauth", + "base": "", + "fields": [ + { + "name": "account", + "type": "name" + }, + { + "name": "permission", + "type": "name" + }, + { + "name": "parent", + "type": "name" + }, + { + "name": "auth", + "type": "authority" + } + ] + }, + { + "name": "updaterex", + "base": "", + "fields": [ + { + "name": "owner", + "type": "name" + } + ] + }, + { + "name": "updtrevision", + "base": "", + "fields": [ + { + "name": "revision", + "type": "uint8" + } + ] + }, + { + "name": "upgraderam", + "base": "", + "fields": [] + }, + { + "name": "user_resources", + "base": "", + "fields": [ + { + "name": "owner", + "type": "name" + }, + { + "name": "net_weight", + "type": "asset" + }, + { + "name": "cpu_weight", + "type": "asset" + }, + { + "name": "ram_bytes", + "type": "int64" + } + ] + }, + { + "name": "voteproducer", + "base": "", + "fields": [ + { + "name": "voter", + "type": "name" + }, + { + "name": "proxy", + "type": "name" + }, + { + "name": "producers", + "type": "name[]" + } + ] + }, + { + "name": "voter_info", + "base": "", + "fields": [ + { + "name": "owner", + "type": "name" + }, + { + "name": "proxy", + "type": "name" + }, + { + "name": "producers", + "type": "name[]" + }, + { + "name": "staked", + "type": "int64" + }, + { + "name": "last_vote_weight", + "type": "float64" + }, + { + "name": "proxied_vote_weight", + "type": "float64" + }, + { + "name": "is_proxy", + "type": "bool" + }, + { + "name": "flags1", + "type": "uint32" + }, + { + "name": "reserved2", + "type": "uint32" + }, + { + "name": "reserved3", + "type": "asset" + } + ] + }, + { + "name": "wait_weight", + "base": "", + "fields": [ + { + "name": "wait_sec", + "type": "uint32" + }, + { + "name": "weight", + "type": "uint16" + } + ] + }, + { + "name": "withdraw", + "base": "", + "fields": [ + { + "name": "owner", + "type": "name" + }, + { + "name": "amount", + "type": "asset" + } + ] + } + ], + "actions": [ + { + "name": "activate", + "type": "activate", + "ricardian_contract": "---\nspec_version: \"0.2.0\"\ntitle: Activate Protocol Feature\nsummary: 'Activate protocol feature {{nowrap feature_digest}}'\nicon: http://127.0.0.1/ricardian_assets/eosio.contracts/icons/admin.png#9bf1cec664863bd6aaac0f814b235f8799fb02c850e9aa5da34e8a004bd6518e\n---\n\n{{$action.account}} activates the protocol feature with a digest of {{feature_digest}}." + }, + { + "name": "bidname", + "type": "bidname", + "ricardian_contract": "---\nspec_version: \"0.2.0\"\ntitle: Bid On a Premium Account Name\nsummary: '{{nowrap bidder}} bids on the premium account name {{nowrap newname}}'\nicon: http://127.0.0.1/ricardian_assets/eosio.contracts/icons/account.png#3d55a2fc3a5c20b456f5657faf666bc25ffd06f4836c5e8256f741149b0b294f\n---\n\n{{bidder}} bids {{bid}} on an auction to own the premium account name {{newname}}.\n\n{{bidder}} transfers {{bid}} to the system to cover the cost of the bid, which will be returned to {{bidder}} only if {{bidder}} is later outbid in the auction for {{newname}} by another account.\n\nIf the auction for {{newname}} closes with {{bidder}} remaining as the highest bidder, {{bidder}} will be authorized to create the account with name {{newname}}.\n\n## Bid refund behavior\n\nIf {{bidder}}’s bid on {{newname}} is later outbid by another account, {{bidder}} will be able to claim back the transferred amount of {{bid}}. The system will attempt to automatically do this on behalf of {{bidder}}, but the automatic refund may occasionally fail which will then require {{bidder}} to manually claim the refund with the bidrefund action.\n\n## Auction close criteria\n\nThe system should automatically close the auction for {{newname}} if it satisfies the condition that over a period of two minutes the following two properties continuously hold:\n\n- no one has bid on {{newname}} within the last 24 hours;\n- and, the value of the latest bid on {{newname}} is greater than the value of the bids on each of the other open auctions.\n\nBe aware that the condition to close the auction described above are sufficient but not necessary. The auction for {{newname}} cannot close unless both of the properties are simultaneously satisfied, but it may be closed without requiring the properties to hold for a period of 2 minutes." + }, + { + "name": "bidrefund", + "type": "bidrefund", + "ricardian_contract": "---\nspec_version: \"0.2.0\"\ntitle: Claim Refund on Name Bid\nsummary: 'Claim refund on {{nowrap newname}} bid'\nicon: http://127.0.0.1/ricardian_assets/eosio.contracts/icons/account.png#3d55a2fc3a5c20b456f5657faf666bc25ffd06f4836c5e8256f741149b0b294f\n---\n\n{{bidder}} claims refund on {{newname}} bid after being outbid by someone else." + }, + { + "name": "buyram", + "type": "buyram", + "ricardian_contract": "---\nspec_version: \"0.2.0\"\ntitle: Buy RAM\nsummary: '{{nowrap payer}} buys RAM on behalf of {{nowrap receiver}} by paying {{nowrap quant}}'\nicon: http://127.0.0.1/ricardian_assets/eosio.contracts/icons/resource.png#3830f1ce8cb07f7757dbcf383b1ec1b11914ac34a1f9d8b065f07600fa9dac19\n---\n\n{{payer}} buys RAM on behalf of {{receiver}} by paying {{quant}}. This transaction will incur a 0.5% fee out of {{quant}} and the amount of RAM delivered will depend on market rates." + }, + { + "name": "buyrambytes", + "type": "buyrambytes", + "ricardian_contract": "---\nspec_version: \"0.2.0\"\ntitle: Buy RAM\nsummary: '{{nowrap payer}} buys {{nowrap bytes}} bytes of RAM on behalf of {{nowrap receiver}}'\nicon: http://127.0.0.1/ricardian_assets/eosio.contracts/icons/resource.png#3830f1ce8cb07f7757dbcf383b1ec1b11914ac34a1f9d8b065f07600fa9dac19\n---\n\n{{payer}} buys approximately {{bytes}} bytes of RAM on behalf of {{receiver}} by paying market rates for RAM. This transaction will incur a 0.5% fee and the cost will depend on market rates." + }, + { + "name": "buyrex", + "type": "buyrex", + "ricardian_contract": "---\nspec_version: \"0.2.0\"\ntitle: Buy REX Tokens\nsummary: '{{nowrap from}} buys REX tokens in exchange for {{nowrap amount}} and their vote stake increases by {{nowrap amount}}'\nicon: http://127.0.0.1/ricardian_assets/eosio.contracts/icons/rex.png#d229837fa62a464b9c71e06060aa86179adf0b3f4e3b8c4f9702f4f4b0c340a8\n---\n\n{{amount}} is taken out of {{from}}’s REX fund and used to purchase REX tokens at the current market exchange rate. In order for the action to succeed, {{from}} must have voted for a proxy or at least 21 block producers. {{amount}} is added to {{from}}’s vote stake.\n\nA sell order of the purchased amount can only be initiated after waiting for the maturity period of 4 to 5 days to pass. Even then, depending on the market conditions, the initiated sell order may not be executed immediately." + }, + { + "name": "canceldelay", + "type": "canceldelay", + "ricardian_contract": "---\nspec_version: \"0.2.0\"\ntitle: Cancel Delayed Transaction\nsummary: '{{nowrap canceling_auth.actor}} cancels a delayed transaction'\nicon: http://127.0.0.1/ricardian_assets/eosio.contracts/icons/account.png#3d55a2fc3a5c20b456f5657faf666bc25ffd06f4836c5e8256f741149b0b294f\n---\n\n{{canceling_auth.actor}} cancels the delayed transaction with id {{trx_id}}." + }, + { + "name": "claim", + "type": "claim", + "ricardian_contract": "" + }, + { + "name": "claimrewards", + "type": "claimrewards", + "ricardian_contract": "---\nspec_version: \"0.2.0\"\ntitle: Claim Block Producer Rewards\nsummary: '{{nowrap owner}} claims block and vote rewards'\nicon: http://127.0.0.1/ricardian_assets/eosio.contracts/icons/admin.png#9bf1cec664863bd6aaac0f814b235f8799fb02c850e9aa5da34e8a004bd6518e\n---\n\n{{owner}} claims block and vote rewards from the system." + }, + { + "name": "closerex", + "type": "closerex", + "ricardian_contract": "---\nspec_version: \"0.2.0\"\ntitle: Cleanup Unused REX Data\nsummary: 'Delete REX related DB entries and free associated RAM'\nicon: http://127.0.0.1/ricardian_assets/eosio.contracts/icons/rex.png#d229837fa62a464b9c71e06060aa86179adf0b3f4e3b8c4f9702f4f4b0c340a8\n---\n\nDelete REX related DB entries and free associated RAM for {{owner}}.\n\nTo fully delete all REX related DB entries, {{owner}} must ensure that their REX balance and REX fund amounts are both zero and they have no outstanding loans." + }, + { + "name": "cnclrexorder", + "type": "cnclrexorder", + "ricardian_contract": "---\nspec_version: \"0.2.0\"\ntitle: Cancel Scheduled REX Sell Order\nsummary: '{{nowrap owner}} cancels a scheduled sell order if not yet filled'\nicon: http://127.0.0.1/ricardian_assets/eosio.contracts/icons/rex.png#d229837fa62a464b9c71e06060aa86179adf0b3f4e3b8c4f9702f4f4b0c340a8\n---\n\n{{owner}} cancels their open sell order." + }, + { + "name": "consolidate", + "type": "consolidate", + "ricardian_contract": "---\nspec_version: \"0.2.0\"\ntitle: Consolidate REX Maturity Buckets Into One\nsummary: 'Consolidate REX maturity buckets into one'\nicon: http://127.0.0.1/ricardian_assets/eosio.contracts/icons/rex.png#d229837fa62a464b9c71e06060aa86179adf0b3f4e3b8c4f9702f4f4b0c340a8\n---\n\nConsolidate REX maturity buckets into one bucket that {{owner}} will not be able to sell until 4 to 5 days later." + }, + { + "name": "defcpuloan", + "type": "defcpuloan", + "ricardian_contract": "---\nspec_version: \"0.2.0\"\ntitle: Withdraw from the Fund of a Specific CPU Loan\nsummary: '{{nowrap from}} transfers {{nowrap amount}} from the fund of CPU loan number {{nowrap loan_num}} back to REX fund'\nicon: http://127.0.0.1/ricardian_assets/eosio.contracts/icons/rex.png#d229837fa62a464b9c71e06060aa86179adf0b3f4e3b8c4f9702f4f4b0c340a8\n---\n\n{{from}} transfers {{amount}} from the fund of CPU loan number {{loan_num}} back to REX fund." + }, + { + "name": "defnetloan", + "type": "defnetloan", + "ricardian_contract": "---\nspec_version: \"0.2.0\"\ntitle: Withdraw from the Fund of a Specific NET Loan\nsummary: '{{nowrap from}} transfers {{nowrap amount}} from the fund of NET loan number {{nowrap loan_num}} back to REX fund'\nicon: http://127.0.0.1/ricardian_assets/eosio.contracts/icons/rex.png#d229837fa62a464b9c71e06060aa86179adf0b3f4e3b8c4f9702f4f4b0c340a8\n---\n\n{{from}} transfers {{amount}} from the fund of NET loan number {{loan_num}} back to REX fund." + }, + { + "name": "delegatebw", + "type": "delegatebw", + "ricardian_contract": "---\nspec_version: \"0.2.0\"\ntitle: Stake Tokens for NET and/or CPU\nsummary: 'Stake tokens for NET and/or CPU and optionally transfer ownership'\nicon: http://127.0.0.1/ricardian_assets/eosio.contracts/icons/resource.png#3830f1ce8cb07f7757dbcf383b1ec1b11914ac34a1f9d8b065f07600fa9dac19\n---\n\n{{#if transfer}} {{from}} stakes on behalf of {{receiver}} {{stake_net_quantity}} for NET bandwidth and {{stake_cpu_quantity}} for CPU bandwidth.\n\nStaked tokens will also be transferred to {{receiver}}. The sum of these two quantities will be deducted from {{from}}’s liquid balance and add to the vote weight of {{receiver}}.\n{{else}}\n{{from}} stakes to self and delegates to {{receiver}} {{stake_net_quantity}} for NET bandwidth and {{stake_cpu_quantity}} for CPU bandwidth.\n\nThe sum of these two quantities add to the vote weight of {{from}}.\n{{/if}}" + }, + { + "name": "deleteauth", + "type": "deleteauth", + "ricardian_contract": "---\nspec_version: \"0.2.0\"\ntitle: Delete Account Permission\nsummary: 'Delete the {{nowrap permission}} permission of {{nowrap account}}'\nicon: http://127.0.0.1/ricardian_assets/eosio.contracts/icons/account.png#3d55a2fc3a5c20b456f5657faf666bc25ffd06f4836c5e8256f741149b0b294f\n---\n\nDelete the {{permission}} permission of {{account}}." + }, + { + "name": "deposit", + "type": "deposit", + "ricardian_contract": "---\nspec_version: \"0.2.0\"\ntitle: Deposit Into REX Fund\nsummary: 'Add to {{nowrap owner}}’s REX fund by transferring {{nowrap amount}} from {{nowrap owner}}’s liquid balance'\nicon: http://127.0.0.1/ricardian_assets/eosio.contracts/icons/rex.png#d229837fa62a464b9c71e06060aa86179adf0b3f4e3b8c4f9702f4f4b0c340a8\n---\n\nTransfer {{amount}} from {{owner}}’s liquid balance to {{owner}}’s REX fund. All proceeds and expenses related to REX are added to or taken out of this fund." + }, + { + "name": "fundcpuloan", + "type": "fundcpuloan", + "ricardian_contract": "---\nspec_version: \"0.2.0\"\ntitle: Deposit into the Fund of a Specific CPU Loan\nsummary: '{{nowrap from}} funds a CPU loan'\nicon: http://127.0.0.1/ricardian_assets/eosio.contracts/icons/rex.png#d229837fa62a464b9c71e06060aa86179adf0b3f4e3b8c4f9702f4f4b0c340a8\n---\n\n{{from}} transfers {{payment}} from REX fund to the fund of CPU loan number {{loan_num}} in order to be used in loan renewal at expiry. {{from}} can withdraw the total balance of the loan fund at any time." + }, + { + "name": "fundnetloan", + "type": "fundnetloan", + "ricardian_contract": "---\nspec_version: \"0.2.0\"\ntitle: Deposit into the Fund of a Specific NET Loan\nsummary: '{{nowrap from}} funds a NET loan'\nicon: http://127.0.0.1/ricardian_assets/eosio.contracts/icons/rex.png#d229837fa62a464b9c71e06060aa86179adf0b3f4e3b8c4f9702f4f4b0c340a8\n---\n\n{{from}} transfers {{payment}} from REX fund to the fund of NET loan number {{loan_num}} in order to be used in loan renewal at expiry. {{from}} can withdraw the total balance of the loan fund at any time." + }, + { + "name": "init", + "type": "init", + "ricardian_contract": "---\nspec_version: \"0.2.0\"\ntitle: Initialize System Contract\nsummary: 'Initialize system contract'\nicon: http://127.0.0.1/ricardian_assets/eosio.contracts/icons/admin.png#9bf1cec664863bd6aaac0f814b235f8799fb02c850e9aa5da34e8a004bd6518e\n---\n\nInitialize system contract. The core token symbol will be set to {{core}}." + }, + { + "name": "linkauth", + "type": "linkauth", + "ricardian_contract": "---\nspec_version: \"0.2.0\"\ntitle: Link Action to Permission\nsummary: '{{nowrap account}} sets the minimum required permission for the {{#if type}}{{nowrap type}} action of the{{/if}} {{nowrap code}} contract to {{nowrap requirement}}'\nicon: http://127.0.0.1/ricardian_assets/eosio.contracts/icons/account.png#3d55a2fc3a5c20b456f5657faf666bc25ffd06f4836c5e8256f741149b0b294f\n---\n\n{{account}} sets the minimum required permission for the {{#if type}}{{type}} action of the{{/if}} {{code}} contract to {{requirement}}.\n\n{{#if type}}{{else}}Any links explicitly associated to specific actions of {{code}} will take precedence.{{/if}}" + }, + { + "name": "mvfrsavings", + "type": "mvfrsavings", + "ricardian_contract": "---\nspec_version: \"0.2.0\"\ntitle: Unlock REX Tokens\nsummary: '{{nowrap owner}} unlocks REX Tokens'\nicon: http://127.0.0.1/ricardian_assets/eosio.contracts/icons/rex.png#d229837fa62a464b9c71e06060aa86179adf0b3f4e3b8c4f9702f4f4b0c340a8\n---\n\n{{owner}} unlocks {{rex}} by moving it out of the REX savings bucket. The unlocked REX tokens cannot be sold until 4 to 5 days later." + }, + { + "name": "mvtosavings", + "type": "mvtosavings", + "ricardian_contract": "---\nspec_version: \"0.2.0\"\ntitle: Lock REX Tokens\nsummary: '{{nowrap owner}} locks REX Tokens'\nicon: http://127.0.0.1/ricardian_assets/eosio.contracts/icons/rex.png#d229837fa62a464b9c71e06060aa86179adf0b3f4e3b8c4f9702f4f4b0c340a8\n---\n\n{{owner}} locks {{rex}} by moving it into the REX savings bucket. The locked REX tokens cannot be sold directly and will have to be unlocked explicitly before selling." + }, + { + "name": "newaccount", + "type": "newaccount", + "ricardian_contract": "---\nspec_version: \"0.2.0\"\ntitle: Create New Account\nsummary: '{{nowrap creator}} creates a new account with the name {{nowrap name}}'\nicon: http://127.0.0.1/ricardian_assets/eosio.contracts/icons/account.png#3d55a2fc3a5c20b456f5657faf666bc25ffd06f4836c5e8256f741149b0b294f\n---\n\n{{creator}} creates a new account with the name {{name}} and the following permissions:\n\nowner permission with authority:\n{{to_json owner}}\n\nactive permission with authority:\n{{to_json active}}" + }, + { + "name": "onblock", + "type": "onblock", + "ricardian_contract": "" + }, + { + "name": "onerror", + "type": "onerror", + "ricardian_contract": "" + }, + { + "name": "refund", + "type": "refund", + "ricardian_contract": "---\nspec_version: \"0.2.0\"\ntitle: Claim Unstaked Tokens\nsummary: 'Return previously unstaked tokens to {{nowrap owner}}'\nicon: http://127.0.0.1/ricardian_assets/eosio.contracts/icons/account.png#3d55a2fc3a5c20b456f5657faf666bc25ffd06f4836c5e8256f741149b0b294f\n---\n\nReturn previously unstaked tokens to {{owner}} after the unstaking period has elapsed." + }, + { + "name": "regproducer", + "type": "regproducer", + "ricardian_contract": "---\nspec_version: \"0.2.0\"\ntitle: Register as a Block Producer Candidate\nsummary: 'Register {{nowrap producer}} account as a block producer candidate'\nicon: http://127.0.0.1/ricardian_assets/eosio.contracts/icons/voting.png#db28cd3db6e62d4509af3644ce7d377329482a14bb4bfaca2aa5f1400d8e8a84\n---\n\nRegister {{producer}} account as a block producer candidate.\n\n{{$clauses.BlockProducerAgreement}}" + }, + { + "name": "regproxy", + "type": "regproxy", + "ricardian_contract": "---\nspec_version: \"0.2.0\"\ntitle: Register/unregister as a Proxy\nsummary: 'Register/unregister {{nowrap proxy}} as a proxy account'\nicon: http://127.0.0.1/ricardian_assets/eosio.contracts/icons/voting.png#db28cd3db6e62d4509af3644ce7d377329482a14bb4bfaca2aa5f1400d8e8a84\n---\n\n{{#if isproxy}}\n{{proxy}} registers as a proxy that can vote on behalf of accounts that appoint it as their proxy.\n{{else}}\n{{proxy}} unregisters as a proxy that can vote on behalf of accounts that appoint it as their proxy.\n{{/if}}" + }, + { + "name": "rentcpu", + "type": "rentcpu", + "ricardian_contract": "---\nspec_version: \"0.2.0\"\ntitle: Rent CPU Bandwidth for 30 Days\nsummary: '{{nowrap from}} pays {{nowrap loan_payment}} to rent CPU bandwidth for {{nowrap receiver}}'\nicon: http://127.0.0.1/ricardian_assets/eosio.contracts/icons/rex.png#d229837fa62a464b9c71e06060aa86179adf0b3f4e3b8c4f9702f4f4b0c340a8\n---\n\n{{from}} pays {{loan_payment}} to rent CPU bandwidth on behalf of {{receiver}} for a period of 30 days.\n\n{{loan_payment}} is taken out of {{from}}’s REX fund. The market price determines the number of tokens to be staked to {{receiver}}’s CPU resources. In addition, {{from}} provides {{loan_fund}}, which is also taken out of {{from}}’s REX fund, to be used for automatic renewal of the loan.\n\nAt expiration, if the loan has less funds than {{loan_payment}}, it is closed and lent tokens that have been staked are taken out of {{receiver}}’s CPU bandwidth. Otherwise, it is renewed at the market price at the time of renewal, that is, the number of staked tokens is recalculated and {{receiver}}’s CPU bandwidth is updated accordingly. {{from}} can fund or defund a loan at any time before expiration. When the loan is closed, {{from}} is refunded any tokens remaining in the loan fund." + }, + { + "name": "rentnet", + "type": "rentnet", + "ricardian_contract": "---\nspec_version: \"0.2.0\"\ntitle: Rent NET Bandwidth for 30 Days\nsummary: '{{nowrap from}} pays {{nowrap loan_payment}} to rent NET bandwidth for {{nowrap receiver}}'\nicon: http://127.0.0.1/ricardian_assets/eosio.contracts/icons/rex.png#d229837fa62a464b9c71e06060aa86179adf0b3f4e3b8c4f9702f4f4b0c340a8\n---\n\n{{from}} pays {{loan_payment}} to rent NET bandwidth on behalf of {{receiver}} for a period of 30 days.\n\n{{loan_payment}} is taken out of {{from}}’s REX fund. The market price determines the number of tokens to be staked to {{receiver}}’s NET resources for 30 days. In addition, {{from}} provides {{loan_fund}}, which is also taken out of {{from}}’s REX fund, to be used for automatic renewal of the loan.\n\nAt expiration, if the loan has less funds than {{loan_payment}}, it is closed and lent tokens that have been staked are taken out of {{receiver}}’s NET bandwidth. Otherwise, it is renewed at the market price at the time of renewal, that is, the number of staked tokens is recalculated and {{receiver}}’s NET bandwidth is updated accordingly. {{from}} can fund or defund a loan at any time before expiration. When the loan is closed, {{from}} is refunded any tokens remaining in the loan fund." + }, + { + "name": "rexexec", + "type": "rexexec", + "ricardian_contract": "---\nspec_version: \"0.2.0\"\ntitle: Perform REX Maintenance\nsummary: 'Process sell orders and expired loans'\nicon: http://127.0.0.1/ricardian_assets/eosio.contracts/icons/rex.png#d229837fa62a464b9c71e06060aa86179adf0b3f4e3b8c4f9702f4f4b0c340a8\n---\n\nPerforms REX maintenance by processing a maximum of {{max}} REX sell orders and expired loans. Any account can execute this action." + }, + { + "name": "rmvproducer", + "type": "rmvproducer", + "ricardian_contract": "---\nspec_version: \"0.2.0\"\ntitle: Forcibly Unregister a Block Producer Candidate\nsummary: '{{nowrap producer}} is unregistered as a block producer candidate'\nicon: http://127.0.0.1/ricardian_assets/eosio.contracts/icons/admin.png#9bf1cec664863bd6aaac0f814b235f8799fb02c850e9aa5da34e8a004bd6518e\n---\n\n{{$action.account}} unregisters {{producer}} as a block producer candidate. {{producer}} account will retain its votes and those votes can change based on voter stake changes or votes removed from {{producer}}. However new voters will not be able to vote for {{producer}} while it remains unregistered." + }, + { + "name": "sellram", + "type": "sellram", + "ricardian_contract": "---\nspec_version: \"0.2.0\"\ntitle: Sell RAM From Account\nsummary: 'Sell unused RAM from {{nowrap account}}'\nicon: http://127.0.0.1/ricardian_assets/eosio.contracts/icons/resource.png#3830f1ce8cb07f7757dbcf383b1ec1b11914ac34a1f9d8b065f07600fa9dac19\n---\n\nSell {{bytes}} bytes of unused RAM from account {{account}} at market price. This transaction will incur a 0.5% fee on the proceeds which depend on market rates." + }, + { + "name": "sellrex", + "type": "sellrex", + "ricardian_contract": "---\nspec_version: \"0.2.0\"\ntitle: Sell REX Tokens in Exchange for EOS\nsummary: '{{nowrap from}} sells {{nowrap rex}} tokens'\nicon: http://127.0.0.1/ricardian_assets/eosio.contracts/icons/rex.png#d229837fa62a464b9c71e06060aa86179adf0b3f4e3b8c4f9702f4f4b0c340a8\n---\n\n{{from}} initiates a sell order to sell {{rex}} tokens at the market exchange rate during the time at which the order is ultimately executed. If {{from}} already has an open sell order in the sell queue, {{rex}} will be added to the amount of the sell order without change the position of the sell order within the queue. Once the sell order is executed, proceeds are added to {{from}}’s REX fund, the value of sold REX tokens is deducted from {{from}}’s vote stake, and votes are updated accordingly.\n\nDepending on the market conditions, it may not be possible to fill the entire sell order immediately. In such a case, the sell order is added to the back of a sell queue. A sell order at the front of the sell queue will automatically be executed when the market conditions allow for the entire order to be filled. Regardless of the market conditions, the system is designed to execute this sell order within 30 days. {{from}} can cancel the order at any time before it is filled using the cnclrexorder action." + }, + { + "name": "setabi", + "type": "setabi", + "ricardian_contract": "---\nspec_version: \"0.2.0\"\ntitle: Deploy Contract ABI\nsummary: 'Deploy contract ABI on account {{nowrap account}}'\nicon: http://127.0.0.1/ricardian_assets/eosio.contracts/icons/account.png#3d55a2fc3a5c20b456f5657faf666bc25ffd06f4836c5e8256f741149b0b294f\n---\n\nDeploy the ABI file associated with the contract on account {{account}}." + }, + { + "name": "setacctcpu", + "type": "setacctcpu", + "ricardian_contract": "---\nspec_version: \"0.2.0\"\ntitle: Explicitly Manage the CPU Quota of Account\nsummary: 'Explicitly manage the CPU bandwidth quota of account {{nowrap account}}'\nicon: http://127.0.0.1/ricardian_assets/eosio.contracts/icons/admin.png#9bf1cec664863bd6aaac0f814b235f8799fb02c850e9aa5da34e8a004bd6518e\n---\n\n{{#if_has_value cpu_weight}}\nExplicitly manage the CPU bandwidth quota of account {{account}} by pinning it to a weight of {{cpu_weight}}.\n\n{{account}} can stake and unstake, however, it will not change their CPU bandwidth quota as long as it remains pinned.\n{{else}}\nUnpin the CPU bandwidth quota of account {{account}}. The CPU bandwidth quota of {{account}} will be driven by the current tokens staked for CPU bandwidth by {{account}}.\n{{/if_has_value}}" + }, + { + "name": "setacctnet", + "type": "setacctnet", + "ricardian_contract": "---\nspec_version: \"0.2.0\"\ntitle: Explicitly Manage the NET Quota of Account\nsummary: 'Explicitly manage the NET bandwidth quota of account {{nowrap account}}'\nicon: http://127.0.0.1/ricardian_assets/eosio.contracts/icons/admin.png#9bf1cec664863bd6aaac0f814b235f8799fb02c850e9aa5da34e8a004bd6518e\n---\n\n{{#if_has_value net_weight}}\nExplicitly manage the network bandwidth quota of account {{account}} by pinning it to a weight of {{net_weight}}.\n\n{{account}} can stake and unstake, however, it will not change their NET bandwidth quota as long as it remains pinned.\n{{else}}\nUnpin the NET bandwidth quota of account {{account}}. The NET bandwidth quota of {{account}} will be driven by the current tokens staked for NET bandwidth by {{account}}.\n{{/if_has_value}}" + }, + { + "name": "setacctram", + "type": "setacctram", + "ricardian_contract": "---\nspec_version: \"0.2.0\"\ntitle: Explicitly Manage the RAM Quota of Account\nsummary: 'Explicitly manage the RAM quota of account {{nowrap account}}'\nicon: http://127.0.0.1/ricardian_assets/eosio.contracts/icons/admin.png#9bf1cec664863bd6aaac0f814b235f8799fb02c850e9aa5da34e8a004bd6518e\n---\n\n{{#if_has_value ram_bytes}}\nExplicitly manage the RAM quota of account {{account}} by pinning it to {{ram_bytes}} bytes.\n\n{{account}} can buy and sell RAM, however, it will not change their RAM quota as long as it remains pinned.\n{{else}}\nUnpin the RAM quota of account {{account}}. The RAM quota of {{account}} will be driven by the current RAM holdings of {{account}}.\n{{/if_has_value}}" + }, + { + "name": "setalimits", + "type": "setalimits", + "ricardian_contract": "---\nspec_version: \"0.2.0\"\ntitle: Adjust Resource Limits of Account\nsummary: 'Adjust resource limits of account {{nowrap account}}'\nicon: http://127.0.0.1/ricardian_assets/eosio.contracts/icons/admin.png#9bf1cec664863bd6aaac0f814b235f8799fb02c850e9aa5da34e8a004bd6518e\n---\n\n{{$action.account}} updates {{account}}’s resource limits to have a RAM quota of {{ram_bytes}} bytes, a NET bandwidth quota of {{net_weight}} and a CPU bandwidth quota of {{cpu_weight}}." + }, + { + "name": "setcode", + "type": "setcode", + "ricardian_contract": "---\nspec_version: \"0.2.0\"\ntitle: Deploy Contract Code\nsummary: 'Deploy contract code on account {{nowrap account}}'\nicon: http://127.0.0.1/ricardian_assets/eosio.contracts/icons/account.png#3d55a2fc3a5c20b456f5657faf666bc25ffd06f4836c5e8256f741149b0b294f\n---\n\nDeploy compiled contract code to the account {{account}}." + }, + { + "name": "setinflation", + "type": "setinflation", + "ricardian_contract": "---\nspec_version: \"0.2.0\"\ntitle: Set Inflation Parameters\nsummary: 'Set inflation parameters'\nicon: http://127.0.0.1/ricardian_assets/eosio.contracts/icons/admin.png#9bf1cec664863bd6aaac0f814b235f8799fb02c850e9aa5da34e8a004bd6518e\n---\n\n{{$action.account}} sets the inflation parameters as follows:\n\n* Annual inflation rate (in units of a hundredth of a percent): {{annual_rate}}\n* Fraction of inflation used to reward block producers: 10000/{{inflation_pay_factor}}\n* Fraction of block producer rewards to be distributed proportional to blocks produced: 10000/{{votepay_factor}}" + }, + { + "name": "setparams", + "type": "setparams", + "ricardian_contract": "---\nspec_version: \"0.2.0\"\ntitle: Set System Parameters\nsummary: 'Set System Parameters'\nicon: http://127.0.0.1/ricardian_assets/eosio.contracts/icons/admin.png#9bf1cec664863bd6aaac0f814b235f8799fb02c850e9aa5da34e8a004bd6518e\n---\n\n{{$action.account}} sets system parameters to:\n{{to_json params}}" + }, + { + "name": "setpriv", + "type": "setpriv", + "ricardian_contract": "---\nspec_version: \"0.2.0\"\ntitle: Make an Account Privileged or Unprivileged\nsummary: '{{#if is_priv}}Make {{nowrap account}} privileged{{else}}Remove privileged status of {{nowrap account}}{{/if}}'\nicon: http://127.0.0.1/ricardian_assets/eosio.contracts/icons/admin.png#9bf1cec664863bd6aaac0f814b235f8799fb02c850e9aa5da34e8a004bd6518e\n---\n\n{{#if is_priv}}\n{{$action.account}} makes {{account}} privileged.\n{{else}}\n{{$action.account}} removes privileged status of {{account}}.\n{{/if}}" + }, + { + "name": "setram", + "type": "setram", + "ricardian_contract": "---\nspec_version: \"0.2.0\"\ntitle: Configure the Available RAM\nsummary: 'Configure the available RAM'\nicon: http://127.0.0.1/ricardian_assets/eosio.contracts/icons/admin.png#9bf1cec664863bd6aaac0f814b235f8799fb02c850e9aa5da34e8a004bd6518e\n---\n\n{{$action.account}} configures the available RAM to {{max_ram_size}} bytes." + }, + { + "name": "setramrate", + "type": "setramrate", + "ricardian_contract": "---\nspec_version: \"0.2.0\"\ntitle: Set the Rate of Increase of RAM\nsummary: 'Set the rate of increase of RAM per block'\nicon: http://127.0.0.1/ricardian_assets/eosio.contracts/icons/admin.png#9bf1cec664863bd6aaac0f814b235f8799fb02c850e9aa5da34e8a004bd6518e\n---\n\n{{$action.account}} sets the rate of increase of RAM to {{bytes_per_block}} bytes/block." + }, + { + "name": "setrex", + "type": "setrex", + "ricardian_contract": "---\nspec_version: \"0.2.0\"\ntitle: Adjust REX Pool Virtual Balance\nsummary: 'Adjust REX Pool Virtual Balance'\nicon: http://127.0.0.1/ricardian_assets/eosio.contracts/icons/admin.png#9bf1cec664863bd6aaac0f814b235f8799fb02c850e9aa5da34e8a004bd6518e\n---\n\n{{$action.account}} adjusts REX loan rate by setting REX pool virtual balance to {{balance}}. No token transfer or issue is executed in this action." + }, + { + "name": "undelegatebw", + "type": "undelegatebw", + "ricardian_contract": "---\nspec_version: \"0.2.0\"\ntitle: Unstake Tokens for NET and/or CPU\nsummary: 'Unstake tokens for NET and/or CPU from {{nowrap receiver}}'\nicon: http://127.0.0.1/ricardian_assets/eosio.contracts/icons/resource.png#3830f1ce8cb07f7757dbcf383b1ec1b11914ac34a1f9d8b065f07600fa9dac19\n---\n\n{{from}} unstakes from {{receiver}} {{unstake_net_quantity}} for NET bandwidth and {{unstake_cpu_quantity}} for CPU bandwidth.\n\nThe sum of these two quantities will be removed from the vote weight of {{receiver}} and will be made available to {{from}} after an uninterrupted 3 day period without further unstaking by {{from}}. After the uninterrupted 3 day period passes, the system will attempt to automatically return the funds to {{from}}’s regular token balance. However, this automatic refund may occasionally fail which will then require {{from}} to manually claim the funds with the refund action." + }, + { + "name": "unlinkauth", + "type": "unlinkauth", + "ricardian_contract": "---\nspec_version: \"0.2.0\"\ntitle: Unlink Action from Permission\nsummary: '{{nowrap account}} unsets the minimum required permission for the {{#if type}}{{nowrap type}} action of the{{/if}} {{nowrap code}} contract'\nicon: http://127.0.0.1/ricardian_assets/eosio.contracts/icons/account.png#3d55a2fc3a5c20b456f5657faf666bc25ffd06f4836c5e8256f741149b0b294f\n---\n\n{{account}} removes the association between the {{#if type}}{{type}} action of the{{/if}} {{code}} contract and its minimum required permission.\n\n{{#if type}}{{else}}This will not remove any links explicitly associated to specific actions of {{code}}.{{/if}}" + }, + { + "name": "unregprod", + "type": "unregprod", + "ricardian_contract": "---\nspec_version: \"0.2.0\"\ntitle: Unregister as a Block Producer Candidate\nsummary: '{{nowrap producer}} unregisters as a block producer candidate'\nicon: http://127.0.0.1/ricardian_assets/eosio.contracts/icons/voting.png#db28cd3db6e62d4509af3644ce7d377329482a14bb4bfaca2aa5f1400d8e8a84\n---\n\n{{producer}} unregisters as a block producer candidate. {{producer}} account will retain its votes and those votes can change based on voter stake changes or votes removed from {{producer}}. However new voters will not be able to vote for {{producer}} while it remains unregistered." + }, + { + "name": "unstaketorex", + "type": "unstaketorex", + "ricardian_contract": "---\nspec_version: \"0.2.0\"\ntitle: Buy REX Tokens Using Staked Tokens\nsummary: '{{nowrap owner}} buys REX tokens in exchange for tokens currently staked to NET and/or CPU'\nicon: http://127.0.0.1/ricardian_assets/eosio.contracts/icons/rex.png#d229837fa62a464b9c71e06060aa86179adf0b3f4e3b8c4f9702f4f4b0c340a8\n---\n\n{{from_net}} and {{from_cpu}} are withdrawn from {{receiver}}’s NET and CPU bandwidths respectively. These funds are used to purchase REX tokens at the current market exchange rate. In order for the action to succeed, {{owner}} must have voted for a proxy or at least 21 block producers.\n\nA sell order of the purchased amount can only be initiated after waiting for the maturity period of 4 to 5 days to pass. Even then, depending on the market conditions, the initiated sell order may not be executed immediately." + }, + { + "name": "updateauth", + "type": "updateauth", + "ricardian_contract": "---\nspec_version: \"0.2.0\"\ntitle: Modify Account Permission\nsummary: 'Add or update the {{nowrap permission}} permission of {{nowrap account}}'\nicon: http://127.0.0.1/ricardian_assets/eosio.contracts/icons/account.png#3d55a2fc3a5c20b456f5657faf666bc25ffd06f4836c5e8256f741149b0b294f\n---\n\nModify, and create if necessary, the {{permission}} permission of {{account}} to have a parent permission of {{parent}} and the following authority:\n{{to_json auth}}" + }, + { + "name": "updaterex", + "type": "updaterex", + "ricardian_contract": "---\nspec_version: \"0.2.0\"\ntitle: Update REX Owner Vote Weight\nsummary: 'Update vote weight to current value of held REX tokens'\nicon: http://127.0.0.1/ricardian_assets/eosio.contracts/icons/rex.png#d229837fa62a464b9c71e06060aa86179adf0b3f4e3b8c4f9702f4f4b0c340a8\n---\n\nUpdate vote weight of {{owner}} account to current value of held REX tokens." + }, + { + "name": "updtrevision", + "type": "updtrevision", + "ricardian_contract": "---\nspec_version: \"0.2.0\"\ntitle: Update System Contract Revision Number\nsummary: 'Update system contract revision number'\nicon: http://127.0.0.1/ricardian_assets/eosio.contracts/icons/admin.png#9bf1cec664863bd6aaac0f814b235f8799fb02c850e9aa5da34e8a004bd6518e\n---\n\n{{$action.account}} advances the system contract revision number to {{revision}}." + }, + { + "name": "upgraderam", + "type": "upgraderam", + "ricardian_contract": "" + }, + { + "name": "voteproducer", + "type": "voteproducer", + "ricardian_contract": "---\nspec_version: \"0.2.0\"\ntitle: Vote for Block Producers\nsummary: '{{nowrap voter}} votes for {{#if proxy}}the proxy {{nowrap proxy}}{{else}}up to 30 block producer candidates{{/if}}'\nicon: http://127.0.0.1/ricardian_assets/eosio.contracts/icons/voting.png#db28cd3db6e62d4509af3644ce7d377329482a14bb4bfaca2aa5f1400d8e8a84\n---\n\n{{#if proxy}}\n{{voter}} votes for the proxy {{proxy}}.\nAt the time of voting the full weight of voter’s staked (CPU + NET) tokens will be cast towards each of the producers voted by {{proxy}}.\n{{else}}\n{{voter}} votes for the following block producer candidates:\n\n{{#each producers}}\n + {{this}}\n{{/each}}\n\nAt the time of voting the full weight of voter’s staked (CPU + NET) tokens will be cast towards each of the above producers.\n{{/if}}" + }, + { + "name": "withdraw", + "type": "withdraw", + "ricardian_contract": "---\nspec_version: \"0.2.0\"\ntitle: Withdraw from REX Fund\nsummary: 'Withdraw {{nowrap amount}} from {{nowrap owner}}’s REX fund by transferring to {{owner}}’s liquid balance'\nicon: http://127.0.0.1/ricardian_assets/eosio.contracts/icons/rex.png#d229837fa62a464b9c71e06060aa86179adf0b3f4e3b8c4f9702f4f4b0c340a8\n---\n\nWithdraws {{amount}} from {{owner}}’s REX fund and transfer them to {{owner}}’s liquid balance." + } + ], + "tables": [ + { + "name": "abihash", + "type": "abi_hash", + "index_type": "i64", + "key_names": [], + "key_types": [] + }, + { + "name": "bidrefunds", + "type": "bid_refund", + "index_type": "i64", + "key_names": [], + "key_types": [] + }, + { + "name": "cpuloan", + "type": "rex_loan", + "index_type": "i64", + "key_names": [], + "key_types": [] + }, + { + "name": "delband", + "type": "delegated_bandwidth", + "index_type": "i64", + "key_names": [], + "key_types": [] + }, + { + "name": "global", + "type": "eosio_global_state", + "index_type": "i64", + "key_names": [], + "key_types": [] + }, + { + "name": "global2", + "type": "eosio_global_state2", + "index_type": "i64", + "key_names": [], + "key_types": [] + }, + { + "name": "global3", + "type": "eosio_global_state3", + "index_type": "i64", + "key_names": [], + "key_types": [] + }, + { + "name": "global4", + "type": "eosio_global_state4", + "index_type": "i64", + "key_names": [], + "key_types": [] + }, + { + "name": "namebids", + "type": "name_bid", + "index_type": "i64", + "key_names": [], + "key_types": [] + }, + { + "name": "netloan", + "type": "rex_loan", + "index_type": "i64", + "key_names": [], + "key_types": [] + }, + { + "name": "producers", + "type": "producer_info", + "index_type": "i64", + "key_names": [], + "key_types": [] + }, + { + "name": "producers2", + "type": "producer_info2", + "index_type": "i64", + "key_names": [], + "key_types": [] + }, + { + "name": "rammarket", + "type": "exchange_state", + "index_type": "i64", + "key_names": [], + "key_types": [] + }, + { + "name": "refunds", + "type": "refund_request", + "index_type": "i64", + "key_names": [], + "key_types": [] + }, + { + "name": "retbuckets", + "type": "rex_return_buckets", + "index_type": "i64", + "key_names": [], + "key_types": [] + }, + { + "name": "rexbal", + "type": "rex_balance", + "index_type": "i64", + "key_names": [], + "key_types": [] + }, + { + "name": "rexfund", + "type": "rex_fund", + "index_type": "i64", + "key_names": [], + "key_types": [] + }, + { + "name": "rexpool", + "type": "rex_pool", + "index_type": "i64", + "key_names": [], + "key_types": [] + }, + { + "name": "rexqueue", + "type": "rex_order", + "index_type": "i64", + "key_names": [], + "key_types": [] + }, + { + "name": "rexretpool", + "type": "rex_return_pool", + "index_type": "i64", + "key_names": [], + "key_types": [] + }, + { + "name": "userres", + "type": "user_resources", + "index_type": "i64", + "key_names": [], + "key_types": [] + }, + { + "name": "voters", + "type": "voter_info", + "index_type": "i64", + "key_names": [], + "key_types": [] + } + ], + "ricardian_clauses": [ + { + "id": "UserAgreement", + "body": "User agreement for the chain can go here." + }, + { + "id": "BlockProducerAgreement", + "body": "I, {{producer}}, hereby nominate myself for consideration as an elected block producer.\n\nIf {{producer}} is selected to produce blocks by the system contract, I will sign blocks with {{producer_key}} and I hereby attest that I will keep this key secret and secure.\n\nIf {{producer}} is unable to perform obligations under this contract I will resign my position by resubmitting this contract with the null producer key.\n\nI acknowledge that a block is 'objectively valid' if it conforms to the deterministic blockchain rules in force at the time of its creation, and is 'objectively invalid' if it fails to conform to those rules.\n\n{{producer}} hereby agrees to only use {{producer_key}} to sign messages under the following scenarios:\n\n* proposing an objectively valid block at the time appointed by the block scheduling algorithm;\n* pre-confirming a block produced by another producer in the schedule when I find said block objectively valid;\n* and, confirming a block for which {{producer}} has received pre-confirmation messages from more than two-thirds of the active block producers.\n\nI hereby accept liability for any and all provable damages that result from my:\n\n* signing two different block proposals with the same timestamp with {{producer_key}};\n* signing two different block proposals with the same block number with {{producer_key}};\n* signing any block proposal which builds off of an objectively invalid block;\n* signing a pre-confirmation for an objectively invalid block;\n* or, signing a confirmation for a block for which I do not possess pre-confirmation messages from more than two-thirds of the active block producers.\n\nI hereby agree that double-signing for a timestamp or block number in concert with two or more other block producers shall automatically be deemed malicious and cause {{producer}} to be subject to:\n\n* a fine equal to the past year of compensation received,\n* immediate disqualification from being a producer,\n* and/or other damages.\n\nAn exception may be made if {{producer}} can demonstrate that the double-signing occurred due to a bug in the reference software; the burden of proof is on {{producer}}.\n\nI hereby agree not to interfere with the producer election process. I agree to process all producer election transactions that occur in blocks I create, to sign all objectively valid blocks I create that contain election transactions, and to sign all pre-confirmations and confirmations necessary to facilitate transfer of control to the next set of producers as determined by the system contract.\n\nI hereby acknowledge that more than two-thirds of the active block producers may vote to disqualify {{producer}} in the event {{producer}} is unable to produce blocks or is unable to be reached, according to criteria agreed to among block producers.\n\nIf {{producer}} qualifies for and chooses to collect compensation due to votes received, {{producer}} will provide a public endpoint allowing at least 100 peers to maintain synchronization with the blockchain and/or submit transactions to be included. {{producer}} shall maintain at least one validating node with full state and signature checking and shall report any objectively invalid blocks produced by the active block producers. Reporting shall be via a method to be agreed to among block producers, said method and reports to be made public.\n\nThe community agrees to allow {{producer}} to authenticate peers as necessary to prevent abuse and denial of service attacks; however, {{producer}} agrees not to discriminate against non-abusive peers.\n\nI agree to process transactions on a FIFO (first in, first out) best-effort basis and to honestly bill transactions for measured execution time.\n\nI {{producer}} agree not to manipulate the contents of blocks in order to derive profit from: the order in which transactions are included, or the hash of the block that is produced.\n\nI, {{producer}}, hereby agree to disclose and attest under penalty of perjury all ultimate beneficial owners of my business entity who own more than 10% and all direct shareholders.\n\nI, {{producer}}, hereby agree to cooperate with other block producers to carry out our respective and mutual obligations under this agreement, including but not limited to maintaining network stability and a valid blockchain.\n\nI, {{producer}}, agree to maintain a website hosted at {{url}} which contains up-to-date information on all disclosures required by this contract.\n\nI, {{producer}}, agree to set the location value of {{location}} such that {{producer}} is scheduled with minimal latency between my previous and next peer.\n\nI, {{producer}}, agree to maintain time synchronization within 10 ms of global atomic clock time, using a method agreed to among block producers.\n\nI, {{producer}}, agree not to produce blocks before my scheduled time unless I have received all blocks produced by the prior block producer.\n\nI, {{producer}}, agree not to publish blocks with timestamps more than 500ms in the future unless the prior block is more than 75% full by either NET or CPU bandwidth metrics.\n\nI, {{producer}}, agree not to set the RAM supply to more RAM than my nodes contain and to resign if I am unable to provide the RAM approved by more than two-thirds of active block producers, as shown in the system parameters." + } + ], + "variants": [] +} \ No newline at end of file diff --git a/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/contracts-v2/eosio.contracts/eosio.system/eosio.system.wasm b/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/contracts-v2/eosio.contracts/eosio.system/eosio.system.wasm new file mode 100755 index 0000000..642d980 Binary files /dev/null and b/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/contracts-v2/eosio.contracts/eosio.system/eosio.system.wasm differ diff --git a/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/contracts-v2/eosio.contracts/eosio.token/eosio.token.abi b/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/contracts-v2/eosio.contracts/eosio.token/eosio.token.abi new file mode 100644 index 0000000..4cbef74 --- /dev/null +++ b/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/contracts-v2/eosio.contracts/eosio.token/eosio.token.abi @@ -0,0 +1,351 @@ +{ + "____comment": "This file was generated with eosio-abigen. DO NOT EDIT ", + "version": "eosio::abi/1.1", + "types": [], + "structs": [ + { + "name": "account", + "base": "", + "fields": [ + { + "name": "balance", + "type": "asset" + } + ] + }, + { + "name": "chngstaker", + "base": "", + "fields": [ + { + "name": "oldstaker", + "type": "name" + }, + { + "name": "newstaker", + "type": "name" + }, + { + "name": "account", + "type": "name" + } + ] + }, + { + "name": "close", + "base": "", + "fields": [ + { + "name": "owner", + "type": "name" + }, + { + "name": "symbol", + "type": "symbol" + } + ] + }, + { + "name": "create", + "base": "", + "fields": [ + { + "name": "issuer", + "type": "name" + }, + { + "name": "maximum_supply", + "type": "asset" + } + ] + }, + { + "name": "currency_stats", + "base": "", + "fields": [ + { + "name": "supply", + "type": "asset" + }, + { + "name": "max_supply", + "type": "asset" + }, + { + "name": "issuer", + "type": "name" + } + ] + }, + { + "name": "issue", + "base": "", + "fields": [ + { + "name": "to", + "type": "name" + }, + { + "name": "quantity", + "type": "asset" + }, + { + "name": "memo", + "type": "string" + } + ] + }, + { + "name": "open", + "base": "", + "fields": [ + { + "name": "owner", + "type": "name" + }, + { + "name": "symbol", + "type": "symbol" + }, + { + "name": "ram_payer", + "type": "name" + } + ] + }, + { + "name": "reserve", + "base": "", + "fields": [ + { + "name": "staked", + "type": "asset" + }, + { + "name": "last_claimed", + "type": "time_point" + } + ] + }, + { + "name": "retire", + "base": "", + "fields": [ + { + "name": "quantity", + "type": "asset" + }, + { + "name": "memo", + "type": "string" + } + ] + }, + { + "name": "setstaked", + "base": "", + "fields": [ + { + "name": "value", + "type": "asset" + } + ] + }, + { + "name": "stake", + "base": "", + "fields": [ + { + "name": "account", + "type": "name" + }, + { + "name": "receiver", + "type": "name" + }, + { + "name": "quantity", + "type": "asset" + }, + { + "name": "memo", + "type": "string" + } + ] + }, + { + "name": "stake_info", + "base": "", + "fields": [ + { + "name": "amount", + "type": "asset" + }, + { + "name": "staker", + "type": "name" + } + ] + }, + { + "name": "staking_stats", + "base": "", + "fields": [ + { + "name": "ore_staked", + "type": "asset" + } + ] + }, + { + "name": "transfer", + "base": "", + "fields": [ + { + "name": "from", + "type": "name" + }, + { + "name": "to", + "type": "name" + }, + { + "name": "quantity", + "type": "asset" + }, + { + "name": "memo", + "type": "string" + } + ] + }, + { + "name": "unstake", + "base": "", + "fields": [ + { + "name": "account", + "type": "name" + }, + { + "name": "receiver", + "type": "name" + }, + { + "name": "quantity", + "type": "asset" + }, + { + "name": "memo", + "type": "string" + } + ] + }, + { + "name": "updateclaim", + "base": "", + "fields": [ + { + "name": "owner", + "type": "name" + } + ] + } + ], + "actions": [ + { + "name": "chngstaker", + "type": "chngstaker", + "ricardian_contract": "" + }, + { + "name": "close", + "type": "close", + "ricardian_contract": "---\nspec_version: \"0.2.0\"\ntitle: Close Token Balance\nsummary: 'Close {{nowrap owner}}’s zero quantity balance'\nicon: http://127.0.0.1/ricardian_assets/eosio.contracts/icons/token.png#207ff68b0406eaa56618b08bda81d6a0954543f36adc328ab3065f31a5c5d654\n---\n\n{{owner}} agrees to close their zero quantity balance for the {{symbol_to_symbol_code symbol}} token.\n\nRAM will be refunded to the RAM payer of the {{symbol_to_symbol_code symbol}} token balance for {{owner}}." + }, + { + "name": "create", + "type": "create", + "ricardian_contract": "---\nspec_version: \"0.2.0\"\ntitle: Create New Token\nsummary: 'Create a new token'\nicon: http://127.0.0.1/ricardian_assets/eosio.contracts/icons/token.png#207ff68b0406eaa56618b08bda81d6a0954543f36adc328ab3065f31a5c5d654\n---\n\n{{$action.account}} agrees to create a new token with symbol {{asset_to_symbol_code maximum_supply}} to be managed by {{issuer}}.\n\nThis action will not result any any tokens being issued into circulation.\n\n{{issuer}} will be allowed to issue tokens into circulation, up to a maximum supply of {{maximum_supply}}.\n\nRAM will deducted from {{$action.account}}’s resources to create the necessary records." + }, + { + "name": "issue", + "type": "issue", + "ricardian_contract": "---\nspec_version: \"0.2.0\"\ntitle: Issue Tokens into Circulation\nsummary: 'Issue {{nowrap quantity}} into circulation and transfer into {{nowrap to}}’s account'\nicon: http://127.0.0.1/ricardian_assets/eosio.contracts/icons/token.png#207ff68b0406eaa56618b08bda81d6a0954543f36adc328ab3065f31a5c5d654\n---\n\nThe token manager agrees to issue {{quantity}} into circulation, and transfer it into {{to}}’s account.\n\n{{#if memo}}There is a memo attached to the transfer stating:\n{{memo}}\n{{/if}}\n\nIf {{to}} does not have a balance for {{asset_to_symbol_code quantity}}, or the token manager does not have a balance for {{asset_to_symbol_code quantity}}, the token manager will be designated as the RAM payer of the {{asset_to_symbol_code quantity}} token balance for {{to}}. As a result, RAM will be deducted from the token manager’s resources to create the necessary records.\n\nThis action does not allow the total quantity to exceed the max allowed supply of the token." + }, + { + "name": "open", + "type": "open", + "ricardian_contract": "---\nspec_version: \"0.2.0\"\ntitle: Open Token Balance\nsummary: 'Open a zero quantity balance for {{nowrap owner}}'\nicon: http://127.0.0.1/ricardian_assets/eosio.contracts/icons/token.png#207ff68b0406eaa56618b08bda81d6a0954543f36adc328ab3065f31a5c5d654\n---\n\n{{ram_payer}} agrees to establish a zero quantity balance for {{owner}} for the {{symbol_to_symbol_code symbol}} token.\n\nIf {{owner}} does not have a balance for {{symbol_to_symbol_code symbol}}, {{ram_payer}} will be designated as the RAM payer of the {{symbol_to_symbol_code symbol}} token balance for {{owner}}. As a result, RAM will be deducted from {{ram_payer}}’s resources to create the necessary records." + }, + { + "name": "retire", + "type": "retire", + "ricardian_contract": "---\nspec_version: \"0.2.0\"\ntitle: Remove Tokens from Circulation\nsummary: 'Remove {{nowrap quantity}} from circulation'\nicon: http://127.0.0.1/ricardian_assets/eosio.contracts/icons/token.png#207ff68b0406eaa56618b08bda81d6a0954543f36adc328ab3065f31a5c5d654\n---\n\nThe token manager agrees to remove {{quantity}} from circulation, taken from their own account.\n\n{{#if memo}} There is a memo attached to the action stating:\n{{memo}}\n{{/if}}" + }, + { + "name": "setstaked", + "type": "setstaked", + "ricardian_contract": "" + }, + { + "name": "stake", + "type": "stake", + "ricardian_contract": "" + }, + { + "name": "transfer", + "type": "transfer", + "ricardian_contract": "---\nspec_version: \"0.2.0\"\ntitle: Transfer Tokens\nsummary: 'Send {{nowrap quantity}} from {{nowrap from}} to {{nowrap to}}'\nicon: http://127.0.0.1/ricardian_assets/eosio.contracts/icons/transfer.png#5dfad0df72772ee1ccc155e670c1d124f5c5122f1d5027565df38b418042d1dd\n---\n\n{{from}} agrees to send {{quantity}} to {{to}}.\n\n{{#if memo}}There is a memo attached to the transfer stating:\n{{memo}}\n{{/if}}\n\nIf {{from}} is not already the RAM payer of their {{asset_to_symbol_code quantity}} token balance, {{from}} will be designated as such. As a result, RAM will be deducted from {{from}}’s resources to refund the original RAM payer.\n\nIf {{to}} does not have a balance for {{asset_to_symbol_code quantity}}, {{from}} will be designated as the RAM payer of the {{asset_to_symbol_code quantity}} token balance for {{to}}. As a result, RAM will be deducted from {{from}}’s resources to create the necessary records." + }, + { + "name": "unstake", + "type": "unstake", + "ricardian_contract": "" + }, + { + "name": "updateclaim", + "type": "updateclaim", + "ricardian_contract": "" + } + ], + "tables": [ + { + "name": "accounts", + "type": "account", + "index_type": "i64", + "key_names": [], + "key_types": [] + }, + { + "name": "reserves", + "type": "reserve", + "index_type": "i64", + "key_names": [], + "key_types": [] + }, + { + "name": "stakeinfo", + "type": "stake_info", + "index_type": "i64", + "key_names": [], + "key_types": [] + }, + { + "name": "stakestats", + "type": "staking_stats", + "index_type": "i64", + "key_names": [], + "key_types": [] + }, + { + "name": "stat", + "type": "currency_stats", + "index_type": "i64", + "key_names": [], + "key_types": [] + } + ], + "ricardian_clauses": [], + "variants": [] +} \ No newline at end of file diff --git a/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/contracts-v2/eosio.contracts/eosio.token/eosio.token.wasm b/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/contracts-v2/eosio.contracts/eosio.token/eosio.token.wasm new file mode 100755 index 0000000..6463500 Binary files /dev/null and b/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/contracts-v2/eosio.contracts/eosio.token/eosio.token.wasm differ diff --git a/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/data/config.ini b/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/data/config.ini new file mode 100644 index 0000000..dff02cc --- /dev/null +++ b/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/data/config.ini @@ -0,0 +1,351 @@ +# the endpoint upon which to listen for incoming connections (eosio::bnet_plugin) +# bnet-endpoint = 0.0.0.0:4321 + +# this peer will request only irreversible blocks from other nodes (eosio::bnet_plugin) +# bnet-follow-irreversible = false + +# the number of threads to use to process network messages (eosio::bnet_plugin) +# bnet-threads = + +# remote endpoint of other node to connect to; Use multiple bnet-connect options as needed to compose a network (eosio::bnet_plugin) +# bnet-connect = + +# this peer will request no pending transactions from other nodes (eosio::bnet_plugin) +# bnet-no-trx = false + +# The string used to format peers when logging messages about them. Variables are escaped with ${}. +# Available Variables: +# _name self-reported name +# +# _id self-reported ID (Public Key) +# +# _ip remote IP address of peer +# +# _port remote port number of peer +# +# _lip local IP address connected to peer +# +# _lport local port number connected to peer +# +# (eosio::bnet_plugin) +# bnet-peer-log-format = ["${_name}" ${_ip}:${_port}] + +# the location of the blocks directory (absolute path or relative to application data dir) (eosio::chain_plugin) +# blocks-dir = "blocks" + +# Pairs of [BLOCK_NUM,BLOCK_ID] that should be enforced as checkpoints. (eosio::chain_plugin) +# checkpoint = + +# Override default WASM runtime (eosio::chain_plugin) +# wasm-runtime = + +# Override default maximum ABI serialization time allowed in ms (eosio::chain_plugin) +# abi-serializer-max-time-ms = 15000 + +# Maximum size (in MiB) of the chain state database (eosio::chain_plugin) +# chain-state-db-size-mb = 1024 + +# Safely shut down node when free space remaining in the chain state database drops below this size (in MiB). (eosio::chain_plugin) +# chain-state-db-guard-size-mb = 128 + +# Maximum size (in MiB) of the reversible blocks database (eosio::chain_plugin) +# reversible-blocks-db-size-mb = 340 + +# Safely shut down node when free space remaining in the reverseible blocks database drops below this size (in MiB). (eosio::chain_plugin) +# reversible-blocks-db-guard-size-mb = 2 + +# Percentage of actual signature recovery cpu to bill. Whole number percentages, e.g. 50 for 50% (eosio::chain_plugin) +# signature-cpu-billable-pct = 50 + +# Number of worker threads in controller thread pool (eosio::chain_plugin) +# chain-threads = 2 + +# print contract's output to console (eosio::chain_plugin) +contracts-console = true + +# Account added to actor whitelist (may specify multiple times) (eosio::chain_plugin) +# actor-whitelist = + +# Account added to actor blacklist (may specify multiple times) (eosio::chain_plugin) +# actor-blacklist = + +# Contract account added to contract whitelist (may specify multiple times) (eosio::chain_plugin) +# contract-whitelist = + +# Contract account added to contract blacklist (may specify multiple times) (eosio::chain_plugin) +# contract-blacklist = + +# Action (in the form code::action) added to action blacklist (may specify multiple times) (eosio::chain_plugin) +# action-blacklist = + +# Public key added to blacklist of keys that should not be included in authorities (may specify multiple times) (eosio::chain_plugin) +# key-blacklist = + +# Deferred transactions sent by accounts in this list do not have any of the subjective whitelist/blacklist checks applied to them (may specify multiple times) (eosio::chain_plugin) +# sender-bypass-whiteblacklist = + +# Database read mode ("speculative", "head", or "read-only"). +# In "speculative" mode database contains changes done up to the head block plus changes made by transactions not yet included to the blockchain. +# In "head" mode database contains changes done up to the current head block. +# In "read-only" mode database contains incoming block changes but no speculative transaction processing. +# (eosio::chain_plugin) +# read-mode = speculative + +# Chain validation mode ("full" or "light"). +# In "full" mode all incoming blocks will be fully validated. +# In "light" mode all incoming blocks headers will be fully validated; transactions in those validated blocks will be trusted +# (eosio::chain_plugin) +# validation-mode = full + +# Disable the check which subjectively fails a transaction if a contract bills more RAM to another account within the context of a notification handler (i.e. when the receiver is not the code of the action). (eosio::chain_plugin) +# disable-ram-billing-notify-checks = false + +# Indicate a producer whose blocks headers signed by it will be fully validated, but transactions in those validated blocks will be trusted. (eosio::chain_plugin) +# trusted-producer = + +# Track actions which match receiver:action:actor. Actor may be blank to include all. Action and Actor both blank allows all from Recieiver. Receiver may not be blank. (eosio::history_plugin) +# filter-on = * + +# Do not track actions which match receiver:action:actor. Action and Actor both blank excludes all from Reciever. Actor blank excludes all from reciever:action. Receiver may not be blank. (eosio::history_plugin) +# filter-out = + +# PEM encoded trusted root certificate (or path to file containing one) used to validate any TLS connections made. (may specify multiple times) +# (eosio::http_client_plugin) +# https-client-root-cert = + +# true: validate that the peer certificates are valid and trusted, false: ignore cert errors (eosio::http_client_plugin) +# https-client-validate-peers = true + +# The local IP and port to listen for incoming http connections; set blank to disable. (eosio::http_plugin) +http-server-address = 0.0.0.0:8888 + +# The local IP and port to listen for incoming https connections; leave blank to disable. (eosio::http_plugin) +# https-server-address = + +# Filename with the certificate chain to present on https connections. PEM format. Required for https. (eosio::http_plugin) +# https-certificate-chain-file = + +# Filename with https private key in PEM format. Required for https (eosio::http_plugin) +# https-private-key-file = + +# Specify the Access-Control-Allow-Origin to be returned on each request. (eosio::http_plugin) +access-control-allow-origin = * + +# Specify the Access-Control-Allow-Headers to be returned on each request. (eosio::http_plugin) +# access-control-allow-headers = + +# Specify the Access-Control-Max-Age to be returned on each request. (eosio::http_plugin) +# access-control-max-age = + +# Specify if Access-Control-Allow-Credentials: true should be returned on each request. (eosio::http_plugin) +# access-control-allow-credentials = false + +# The maximum body size in bytes allowed for incoming RPC requests (eosio::http_plugin) +# max-body-size = 1048576 + +# Maximum size in megabytes http_plugin should use for processing http requests. 503 error response when exceeded. (eosio::http_plugin) +# http-max-bytes-in-flight-mb = 500 + +# Append the error log to HTTP responses (eosio::http_plugin) +# verbose-http-errors = false + +# If set to false, then any incoming "Host" header is considered valid (eosio::http_plugin) +http-validate-host = false + +# Additionaly acceptable values for the "Host" header of incoming HTTP requests, can be specified multiple times. Includes http/s_server_address by default. (eosio::http_plugin) +# http-alias = + +# Number of worker threads in http thread pool (eosio::http_plugin) +# http-threads = 2 + +# The maximum number of pending login requests (eosio::login_plugin) +# max-login-requests = 1000000 + +# The maximum timeout for pending login requests (in seconds) (eosio::login_plugin) +# max-login-timeout = 60 + +# The target queue size between nodeos and MongoDB plugin thread. (eosio::mongo_db_plugin) +# mongodb-queue-size = 1024 + +# The maximum size of the abi cache for serializing data. (eosio::mongo_db_plugin) +# mongodb-abi-cache-size = 2048 + +# Required with --replay-blockchain, --hard-replay-blockchain, or --delete-all-blocks to wipe mongo db.This option required to prevent accidental wipe of mongo db. (eosio::mongo_db_plugin) +# mongodb-wipe = false + +# If specified then only abi data pushed to mongodb until specified block is reached. (eosio::mongo_db_plugin) +# mongodb-block-start = 0 + +# MongoDB URI connection string, see: https://docs.mongodb.com/master/reference/connection-string/. If not specified then plugin is disabled. Default database 'EOS' is used if not specified in URI. Example: mongodb://127.0.0.1:27017/EOS (eosio::mongo_db_plugin) +# mongodb-uri = + +# Update blocks/block_state with latest via block number so that duplicates are overwritten. (eosio::mongo_db_plugin) +# mongodb-update-via-block-num = false + +# Enables storing blocks in mongodb. (eosio::mongo_db_plugin) +# mongodb-store-blocks = true + +# Enables storing block state in mongodb. (eosio::mongo_db_plugin) +# mongodb-store-block-states = true + +# Enables storing transactions in mongodb. (eosio::mongo_db_plugin) +# mongodb-store-transactions = true + +# Enables storing transaction traces in mongodb. (eosio::mongo_db_plugin) +# mongodb-store-transaction-traces = true + +# Enables storing action traces in mongodb. (eosio::mongo_db_plugin) +# mongodb-store-action-traces = true + +# Track actions which match receiver:action:actor. Receiver, Action, & Actor may be blank to include all. i.e. eosio:: or :transfer: Use * or leave unspecified to include all. (eosio::mongo_db_plugin) +# mongodb-filter-on = + +# Do not track actions which match receiver:action:actor. Receiver, Action, & Actor may be blank to exclude all. (eosio::mongo_db_plugin) +# mongodb-filter-out = + +# The actual host:port used to listen for incoming p2p connections. (eosio::net_plugin) +# p2p-listen-endpoint = 0.0.0.0:9876 + +# An externally accessible host:port for identifying this node. Defaults to p2p-listen-endpoint. (eosio::net_plugin) +# p2p-server-address = + +# The public endpoint of a peer node to connect to. Use multiple p2p-peer-address options as needed to compose a network. (eosio::net_plugin) +# p2p-peer-address = + +# Maximum number of client nodes from any single IP address (eosio::net_plugin) +# p2p-max-nodes-per-host = 1 + +# The name supplied to identify this node amongst the peers. (eosio::net_plugin) +# agent-name = "EOS Test Agent" + +# Can be 'any' or 'producers' or 'specified' or 'none'. If 'specified', peer-key must be specified at least once. If only 'producers', peer-key is not required. 'producers' and 'specified' may be combined. (eosio::net_plugin) +# allowed-connection = any + +# Optional public key of peer allowed to connect. May be used multiple times. (eosio::net_plugin) +# peer-key = + +# Tuple of [PublicKey, WIF private key] (may specify multiple times) (eosio::net_plugin) +# peer-private-key = + +# Maximum number of clients from which connections are accepted, use 0 for no limit (eosio::net_plugin) +# max-clients = 25 + +# number of seconds to wait before cleaning up dead connections (eosio::net_plugin) +# connection-cleanup-period = 30 + +# max connection cleanup time per cleanup call in millisec (eosio::net_plugin) +# max-cleanup-time-msec = 10 + +# True to require exact match of peer network version. (eosio::net_plugin) +# network-version-match = false + +# Number of worker threads in net_plugin thread pool (eosio::net_plugin) +# net-threads = 1 + +# number of blocks to retrieve in a chunk from any individual peer during synchronization (eosio::net_plugin) +# sync-fetch-span = 100 + +# Enable expirimental socket read watermark optimization (eosio::net_plugin) +# use-socket-read-watermark = false + +# The string used to format peers when logging messages about them. Variables are escaped with ${}. +# Available Variables: +# _name self-reported name +# +# _id self-reported ID (64 hex characters) +# +# _sid first 8 characters of _peer.id +# +# _ip remote IP address of peer +# +# _port remote port number of peer +# +# _lip local IP address connected to peer +# +# _lport local port number connected to peer +# +# (eosio::net_plugin) +# peer-log-format = ["${_name}" ${_ip}:${_port}] + +# Enable block production, even if the chain is stale. (eosio::producer_plugin) +enable-stale-production = true + +# Start this node in a state where production is paused (eosio::producer_plugin) +# pause-on-startup = false + +# Limits the maximum time (in milliseconds) that is allowed a pushed transaction's code to execute before being considered invalid (eosio::producer_plugin) +max-transaction-time = 3000 + +# Limits the maximum age (in seconds) of the DPOS Irreversible Block for a chain this node will produce blocks on (use negative value to indicate unlimited) (eosio::producer_plugin) +# max-irreversible-block-age = -1 + +# ID of producer controlled by this node (e.g. inita; may specify multiple times) (eosio::producer_plugin) +producer-name = eosio +producer-name = producer1 +producer-name = producer2 + +# (DEPRECATED - Use signature-provider instead) Tuple of [public key, WIF private key] (may specify multiple times) (eosio::producer_plugin) +# private-key = + +# Key=Value pairs in the form = +# Where: +# is a string form of a vaild EOSIO public key +# +# is a string in the form : +# +# is KEY, or KEOSD +# +# KEY: is a string form of a valid EOSIO private key which maps to the provided public key +# +# KEOSD: is the URL where keosd is available and the approptiate wallet(s) are unlocked (eosio::producer_plugin) +signature-provider = EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV=KEY:5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3 + +# Limits the maximum time (in milliseconds) that is allowed for sending blocks to a keosd provider for signing (eosio::producer_plugin) +# keosd-provider-timeout = 5 + +# account that can not access to extended CPU/NET virtual resources (eosio::producer_plugin) +# greylist-account = + +# offset of non last block producing time in microseconds. Negative number results in blocks to go out sooner, and positive number results in blocks to go out later (eosio::producer_plugin) +# produce-time-offset-us = 0 + +# offset of last block producing time in microseconds. Negative number results in blocks to go out sooner, and positive number results in blocks to go out later (eosio::producer_plugin) +# last-block-time-offset-us = 0 + +# Maximum wall-clock time, in milliseconds, spent retiring scheduled transactions in any block before returning to normal transaction processing. (eosio::producer_plugin) +# max-scheduled-transaction-time-per-block-ms = 500 +http-max-response-time-ms = 1000 + +# ratio between incoming transations and deferred transactions when both are exhausted (eosio::producer_plugin) +# incoming-defer-ratio = 1 + +# Number of worker threads in producer thread pool (eosio::producer_plugin) +# producer-threads = 2 + +# the location of the snapshots directory (absolute path or relative to application data dir) (eosio::producer_plugin) +# snapshots-dir = "snapshots" + +# the location of the state-history directory (absolute path or relative to application data dir) (eosio::state_history_plugin) +# state-history-dir = "state-history" + +# enable trace history (eosio::state_history_plugin) +# trace-history = false + +# enable chain state history (eosio::state_history_plugin) +# chain-state-history = false + +# the endpoint upon which to listen for incoming connections. Caution: only expose this port to your internal network. (eosio::state_history_plugin) +# state-history-endpoint = 127.0.0.1:8080 + +# Lag in number of blocks from the head block when selecting the reference block for transactions (-1 means Last Irreversible Block) (eosio::txn_test_gen_plugin) +# txn-reference-block-lag = 0 + +# Number of worker threads in txn_test_gen thread pool (eosio::txn_test_gen_plugin) +# txn-test-gen-threads = 2 + +# Plugin(s) to enable, may be specified multiple times +plugin = eosio::producer_plugin +plugin = eosio::chain_api_plugin +plugin = eosio::producer_api_plugin +plugin = eosio::http_plugin +plugin = eosio::history_api_plugin diff --git a/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/data/genesis.json b/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/data/genesis.json new file mode 100755 index 0000000..c2b4934 --- /dev/null +++ b/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/data/genesis.json @@ -0,0 +1,24 @@ +{ + "initial_timestamp": "2019-07-25T22:30:39.500", + "initial_key": "EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", + "initial_configuration": { + "max_block_net_usage": 1048576, + "target_block_net_usage_pct": 1000, + "max_transaction_net_usage": 524288, + "base_per_transaction_net_usage": 12, + "net_usage_leeway": 500, + "context_free_discount_net_usage_num": 20, + "context_free_discount_net_usage_den": 100, + "max_block_cpu_usage": 1500000, + "target_block_cpu_usage_pct": 1000, + "max_transaction_cpu_usage": 1450000, + "min_transaction_cpu_usage": 100, + "max_transaction_lifetime": 3600, + "deferred_trx_expiration_window": 600, + "max_transaction_delay": 3888000, + "max_inline_action_size": 4096, + "max_inline_action_depth": 4, + "max_authority_depth": 6 + }, + "initial_chain_id": "0000000000000000000000000000000000000000000000000000000000000000" +} diff --git a/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/data/protocol_features/BUILTIN-DISALLOW_EMPTY_PRODUCER_SCHEDULE.json b/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/data/protocol_features/BUILTIN-DISALLOW_EMPTY_PRODUCER_SCHEDULE.json new file mode 100644 index 0000000..cd2296b --- /dev/null +++ b/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/data/protocol_features/BUILTIN-DISALLOW_EMPTY_PRODUCER_SCHEDULE.json @@ -0,0 +1,11 @@ +{ + "protocol_feature_type": "builtin", + "dependencies": [], + "description_digest": "2853617cec3eabd41881eb48882e6fc5e81a0db917d375057864b3befbe29acd", + "subjective_restrictions": { + "earliest_allowed_activation_time": "1970-01-01T00:00:00.000", + "preactivation_required": true, + "enabled": true + }, + "builtin_feature_codename": "DISALLOW_EMPTY_PRODUCER_SCHEDULE" +} \ No newline at end of file diff --git a/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/data/protocol_features/BUILTIN-FIX_LINKAUTH_RESTRICTION.json b/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/data/protocol_features/BUILTIN-FIX_LINKAUTH_RESTRICTION.json new file mode 100644 index 0000000..de632bb --- /dev/null +++ b/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/data/protocol_features/BUILTIN-FIX_LINKAUTH_RESTRICTION.json @@ -0,0 +1,11 @@ +{ + "protocol_feature_type": "builtin", + "dependencies": [], + "description_digest": "a98241c83511dc86c857221b9372b4aa7cea3aaebc567a48604e1d3db3557050", + "subjective_restrictions": { + "earliest_allowed_activation_time": "1970-01-01T00:00:00.000", + "preactivation_required": true, + "enabled": true + }, + "builtin_feature_codename": "FIX_LINKAUTH_RESTRICTION" +} \ No newline at end of file diff --git a/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/data/protocol_features/BUILTIN-FORWARD_SETCODE.json b/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/data/protocol_features/BUILTIN-FORWARD_SETCODE.json new file mode 100644 index 0000000..ec3fa85 --- /dev/null +++ b/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/data/protocol_features/BUILTIN-FORWARD_SETCODE.json @@ -0,0 +1,11 @@ +{ + "protocol_feature_type": "builtin", + "dependencies": [], + "description_digest": "898082c59f921d0042e581f00a59d5ceb8be6f1d9c7a45b6f07c0e26eaee0222", + "subjective_restrictions": { + "earliest_allowed_activation_time": "1970-01-01T00:00:00.000", + "preactivation_required": true, + "enabled": true + }, + "builtin_feature_codename": "FORWARD_SETCODE" +} \ No newline at end of file diff --git a/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/data/protocol_features/BUILTIN-GET_SENDER.json b/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/data/protocol_features/BUILTIN-GET_SENDER.json new file mode 100644 index 0000000..f695ead --- /dev/null +++ b/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/data/protocol_features/BUILTIN-GET_SENDER.json @@ -0,0 +1,11 @@ +{ + "protocol_feature_type": "builtin", + "dependencies": [], + "description_digest": "1eab748b95a2e6f4d7cb42065bdee5566af8efddf01a55a0a8d831b823f8828a", + "subjective_restrictions": { + "earliest_allowed_activation_time": "1970-01-01T00:00:00.000", + "preactivation_required": true, + "enabled": true + }, + "builtin_feature_codename": "GET_SENDER" +} \ No newline at end of file diff --git a/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/data/protocol_features/BUILTIN-NO_DUPLICATE_DEFERRED_ID.json b/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/data/protocol_features/BUILTIN-NO_DUPLICATE_DEFERRED_ID.json new file mode 100644 index 0000000..68fe48a --- /dev/null +++ b/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/data/protocol_features/BUILTIN-NO_DUPLICATE_DEFERRED_ID.json @@ -0,0 +1,13 @@ +{ + "protocol_feature_type": "builtin", + "dependencies": [ + "ef43112c6543b88db2283a2e077278c315ae2c84719a8b25f25cc88565fbea99" + ], + "description_digest": "45967387ee92da70171efd9fefd1ca8061b5efe6f124d269cd2468b47f1575a0", + "subjective_restrictions": { + "earliest_allowed_activation_time": "1970-01-01T00:00:00.000", + "preactivation_required": true, + "enabled": true + }, + "builtin_feature_codename": "NO_DUPLICATE_DEFERRED_ID" +} \ No newline at end of file diff --git a/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/data/protocol_features/BUILTIN-ONLY_BILL_FIRST_AUTHORIZER.json b/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/data/protocol_features/BUILTIN-ONLY_BILL_FIRST_AUTHORIZER.json new file mode 100644 index 0000000..0d5f57a --- /dev/null +++ b/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/data/protocol_features/BUILTIN-ONLY_BILL_FIRST_AUTHORIZER.json @@ -0,0 +1,11 @@ +{ + "protocol_feature_type": "builtin", + "dependencies": [], + "description_digest": "2f1f13e291c79da5a2bbad259ed7c1f2d34f697ea460b14b565ac33b063b73e2", + "subjective_restrictions": { + "earliest_allowed_activation_time": "1970-01-01T00:00:00.000", + "preactivation_required": true, + "enabled": true + }, + "builtin_feature_codename": "ONLY_BILL_FIRST_AUTHORIZER" +} \ No newline at end of file diff --git a/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/data/protocol_features/BUILTIN-ONLY_LINK_TO_EXISTING_PERMISSION.json b/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/data/protocol_features/BUILTIN-ONLY_LINK_TO_EXISTING_PERMISSION.json new file mode 100644 index 0000000..039ae52 --- /dev/null +++ b/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/data/protocol_features/BUILTIN-ONLY_LINK_TO_EXISTING_PERMISSION.json @@ -0,0 +1,11 @@ +{ + "protocol_feature_type": "builtin", + "dependencies": [], + "description_digest": "f3c3d91c4603cde2397268bfed4e662465293aab10cd9416db0d442b8cec2949", + "subjective_restrictions": { + "earliest_allowed_activation_time": "1970-01-01T00:00:00.000", + "preactivation_required": true, + "enabled": true + }, + "builtin_feature_codename": "ONLY_LINK_TO_EXISTING_PERMISSION" +} \ No newline at end of file diff --git a/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/data/protocol_features/BUILTIN-PREACTIVATE_FEATURE.json b/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/data/protocol_features/BUILTIN-PREACTIVATE_FEATURE.json new file mode 100644 index 0000000..d2f905e --- /dev/null +++ b/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/data/protocol_features/BUILTIN-PREACTIVATE_FEATURE.json @@ -0,0 +1,11 @@ +{ + "protocol_feature_type": "builtin", + "dependencies": [], + "description_digest": "64fe7df32e9b86be2b296b3f81dfd527f84e82b98e363bc97e40bc7a83733310", + "subjective_restrictions": { + "earliest_allowed_activation_time": "1970-01-01T00:00:00.000", + "preactivation_required": false, + "enabled": true + }, + "builtin_feature_codename": "PREACTIVATE_FEATURE" +} \ No newline at end of file diff --git a/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/data/protocol_features/BUILTIN-RAM_RESTRICTIONS.json b/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/data/protocol_features/BUILTIN-RAM_RESTRICTIONS.json new file mode 100644 index 0000000..67b4bef --- /dev/null +++ b/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/data/protocol_features/BUILTIN-RAM_RESTRICTIONS.json @@ -0,0 +1,11 @@ +{ + "protocol_feature_type": "builtin", + "dependencies": [], + "description_digest": "1812fdb5096fd854a4958eb9d53b43219d114de0e858ce00255bd46569ad2c68", + "subjective_restrictions": { + "earliest_allowed_activation_time": "1970-01-01T00:00:00.000", + "preactivation_required": true, + "enabled": true + }, + "builtin_feature_codename": "RAM_RESTRICTIONS" +} \ No newline at end of file diff --git a/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/data/protocol_features/BUILTIN-REPLACE_DEFERRED.json b/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/data/protocol_features/BUILTIN-REPLACE_DEFERRED.json new file mode 100644 index 0000000..5dda572 --- /dev/null +++ b/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/data/protocol_features/BUILTIN-REPLACE_DEFERRED.json @@ -0,0 +1,11 @@ +{ + "protocol_feature_type": "builtin", + "dependencies": [], + "description_digest": "9908b3f8413c8474ab2a6be149d3f4f6d0421d37886033f27d4759c47a26d944", + "subjective_restrictions": { + "earliest_allowed_activation_time": "1970-01-01T00:00:00.000", + "preactivation_required": true, + "enabled": true + }, + "builtin_feature_codename": "REPLACE_DEFERRED" +} \ No newline at end of file diff --git a/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/data/protocol_features/BUILTIN-RESTRICT_ACTION_TO_SELF.json b/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/data/protocol_features/BUILTIN-RESTRICT_ACTION_TO_SELF.json new file mode 100644 index 0000000..e0b8948 --- /dev/null +++ b/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/data/protocol_features/BUILTIN-RESTRICT_ACTION_TO_SELF.json @@ -0,0 +1,11 @@ +{ + "protocol_feature_type": "builtin", + "dependencies": [], + "description_digest": "e71b6712188391994c78d8c722c1d42c477cf091e5601b5cf1befd05721a57f3", + "subjective_restrictions": { + "earliest_allowed_activation_time": "1970-01-01T00:00:00.000", + "preactivation_required": true, + "enabled": true + }, + "builtin_feature_codename": "RESTRICT_ACTION_TO_SELF" +} \ No newline at end of file diff --git a/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/data/protocol_features/BUILTIN-WEBAUTHN_KEY.json b/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/data/protocol_features/BUILTIN-WEBAUTHN_KEY.json new file mode 100644 index 0000000..cf33c24 --- /dev/null +++ b/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/data/protocol_features/BUILTIN-WEBAUTHN_KEY.json @@ -0,0 +1,11 @@ +{ + "protocol_feature_type": "builtin", + "dependencies": [], + "description_digest": "927fdf78c51e77a899f2db938249fb1f8bb38f4e43d9c1f75b190492080cbc34", + "subjective_restrictions": { + "earliest_allowed_activation_time": "1970-01-01T00:00:00.000", + "preactivation_required": true, + "enabled": true + }, + "builtin_feature_codename": "WEBAUTHN_KEY" +} \ No newline at end of file diff --git a/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/data/protocol_features/BUILTIN-WTMSIG_BLOCK_SIGNATURES.json b/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/data/protocol_features/BUILTIN-WTMSIG_BLOCK_SIGNATURES.json new file mode 100644 index 0000000..b27d902 --- /dev/null +++ b/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/data/protocol_features/BUILTIN-WTMSIG_BLOCK_SIGNATURES.json @@ -0,0 +1,11 @@ +{ + "protocol_feature_type": "builtin", + "dependencies": [], + "description_digest": "ab76031cad7a457f4fd5f5fca97a3f03b8a635278e0416f77dcc91eb99a48e10", + "subjective_restrictions": { + "earliest_allowed_activation_time": "1970-01-01T00:00:00.000", + "preactivation_required": true, + "enabled": true + }, + "builtin_feature_codename": "WTMSIG_BLOCK_SIGNATURES" +} \ No newline at end of file diff --git a/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/data/walletpw.txt b/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/data/walletpw.txt new file mode 100644 index 0000000..4a067ab --- /dev/null +++ b/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/data/walletpw.txt @@ -0,0 +1 @@ +PW5KUwaAjZ8Ddf5ae2gpyJHQYBdXYD2CiKyuDrwgK3Z86FtzMkpQ6 \ No newline at end of file diff --git a/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/genesis/clean.sh b/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/genesis/clean.sh new file mode 100755 index 0000000..bfd4ba9 --- /dev/null +++ b/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/genesis/clean.sh @@ -0,0 +1,3 @@ +#!/bin/bash +rm -fr blockchain +ls -al diff --git a/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/genesis/genesis_start.sh b/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/genesis/genesis_start.sh new file mode 100755 index 0000000..1ff52eb --- /dev/null +++ b/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/genesis/genesis_start.sh @@ -0,0 +1,36 @@ +#!/bin/bash +DATADIR="./blockchain" +nodeos=nodeos + + +if [ ! -d $DATADIR ]; then + mkdir -p $DATADIR; +fi + +$nodeos \ +--genesis-json $DATADIR"/../../genesis.json" \ +--signature-provider EOS6H2tjbrS6zm8d3tX6yeHorEoihP23Ny9c9wFRHGfJp4vtD42rn=KEY:5HyUCyaSAHM9FSomwidgDVcoeBFVs6d3EKF5VZy1fPTFGJXFAZN \ +--plugin eosio::producer_api_plugin \ +--plugin eosio::chain_api_plugin \ +--plugin eosio::http_plugin \ +--plugin eosio::history_api_plugin \ +--plugin eosio::history_plugin \ +--filter-on=* \ +--data-dir $DATADIR"/data" \ +--blocks-dir $DATADIR"/blocks" \ +--config-dir $DATADIR"/config" \ +--producer-name eosio \ +--http-server-address 127.0.0.1:8888 \ +--p2p-listen-endpoint 127.0.0.1:9010 \ +--access-control-allow-origin=* \ +--contracts-console \ +--http-validate-host=false \ +--verbose-http-errors \ +--enable-stale-production \ +--max-transaction-time=1000 \ +--p2p-peer-address localhost:9011 \ +--p2p-peer-address localhost:9012 \ +--p2p-peer-address localhost:9013 \ +--p2p-peer-address localhost:9014 \ +>> $DATADIR"/nodeos.log" 2>&1 & \ +echo $! > $DATADIR"/eosd.pid" diff --git a/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/genesis/hard_replay.sh b/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/genesis/hard_replay.sh new file mode 100755 index 0000000..a173c48 --- /dev/null +++ b/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/genesis/hard_replay.sh @@ -0,0 +1,32 @@ +#!/bin/bash +DATADIR="./blockchain" +nodeos=nodeos + +if [ ! -d $DATADIR ]; then + mkdir -p $DATADIR; +fi + +$nodeos \ +--signature-provider EOS6H2tjbrS6zm8d3tX6yeHorEoihP23Ny9c9wFRHGfJp4vtD42rn=KEY:5HyUCyaSAHM9FSomwidgDVcoeBFVs6d3EKF5VZy1fPTFGJXFAZN \ +--plugin eosio::producer_plugin \ +--plugin eosio::chain_api_plugin \ +--plugin eosio::http_plugin \ +--plugin eosio::history_api_plugin \ +--data-dir $DATADIR"/data" \ +--blocks-dir $DATADIR"/blocks" \ +--config-dir $DATADIR"/config" \ +--producer-name eosio \ +--http-server-address 127.0.0.1:8888 \ +--p2p-listen-endpoint 127.0.0.1:9010 \ +--access-control-allow-origin=* \ +--contracts-console \ +--http-validate-host=false \ +--verbose-http-errors \ +--enable-stale-production \ +--max-transaction-time=1000 \ +--p2p-peer-address localhost:9011 \ +--p2p-peer-address localhost:9012 \ +--p2p-peer-address localhost:9013 \ +--hard-replay-blockchain \ +>> $DATADIR"/nodeos.log" 2>&1 & \ +echo $! > $DATADIR"/eosd.pid" diff --git a/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/genesis/stop.sh b/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/genesis/stop.sh new file mode 100755 index 0000000..faa40cc --- /dev/null +++ b/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/genesis/stop.sh @@ -0,0 +1,16 @@ +#!/bin/bash +DATADIR="./blockchain/" + +if [ -f $DATADIR"/eosd.pid" ]; then +pid=`cat $DATADIR"/eosd.pid"` +echo $pid +kill $pid +rm -r $DATADIR"/eosd.pid" +echo -ne "Stoping Node" +while true; do +[ ! -d "/proc/$pid/fd" ] && break +echo -ne "." +sleep 1 +done +echo -ne "\rNode Stopped. \n" +fi \ No newline at end of file diff --git a/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/producer1/clean.sh b/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/producer1/clean.sh new file mode 100755 index 0000000..bfd4ba9 --- /dev/null +++ b/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/producer1/clean.sh @@ -0,0 +1,3 @@ +#!/bin/bash +rm -fr blockchain +ls -al diff --git a/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/producer1/genesis_start.sh b/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/producer1/genesis_start.sh new file mode 100755 index 0000000..f10f1ca --- /dev/null +++ b/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/producer1/genesis_start.sh @@ -0,0 +1,33 @@ +#!/bin/bash +DATADIR="./blockchain" +CURDIRNAME=${PWD##*/} +nodeos=nodeos +if [ ! -d $DATADIR ]; then + mkdir -p $DATADIR; +fi + +$nodeos \ +--genesis-json $DATADIR"/../../genesis.json" \ +--signature-provider EOS6H2tjbrS6zm8d3tX6yeHorEoihP23Ny9c9wFRHGfJp4vtD42rn=KEY:5HyUCyaSAHM9FSomwidgDVcoeBFVs6d3EKF5VZy1fPTFGJXFAZN \ +--plugin eosio::producer_api_plugin \ +--plugin eosio::chain_api_plugin \ +--plugin eosio::http_plugin \ +--plugin eosio::history_api_plugin \ +--data-dir $DATADIR"/data" \ +--blocks-dir $DATADIR"/blocks" \ +--config-dir $DATADIR"/config" \ +--producer-name $CURDIRNAME \ +--http-server-address 127.0.0.1:8011 \ +--p2p-listen-endpoint 127.0.0.1:9011 \ +--access-control-allow-origin=* \ +--contracts-console \ +--http-validate-host=false \ +--verbose-http-errors \ +--enable-stale-production \ +--max-transaction-time=1000 \ +--p2p-peer-address localhost:9010 \ +--p2p-peer-address localhost:9012 \ +--p2p-peer-address localhost:9013 \ +--p2p-peer-address localhost:9014 \ +>> $DATADIR"/nodeos.log" 2>&1 & \ +echo $! > $DATADIR"/eosd.pid" \ No newline at end of file diff --git a/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/producer1/hard_start.sh b/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/producer1/hard_start.sh new file mode 100755 index 0000000..a752b86 --- /dev/null +++ b/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/producer1/hard_start.sh @@ -0,0 +1,31 @@ +#!/bin/bash +DATADIR="./blockchain" +CURDIRNAME=${PWD##*/} +nodeos=nodeos +if [ ! -d $DATADIR ]; then + mkdir -p $DATADIR; +fi + +$nodeos \ +--signature-provider EOS6H2tjbrS6zm8d3tX6yeHorEoihP23Ny9c9wFRHGfJp4vtD42rn=KEY:5HyUCyaSAHM9FSomwidgDVcoeBFVs6d3EKF5VZy1fPTFGJXFAZN \ +--plugin eosio::producer_plugin \ +--plugin eosio::chain_api_plugin \ +--plugin eosio::http_plugin \ +--plugin eosio::history_api_plugin \ +--data-dir $DATADIR"/data" \ +--blocks-dir $DATADIR"/blocks" \ +--config-dir $DATADIR"/config" \ +--producer-name producer1 \ +--http-server-address 127.0.0.1:8011 \ +--p2p-listen-endpoint 127.0.0.1:9011 \ +--access-control-allow-origin=* \ +--contracts-console \ +--http-validate-host=false \ +--verbose-http-errors \ +--enable-stale-production \ +--p2p-peer-address localhost:9010 \ +--p2p-peer-address localhost:9012 \ +--p2p-peer-address localhost:9013 \ +--hard-replay-blockchain \ +>> $DATADIR"/nodeos.log" 2>&1 & \ +echo $! > $DATADIR"/eosd.pid" diff --git a/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/producer1/start.sh b/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/producer1/start.sh new file mode 100755 index 0000000..f62ac58 --- /dev/null +++ b/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/producer1/start.sh @@ -0,0 +1,31 @@ +#!/bin/bash +DATADIR="./blockchain" +CURDIRNAME=${PWD##*/} +nodeos=nodeos +if [ ! -d $DATADIR ]; then + mkdir -p $DATADIR; +fi + +$nodeos \ +--signature-provider EOS6H2tjbrS6zm8d3tX6yeHorEoihP23Ny9c9wFRHGfJp4vtD42rn=KEY:5HyUCyaSAHM9FSomwidgDVcoeBFVs6d3EKF5VZy1fPTFGJXFAZN \ +--plugin eosio::producer_plugin \ +--plugin eosio::chain_api_plugin \ +--plugin eosio::http_plugin \ +--plugin eosio::history_api_plugin \ +--data-dir $DATADIR"/data" \ +--blocks-dir $DATADIR"/blocks" \ +--config-dir $DATADIR"/config" \ +--producer-name producer1 \ +--http-server-address 127.0.0.1:8011 \ +--p2p-listen-endpoint 127.0.0.1:9011 \ +--access-control-allow-origin=* \ +--contracts-console \ +--http-validate-host=false \ +--verbose-http-errors \ +--enable-stale-production \ +--p2p-peer-address localhost:9010 \ +--p2p-peer-address localhost:9012 \ +--p2p-peer-address localhost:9013 \ +--p2p-peer-address localhost:9014 \ +>> $DATADIR"/nodeos.log" 2>&1 & \ +echo $! > $DATADIR"/eosd.pid" diff --git a/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/producer1/stop.sh b/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/producer1/stop.sh new file mode 100755 index 0000000..faa40cc --- /dev/null +++ b/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/producer1/stop.sh @@ -0,0 +1,16 @@ +#!/bin/bash +DATADIR="./blockchain/" + +if [ -f $DATADIR"/eosd.pid" ]; then +pid=`cat $DATADIR"/eosd.pid"` +echo $pid +kill $pid +rm -r $DATADIR"/eosd.pid" +echo -ne "Stoping Node" +while true; do +[ ! -d "/proc/$pid/fd" ] && break +echo -ne "." +sleep 1 +done +echo -ne "\rNode Stopped. \n" +fi \ No newline at end of file diff --git a/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/step0.init_wallet.sh b/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/step0.init_wallet.sh new file mode 100755 index 0000000..c838db4 --- /dev/null +++ b/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/step0.init_wallet.sh @@ -0,0 +1,16 @@ +#!/bin/bash +cleos="$1" +setup_dir="$2" +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" + +if [[ "$setup_dir" == "/root" ]]; then + setup_dir="" +fi +$cleos wallet create -n oretest -f "$setup_dir"/data/walletpw.txt + +$cleos wallet unlock -n oretest --password $(cat ${DIR}/data/walletpw.txt) + +$cleos wallet import -n oretest --private-key 5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3 +$cleos wallet import -n oretest --private-key 5JUzsJi7rARZy2rT5eHhcdUKTyVPvaksnEKtNWzyiBbifJA1dUW +$cleos wallet import -n oretest --private-key 5HrMPq41QRVWbQhWvtcxBKLAS5RkksP71q4MumAt2Pdk5SrPpDG +$cleos wallet import -n oretest --private-key 5HyUCyaSAHM9FSomwidgDVcoeBFVs6d3EKF5VZy1fPTFGJXFAZN diff --git a/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/step1.create_accounts.sh b/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/step1.create_accounts.sh new file mode 100755 index 0000000..a717cb9 --- /dev/null +++ b/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/step1.create_accounts.sh @@ -0,0 +1,67 @@ +#!/bin/bash + +cleos="$1" +eosio_contracts=$2 + +$cleos create account eosio eosio.bpay EOS6H2tjbrS6zm8d3tX6yeHorEoihP23Ny9c9wFRHGfJp4vtD42rn +$cleos create account eosio eosio.msig EOS6H2tjbrS6zm8d3tX6yeHorEoihP23Ny9c9wFRHGfJp4vtD42rn +$cleos create account eosio eosio.names EOS6H2tjbrS6zm8d3tX6yeHorEoihP23Ny9c9wFRHGfJp4vtD42rn +$cleos create account eosio eosio.ram EOS6H2tjbrS6zm8d3tX6yeHorEoihP23Ny9c9wFRHGfJp4vtD42rn +$cleos create account eosio eosio.ramfee EOS6H2tjbrS6zm8d3tX6yeHorEoihP23Ny9c9wFRHGfJp4vtD42rn +$cleos create account eosio eosio.saving EOS6H2tjbrS6zm8d3tX6yeHorEoihP23Ny9c9wFRHGfJp4vtD42rn +$cleos create account eosio eosio.stake EOS6H2tjbrS6zm8d3tX6yeHorEoihP23Ny9c9wFRHGfJp4vtD42rn +$cleos create account eosio eosio.token EOS6H2tjbrS6zm8d3tX6yeHorEoihP23Ny9c9wFRHGfJp4vtD42rn +$cleos create account eosio eosio.vpay EOS6H2tjbrS6zm8d3tX6yeHorEoihP23Ny9c9wFRHGfJp4vtD42rn +$cleos create account eosio eosio.rex EOS6H2tjbrS6zm8d3tX6yeHorEoihP23Ny9c9wFRHGfJp4vtD42rn +$cleos create account eosio eosio.wrap EOS6H2tjbrS6zm8d3tX6yeHorEoihP23Ny9c9wFRHGfJp4vtD42rn + +$cleos set contract eosio $eosio_contracts/eosio.bios/ + +sleep 1s +$cleos set contract eosio.token $eosio_contracts/eosio.token/ + +sleep 1s +$cleos set contract eosio.msig $eosio_contracts/eosio.msig/ + +sleep 1s +$cleos set contract eosio.wrap $eosio_contracts/eosio.wrap/ + +curl -X POST http://127.0.0.1:8889/v1/producer/schedule_protocol_feature_activations -d '{"protocol_features_to_activate": ["0ec7e080177b2c02b278d5088611686b49d739925a92d9bfcacd7fc6b74053bd"]}' +curl -X POST http://127.0.0.1:8888/v1/producer/schedule_protocol_feature_activations -d '{"protocol_features_to_activate": ["0ec7e080177b2c02b278d5088611686b49d739925a92d9bfcacd7fc6b74053bd"]}' + +sleep 3s +$cleos set contract eosio $eosio_contracts/eosio.system/ +sleep 3s +$cleos set contract eosio $eosio_contracts/eosio.system/ + +sleep 3s +$cleos push action eosio.token create '[ "eosio", "10000000000.0000 SYS" ]' -p eosio.token@active + +sleep 1s +$cleos push action eosio.token create '[ "eosio", "10000000000.0000 ORE" ]' -p eosio.token@active + +sleep 1s +$cleos push action eosio.token issue '[ "eosio", "1000000000.0000 SYS", "memo" ]' -p eosio@active + +sleep 1s +$cleos push action eosio.token issue '[ "eosio", "1000000000.0000 ORE", "memo" ]' -p eosio@active + +sleep 3s +$cleos push action eosio init '[0, "4,SYS"]' -p eosio@active + +# sleep 3s +$cleos push action eosio setpriv '["eosio.msig", 1]' -p eosio@active + +$cleos system newaccount eosio --transfer producer1 EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV --stake-net "200000000.0000 SYS" --stake-cpu "200000000.0000 SYS" --buy-ram-kbytes 8192 + +$cleos system newaccount eosio --transfer producer2 EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV --stake-net "150000000.0000 SYS" --stake-cpu "150000000.0000 SYS" --buy-ram-kbytes 8192 + +$cleos system newaccount eosio --transfer ore EOS6H2tjbrS6zm8d3tX6yeHorEoihP23Ny9c9wFRHGfJp4vtD42rn --stake-net "100000000.0000 SYS" --stake-cpu "100000000.0000 SYS" --buy-ram-kbytes 8192 + +$cleos system newaccount eosio --transfer funds.ore EOS6H2tjbrS6zm8d3tX6yeHorEoihP23Ny9c9wFRHGfJp4vtD42rn --stake-net "10000.0000 SYS" --stake-cpu "10000.0000 SYS" --buy-ram-kbytes 8192 + +sleep 3 + +$cleos system regproducer producer1 EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV https://accountnum11.com +$cleos system regproducer producer2 EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV https://accountnum12.com + diff --git a/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/step2.vote.sh b/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/step2.vote.sh new file mode 100755 index 0000000..2930608 --- /dev/null +++ b/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/step2.vote.sh @@ -0,0 +1,6 @@ +#!/bin/bash +cleos="$1" + +$cleos system voteproducer prods producer1 producer1 +$cleos system voteproducer prods producer2 producer2 +$cleos system voteproducer prods ore producer1 producer2 \ No newline at end of file diff --git a/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/step3.oresystem.sh b/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/step3.oresystem.sh new file mode 100755 index 0000000..3bbb0b5 --- /dev/null +++ b/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/step3.oresystem.sh @@ -0,0 +1,35 @@ +#!/bin/bash +cleos="$1" +ore_contracts=$2 + +$cleos transfer eosio ore "10000000.0000 SYS" "test.com,50,10" -p eosio@active +sleep 1s +$cleos system newaccount ore --transfer system.ore EOS6H2tjbrS6zm8d3tX6yeHorEoihP23Ny9c9wFRHGfJp4vtD42rn --stake-net "10000.0000 SYS" --stake-cpu "10000.0000 SYS" --buy-ram-kbytes 8192 -p ore +$cleos system newaccount ore --transfer lock.ore EOS6H2tjbrS6zm8d3tX6yeHorEoihP23Ny9c9wFRHGfJp4vtD42rn --stake-net "10000.0000 SYS" --stake-cpu "10000.0000 SYS" --buy-ram-kbytes 8192 -p ore + +$cleos set contract system.ore "$ore_contracts"/ore.system/ ore.system.wasm ore.system.abi +sleep 3s +$cleos set account permission system.ore active '{"threshold": 1,"keys": [{"key": "EOS6H2tjbrS6zm8d3tX6yeHorEoihP23Ny9c9wFRHGfJp4vtD42rn","weight": 1}],"accounts": [{"permission":{"actor":"system.ore","permission":"eosio.code"},"weight":1}]}' owner -p system.ore@owner +$cleos set account permission lock.ore active '{"threshold": 1,"keys": [{"key": "EOS6H2tjbrS6zm8d3tX6yeHorEoihP23Ny9c9wFRHGfJp4vtD42rn","weight": 1}],"accounts": [{"permission":{"actor":"system.ore","permission":"eosio.code"},"weight":1}]}' owner -p lock.ore@owner + +$cleos transfer eosio producer1 "10000000.0000 ORE" "test.com,50,10" -p eosio@active +$cleos transfer eosio producer1 "10000000.0000 SYS" "test.com,50,10" -p eosio@active +$cleos transfer eosio system.ore "10000000.0000 ORE" "test.com,50,10" -p eosio@active +$cleos transfer eosio system.ore "10000000.0000 SYS" "test.com,50,10" -p eosio@active + + +sleep 3s +$cleos push action system.ore setprice '[ "4.0000 ORE", 3048, "0.1000 ORE", "0.1000 ORE", 1]' -p system.ore +$cleos push action system.ore setprice '[ "5.0000 ORE", 4075, "1.0000 ORE", "1.0000 ORE", 2]' -p system.ore +$cleos push action system.ore setprice '[ "6.0000 ORE", 5098, "1.1000 ORE", "1.1000 ORE", 3]' -p system.ore +$cleos push action system.ore setprice '[ "50.0000 ORE", 9000, "20.0000 ORE", "80.000 ORE", 4]' -p system.ore +$cleos push action system.ore setprice '[ "1000000.0000 ORE", 30000, "1000.0000 ORE", "1000.0000 ORE", 100]' -p system.ore + + +$cleos set account permission producer1 active '{"threshold": 1,"keys": [{"key": "EOS6H2tjbrS6zm8d3tX6yeHorEoihP23Ny9c9wFRHGfJp4vtD42rn","weight": 1}],"accounts": [{"permission":{"actor":"system.ore","permission":"eosio.code"},"weight":1}]}' owner -p producer1@owner + +sleep 3s +$cleos push action system.ore createoreacc '[ "producer1", "neworeacct11", "EOS6H2tjbrS6zm8d3tX6yeHorEoihP23Ny9c9wFRHGfJp4vtD42rn", "EOS6H2tjbrS6zm8d3tX6yeHorEoihP23Ny9c9wFRHGfJp4vtD42rn", 1, "producer1"]' -p producer1 +$cleos push action system.ore createoreacc '[ "producer1", "neworeacct12", "EOS6H2tjbrS6zm8d3tX6yeHorEoihP23Ny9c9wFRHGfJp4vtD42rn", "EOS6H2tjbrS6zm8d3tX6yeHorEoihP23Ny9c9wFRHGfJp4vtD42rn", 1, "producer1"]' -p producer1 +$cleos push action system.ore createoreacc '[ "producer1", "test11111111", "EOS6H2tjbrS6zm8d3tX6yeHorEoihP23Ny9c9wFRHGfJp4vtD42rn", "EOS6H2tjbrS6zm8d3tX6yeHorEoihP23Ny9c9wFRHGfJp4vtD42rn", 2, "producer1"]' -p producer1 +$cleos push action system.ore createoreacc '[ "producer1", "test11111112", "EOS6H2tjbrS6zm8d3tX6yeHorEoihP23Ny9c9wFRHGfJp4vtD42rn", "EOS6H2tjbrS6zm8d3tX6yeHorEoihP23Ny9c9wFRHGfJp4vtD42rn", 3, "producer1"]' -p producer1 \ No newline at end of file diff --git a/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/step4.createescrow.sh b/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/step4.createescrow.sh new file mode 100755 index 0000000..c651368 --- /dev/null +++ b/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/step4.createescrow.sh @@ -0,0 +1,28 @@ +#!/bin/bash +CHAIN_SYMBOL=${3:-ORE} +SYMBOL_PRECISION=${4:-4} + +cleos="$1" +createescrow_path=$2 + +$cleos system newaccount eosio --transfer createescrow EOS6H2tjbrS6zm8d3tX6yeHorEoihP23Ny9c9wFRHGfJp4vtD42rn --stake-net "10000.0000 SYS" --stake-cpu "10000.0000 SYS" --buy-ram-kbytes 8192 + +# sleep 3s +$cleos set contract createescrow $createescrow_path/ createescrow.wasm createescrow.abi + +$cleos set account permission createescrow active \ +'{"threshold": 1,"keys": [{"key": "EOS6H2tjbrS6zm8d3tX6yeHorEoihP23Ny9c9wFRHGfJp4vtD42rn","weight": 1}],"accounts": [{"permission":{"actor":"createescrow","permission":"eosio.code"},"weight":1}, {"permission":{"actor":"system.ore","permission":"eosio.code"},"weight":1}]}' owner + +sleep 3s +$cleos push action createescrow init '["'$SYMBOL_PRECISION','$CHAIN_SYMBOL'","system.ore","createoreacc", 0]' -p createescrow + +AIRDROP_JSON='{"contract":"", "balance":"0 ORE", "amount":"0 ORE"}' +REX_JSON='{"net_loan_payment":"0.0000 ORE","net_loan_fund":"0.0000 ORE","cpu_loan_payment":"0.0000 ORE","cpu_loan_fund":"0.0000 ORE"}' +PARAMS_JSON='{"owner":"system.ore", "dapp":"test.com", "ram_bytes":"0", "net":"0.0001 ORE", "cpu":"0.0001 ORE", "airdrop":'$AIRDROP_JSON', "pricekey":1, "use_rex": false, "rex":'$REX_JSON'}' +sleep 3s +$cleos push action createescrow define "$PARAMS_JSON" -p system.ore +sleep 3s +$cleos transfer system.ore createescrow "100.0000 ORE" "test.com,50,10" -p system.ore + +sleep 3s +$cleos push action createescrow create '["system.ore","producer4231","EOS6H2tjbrS6zm8d3tX6yeHorEoihP23Ny9c9wFRHGfJp4vtD42rn","EOS6H2tjbrS6zm8d3tX6yeHorEoihP23Ny9c9wFRHGfJp4vtD42rn","test.com","producer1"]' -p system.ore diff --git a/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/stop.sh b/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/stop.sh new file mode 100755 index 0000000..924a397 --- /dev/null +++ b/scripts/2020-12_TokenEconomicsUpgrade/test-environment/chain-setup/stop.sh @@ -0,0 +1,27 @@ +#!/bin/bash + +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" + +pkill nodeos + +docker-compose -f "$DIR/Dockerfiles/docker-compose-ore.yml" -p ore rm -sf + +: ${ORE_DATADIR="$DIR/data"} + + +obc_dir="${ORE_DATADIR}/blocks" +op2p_dir="${ORE_DATADIR}/p2p" +ostate_dir="${ORE_DATADIR}/state" + +# To prevent the risk of glob problems due to non-existant folders, +# we re-create them silently before we touch them. +mkdir -p "$obc_dir" "$op2p_dir" "$ostate_dir" &> /dev/null +rm -rfv "$obc_dir"/* +rm -rfv "$op2p_dir"/* +rm -rfv "$ostate_dir"/* +mkdir -p "$obc_dir" "$op2p_dir" "$ostate_dir" &> /dev/null +rm "${ORE_DATADIR}/nodeos.log" + +if [[ "$2" != "/root" ]]; then + rm ~/eosio-wallet/oretest.wallet +fi \ No newline at end of file diff --git a/scripts/2020-12_TokenEconomicsUpgrade/test-environment/step0-setup-chain.sh b/scripts/2020-12_TokenEconomicsUpgrade/test-environment/step0-setup-chain.sh new file mode 100755 index 0000000..8e8e8d7 --- /dev/null +++ b/scripts/2020-12_TokenEconomicsUpgrade/test-environment/step0-setup-chain.sh @@ -0,0 +1,19 @@ +#!/bin/bash +cleos="$1" +production_eosio_contracts=${2:-~}/contracts-v1/eosio.contracts +production_ore_contracts=${2:-~}/contracts-v1/ore-protocol +createescrow_path=${2:-~}/contracts-v1/CreateEscrow + +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" + +echo 'Initialize wallets' +$DIR/chain-setup/step0.init_wallet.sh "$cleos" "$2" +echo 'Create accounts' +$DIR/chain-setup/step1.create_accounts.sh "$cleos" "$production_eosio_contracts" +echo 'Vote producer' +$DIR/chain-setup/step2.vote.sh "$cleos" +echo 'Deploy system.ore' +$DIR/chain-setup/step3.oresystem.sh "$cleos" "$production_ore_contracts" +echo 'Deploy createescrow' +$DIR/chain-setup/step4.createescrow.sh "$cleos" "$createescrow_path" + diff --git a/scripts/2020-12_TokenEconomicsUpgrade/test-environment/test.sh b/scripts/2020-12_TokenEconomicsUpgrade/test-environment/test.sh new file mode 100755 index 0000000..31e5915 --- /dev/null +++ b/scripts/2020-12_TokenEconomicsUpgrade/test-environment/test.sh @@ -0,0 +1,26 @@ +#!/bin/bash + +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" + +cleos="${1:-"docker exec -it ore-main cleos --url http://127.0.0.1:8888 --wallet-url http://ore-wallet:8901"}" +setup_dir="$DIR/chain-setup" +if [[ "$cleos" == "cleos" ]]; then + nodeos --data-dir "$setup_dir"/data \ + --config-dir "$setup_dir"/data \ + --config config.ini \ + --logconf "$setup_dir"/data/logging.json \ + --genesis-json "$setup_dir"/data/genesis.json \ + >> "$setup_dir"/data/nodeos.log 2>&1 & + sleep 1s + ./step0-setup-chain.sh "$cleos" "$setup_dir" + ../upgrade/step1-upgrade.sh "$cleos" "$setup_dir" + ../upgrade/step2-verify.sh "$cleos" "$setup_dir" + ./chain-setup/stop.sh "$cleos" "$setup_dir" +else + docker-compose -f "$setup_dir"/Dockerfiles/docker-compose-ore.yml -p ore up -d + sleep 1s + ./step0-setup-chain.sh "$cleos" /root + ../upgrade/step1-upgrade.sh "$cleos" /root + ../upgrade/step2-verify.sh "$cleos" /root + ./chain-setup/stop.sh "$cleos" /root +fi \ No newline at end of file diff --git a/scripts/2020-12_TokenEconomicsUpgrade/upgrade/step1-upgrade.sh b/scripts/2020-12_TokenEconomicsUpgrade/upgrade/step1-upgrade.sh new file mode 100755 index 0000000..bde50f9 --- /dev/null +++ b/scripts/2020-12_TokenEconomicsUpgrade/upgrade/step1-upgrade.sh @@ -0,0 +1,24 @@ +#!/bin/bash +# +# To run the upgrade there must be a wallet unlock with following keys: +# eosio@active, eosio.token@active, createescrow@active, system.ore@owner, system.ore@active +# +cleos="$1" +eosio_contracts=${2:-~}/contracts-v2/eosio.contracts +createescrow_path=${2:-~}/contracts-v2/CreateEscrow +if [[ "$2" == "/root" ]]; then + ore_contracts="$2/contracts" +else + ore_contracts="../../../contracts" +fi + +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" + +sleep 2s +$DIR/upgradeScripts/step1-unstake-ram.sh $cleos +read -p "press key" keypress +$DIR/upgradeScripts/step2-update-eosio.sh "$cleos" "$eosio_contracts" +read -p "press key" keypress +$DIR/upgradeScripts/step3-update-ore-system.sh "$cleos" "$ore_contracts" +read -p "press key" keypress +$DIR/upgradeScripts/step4-update-createescrow.sh "$cleos" "$createescrow_path" \ No newline at end of file diff --git a/scripts/2020-12_TokenEconomicsUpgrade/upgrade/step2-verify.sh b/scripts/2020-12_TokenEconomicsUpgrade/upgrade/step2-verify.sh new file mode 100755 index 0000000..61f01bb --- /dev/null +++ b/scripts/2020-12_TokenEconomicsUpgrade/upgrade/step2-verify.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +cleos="$1" + +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" + +echo 'Test Emergency' +$DIR/verifyScripts/emergency.sh "$cleos" + +echo 'Test Trigger' +$DIR/verifyScripts/trigger.sh "$cleos" + +echo 'Test Normal Phase' +$DIR/verifyScripts/normalphase.sh "$cleos" \ No newline at end of file diff --git a/scripts/2020-12_TokenEconomicsUpgrade/upgrade/upgradeScripts/step1-unstake-ram.sh b/scripts/2020-12_TokenEconomicsUpgrade/upgrade/upgradeScripts/step1-unstake-ram.sh new file mode 100755 index 0000000..fdf20ab --- /dev/null +++ b/scripts/2020-12_TokenEconomicsUpgrade/upgrade/upgradeScripts/step1-unstake-ram.sh @@ -0,0 +1,11 @@ +cleos="$1" + +# requires following permissions +# ore@active, apim@active, aikon@active + +sleep 2s +$cleos system sellram -x 1000 ore 33822867456 +sleep 2s +$cleos system sellram -x 1000 aikon 5583457484 +sleep 2s +$cleos system sellram -x 1000 apim 11274289152 \ No newline at end of file diff --git a/scripts/2020-12_TokenEconomicsUpgrade/upgrade/upgradeScripts/step2-update-eosio.sh b/scripts/2020-12_TokenEconomicsUpgrade/upgrade/upgradeScripts/step2-update-eosio.sh new file mode 100755 index 0000000..62f7861 --- /dev/null +++ b/scripts/2020-12_TokenEconomicsUpgrade/upgrade/upgradeScripts/step2-update-eosio.sh @@ -0,0 +1,19 @@ +cleos="$1" +eosio_contracts="$2" + +sleep 2s +$cleos system newaccount -x 1000 eosio --transfer eosio.upay EOS6H2tjbrS6zm8d3tX6yeHorEoihP23Ny9c9wFRHGfJp4vtD42rn --stake-net "10000.0000 SYS" --stake-cpu "10000.0000 SYS" --buy-ram-kbytes 8192 -p eosio +sleep 2s +$cleos set contract -x 1000 eosio $eosio_contracts/eosio.system/ -p eosio -p system.ore +sleep 2s +$cleos set contract -x 1000 eosio.token $eosio_contracts/eosio.token/ -p eosio.token -p system.ore +sleep 2s +$cleos push action -x 1000 eosio setram '[17179869184]' -p eosio # 16 Gib +sleep 2s +$cleos set account permission -x 1000 system.ore active '{"threshold": 1,"keys": [{"key": "EOS6H2tjbrS6zm8d3tX6yeHorEoihP23Ny9c9wFRHGfJp4vtD42rn","weight": 1}],"accounts": [{"permission":{"actor":"eosio","permission":"eosio.code"},"weight":1}, {"permission":{"actor":"system.ore","permission":"eosio.code"},"weight":1}]}' owner -p system.ore@owner +sleep 2s +$cleos push action -x 1000 eosio.token open '["eosio.upay", "4,ORE", "eosio"]' -p eosio@active +sleep 2s +$cleos push action -x 1000 eosio.token setstaked '["0.0000 ORE"]' -p eosio.token@active +sleep 2s +$cleos push action -x 1000 eosio setinflation '[0, 10000, 10000]' -p eosio@active \ No newline at end of file diff --git a/scripts/2020-12_TokenEconomicsUpgrade/upgrade/upgradeScripts/step3-update-ore-system.sh b/scripts/2020-12_TokenEconomicsUpgrade/upgrade/upgradeScripts/step3-update-ore-system.sh new file mode 100755 index 0000000..227d1d9 --- /dev/null +++ b/scripts/2020-12_TokenEconomicsUpgrade/upgrade/upgradeScripts/step3-update-ore-system.sh @@ -0,0 +1,8 @@ +cleos="$1" +ore_contracts="$2" + +$cleos set contract -x 1000 system.ore $ore_contracts/build/ore.system/ ore.system.wasm ore.system.abi +sleep 2s +$cleos set account permission -x 1000 system.ore active '{"threshold": 1,"keys": [{"key": "EOS6H2tjbrS6zm8d3tX6yeHorEoihP23Ny9c9wFRHGfJp4vtD42rn","weight": 1}],"accounts": [{"permission":{"actor":"eosio","permission":"eosio.code"},"weight":1}, {"permission":{"actor":"system.ore","permission":"eosio.code"},"weight":1}]}' owner -p system.ore@owner +sleep 2s +$cleos push action -x 1000 system.ore migrate '[]' -p system.ore \ No newline at end of file diff --git a/scripts/2020-12_TokenEconomicsUpgrade/upgrade/upgradeScripts/step4-update-createescrow.sh b/scripts/2020-12_TokenEconomicsUpgrade/upgrade/upgradeScripts/step4-update-createescrow.sh new file mode 100755 index 0000000..4dc995e --- /dev/null +++ b/scripts/2020-12_TokenEconomicsUpgrade/upgrade/upgradeScripts/step4-update-createescrow.sh @@ -0,0 +1,4 @@ +cleos="$1" +createescrow_path="$2" + +$cleos set contract -x 1000 createescrow $createescrow_path/ createescrow.wasm createescrow.abi -p createescrow -p system.ore \ No newline at end of file diff --git a/scripts/2020-12_TokenEconomicsUpgrade/upgrade/verifyScripts/emergency.sh b/scripts/2020-12_TokenEconomicsUpgrade/upgrade/verifyScripts/emergency.sh new file mode 100755 index 0000000..f2ddcf3 --- /dev/null +++ b/scripts/2020-12_TokenEconomicsUpgrade/upgrade/verifyScripts/emergency.sh @@ -0,0 +1,29 @@ +#!/bin/bash + +cleos="$1" + +$cleos push action system.ore createoreacc '[ "producer1", "test11111122", "EOS6H2tjbrS6zm8d3tX6yeHorEoihP23Ny9c9wFRHGfJp4vtD42rn", "EOS6H2tjbrS6zm8d3tX6yeHorEoihP23Ny9c9wFRHGfJp4vtD42rn", 1, "producer1"]' -p producer1 + +$cleos get table eosio.token ORE stakestats +$cleos get table eosio.token producer1 reserves +$cleos get table eosio.token test11111122 stakeinfo + +$cleos push action system.ore settier '[ 100, 1000000000, 20320875724 , "1.0000 ORE", "1.0000 ORE"]' -p system.ore + +$cleos push action system.ore settier '[ 20, 30000, 2320875724 , "1.0000 ORE", "1.0000 ORE"]' -p system.ore + +$cleos push action system.ore settier '[ 10, 30000, 220875724 , "1.0000 ORE", "1.0000 ORE"]' -p system.ore + +$cleos push action system.ore createoreacc '[ "eosio", "test11111124", "EOS6H2tjbrS6zm8d3tX6yeHorEoihP23Ny9c9wFRHGfJp4vtD42rn", "EOS6H2tjbrS6zm8d3tX6yeHorEoihP23Ny9c9wFRHGfJp4vtD42rn", 100, ""]' -p eosio +$cleos push action system.ore createoreacc '[ "eosio", "test11111125", "EOS6H2tjbrS6zm8d3tX6yeHorEoihP23Ny9c9wFRHGfJp4vtD42rn", "EOS6H2tjbrS6zm8d3tX6yeHorEoihP23Ny9c9wFRHGfJp4vtD42rn", 100, ""]' -p eosio +$cleos push action system.ore createoreacc '[ "eosio", "test11111131", "EOS6H2tjbrS6zm8d3tX6yeHorEoihP23Ny9c9wFRHGfJp4vtD42rn", "EOS6H2tjbrS6zm8d3tX6yeHorEoihP23Ny9c9wFRHGfJp4vtD42rn", 100, ""]' -p eosio +$cleos push action system.ore createoreacc '[ "eosio", "test11111132", "EOS6H2tjbrS6zm8d3tX6yeHorEoihP23Ny9c9wFRHGfJp4vtD42rn", "EOS6H2tjbrS6zm8d3tX6yeHorEoihP23Ny9c9wFRHGfJp4vtD42rn", 100, ""]' -p eosio +$cleos push action system.ore createoreacc '[ "eosio", "test11111133", "EOS6H2tjbrS6zm8d3tX6yeHorEoihP23Ny9c9wFRHGfJp4vtD42rn", "EOS6H2tjbrS6zm8d3tX6yeHorEoihP23Ny9c9wFRHGfJp4vtD42rn", 20, ""]' -p eosio +$cleos push action system.ore createoreacc '[ "eosio", "test11111134", "EOS6H2tjbrS6zm8d3tX6yeHorEoihP23Ny9c9wFRHGfJp4vtD42rn", "EOS6H2tjbrS6zm8d3tX6yeHorEoihP23Ny9c9wFRHGfJp4vtD42rn", 20, ""]' -p eosio +$cleos push action system.ore createoreacc '[ "eosio", "test11111135", "EOS6H2tjbrS6zm8d3tX6yeHorEoihP23Ny9c9wFRHGfJp4vtD42rn", "EOS6H2tjbrS6zm8d3tX6yeHorEoihP23Ny9c9wFRHGfJp4vtD42rn", 10, ""]' -p eosio +$cleos push action system.ore createoreacc '[ "eosio", "test11111141", "EOS6H2tjbrS6zm8d3tX6yeHorEoihP23Ny9c9wFRHGfJp4vtD42rn", "EOS6H2tjbrS6zm8d3tX6yeHorEoihP23Ny9c9wFRHGfJp4vtD42rn", 10, ""]' -p eosio + +$cleos get table eosio eosio global + +$cleos push action system.ore createoreacc '[ "eosio", "test11111151", "EOS6H2tjbrS6zm8d3tX6yeHorEoihP23Ny9c9wFRHGfJp4vtD42rn", "EOS6H2tjbrS6zm8d3tX6yeHorEoihP23Ny9c9wFRHGfJp4vtD42rn", 1, ""]' -p eosio + \ No newline at end of file diff --git a/scripts/2020-12_TokenEconomicsUpgrade/upgrade/verifyScripts/normalphase.sh b/scripts/2020-12_TokenEconomicsUpgrade/upgrade/verifyScripts/normalphase.sh new file mode 100755 index 0000000..f44ba07 --- /dev/null +++ b/scripts/2020-12_TokenEconomicsUpgrade/upgrade/verifyScripts/normalphase.sh @@ -0,0 +1,25 @@ +#!/bin/bash + +cleos="$1" + +sleep 1s +$cleos push action eosio upgraderam '[]' -p eosio +$cleos get table eosio eosio global +sleep 1s +$cleos push action eosio upgraderam '[]' -p eosio +$cleos get table eosio eosio global +sleep 1s +$cleos push action eosio upgraderam '[]' -p eosio +$cleos get table eosio eosio global +sleep 1s +$cleos push action eosio upgraderam '[]' -p eosio +$cleos get table eosio eosio global +sleep 1s +$cleos push action eosio upgraderam '[]' -p eosio +$cleos get table eosio eosio global +sleep 1s +$cleos push action eosio upgraderam '[]' -p eosio +$cleos get table eosio eosio global +sleep 1s +$cleos push action eosio upgraderam '[]' -p eosio +$cleos get table eosio eosio global \ No newline at end of file diff --git a/scripts/2020-12_TokenEconomicsUpgrade/upgrade/verifyScripts/stake.sh b/scripts/2020-12_TokenEconomicsUpgrade/upgrade/verifyScripts/stake.sh new file mode 100755 index 0000000..3c826a4 --- /dev/null +++ b/scripts/2020-12_TokenEconomicsUpgrade/upgrade/verifyScripts/stake.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +cleos="$1" + +$cleos push action system.ore createoreacc '[ "producer1", "test11111122", "EOS6H2tjbrS6zm8d3tX6yeHorEoihP23Ny9c9wFRHGfJp4vtD42rn", "EOS6H2tjbrS6zm8d3tX6yeHorEoihP23Ny9c9wFRHGfJp4vtD42rn", 1, "producer1"]' -p producer1 + +$cleos get table eosio.token ORE stakestats +$cleos get table eosio.token producer1 reserves +$cleos get table eosio.token test11111122 stakeinfo + +$cleos push action system.ore settier '[ 100, 1000000000, 16320875724 , "1.0000 ORE", "1.000 ORE"]' -p system.ore + +$cleos push action system.ore createoreacc '[ "eosio", "test11111123", "EOS6H2tjbrS6zm8d3tX6yeHorEoihP23Ny9c9wFRHGfJp4vtD42rn", "EOS6H2tjbrS6zm8d3tX6yeHorEoihP23Ny9c9wFRHGfJp4vtD42rn", 100, ""]' -p eosio + \ No newline at end of file diff --git a/scripts/2020-12_TokenEconomicsUpgrade/upgrade/verifyScripts/trigger.sh b/scripts/2020-12_TokenEconomicsUpgrade/upgrade/verifyScripts/trigger.sh new file mode 100755 index 0000000..621f384 --- /dev/null +++ b/scripts/2020-12_TokenEconomicsUpgrade/upgrade/verifyScripts/trigger.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +cleos="$1" + +$cleos push action eosio upgraderam '[]' -p eosio + +$cleos get table eosio eosio global + +$cleos push action system.ore createoreacc '[ "eosio", "test11111152", "EOS6H2tjbrS6zm8d3tX6yeHorEoihP23Ny9c9wFRHGfJp4vtD42rn", "EOS6H2tjbrS6zm8d3tX6yeHorEoihP23Ny9c9wFRHGfJp4vtD42rn", 1, ""]' -p eosio \ No newline at end of file diff --git a/scripts/run_tests.sh b/scripts/run_tests.sh deleted file mode 100755 index 81e505a..0000000 --- a/scripts/run_tests.sh +++ /dev/null @@ -1 +0,0 @@ -#run all tests in /tests diff --git a/tests/README.md b/tests/README.md deleted file mode 100755 index bbcd7a8..0000000 --- a/tests/README.md +++ /dev/null @@ -1,9 +0,0 @@ - -# Contracts Unit Tests - -To run the python test scripts -- setup eosfactory framework.(http://eosfactory.io/sphinx/build/html/tutorials/01.InstallingEOSFactory.html) -- Specify the contracts destination folder as "contractPath" in the test scripts -- Run the tests (For example python3 tests/instrumenttest.py) - -Currently eosfactory works with v1.0.8 release of eosio. diff --git a/tests/build_and_test.sh b/tests/build_and_test.sh deleted file mode 100755 index c9fe1d7..0000000 --- a/tests/build_and_test.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/bash - -cd ~/ore-protocol/contracts - -cd ore.instrument && mkdir build -eosio-cpp ore.instrument.cpp -o build/ore.instrument.wast -eosio-abigen ore.instrument.cpp --contract=ore.instrument --output=build/ore.instrument.abi - -cd ../ore.rights_registry && mkdir build -eosio-cpp ore.rights_registry.cpp -o build/ore.rights_registry.wast -eosio-abigen ore.rights_registry.cpp --contract=ore.rights_registry --output=build/ore.rights_registry.abi - -cd ../ore.usage_log && mkdir build -eosio-cpp ore.usage_log.cpp -o build/ore.usage_log.wast -eosio-abigen ore.usage_log.cpp --contract=ore.usage_log --output=build/ore.usage_log.abi - -cd ../ore.standard_token && mkdir build -eosio-cpp ore.standard_token.cpp -o build/ore.standard_token.wast -eosio-abigen ore.standard_token.cpp --contract=ore.standard_token --output=build/ore.standard_token.abi diff --git a/tests/instrument.py b/tests/instrument.py deleted file mode 100644 index f5aa4aa..0000000 --- a/tests/instrument.py +++ /dev/null @@ -1,593 +0,0 @@ -import unittest -from eosfactory.eosf import * -import time - -verbosity([Verbosity.INFO, Verbosity.OUT, Verbosity.TRACE, Verbosity.DEBUG]) - -class Test(unittest.TestCase): - - def run(self, result=None): - super().run(result) - - - @classmethod - def setUpClass(cls): - SCENARIO(''' - Create a contract from template, then build and deploy it. - ''') - reset() - create_wallet() - create_master_account("master") - - COMMENT(''' - Create test accounts: - ''') - create_account("app", master) - create_account("notminter", master) - - - def setUp(self): - pass - - - def test_01(self): - - create_account("right", master, account_name="rights.ore") - right_contract = Contract(right, "/root/ore-protocol/contracts/ore.rights_registry") - right_contract.build() - right_contract.deploy() - - create_account("instr", master, account_name="instr.ore") - instr_contract = Contract(instr, "/root/ore-protocol/contracts/ore.instrument") - instr_contract.build() - instr_contract.deploy() - - def test_02(self): - COMMENT(''' - Create and Issue OREINST: - ''') - - instr.push_action( - "create", - { - "issuer": instr, - "maximum_supply": "100000000.0000 OREINST" - }, - permission=(instr, Permission.ACTIVE)) - - instr.push_action( - "issue", - { - "to": instr, - "quantity": "10000000.0000 OREINST", - "memo": "" - }, - permission=(instr, Permission.ACTIVE)) - - def test_03(self): - COMMENT(''' - Register rights: - ''') - - right.push_action( - "upsertright", - { - "owner": app, - "right_name": "apimarket.manager.licenseApi", - "urls": [{ - "base_right": "", - "url": " ore://manager.apim/action/licenseapi", - "method": "post", - "matches_params": [{ - "name": "sla", - "value": "default" - }], - "token_life_span": 100, - "is_default": 1 - }], - "issuer_whitelist": [app] - }, - permission=(app, Permission.ACTIVE)) - - right.push_action( - "upsertright", - { - "owner": app, - "right_name": "apimarket.manager.licenseApi2", - "urls": [{ - "base_right": "", - "url": " ore://manager.apim/action/licenseapi", - "method": "post", - "matches_params": [{ - "name": "sla", - "value": "default" - }], - "token_life_span": 100, - "is_default": 1 - }], - "issuer_whitelist": [] - }, - permission=(app, Permission.ACTIVE)) - - right.push_action( - "upsertright", - { - "owner": app, - "right_name": "apimarket.manager.licenseApi3", - "urls": [{ - "base_right": "", - "url": " ore://manager.apim/action/licenseapi", - "method": "post", - "matches_params": [{ - "name": "sla", - "value": "default" - }], - "token_life_span": 100, - "is_default": 1 - }], - "issuer_whitelist": [] - }, - permission=(app, Permission.ACTIVE)) - - def test_04(self): - COMMENT(''' - Mint: - ''') - - instr.push_action( - "mint", - { - "minter": app, - "owner": app, - "instrument": { - "issuer": app, - "instrument_class": "sample_class", - "description": "sample_description", - "instrument_template": "sample_template", - "security_type": "", - "parameter_rules": [], - "rights": [{ - "right_name": "apimarket.manager.licenseApi", - "description": "licenser", - "price_in_cpu": "10", - "additional_url_params": [] - }, - { - "right_name": "apimarket.manager.licenseApi2", - "description": "licenser", - "price_in_cpu": "10", - "additional_url_params": [] - }], - "parent_instrument_id": 0, - "data": [], - "encrypted_by": "", - "mutability": 2 - }, - "start_time": 0, - "end_time": 0, - "instrumentId": 0 - }, - permission=(app, Permission.ACTIVE)) - - with self.assertRaises(Error): # Instrument id exists - instr.push_action( - "mint", - { - "minter": app, - "owner": app, - "instrument": { - "issuer": app, - "instrument_class": "sample_class", - "description": "sample_description", - "instrument_template": "", - "security_type": "", - "parameter_rules": [], - "rights": [{ - "right_name": "apimarket.manager.licenseApi", - "description": "licenser", - "price_in_cpu": "10", - "additional_url_params": [] - }], - "parent_instrument_id": 0, - "data": [], - "encrypted_by": "", - "mutability": 2 - }, - "start_time": 0, - "end_time": 0, - "instrumentId": 1 - }, - permission=(app, Permission.ACTIVE)) - - with self.assertRaises(Error): # Owner account doesnt exists - instr.push_action( - "mint", - { - "minter": app, - "owner": "notexists", - "instrument": { - "issuer": app, - "instrument_class": "sample_class", - "description": "sample_description", - "instrument_template": "", - "security_type": "", - "parameter_rules": [], - "rights": [{ - "right_name": "apimarket.manager.licenseApi", - "description": "licenser", - "price_in_cpu": "10", - "additional_url_params": [] - }], - "parent_instrument_id": 0, - "data": [], - "encrypted_by": "", - "mutability": 2 - }, - "start_time": 0, - "end_time": 0, - "instrumentId": 0 - }, - permission=(app, Permission.ACTIVE)) - - def test_05(self): - COMMENT(''' - Create Instrument: - ''') - - instr.push_action( - "createinst", - { - "minter": app, - "owner": app, - "instrumentId": 2, - "instrument": { - "issuer": app, - "instrument_class": "sample_class", - "description": "sample_description", - "instrument_template": "", - "security_type": "", - "parameter_rules": [], - "rights": [{ - "right_name": "apimarket.manager.licenseApi", - "description": "licenser", - "price_in_cpu": "10", - "additional_url_params": [] - }], - "parent_instrument_id": 0, - "data": [], - "encrypted_by": "", - "mutability": 2 - }, - "start_time": 0, - "end_time": 0 - }, - permission=(instr, Permission.ACTIVE)) - - instr.push_action( - "createinst", - { - "minter": app, - "owner": app, - "instrumentId": 5, - "instrument": { - "issuer": app, - "instrument_class": "sample_class", - "description": "sample_description", - "instrument_template": "", - "security_type": "", - "parameter_rules": [], - "rights": [{ - "right_name": "apimarket.manager.licenseApi", - "description": "licenser", - "price_in_cpu": "10", - "additional_url_params": [] - }], - "parent_instrument_id": 0, - "data": [], - "encrypted_by": "", - "mutability": 2 - }, - "start_time": 0, - "end_time": 0 - }, - permission=(instr, Permission.ACTIVE)) - - - def test_06(self): - COMMENT(''' - Update Instrument: - ''') - time.sleep(3) - instr.push_action( - "createinst", - { - "minter": app, - "owner": app, - "instrumentId": 2, - "instrument": { - "issuer": app, - "instrument_class": "sample_class", - "description": "sample_description", - "instrument_template": "", - "security_type": "", - "parameter_rules": [], - "rights": [{ - "right_name": "apimarket.manager.licenseApi", - "description": "licenser", - "price_in_cpu": "10", - "additional_url_params": [] - }], - "parent_instrument_id": 0, - "data": [], - "encrypted_by": "", - "mutability": 2 - }, - "start_time": 0, - "end_time": 0 - }, - permission=(instr, Permission.ACTIVE)) - - - def test_07(self): - COMMENT(''' - Check Rights: - ''') - - instr.push_action( - "mint", - { - "minter": app, - "owner": app, - "instrument": { - "issuer": app, - "instrument_class": "class", - "description": "sample_description", - "instrument_template": "", - "security_type": "", - "parameter_rules": [], - "rights": [{ - "right_name": "apimarket.manager.licenseApi3", - "description": "licenser", - "price_in_cpu": "10", - "additional_url_params": [] - }], - "parent_instrument_id": 0, - "data": [], - "encrypted_by": "", - "mutability": 2 - }, - "start_time": 0, - "end_time": 0, - "instrumentId": 3 - }, - permission=(app, Permission.ACTIVE)) - - instr.push_action( - "checkright", - { - "minter": app, - "issuer": app, - "rightname": "apimarket.manager.licenseApi", - "deferred_transaction_id": 10 - }, - permission=(instr, Permission.ACTIVE)) - - with self.assertRaises(Error): # Right doesn't exist - instr.push_action( - "checkright", - { - "minter": app, - "issuer": app, - "rightname": "nonexistent.right", - "deferred_transaction_id": 0 - }, - permission=(instr, Permission.ACTIVE)) - - with self.assertRaises(Error): # minter neither owns the right nor whitelisted for the right - instr.push_action( - "checkright", - { - "minter": "ownerfails", - "issuer": app, - "rightname": "apimarket.manager.licenseApi", - "deferred_transaction_id": 0 - }, - permission=(instr, Permission.ACTIVE)) - - with self.assertRaises(Error): # instrument issuer neither holds the right nor whitelisted for the right - instr.push_action( - "checkright", - { - "minter": "minter", - "issuer": "issuerfails", - "rightname": "apimarket.manager.licenseApi", - "deferred_transaction_id": 0 - }, - permission=(instr, Permission.ACTIVE)) - - def test_08(self): - COMMENT(''' - Revoke: - ''') - - instr.push_action( - "mint", - { - "minter": app, - "owner": app, - "instrument": { - "issuer": app, - "instrument_class": "class", - "description": "sample_description", - "instrument_template": "", - "security_type": "", - "parameter_rules": [], - "rights": [{ - "right_name": "apimarket.manager.licenseApi3", - "description": "licenser", - "price_in_cpu": "10", - "additional_url_params": [] - }], - "parent_instrument_id": 0, - "data": [], - "encrypted_by": "", - "mutability": 2 - }, - "start_time": 0, - "end_time": 0, - "instrumentId": 4 - }, - permission=(app, Permission.ACTIVE)) - - instr.push_action( - "revoke", - { - "revoker": app, - "token_id": 5 - }, - permission=(app, Permission.ACTIVE)) - - with self.assertRaises(Error): #token doesn't exist - instr.push_action( - "revoke", - { - "revoker": app, - "token_id": 70 - }, - permission=(app, Permission.ACTIVE)) - - with self.assertRaises(Error): # The revoker account doesn't have authority to revoke the instrument - instr.push_action( - "revoke", - { - "revoker": right, - "token_id": 4 - }, - permission=(right, Permission.ACTIVE)) - - with self.assertRaises(Error): # token is already revoked - instr.push_action( - "revoke", - { - "revoker": app, - "token_id": 5 - }, - permission=(app, Permission.ACTIVE)) - - def test_09(self): - COMMENT(''' - Update: - ''') - - instr.push_action( - "update", - { - "updater": app, - "instrument_template": "", - "instrument": { - "issuer": app, - "instrument_class": "sample_class", - "description": "sample_description", - "instrument_template": "", - "security_type": "", - "parameter_rules": [], - "rights": [{ - "right_name": "apimarket.manager.licenseApi", - "description": "licenser", - "price_in_cpu": "10", - "additional_url_params": [] - }], - "parent_instrument_id": 0, - "data": [], - "encrypted_by": "", - "mutability": 2 - }, - "instrument_id": 2, - "start_time": 0, - "end_time": 0 - }, - permission=(app, Permission.ACTIVE)) - - with self.assertRaises(Error): #Updater acccount doesn't have the authority to change start/edd time of the instrument - instr.push_action( - "update", - { - "updater": right, - "instrument_template": "", - "instrument": { - "issuer": app, - "instrument_class": "sample_class", - "description": "sample_description", - "instrument_template": "", - "security_type": "", - "parameter_rules": [], - "rights": [{ - "right_name": "apimarket.manager.licenseApi", - "description": "licenser", - "price_in_cpu": "10", - "additional_url_params": [] - }], - "parent_instrument_id": 0, - "data": [], - "encrypted_by": "", - "mutability": 2 - }, - "instrument_id": 1, - "start_time": 0, - "end_time": 0 - }, - permission=(right, Permission.ACTIVE)) - - def test_10(self): - COMMENT(''' - Transfer: - ''') - - instr.push_action( - "transfer", - { - "sender": app, - "to": right, - "token_id": 2 - }, - permission=(app, Permission.ACTIVE)) - - with self.assertRaises(Error): #Sender account is not allowed to transfer the instrument - instr.push_action( - "transfer", - { - "sender": app, - "to": right, - "token_id": 2 - }, - permission=(app, Permission.ACTIVE)) - - with self.assertRaises(Error): #Token doesn't exists - instr.push_action( - "transfer", - { - "sender": app, - "to": right, - "token_id": 99 - }, - permission=(app, Permission.ACTIVE)) - - - # def test_06(self): - # def test_07(self): - # def test_08(self): - - - - - def tearDown(self): - pass - - - @classmethod - def tearDownClass(cls): - stop() - - -if __name__ == "__main__": - unittest.main() \ No newline at end of file diff --git a/tests/rights_registry.py b/tests/rights_registry.py deleted file mode 100644 index 114f4a0..0000000 --- a/tests/rights_registry.py +++ /dev/null @@ -1,117 +0,0 @@ -import unittest -from eosfactory.eosf import * - -verbosity([Verbosity.INFO, Verbosity.OUT, Verbosity.TRACE, Verbosity.DEBUG]) - -class Test(unittest.TestCase): - - def run(self, result=None): - super().run(result) - - - @classmethod - def setUpClass(cls): - SCENARIO(''' - Create a contract from template, then build and deploy it. - ''') - reset() - create_wallet() - create_master_account("master") - - COMMENT(''' - Create test accounts: - ''') - create_account("app", master) - - - def setUp(self): - pass - - - def test_01(self): - COMMENT(''' - Create, build and deploy the contracts: - ''') - - create_account("right", master) - right_contract = Contract(right, "/root/ore-protocol/contracts/ore.rights_registry") - right_contract.build() - right_contract.deploy() - - def test_02(self): - COMMENT(''' - Register rights: - ''') - - right.push_action( - "upsertright", - { - "owner": app, - "right_name": "apimarket.manager.licenseApi", - "urls": [{ - "base_right": "", - "url": " ore://manager.apim/action/licenseapi", - "method": "post", - "matches_params": [{ - "name": "sla", - "value": "default" - }], - "token_life_span": 100, - "is_default": 1 - }], - "issuer_whitelist": ["app.apim"] - }, - permission=(app, Permission.ACTIVE)) - - with self.assertRaises(Error): #You are not the issuer of the existing contract. Update canceled. - right.push_action( - "upsertright", - { - "owner": app, - "right_name": "apimarket.manager.licenseApi", - "urls": [{ - "base_right": "", - "url": " ore://manager.apim/action/licenseapi", - "method": "post", - "matches_params": [{ - "name": "sla", - "value": "default" - }], - "token_life_span": 100, - "is_default": 1 - }], - "issuer_whitelist": ["app.apim"] - }, - permission=(app, Permission.ACTIVE)) - - right.push_action( - "upsertright", - { - "owner": app, - "right_name": "apimarket.manager.licenseApi2", - "urls": [{ - "base_right": "", - "url": " ore://manager.apim/action/licenseapi", - "method": "post", - "matches_params": [{ - "name": "sla", - "value": "default" - }], - "token_life_span": 100, - "is_default": 1 - }], - "issuer_whitelist": ["app.apim"] - }, - permission=(app, Permission.ACTIVE)) - - def tearDown(self): - pass - - - @classmethod - def tearDownClass(cls): - stop() - - -if __name__ == "__main__": - unittest.main() diff --git a/tests/setup.py b/tests/setup.py deleted file mode 100644 index e98a33f..0000000 --- a/tests/setup.py +++ /dev/null @@ -1,210 +0,0 @@ -import unittest -from eosfactory.eosf import * - -verbosity([Verbosity.INFO, Verbosity.OUT, Verbosity.TRACE, Verbosity.DEBUG]) - -STANDARD_TOKEN = "~/Workspace/testeos/contracts/ore.standard_token/" -RIGHTS_REGISTRY = "~/Workspace/ore-protocol/contracts/ore.rights_registry/" -INSTRUMENT = "~/Workspace/ore-protocol/contracts/ore.instrument/" -USAGE_LOG = "~/Workspace/ore-protocol/contracts/ore.usage_log/" -APIM_MANAGER = "~/Workspace/ore-protocol/contracts/apim.manager/" - -class Test(unittest.TestCase): - - def run(self, result=None): - super().run(result) - - - @classmethod - def setUpClass(cls): - SCENARIO(''' - Create a contract from template, then build and deploy it. - ''') - reset() - create_wallet() - create_master_account("master") - - COMMENT(''' - Create test accounts: - ''') - create_account("app", master) - - - def setUp(self): - pass - - - def test_01(self): - COMMENT(''' - Create, build and deploy the contracts: - ''') - create_account("token", master) - token_contract = Contract(token, "ore.standard_token") - token_contract.build() - token_contract.deploy() - - create_account("right", master) - right_contract = Contract(right, "ore.rights_registry") - right_contract.build() - right_contract.deploy() - - create_account("instr", master) - instr_contract = Contract(instr, "ore.instrument") - instr_contract.build() - instr_contract.deploy() - - create_account("apim", master) - apim_contract = Contract(apim, "apim.manager") - apim_contract.build() - apim_contract.deploy() - - create_account("usage", master) - usage_contract = Contract(usage, "ore.usage_log") - usage_contract.build() - usage_contract.deploy() - - # token_contract.delete() - # right_contract.delete() - # instr_contract.delete() - # apim_contract.delete() - # usage_contract.delete() - - def test_02(self): - COMMENT(''' - Create and issue tokens: - ''') - - token.push_action( - "create", - { - "issuer": token, - "maximum_supply": "100000000.0000 CPU" - }, - permission=(token, Permission.ACTIVE)) - - token.push_action( - "create", - { - "issuer": token, - "maximum_supply": "100000000.0000 ORE" - }, - permission=(token, Permission.ACTIVE)) - - instr.push_action( - "create", - { - "issuer": instr, - "maximum_supply": "100000000.0000 OREINST" - }, - permission=(instr, Permission.ACTIVE)) - - token.push_action( - "issue", - { - "to": app, - "quantity": "10000000.0000 CPU", - "memo": "" - }, - permission=(token, Permission.ACTIVE)) - - token.push_action( - "issue", - { - "to": app, - "quantity": "10000000.0000 ORE", - "memo": "" - }, - permission=(token, Permission.ACTIVE)) - - instr.push_action( - "issue", - { - "to": instr, - "quantity": "10000000.0000 OREINST", - "memo": "" - }, - permission=(instr, Permission.ACTIVE)) - - def test_03(self): - COMMENT(''' - Register rights: - ''') - - right.push_action( - "upsertright", - { - "owner": apim, - "right_name": "apimarket.manager.licenseApi", - "urls": [{ - "base_right": "", - "url": " ore://manager.apim/action/licenseapi", - "method": "post", - "matches_params": [{ - "name": "sla", - "value": "default" - }], - "token_life_span": 100, - "is_default": 1 - }], - "issuer_whitelist": ["app.apim"] - }, - permission=(apim, Permission.ACTIVE)) - - - - def test_04(self): - COMMENT(''' - Publish and license offers: - ''') - with self.assertRaises(Error): - apim.push_action( - "publishapi", - { - "creator":app, - "issuer":app, - "api_voucher_license_price_in_cpu":"0", - "api_voucher_lifetime_in_seconds": "10", - "api_voucher_start_date": "0", - "api_voucher_end_date": "0", - "api_voucher_mutability": "0", - "api_voucher_security_type":"pass", - "api_voucher_valid_forever": "0", - "right_params": [ - { - "right_name": "apimarket.manager.licenseApi", - "right_description":"description", - "right_price_in_cpu":"100", - "api_name":"apis", - "api_description":"desci", - "api_price_in_cpu":"10", - "api_payment_model":"pass", - "api_additional_url_params":"" - } - ], - "api_voucher_parameter_rules":[], - "offer_mutability": 2, - "offer_security_type": "sec", - "offer_template":"", - "offer_start_time": 0, - "offer_end_time":0, - "offer_override_id":0 - }, - permission=(app, Permission.ACTIVE)) - - - def test_05(self): - COMMENT(''' - Check tables: - ''') - - def tearDown(self): - pass - - - @classmethod - def tearDownClass(cls): - stop() - - -if __name__ == "__main__": - unittest.main() diff --git a/tests/standard_token.py b/tests/standard_token.py deleted file mode 100644 index 6ca6b6b..0000000 --- a/tests/standard_token.py +++ /dev/null @@ -1,380 +0,0 @@ -import unittest -from eosfactory.eosf import * - -verbosity([Verbosity.INFO, Verbosity.OUT, Verbosity.TRACE, Verbosity.DEBUG]) - -class Test(unittest.TestCase): - - def run(self, result=None): - super().run(result) - - - @classmethod - def setUpClass(cls): - SCENARIO(''' - Create a contract from template, then build and deploy it. - ''') - reset() - create_wallet() - create_master_account("master") - - COMMENT(''' - Create test accounts: - ''') - create_account("app", master) - create_account("nonapp", master) - - - def setUp(self): - pass - - - def test_01(self): - COMMENT(''' - Create, build and deploy the contracts: - ''') - create_account("token", master) - token_contract = Contract(token, "/root/ore-protocol/contracts/ore.standard_token") - token_contract.build() - token_contract.deploy() - - def test_02(self): - COMMENT(''' - Create tokens: - ''') - - #Valid transaction - token.push_action( - "create", - { - "issuer": token, - "maximum_supply": "100000000.0000 ORE" - }, - permission=(token, Permission.ACTIVE)) - - with self.assertRaises(Error): #Invalid symbol name - token.push_action( - "create", - { - "issuer": token, - "maximum_supply": "100000000.0000 OREEEEEE" - }, - permission=(token, Permission.ACTIVE)) - - with self.assertRaises(Error): #Invalid supply - token.push_action( - "create", - { - "issuer": token, - "maximum_supply": "100000.000000000000000000000000000000 ORA" - }, - permission=(token, Permission.ACTIVE)) - - with self.assertRaises(Error): #Max supply must be positive - token.push_action( - "create", - { - "issuer": token, - "maximum_supply": "-100000000.0000 ORA" - }, - permission=(token, Permission.ACTIVE)) - - with self.assertRaises(Error): #Token symbol already exists - token.push_action( - "create", - { - "issuer": token, - "maximum_supply": "100000000.0000 ORE" - }, - permission=(token, Permission.ACTIVE)) - - - def test_03(self): - COMMENT(''' - Issue tokens: - ''') - #Valid transaction - token.push_action( - "issue", - { - "to": app, - "quantity": "10000000.0000 ORE", - "memo": "" - }, - permission=(token, Permission.ACTIVE)) - - token.push_action( - "issue", - { - "to": token, - "quantity": "100.0000 ORE", - "memo": "" - }, - permission=(token, Permission.ACTIVE)) - - with self.assertRaises(Error): #Invalid symbol name - token.push_action( - "issue", - { - "to": app, - "quantity": "100.0000 OREEEEEE", - "memo": "" - }, - permission=(token, Permission.ACTIVE)) - - with self.assertRaises(Error): #Token symbol does not exists - token.push_action( - "issue", - { - "to": app, - "quantity": "100.0000 ORU", - "memo": "" - }, - permission=(token, Permission.ACTIVE)) - - with self.assertRaises(Error): #Memo has more than 256 bytes - token.push_action( - "issue", - { - "to": app, - "quantity": "100.0000 ORE", - "memo": "LONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONG" - }, - permission=(token, Permission.ACTIVE)) - - with self.assertRaises(Error): #Quantity must be positive - token.push_action( - "issue", - { - "to": app, - "quantity": "-100.0000 ORE", - "memo": "" - }, - permission=(token, Permission.ACTIVE)) - - with self.assertRaises(Error): #Symbol precision mismatch - token.push_action( - "issue", - { - "to": app, - "quantity": "100.000 ORE", - "memo": "" - }, - permission=(token, Permission.ACTIVE)) - - with self.assertRaises(Error): #Quantity exceeds available supply - token.push_action( - "issue", - { - "to": app, - "quantity": "100000000.0000 ORE", - "memo": "" - }, - permission=(token, Permission.ACTIVE)) - - def test_04(self): - COMMENT(''' - Approve tokens: - ''') - #Valid transaction - token.push_action( - "approve", - { - "from": app, - "to": nonapp, - "quantity": "10.0000 ORE", - "memo": "" - }, - permission=(app, Permission.ACTIVE)) - - with self.assertRaises(Error): #Amount being approved is more than the balance of approver account - token.push_action( - "approve", - { - "from": app, - "to": nonapp, - "quantity": "10000001.0000 ORE", - "memo": "" - }, - permission=(app, Permission.ACTIVE)) - - def test_05(self): - COMMENT(''' - Retire tokens: - ''') - #Valid transaction - token.push_action( - "retire", - { - "quantity": "100.0000 ORE", - "memo": "" - }, - permission=(token, Permission.ACTIVE)) - - with self.assertRaises(Error): #Invalid symbol name - token.push_action( - "retire", - { - "quantity": "100.0000 OREEEEEE", - "memo": "" - }, - permission=(token, Permission.ACTIVE)) - - with self.assertRaises(Error): #Token symbol does not exists - token.push_action( - "retire", - { - "quantity": "100.0000 ORU", - "memo": "" - }, - permission=(token, Permission.ACTIVE)) - - with self.assertRaises(Error): #Memo has more than 256 bytes - token.push_action( - "retire", - { - "quantity": "100.0000 ORE", - "memo": "LONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONG" - }, - permission=(token, Permission.ACTIVE)) - - with self.assertRaises(Error): #Quantity must be positive - token.push_action( - "retire", - { - "quantity": "-100.0000 ORE", - "memo": "" - }, - permission=(token, Permission.ACTIVE)) - - with self.assertRaises(Error): #Symbol precision mismatch - token.push_action( - "retire", - { - "quantity": "100.000 ORE", - "memo": "" - }, - permission=(token, Permission.ACTIVE)) - - - def test_06(self): - COMMENT(''' - Transfer tokens: - ''') - #Valid Transaction - token.push_action( - "transfer", - { - "from":app, - "to": nonapp, - "quantity": "10.0000 ORE", - "memo": "" - }, - permission=(app, Permission.ACTIVE)) - - with self.assertRaises(Error): #Cannot transfer to self - token.push_action( - "transfer", - { - "from":app, - "to": app, - "quantity": "100.0000 ORE", - "memo": "" - }, - permission=(app, Permission.ACTIVE)) - - with self.assertRaises(Error): #To account does not exist - token.push_action( - "transfer", - { - "from":app, - "to": "nonexist", - "quantity": "100.0000 ORE", - "memo": "" - }, - permission=(app, Permission.ACTIVE)) - - with self.assertRaises(Error): #Memo has more than 256 bytes - token.push_action( - "transfer", - { - "from":app, - "to": nonapp, - "quantity": "100.0000 ORE", - "memo": "LONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONG" - }, - permission=(app, Permission.ACTIVE)) - - with self.assertRaises(Error): #Invalid quantity - token.push_action( - "transfer", - { - "from":app, - "to": nonapp, - "quantity": "A ORE", - "memo": "" - }, - permission=(app, Permission.ACTIVE)) - - with self.assertRaises(Error): #Quantity must be positive - - token.push_action( - "transfer", - { - "from":app, - "to": nonapp, - "quantity": "-100.0000 ORE", - "memo": "" - }, - permission=(app, Permission.ACTIVE)) - - with self.assertRaises(Error): #Symbol precision mismatch - token.push_action( - "transfer", - { - "from":app, - "to": nonapp, - "quantity": "100.000 ORE", - "memo": "" - }, - permission=(app, Permission.ACTIVE)) - - - def test_07(self): - COMMENT(''' - Transfer From tokens: - ''') - token.push_action( - "transferfrom", - { - "sender": nonapp, - "from":app, - "to": token, - "quantity": "5.0000 ORE", - "memo": "" - }, - permission=(nonapp, Permission.ACTIVE)) - - with self.assertRaises(Error): #The amount being transferred is more than the approved account - token.push_action( - "transferfrom", - { - "sender": nonapp, - "from":app, - "to": token, - "quantity": "6.0000 ORE", - "memo": "" - }, - permission=(nonapp, Permission.ACTIVE)) - - def tearDown(self): - pass - - - @classmethod - def tearDownClass(cls): - stop() - - -if __name__ == "__main__": - unittest.main() diff --git a/tests/usage_log.py b/tests/usage_log.py deleted file mode 100644 index 35f0333..0000000 --- a/tests/usage_log.py +++ /dev/null @@ -1,116 +0,0 @@ -import unittest -from eosfactory.eosf import * - -verbosity([Verbosity.INFO, Verbosity.OUT, Verbosity.TRACE, Verbosity.DEBUG]) - -class Test(unittest.TestCase): - - def run(self, result=None): - super().run(result) - - - @classmethod - def setUpClass(cls): - SCENARIO(''' - Create a contract from template, then build and deploy it. - ''') - reset() - create_wallet() - create_master_account("master") - - COMMENT(''' - Create test accounts: - ''') - create_account("app", master) - - - def setUp(self): - pass - - - def test_01(self): - COMMENT(''' - Create, build and deploy the contracts: - ''') - - create_account("usage", master) - usage_contract = Contract(usage, "/root/ore-protocol/contracts/ore.usage_log") - usage_contract.build() - usage_contract.deploy() - - def test_02(self): - COMMENT(''' - Create Log: - ''') - - usage.push_action( - "createlog", - { - "instrument_id": 1, - "right_name": "right1", - "token_hash": "tokenhash1", - "timestamp": 100 - - }, - permission=(app, Permission.ACTIVE)) - - usage.push_action( - "createlog", - { - "instrument_id": 2, - "right_name": "right2", - "token_hash": "tokenhash2", - "timestamp": 100 - - }, - permission=(app, Permission.ACTIVE)) - - def test_03(self): - COMMENT(''' - Delete Log: - ''') - usage.push_action( - "deletelog", - { - "instrument_id": 2, - "token_hash": "tokenhash2" - - }, - permission=(app, Permission.ACTIVE)) - - with self.assertRaises(Error): #No log exist for the given pair or right and instrument - usage.push_action( - "deletelog", - { - "instrument_id": 2, - "token_hash": "tokenhash2" - - }, - permission=(app, Permission.ACTIVE)) - - def test_04(self): - COMMENT(''' - Update Count: - ''') - - usage.push_action( - "updatecount", - { - "instrument_id": 1, - "right_name": "right1", - "cpu": "1.0000 CPU" - - }, - permission=(app, Permission.ACTIVE)) - - def tearDown(self): - pass - - - @classmethod - def tearDownClass(cls): - stop() - - -if __name__ == "__main__": - unittest.main()