├── scripts ├── .gitignore ├── print_all_bps.js ├── .environment ├── helper.sh └── package-lock.json ├── contracts ├── .gitignore ├── token.proton │ ├── README.md │ ├── CMakeLists.txt │ ├── test_regtoken.sh │ ├── ricardian │ │ ├── token.proton.contracts.md.in │ │ └── token.proton.contracts.md │ ├── include │ │ └── token.proton │ │ │ └── token.proton.hpp │ └── src │ │ └── token.proton.cpp ├── cfund.proton │ ├── README.md │ ├── CMakeLists.txt │ ├── test.sh │ ├── ricardian │ │ ├── cfund.proton.contracts.md.in │ │ └── cfund.proton.contracts.md │ ├── include │ │ └── cfund.proton │ │ │ └── cfund.proton.hpp │ └── src │ │ └── cfund.proton.cpp ├── eosio.proton │ ├── README.md │ ├── CMakeLists.txt │ ├── ricardian │ │ ├── eosio.proton.contracts.md.in │ │ ├── eosio.proton.clauses.md │ │ └── eosio.proton.contracts.md │ └── test.sh ├── .DS_Store ├── icons │ ├── rex.png │ ├── account.png │ ├── admin.png │ ├── token.png │ ├── voting.png │ ├── multisig.png │ ├── resource.png │ ├── transfer.png │ ├── account.svg │ ├── admin.svg │ ├── multisig.svg │ ├── transfer.svg │ ├── token.svg │ ├── voting.svg │ ├── rex.svg │ └── resource.svg ├── memochecker │ ├── ricardian │ │ ├── memochecker.contracts.md │ │ └── memochecker.contracts.md.in │ ├── README.md │ ├── CMakeLists.txt │ ├── test.sh │ ├── include │ │ └── memochecker.hpp │ └── src │ │ └── memochecker.cpp ├── eosio.system │ ├── src │ │ ├── native.cpp │ │ ├── rex.results.cpp │ │ ├── name_bidding.cpp │ │ └── exchange_state.cpp │ ├── CMakeLists.txt │ ├── newRam_test.sh │ ├── include │ │ └── eosio.system │ │ │ ├── exchange_state.hpp │ │ │ └── rex.results.hpp │ └── ricardian │ │ └── eosio.system.clauses.md ├── eosio.assert │ ├── CMakeLists.txt │ ├── include │ │ └── eosio.assert │ │ │ └── eosio.assert.hpp │ └── src │ │ └── eosio.assert.cpp ├── eosio.wrap │ ├── ricardian │ │ ├── eosio.wrap.contracts.md.in │ │ └── eosio.wrap.contracts.md │ ├── src │ │ └── eosio.wrap.cpp │ ├── CMakeLists.txt │ └── include │ │ └── eosio.wrap │ │ └── eosio.wrap.hpp ├── eosio.bios │ ├── CMakeLists.txt │ ├── src │ │ └── eosio.bios.cpp │ └── ricardian │ │ ├── eosio.bios.contracts.md.in │ │ └── eosio.bios.contracts.md ├── eosio.msig │ ├── CMakeLists.txt │ └── ricardian │ │ ├── eosio.msig.contracts.md.in │ │ └── eosio.msig.contracts.md ├── eosio.msig.old │ ├── CMakeLists.txt │ └── ricardian │ │ └── eosio.msig.contracts.md.in ├── eosio.token │ ├── CMakeLists.txt │ ├── ricardian │ │ ├── eosio.token.contracts.md.in │ │ └── eosio.token.contracts.md │ ├── src │ │ └── eosio.token.cpp │ └── include │ │ └── eosio.token │ │ └── eosio.token.hpp └── CMakeLists.txt ├── .DS_Store ├── tests ├── test_contracts │ ├── exchange.wasm │ ├── reject_all.wasm │ └── old_versions │ │ ├── v1.2.1 │ │ ├── eosio.msig │ │ │ ├── eosio.msig.wasm │ │ │ ├── Readme.txt │ │ │ └── eosio.msig.abi │ │ └── eosio.system │ │ │ ├── eosio.system.wasm │ │ │ ├── README.txt │ │ │ └── Readme.txt │ │ └── v1.8.3 │ │ └── eosio.system │ │ ├── eosio.system.wasm │ │ └── README.txt ├── test_symbol.hpp ├── main.cpp ├── CMakeLists.txt └── contracts.hpp.in ├── docker ├── environment.dockerpart ├── buildContracts.sh ├── external-dependencies.dockerpart ├── verifyInstallation.sh └── unit-test.sh ├── .gitignore ├── pipeline.jsonc ├── docs ├── 03_guides │ ├── 02_how-to-buy-ram.md │ ├── 03_how-to-stake.md │ ├── 04_how-to-vote.md │ ├── 05_how-to-create-issue-and-transfer-a-token.md │ └── 06_how-to-sign-a-multisig-transaction-with-eosio.msig.md └── 02_build-and-deploy.md ├── docs.json ├── LICENSE ├── README.md ├── CMakeLists.txt └── IMPORTANT.md /scripts/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules -------------------------------------------------------------------------------- /contracts/.gitignore: -------------------------------------------------------------------------------- 1 | *.abi 2 | *.wasm -------------------------------------------------------------------------------- /contracts/token.proton/README.md: -------------------------------------------------------------------------------- 1 | # PROTON Tokens registration -------------------------------------------------------------------------------- /contracts/cfund.proton/README.md: -------------------------------------------------------------------------------- 1 | # PROTON Committee fund contract -------------------------------------------------------------------------------- /contracts/eosio.proton/README.md: -------------------------------------------------------------------------------- 1 | # PROTON Permissions & Avatar contract -------------------------------------------------------------------------------- /.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/batterseapower/proton.contracts/master/.DS_Store -------------------------------------------------------------------------------- /contracts/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/batterseapower/proton.contracts/master/contracts/.DS_Store -------------------------------------------------------------------------------- /contracts/icons/rex.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/batterseapower/proton.contracts/master/contracts/icons/rex.png -------------------------------------------------------------------------------- /contracts/icons/account.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/batterseapower/proton.contracts/master/contracts/icons/account.png -------------------------------------------------------------------------------- /contracts/icons/admin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/batterseapower/proton.contracts/master/contracts/icons/admin.png -------------------------------------------------------------------------------- /contracts/icons/token.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/batterseapower/proton.contracts/master/contracts/icons/token.png -------------------------------------------------------------------------------- /contracts/icons/voting.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/batterseapower/proton.contracts/master/contracts/icons/voting.png -------------------------------------------------------------------------------- /contracts/icons/multisig.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/batterseapower/proton.contracts/master/contracts/icons/multisig.png -------------------------------------------------------------------------------- /contracts/icons/resource.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/batterseapower/proton.contracts/master/contracts/icons/resource.png -------------------------------------------------------------------------------- /contracts/icons/transfer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/batterseapower/proton.contracts/master/contracts/icons/transfer.png -------------------------------------------------------------------------------- /tests/test_contracts/exchange.wasm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/batterseapower/proton.contracts/master/tests/test_contracts/exchange.wasm -------------------------------------------------------------------------------- /tests/test_contracts/reject_all.wasm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/batterseapower/proton.contracts/master/tests/test_contracts/reject_all.wasm -------------------------------------------------------------------------------- /tests/test_contracts/old_versions/v1.2.1/eosio.msig/eosio.msig.wasm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/batterseapower/proton.contracts/master/tests/test_contracts/old_versions/v1.2.1/eosio.msig/eosio.msig.wasm -------------------------------------------------------------------------------- /tests/test_contracts/old_versions/v1.2.1/eosio.system/eosio.system.wasm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/batterseapower/proton.contracts/master/tests/test_contracts/old_versions/v1.2.1/eosio.system/eosio.system.wasm -------------------------------------------------------------------------------- /tests/test_contracts/old_versions/v1.8.3/eosio.system/eosio.system.wasm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/batterseapower/proton.contracts/master/tests/test_contracts/old_versions/v1.8.3/eosio.system/eosio.system.wasm -------------------------------------------------------------------------------- /contracts/memochecker/ricardian/memochecker.contracts.md: -------------------------------------------------------------------------------- 1 |

addmemo

2 | addmemo 3 | 4 |

delmemo

5 | delmemo 6 | 7 |

delid

8 | delid 9 | -------------------------------------------------------------------------------- /contracts/memochecker/ricardian/memochecker.contracts.md.in: -------------------------------------------------------------------------------- 1 |

addmemo

2 | addmemo 3 | 4 |

delmemo

5 | delmemo 6 | 7 |

delid

8 | delid 9 | -------------------------------------------------------------------------------- /tests/test_contracts/old_versions/v1.8.3/eosio.system/README.txt: -------------------------------------------------------------------------------- 1 | Compiled with 2 | eosio.contracts: 7109f002fa9afff18edcafce5c32b224a21eef98 (v1.8.3) 3 | eosio.cdt: 263e41cbb3e58dca71117401f43be104f1e58ae4 (v1.6.3) 4 | -------------------------------------------------------------------------------- /contracts/memochecker/README.md: -------------------------------------------------------------------------------- 1 | # memo checker 2 | 3 | Contract which reject transfers with not whitelisted memos. 4 | Allowed memos are stored in contract table so can be added and removed. 5 | 6 | Usage: 7 | - stake.proton 8 | -------------------------------------------------------------------------------- /tests/test_contracts/old_versions/v1.2.1/eosio.msig/Readme.txt: -------------------------------------------------------------------------------- 1 | Compiled with 2 | eosio.contracts: ee6415b0d3f9cff3bafebf98b2e06b80545dfa36 3 | eosio.wasmsdk: 0d4befeee7abbef1db775b2e8833f7db8fca7ad2 (v1.1.1), CORE_SYMBOL_NAME = "SYS" 4 | -------------------------------------------------------------------------------- /tests/test_contracts/old_versions/v1.2.1/eosio.system/README.txt: -------------------------------------------------------------------------------- 1 | Compiled with 2 | eosio.contracts: bf28f8bbf9ee753966c95c586906e82d72f9dfac (v1.2.1) 3 | eosio.wasmsdk: 2c106a018f2e69d34325ef2376cf085426068e93, CORE_SYMBOL_NAME = "SYS" 4 | -------------------------------------------------------------------------------- /tests/test_contracts/old_versions/v1.2.1/eosio.system/Readme.txt: -------------------------------------------------------------------------------- 1 | Compiled with 2 | eosio.contracts: bf28f8bbf9ee753966c95c586906e82d72f9dfac (v1.2.1) 3 | eosio.wasmsdk: 2c106a018f2e69d34325ef2376cf085426068e93, CORE_SYMBOL_NAME = "SYS" 4 | -------------------------------------------------------------------------------- /docker/environment.dockerpart: -------------------------------------------------------------------------------- 1 | # set environment variables (EOSIO_ROOT and CMAKE_FRAMEWORK_PATH are autogenerated) 2 | RUN PATH=/usr/local/eosio/bin:$(echo "/usr/opt/eosio.cdt/$(ls /usr/opt/eosio.cdt)/bin"):$PATH 3 | ENV LD_LIBRARY_PATH=/usr/local/lib -------------------------------------------------------------------------------- /docker/buildContracts.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e # exit on failure of any "simple" command (excludes &&, ||, or | chains) 3 | cd /eosio.contracts 4 | ./build.sh -c /usr/opt/eosio.cdt -e /opt/eosio -t -y 5 | cd build 6 | tar -pczf /artifacts/contracts.tar.gz * 7 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | CMakeLists.txt.user 2 | CMakeCache.txt 3 | *CMakeFiles 4 | CMakeScripts 5 | Testing 6 | Makefile 7 | cmake_install.cmake 8 | install_manifest.txt 9 | compile_commands.json 10 | CTestTestfile.cmake 11 | _deps 12 | contracts_project-prefix 13 | .DS_Store -------------------------------------------------------------------------------- /docker/external-dependencies.dockerpart: -------------------------------------------------------------------------------- 1 | # install external dependencies 2 | RUN apt-get update && \ 3 | apt-get -y upgrade && \ 4 | DEBIAN_FRONTEND=noninteractive apt-get -y install openssl ca-certificates build-essential libbz2-dev zlib1g-dev libssl-dev libgmp3-dev libicu-dev cmake bc jq curl wget net-tools unzip gnupg git graphviz -------------------------------------------------------------------------------- /contracts/eosio.system/src/native.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include 4 | 5 | namespace eosiosystem { 6 | 7 | void native::onerror( ignore, ignore> ) { 8 | eosio::check( false, "the onerror action cannot be called directly" ); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /pipeline.jsonc: -------------------------------------------------------------------------------- 1 | { 2 | "eosio-dot-contracts": 3 | { 4 | "pipeline-branch": "master", 5 | "dependencies": // dependencies to pull for a build of contracts, by branch, tag, or commit hash 6 | { 7 | "eosio": "release/2.0.x", 8 | "eosio.cdt": "release/1.7.x" 9 | } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /contracts/eosio.system/src/rex.results.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | void rex_results::buyresult( const asset& rex_received ) { } 4 | 5 | void rex_results::sellresult( const asset& proceeds ) { } 6 | 7 | void rex_results::orderresult( const name& owner, const asset& proceeds ) { } 8 | 9 | void rex_results::rentresult( const asset& rented_tokens ) { } 10 | 11 | extern "C" void apply( uint64_t, uint64_t, uint64_t ) { } 12 | -------------------------------------------------------------------------------- /contracts/icons/account.svg: -------------------------------------------------------------------------------- 1 | Account -------------------------------------------------------------------------------- /contracts/eosio.assert/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_contract(eosio.assert eosio.assert 2 | ${CMAKE_CURRENT_SOURCE_DIR}/src/eosio.assert.cpp 3 | ) 4 | 5 | #target_compile_options(eosio.assert.wasm PUBLIC -fcolor-diagnostics) 6 | 7 | target_include_directories(eosio.assert 8 | PUBLIC 9 | ${CMAKE_CURRENT_SOURCE_DIR}/include) 10 | 11 | set_target_properties(eosio.assert 12 | PROPERTIES 13 | RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}") 14 | 15 | 16 | -------------------------------------------------------------------------------- /contracts/eosio.wrap/ricardian/eosio.wrap.contracts.md.in: -------------------------------------------------------------------------------- 1 |

exec

2 | 3 | --- 4 | spec_version: "0.2.0" 5 | title: Privileged Execute 6 | summary: '{{nowrap executer}} executes a transaction while bypassing authority checks' 7 | icon: @ICON_BASE_URL@/@ADMIN_ICON_URI@ 8 | --- 9 | 10 | {{executer}} executes the following transaction while bypassing authority checks: 11 | {{to_json trx}} 12 | 13 | {{$action.account}} must also authorize this action. 14 | -------------------------------------------------------------------------------- /contracts/eosio.wrap/src/eosio.wrap.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | namespace eosio { 4 | 5 | void wrap::exec( ignore, ignore ) { 6 | require_auth( get_self() ); 7 | 8 | name executer; 9 | _ds >> executer; 10 | 11 | require_auth( executer ); 12 | 13 | send_deferred( (uint128_t(executer.value) << 64) | (uint64_t)current_time_point().time_since_epoch().count(), executer, _ds.pos(), _ds.remaining() ); 14 | } 15 | 16 | } /// namespace eosio 17 | -------------------------------------------------------------------------------- /scripts/print_all_bps.js: -------------------------------------------------------------------------------- 1 | const { JsonRpc } = require('@proton/js') 2 | 3 | const rpc = new JsonRpc(['https://proton.eoscafeblock.com']) 4 | 5 | const main = async () => { 6 | const { rows: producers } = await rpc.get_table_rows({ 7 | code: 'eosio', 8 | scope: 'eosio', 9 | table: 'producers', 10 | limit: -1 11 | }) 12 | const producersWithAuth = producers.map(producer => ({ actor: producer.owner, permission: 'active' })) 13 | console.log(JSON.stringify(producersWithAuth, null, 4)) 14 | } 15 | 16 | main() -------------------------------------------------------------------------------- /tests/test_symbol.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #define CORE_SYM_NAME "TST" 4 | #define CORE_SYM_PRECISION 4 5 | 6 | #define _STRINGIZE1(x) #x 7 | #define _STRINGIZE2(x) _STRINGIZE1(x) 8 | 9 | #define CORE_SYM_STR ( _STRINGIZE2(CORE_SYM_PRECISION) "," CORE_SYM_NAME ) 10 | #define CORE_SYM ( ::eosio::chain::string_to_symbol_c( CORE_SYM_PRECISION, CORE_SYM_NAME ) ) 11 | 12 | struct core_sym { 13 | static inline eosio::chain::asset from_string(const std::string& s) { 14 | return eosio::chain::asset::from_string(s + " " CORE_SYM_NAME); 15 | } 16 | }; 17 | -------------------------------------------------------------------------------- /contracts/eosio.wrap/ricardian/eosio.wrap.contracts.md: -------------------------------------------------------------------------------- 1 |

exec

2 | 3 | --- 4 | spec_version: "0.2.0" 5 | title: Privileged Execute 6 | summary: '{{nowrap executer}} executes a transaction while bypassing authority checks' 7 | icon: https://raw.githubusercontent.com/EOSIO/eosio.contracts/master/contracts/icons/admin.png#9bf1cec664863bd6aaac0f814b235f8799fb02c850e9aa5da34e8a004bd6518e 8 | --- 9 | 10 | {{executer}} executes the following transaction while bypassing authority checks: 11 | {{to_json trx}} 12 | 13 | {{$action.account}} must also authorize this action. 14 | -------------------------------------------------------------------------------- /contracts/eosio.bios/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_contract(eosio.bios eosio.bios ${CMAKE_CURRENT_SOURCE_DIR}/src/eosio.bios.cpp) 2 | 3 | target_include_directories(eosio.bios 4 | PUBLIC 5 | ${CMAKE_CURRENT_SOURCE_DIR}/include) 6 | 7 | set_target_properties(eosio.bios 8 | PROPERTIES 9 | RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}") 10 | 11 | configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/ricardian/eosio.bios.contracts.md.in ${CMAKE_CURRENT_BINARY_DIR}/ricardian/eosio.bios.contracts.md @ONLY ) 12 | 13 | target_compile_options( eosio.bios PUBLIC -R${CMAKE_CURRENT_SOURCE_DIR}/ricardian -R${CMAKE_CURRENT_BINARY_DIR}/ricardian ) 14 | -------------------------------------------------------------------------------- /contracts/eosio.msig/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_contract(eosio.msig eosio.msig ${CMAKE_CURRENT_SOURCE_DIR}/src/eosio.msig.cpp) 2 | 3 | target_include_directories(eosio.msig 4 | PUBLIC 5 | ${CMAKE_CURRENT_SOURCE_DIR}/include) 6 | 7 | set_target_properties(eosio.msig 8 | PROPERTIES 9 | RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}") 10 | 11 | configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/ricardian/eosio.msig.contracts.md.in ${CMAKE_CURRENT_BINARY_DIR}/ricardian/eosio.msig.contracts.md @ONLY ) 12 | 13 | target_compile_options( eosio.msig PUBLIC -R${CMAKE_CURRENT_SOURCE_DIR}/ricardian -R${CMAKE_CURRENT_BINARY_DIR}/ricardian ) 14 | -------------------------------------------------------------------------------- /contracts/eosio.wrap/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_contract(eosio.wrap eosio.wrap ${CMAKE_CURRENT_SOURCE_DIR}/src/eosio.wrap.cpp) 2 | 3 | target_include_directories(eosio.wrap 4 | PUBLIC 5 | ${CMAKE_CURRENT_SOURCE_DIR}/include) 6 | 7 | set_target_properties(eosio.wrap 8 | PROPERTIES 9 | RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}") 10 | 11 | configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/ricardian/eosio.wrap.contracts.md.in ${CMAKE_CURRENT_BINARY_DIR}/ricardian/eosio.wrap.contracts.md @ONLY ) 12 | 13 | target_compile_options( eosio.wrap PUBLIC -R${CMAKE_CURRENT_SOURCE_DIR}/ricardian -R${CMAKE_CURRENT_BINARY_DIR}/ricardian ) 14 | -------------------------------------------------------------------------------- /contracts/eosio.msig.old/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_contract(eosio.msig eosio.msig ${CMAKE_CURRENT_SOURCE_DIR}/src/eosio.msig.cpp) 2 | 3 | target_include_directories(eosio.msig 4 | PUBLIC 5 | ${CMAKE_CURRENT_SOURCE_DIR}/include) 6 | 7 | set_target_properties(eosio.msig 8 | PROPERTIES 9 | RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}") 10 | 11 | configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/ricardian/eosio.msig.contracts.md.in ${CMAKE_CURRENT_BINARY_DIR}/ricardian/eosio.msig.contracts.md @ONLY ) 12 | 13 | target_compile_options( eosio.msig PUBLIC -R${CMAKE_CURRENT_SOURCE_DIR}/ricardian -R${CMAKE_CURRENT_BINARY_DIR}/ricardian ) 14 | -------------------------------------------------------------------------------- /contracts/eosio.token/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_contract(eosio.token eosio.token ${CMAKE_CURRENT_SOURCE_DIR}/src/eosio.token.cpp) 2 | 3 | target_include_directories(eosio.token 4 | PUBLIC 5 | ${CMAKE_CURRENT_SOURCE_DIR}/include) 6 | 7 | set_target_properties(eosio.token 8 | PROPERTIES 9 | RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}") 10 | 11 | configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/ricardian/eosio.token.contracts.md.in ${CMAKE_CURRENT_BINARY_DIR}/ricardian/eosio.token.contracts.md @ONLY ) 12 | 13 | target_compile_options( eosio.token PUBLIC -R${CMAKE_CURRENT_SOURCE_DIR}/ricardian -R${CMAKE_CURRENT_BINARY_DIR}/ricardian ) 14 | -------------------------------------------------------------------------------- /contracts/icons/admin.svg: -------------------------------------------------------------------------------- 1 | Admin -------------------------------------------------------------------------------- /docs/03_guides/02_how-to-buy-ram.md: -------------------------------------------------------------------------------- 1 | ## Goal 2 | 3 | Setup an account that require multiple signatures for signing a transaction 4 | 5 | ## Before you begin 6 | 7 | * You have an account 8 | 9 | * Ensure the reference system contracts from `eosio.contracts` repository is deployed and used to manage system resources 10 | 11 | * You have sufficient token allocated to your account 12 | 13 | * Install the currently supported version of cleos 14 | 15 | * Unlock your wallet 16 | 17 | ## Steps 18 | 19 | Buys RAM in value of 0.1 SYS tokens for account `alice`: 20 | 21 | ```shell 22 | cleos system buyram alice alice "0.1 SYS" -p alice@active 23 | ``` -------------------------------------------------------------------------------- /contracts/memochecker/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_contract(memochecker memochecker ${CMAKE_CURRENT_SOURCE_DIR}/src/memochecker.cpp) 2 | 3 | target_include_directories(memochecker 4 | PUBLIC 5 | ${CMAKE_CURRENT_SOURCE_DIR}/include) 6 | 7 | set_target_properties(memochecker 8 | PROPERTIES 9 | RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}") 10 | 11 | 12 | configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/ricardian/memochecker.contracts.md.in ${CMAKE_CURRENT_BINARY_DIR}/ricardian/memochecker.contracts.md @ONLY ) 13 | 14 | target_compile_options( memochecker PUBLIC -R${CMAKE_CURRENT_SOURCE_DIR}/ricardian -R${CMAKE_CURRENT_BINARY_DIR}/ricardian ) 15 | 16 | -------------------------------------------------------------------------------- /contracts/cfund.proton/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_contract(cfund.proton cfund.proton ${CMAKE_CURRENT_SOURCE_DIR}/src/cfund.proton.cpp) 2 | 3 | target_include_directories(cfund.proton 4 | PUBLIC 5 | ${CMAKE_CURRENT_SOURCE_DIR}/include) 6 | 7 | set_target_properties(cfund.proton 8 | PROPERTIES 9 | RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}") 10 | 11 | 12 | configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/ricardian/cfund.proton.contracts.md.in ${CMAKE_CURRENT_BINARY_DIR}/ricardian/cfund.proton.contracts.md @ONLY ) 13 | 14 | target_compile_options( cfund.proton PUBLIC -R${CMAKE_CURRENT_SOURCE_DIR}/ricardian -R${CMAKE_CURRENT_BINARY_DIR}/ricardian ) 15 | 16 | -------------------------------------------------------------------------------- /contracts/token.proton/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_contract(token.proton token.proton ${CMAKE_CURRENT_SOURCE_DIR}/src/token.proton.cpp) 2 | 3 | target_include_directories(token.proton 4 | PUBLIC 5 | ${CMAKE_CURRENT_SOURCE_DIR}/include) 6 | 7 | set_target_properties(token.proton 8 | PROPERTIES 9 | RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}") 10 | 11 | 12 | configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/ricardian/token.proton.contracts.md.in ${CMAKE_CURRENT_BINARY_DIR}/ricardian/token.proton.contracts.md @ONLY ) 13 | 14 | target_compile_options( token.proton PUBLIC -R${CMAKE_CURRENT_SOURCE_DIR}/ricardian -R${CMAKE_CURRENT_BINARY_DIR}/ricardian ) 15 | 16 | -------------------------------------------------------------------------------- /contracts/eosio.proton/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_contract(eosio.proton eosio.proton ${CMAKE_CURRENT_SOURCE_DIR}/src/eosio.proton.cpp) 2 | 3 | target_include_directories(eosio.proton 4 | PUBLIC 5 | ${CMAKE_CURRENT_SOURCE_DIR}/include 6 | ${CMAKE_CURRENT_SOURCE_DIR}/../eosio.system/include) 7 | 8 | set_target_properties(eosio.proton 9 | PROPERTIES 10 | RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}") 11 | 12 | configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/ricardian/eosio.proton.contracts.md.in ${CMAKE_CURRENT_BINARY_DIR}/ricardian/eosio.proton.contracts.md @ONLY ) 13 | 14 | target_compile_options( eosio.proton PUBLIC -R${CMAKE_CURRENT_SOURCE_DIR}/ricardian -R${CMAKE_CURRENT_BINARY_DIR}/ricardian ) 15 | -------------------------------------------------------------------------------- /docs/03_guides/03_how-to-stake.md: -------------------------------------------------------------------------------- 1 | ## Goal 2 | 3 | Stake resource for your account 4 | 5 | ## Before you begin 6 | 7 | * Install the currently supported version of cleos 8 | 9 | * Ensure the reference system contracts from `eosio.contracts` repository is deployed and used to manage system resources 10 | 11 | * Understand the following: 12 | * What is an account 13 | * What is network bandwidth 14 | * What is CPU bandwidth 15 | 16 | ## Steps 17 | 18 | Stake 0.01 SYS network bandwidth for `alice` 19 | 20 | ```shell 21 | cleos system delegatebw alice alice "0 SYS" "0.01 SYS" 22 | ``` 23 | 24 | Stake 0.01 SYS CPU bandwidth for `alice`: 25 | 26 | ```shell 27 | cleos system delegatebw alice alice "0.01 SYS" "0 SYS" 28 | ``` -------------------------------------------------------------------------------- /contracts/icons/multisig.svg: -------------------------------------------------------------------------------- 1 | Multi Sig -------------------------------------------------------------------------------- /contracts/icons/transfer.svg: -------------------------------------------------------------------------------- 1 | Transfer_1 -------------------------------------------------------------------------------- /docker/verifyInstallation.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e # exit on failure of any "simple" command (excludes &&, ||, or | chains) 3 | # expected places to find EOSIO CMAKE in the docker container, in ascending order of preference 4 | [[ -e /usr/lib/eosio/lib/cmake/eosio/eosio-config.cmake ]] && export CMAKE_FRAMEWORK_PATH="/usr/lib/eosio" 5 | [[ -e /opt/eosio/lib/cmake/eosio/eosio-config.cmake ]] && export CMAKE_FRAMEWORK_PATH="/opt/eosio" 6 | [[ ! -z "$EOSIO_ROOT" && -e $EOSIO_ROOT/lib/cmake/eosio/eosio-config.cmake ]] && export CMAKE_FRAMEWORK_PATH="$EOSIO_ROOT" 7 | # fail if we didn't find it 8 | [[ -z "$CMAKE_FRAMEWORK_PATH" ]] && exit 1 9 | # export variables 10 | echo "" >> /eosio.contracts/docker/environment.Dockerfile # necessary if there is no '\n' at end of file 11 | echo "ENV CMAKE_FRAMEWORK_PATH=$CMAKE_FRAMEWORK_PATH" >> /eosio.contracts/docker/environment.Dockerfile 12 | echo "ENV EOSIO_ROOT=$CMAKE_FRAMEWORK_PATH" >> /eosio.contracts/docker/environment.Dockerfile -------------------------------------------------------------------------------- /contracts/icons/token.svg: -------------------------------------------------------------------------------- 1 | Token_1 -------------------------------------------------------------------------------- /contracts/icons/voting.svg: -------------------------------------------------------------------------------- 1 | Voting_1 -------------------------------------------------------------------------------- /contracts/cfund.proton/test.sh: -------------------------------------------------------------------------------- 1 | 2 | ### Deploy 3 | #./cleos.sh set account permission cfund.proton active --add-code -p cfund.proton@active 4 | #./cleos.sh set contract cfund.proton ./cfund.proton -p cfund.proton 5 | 6 | ### Admins actions 7 | #./cleos.sh push action cfund.proton reg '{"account":"cryptolions"}' -p cfund.proton@active 8 | #./cleos.sh push action cfund.proton unreg '{"account":"cryptolions"}' -p cfund.proton@active 9 | #./cleos.sh push action cfund.proton activate '{"account":"cryptolions", "status": 0}' -p cfund.proton@active 10 | #./cleos.sh push action cfund.proton activate '{"account":"cryptolions", "status": 1}' -p cfund.proton@active 11 | #./cleos.sh push action cfund.proton process '{}' -p cfund.proton@active 12 | 13 | ### Users Actions 14 | #./cleos.sh push action cfund.proton claimreward '{"account":"cryptolions"}' -p cryptolions@active 15 | 16 | 17 | ### Tables 18 | #./cleos.sh get table cfund.proton cfund.proton users 19 | #./cleos.sh get table cfund.proton cfund.proton global -------------------------------------------------------------------------------- /docs/03_guides/04_how-to-vote.md: -------------------------------------------------------------------------------- 1 | ## Goal 2 | 3 | Vote for a block producer 4 | 5 | ## Before you begin 6 | 7 | * Install the current supported version of cleos 8 | 9 | * Ensure the reference system contracts from `eosio.contracts` repository is deployed and used to manage system resources 10 | 11 | * Understand the following: 12 | * What is a block producer 13 | * How does voting works 14 | 15 | * Unlock your wallet 16 | 17 | ## Steps 18 | 19 | Assume you are going to vote for blockproducer1 and blockproducer2 from an account called `eosiotestts2`, execute the following: 20 | 21 | ```bash 22 | cleos system voteproducer prods eosiotestts2 blockproducer1 blockproducer2 23 | ``` 24 | 25 | You should see something like below: 26 | 27 | ```bash 28 | executed transaction: 2d8b58f7387aef52a1746d7a22d304bbbe0304481d7751fc4a50b619df62676d 128 bytes 374 us 29 | # eosio <= eosio::voteproducer {"voter":"eosiotestts2","proxy":"","producers":["blockproducer1","blockproducer2"]} 30 | ``` -------------------------------------------------------------------------------- /contracts/token.proton/test_regtoken.sh: -------------------------------------------------------------------------------- 1 | 2 | 3 | #./cleos.sh push action token.proton reg '{"tcontract":"eosio.token","tname":"Proton", "url":"https://protonchain.com", "desc":"Proton (XPR) is a new public blockchain and smart contract platform designed for both consumer applications and peer-peer payments." "iconurl":"", "symbol":"4,XPR"}' -p eosio.token 4 | 5 | #./cleos.sh get table token.proton token.proton tokens 6 | #./cleos.sh get table --index 2 --key-type name token.proton token.proton tokens -L eosio.token 7 | 8 | #./cleos.sh push action token.proton update '{"id": 1000001, "tcontract":"eosio.token","tname":"Proton", "url":"https://protonchain.com", "desc":"Proton (XPR) is a new public blockchain and smart contract platform designed for both consumer applications and peer-peer payments." "iconurl":"", "symbol":"4,XPR"}' -p eosio.token 9 | 10 | #./cleos.sh push action token.proton remove '{"id": 1000001}' -p eosio.token 11 | 12 | #./cleos.sh push action token.proton updblacklist '{"id": 1000003, "blisted":1}' -p token.proton -------------------------------------------------------------------------------- /docker/unit-test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e # exit on failure of any "simple" command (excludes &&, ||, or | chains) 3 | CPU_CORES=$(getconf _NPROCESSORS_ONLN) 4 | echo "$CPU_CORES cpu cores detected." 5 | cd /eosio.contracts/build/tests 6 | TEST_COUNT=$(ctest -N | grep -i 'Total Tests: ' | cut -d ':' -f 2 | awk '{print $1}') 7 | [[ $TEST_COUNT > 0 ]] && echo "$TEST_COUNT tests found." || (echo "ERROR: No tests registered with ctest! Exiting..." && exit 1) 8 | echo "$ ctest -j $CPU_CORES --output-on-failure -T Test" 9 | set +e # defer ctest error handling to end 10 | ctest -j $CPU_CORES --output-on-failure -T Test 11 | EXIT_STATUS=$? 12 | [[ "$EXIT_STATUS" == 0 ]] && set -e 13 | mv /eosio.contracts/build/tests/Testing/$(ls /eosio.contracts/build/tests/Testing/ | grep '20' | tail -n 1)/Test.xml /artifacts/Test.xml 14 | # ctest error handling 15 | if [[ "$EXIT_STATUS" != 0 ]]; then 16 | echo "Failing due to non-zero exit status from ctest: $EXIT_STATUS" 17 | echo ' ^^^ scroll up for more information ^^^' 18 | exit $EXIT_STATUS 19 | fi -------------------------------------------------------------------------------- /docs.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "eosio.contracts", 3 | "generators": [ 4 | { 5 | "name": "collate_markdown", 6 | "options": { 7 | "docs_dir": "docs" 8 | } 9 | }, 10 | { 11 | "name": "mdjavadoc", 12 | "options": { 13 | "source_dirs": [ 14 | "contracts/eosio.token/include/eosio.token/", 15 | "contracts/eosio.wrap/include/eosio.wrap/", 16 | "contracts/eosio.bios/include/eosio.bios/", 17 | "contracts/eosio.system/include/eosio.system/", 18 | "contracts/eosio.msig/include/eosio.msig/" 19 | ], 20 | "output_dir": "action-reference" 21 | } 22 | } 23 | ], 24 | "skip_default_filters": true, 25 | "filters": [ 26 | { 27 | "name": "sanitize", 28 | "options": { 29 | "exclude": ["action-reference"] 30 | } 31 | }, 32 | { 33 | "name": "capitalize", 34 | "options": { 35 | "mode": "all", 36 | "exclude": ["action-reference"] 37 | } 38 | } 39 | ] 40 | } 41 | -------------------------------------------------------------------------------- /contracts/token.proton/ricardian/token.proton.contracts.md.in: -------------------------------------------------------------------------------- 1 |

reg

2 | 3 | --- 4 | spec_version: "0.2.0" 5 | title: Register Token information 6 | summary: 'Register Token information' 7 | icon: @ICON_BASE_URL@/@TOKEN_ICON_URI@ 8 | --- 9 | Register Token information for {{symbol}} token on contract {{tcontract}} 10 | 11 | 12 | 13 |

update

14 | 15 | --- 16 | spec_version: "0.2.0" 17 | title: 'Update Token information' 18 | summary: 'Create a new token' 19 | icon: @ICON_BASE_URL@/@TOKEN_ICON_URI@ 20 | --- 21 | Update Token information for {{symbol}} token on contract {{tcontract}} 22 | 23 | 24 | 25 |

remove

26 | 27 | --- 28 | spec_version: "0.2.0" 29 | title: Remove Token information 30 | summary: 'Remove Token information' 31 | icon: @ICON_BASE_URL@/@TOKEN_ICON_URI@ 32 | --- 33 | Remove token information by token id 34 | 35 | 36 |

updblacklist

37 | 38 | --- 39 | spec_version: "0.2.0" 40 | title: Update Token blacklisted status 41 | summary: 'Update Token blacklisted status' 42 | icon: @ICON_BASE_URL@/@TOKEN_ICON_URI@ 43 | --- 44 | Update add or edit entries to token blacklist 45 | -------------------------------------------------------------------------------- /contracts/icons/rex.svg: -------------------------------------------------------------------------------- 1 | Rex -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2017-2019 block.one and its contributors. All rights reserved. 2 | 3 | The MIT License 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /contracts/memochecker/test.sh: -------------------------------------------------------------------------------- 1 | ## Contract which reject transfers with not whitelisted memos. 2 | ## Allowed memos are stored in contract table so can be added and removed. 3 | 4 | ## Usage 5 | ## - stake.proton 6 | 7 | ## 8 | 9 | 10 | ##----------------------------------------------- 11 | 12 | ### Deploy 13 | #./cleos.sh set contract stake.proton ./build/memochecker -p stake.proton 14 | 15 | ### Add memo 16 | #./cleos.sh push action stake.proton addmemo '{"memo":"Stake"}' -p stake.proton 17 | #./cleos.sh push action stake.proton addmemo '{"memo":"Unstake"}' -p stake.proton 18 | #./cleos.sh push action stake.proton addmemo '{"memo":"stake bandwidth"}' -p stake.proton 19 | #./cleos.sh push action stake.proton addmemo '{"memo":"unstake XPR"}' -p stake.proton 20 | 21 | 22 | ### Del memo 23 | #./cleos.sh push action stake.proton delmemo '{"memo":"Stake"}' -p stake.proton 24 | #./cleos.sh push action stake.proton delmemo '{"memo":"Unstake"}' -p stake.proton 25 | #./cleos.sh push action stake.proton delmemo '{"memo":"stake bandwidth"}' -p stake.proton 26 | #./cleos.sh push action stake.proton delmemo '{"memo":"unstake XPR"}' -p stake.proton 27 | 28 | 29 | ### Del by ID 30 | #./cleos.sh push action stake.proton delid '{"id":1}' -p stake.proton 31 | 32 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /contracts/eosio.system/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_contract(eosio.system eosio.system 2 | ${CMAKE_CURRENT_SOURCE_DIR}/src/eosio.system.cpp 3 | ${CMAKE_CURRENT_SOURCE_DIR}/src/delegate_bandwidth.cpp 4 | ${CMAKE_CURRENT_SOURCE_DIR}/src/exchange_state.cpp 5 | ${CMAKE_CURRENT_SOURCE_DIR}/src/native.cpp 6 | ${CMAKE_CURRENT_SOURCE_DIR}/src/producer_pay.cpp 7 | ${CMAKE_CURRENT_SOURCE_DIR}/src/rex.cpp 8 | ${CMAKE_CURRENT_SOURCE_DIR}/src/voting.cpp 9 | ) 10 | 11 | target_include_directories(eosio.system 12 | PUBLIC 13 | ${CMAKE_CURRENT_SOURCE_DIR}/include 14 | ${CMAKE_CURRENT_SOURCE_DIR}/../eosio.token/include 15 | ${CMAKE_CURRENT_SOURCE_DIR}/../eosio.proton/include) 16 | 17 | set_target_properties(eosio.system 18 | PROPERTIES 19 | RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}") 20 | 21 | add_contract(rex.results rex.results ${CMAKE_CURRENT_SOURCE_DIR}/src/rex.results.cpp) 22 | 23 | target_include_directories(rex.results 24 | PUBLIC 25 | ${CMAKE_CURRENT_SOURCE_DIR}/include) 26 | 27 | set_target_properties(rex.results 28 | PROPERTIES 29 | RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/.rex") 30 | 31 | configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/ricardian/eosio.system.contracts.md.in ${CMAKE_CURRENT_BINARY_DIR}/ricardian/eosio.system.contracts.md @ONLY ) 32 | 33 | target_compile_options( eosio.system PUBLIC -R${CMAKE_CURRENT_SOURCE_DIR}/ricardian -R${CMAKE_CURRENT_BINARY_DIR}/ricardian ) 34 | -------------------------------------------------------------------------------- /contracts/icons/resource.svg: -------------------------------------------------------------------------------- 1 | Resource -------------------------------------------------------------------------------- /contracts/cfund.proton/ricardian/cfund.proton.contracts.md.in: -------------------------------------------------------------------------------- 1 |

reg

2 | 3 | --- 4 | spec_version: "0.2.0" 5 | title: Register Committee member 6 | summary: 'Register {{nowrap account}} as Committee member' 7 | icon: @ICON_BASE_URL@/@ADMIN_ICON_URI@ 8 | --- 9 | Register {{account}} as Committee member 10 | 11 |

unreg

12 | 13 | --- 14 | spec_version: "0.2.0" 15 | title: Unregister Committee member 16 | summary: 'Unregister {{nowrap account}} Committee member' 17 | icon: @ICON_BASE_URL@/@ADMIN_ICON_URI@ 18 | --- 19 | Unregister {{account}} Committee member 20 | 21 |

activate

22 | 23 | --- 24 | spec_version: "0.2.0" 25 | title: Activate Committee member 26 | summary: 'Activate {{nowrap account}} Committee member' 27 | icon: @ICON_BASE_URL@/@ADMIN_ICON_URI@ 28 | --- 29 | Activate {{account}} Committee member 30 | 31 | 32 |

claimreward

33 | --- 34 | spec_version: "0.2.0" 35 | title: Claim Committee Rewards 36 | summary: '{{nowrap account}} claims Committee rewards' 37 | icon: @ICON_BASE_URL@/@TOKEN_ICON_URI@ 38 | --- 39 | {{account}} claims Committee reward from the system. 40 | 41 | 42 |

process

43 | 44 | --- 45 | spec_version: "0.2.0" 46 | title: sharing rewards (internal) 47 | summary: 'sharing rewards (internal)' 48 | icon: @ICON_BASE_URL@/@TRANSFER_ICON_URI@ 49 | --- 50 | sharing/allocating rewards to active Committee members (internal) 51 | -------------------------------------------------------------------------------- /contracts/eosio.system/newRam_test.sh: -------------------------------------------------------------------------------- 1 | #### Base ram buy/sell actions which allow buy RAM for SYS was renamed: 2 | # 3 | # buyram -> buyramsys 4 | # buyrambytes -> buyrambsys 5 | # sellram -> sellramsys 6 | 7 | 8 | ##### Buying 100 bytes using XPR amount 9 | # 10 | # ./cleos.sh system buyram tester1 tester1 "2.2222 XPR" 11 | # ./cleos.sh system sellram tester1 100 12 | 13 | 14 | ##### Buy 1 KB= 1024 bytes RAM 15 | # 16 | # ./cleos.sh system buyram tester1 tester1 -k 1 17 | # ./cleos.sh system sellram tester1 1024 18 | 19 | 20 | ##### Increase users RAM limit 21 | # 22 | # ./cleos.sh push action eosio ramlimitset '["tester4", 1048576]' -p admin.proton@light 23 | 24 | 25 | 26 | #### Increase RAM limit for user 27 | # 28 | # ./cleos.sh push action eosio ramlimitset '["tester4", 1048576]' -p admin.proton@light 29 | 30 | #### Set RAM Options 31 | # 32 | #./cleos.sh push action eosio setramoption '{"ram_price_per_byte": "0.0200 XPR", "max_per_user_bytes": 3145728, "ram_fee_percent": 1000}' -p admin.proton@light 33 | 34 | 35 | #### allow admin.proton@llight to call ram confi actions (add permissions, require msig) 36 | # 37 | # ./cleos.sh set action permission admin.proton eosio ramlimitset light 38 | # ./cleos.sh set action permission admin.proton eosio setramoption light 39 | 40 | 41 | 42 | 43 | ##### TABLES #################### 44 | 45 | # ./cleos.sh get table eosio eosio globalram 46 | 47 | # ACC=tester1 48 | # ./cleos.sh get table eosio $ACC usersram 49 | 50 | # ./cleos.sh get table eosio eosio rammarket | grep balance 51 | -------------------------------------------------------------------------------- /contracts/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required( VERSION 3.5 ) 2 | 3 | project(contracts) 4 | 5 | set(EOSIO_WASM_OLD_BEHAVIOR "Off") 6 | find_package(eosio.cdt) 7 | 8 | #set(ICON_BASE_URL "http://127.0.0.1/ricardian_assets/eosio.contracts/icons") 9 | set(ICON_BASE_URL "https://raw.githubusercontent.com/EOSIO/eosio.contracts/master/contracts/icons") 10 | 11 | set(ACCOUNT_ICON_URI "account.png#3d55a2fc3a5c20b456f5657faf666bc25ffd06f4836c5e8256f741149b0b294f") 12 | set(ADMIN_ICON_URI "admin.png#9bf1cec664863bd6aaac0f814b235f8799fb02c850e9aa5da34e8a004bd6518e") 13 | set(MULTISIG_ICON_URI "multisig.png#4fb41d3cf02d0dd2d35a29308e93c2d826ec770d6bb520db668f530764be7153") 14 | set(RESOURCE_ICON_URI "resource.png#3830f1ce8cb07f7757dbcf383b1ec1b11914ac34a1f9d8b065f07600fa9dac19") 15 | set(REX_ICON_URI "rex.png#d229837fa62a464b9c71e06060aa86179adf0b3f4e3b8c4f9702f4f4b0c340a8") 16 | set(TOKEN_ICON_URI "token.png#207ff68b0406eaa56618b08bda81d6a0954543f36adc328ab3065f31a5c5d654") 17 | set(TRANSFER_ICON_URI "transfer.png#5dfad0df72772ee1ccc155e670c1d124f5c5122f1d5027565df38b418042d1dd") 18 | set(VOTING_ICON_URI "voting.png#db28cd3db6e62d4509af3644ce7d377329482a14bb4bfaca2aa5f1400d8e8a84") 19 | 20 | add_subdirectory(eosio.bios) 21 | add_subdirectory(eosio.msig) 22 | add_subdirectory(eosio.system) 23 | add_subdirectory(eosio.token) 24 | add_subdirectory(eosio.wrap) 25 | add_subdirectory(eosio.assert) 26 | add_subdirectory(eosio.proton) 27 | add_subdirectory(token.proton) 28 | add_subdirectory(cfund.proton) 29 | add_subdirectory(memochecker) 30 | -------------------------------------------------------------------------------- /scripts/.environment: -------------------------------------------------------------------------------- 1 | export SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" 2 | export REPO_ROOT="${SCRIPT_DIR}/.." 3 | export TEST_DIR="${REPO_ROOT}/tests" 4 | 5 | export EOSIO_MIN_VERSION_MAJOR=$(cat $TEST_DIR/CMakeLists.txt | grep -E "^[[:blank:]]*set[[:blank:]]*\([[:blank:]]*EOSIO_VERSION_MIN" | tail -1 | sed 's/.*EOSIO_VERSION_MIN //g' | sed 's/ //g' | sed 's/"//g' | cut -d\) -f1 | cut -f1 -d '.') 6 | export EOSIO_MIN_VERSION_MINOR=$(cat $TEST_DIR/CMakeLists.txt | grep -E "^[[:blank:]]*set[[:blank:]]*\([[:blank:]]*EOSIO_VERSION_MIN" | tail -1 | sed 's/.*EOSIO_VERSION_MIN //g' | sed 's/ //g' | sed 's/"//g' | cut -d\) -f1 | cut -f2 -d '.') 7 | export EOSIO_SOFT_MAX_MAJOR=$(cat $TEST_DIR/CMakeLists.txt | grep -E "^[[:blank:]]*set[[:blank:]]*\([[:blank:]]*EOSIO_VERSION_SOFT_MAX" | tail -1 | sed 's/.*EOSIO_VERSION_SOFT_MAX //g' | sed 's/ //g' | sed 's/"//g' | cut -d\) -f1 | cut -f1 -d '.') 8 | export EOSIO_SOFT_MAX_MINOR=$(cat $TEST_DIR/CMakeLists.txt | grep -E "^[[:blank:]]*set[[:blank:]]*\([[:blank:]]*EOSIO_VERSION_SOFT_MAX" | tail -1 | sed 's/.*EOSIO_VERSION_SOFT_MAX //g' | sed 's/ //g' | sed 's/"//g' | cut -d\) -f1 | cut -f2 -d '.') 9 | export EOSIO_MAX_VERSION=$(cat $TEST_DIR/CMakeLists.txt | grep -E "^[[:blank:]]*set[[:blank:]]*\([[:blank:]]*EOSIO_VERSION_HARD_MAX" | tail -1 | sed 's/.*EOSIO_VERSION_HARD_MAX //g' | sed 's/ //g' | sed 's/"//g' | cut -d\) -f1) 10 | export EOSIO_MAX_VERSION="${EOSIO_MAX_VERSION:-$(echo $EOSIO_SOFT_MAX_MAJOR.999)}" 11 | export EOSIO_MAX_VERSION_MAJOR=$(echo $EOSIO_MAX_VERSION | cut -f1 -d '.') 12 | export EOSIO_MAX_VERSION_MINOR=$(echo $EOSIO_MAX_VERSION | cut -f2 -d '.') -------------------------------------------------------------------------------- /contracts/token.proton/ricardian/token.proton.contracts.md: -------------------------------------------------------------------------------- 1 |

reg

2 | 3 | --- 4 | spec_version: "0.2.0" 5 | title: Register Token information 6 | summary: 'Register Token information' 7 | icon: https://raw.githubusercontent.com/EOSIO/eosio.contracts/master/contracts/icons/token.png#207ff68b0406eaa56618b08bda81d6a0954543f36adc328ab3065f31a5c5d654 8 | --- 9 | Register Token information for {{symbol}} token on contract {{tcontract}} 10 | 11 | 12 | 13 |

update

14 | 15 | --- 16 | spec_version: "0.2.0" 17 | title: 'Update Token information' 18 | summary: 'Create a new token' 19 | icon: https://raw.githubusercontent.com/EOSIO/eosio.contracts/master/contracts/icons/token.png#207ff68b0406eaa56618b08bda81d6a0954543f36adc328ab3065f31a5c5d654 20 | --- 21 | Update Token information for {{symbol}} token on contract {{tcontract}} 22 | 23 | 24 | 25 |

remove

26 | 27 | --- 28 | spec_version: "0.2.0" 29 | title: Remove Token information 30 | summary: 'Remove Token information' 31 | icon: https://raw.githubusercontent.com/EOSIO/eosio.contracts/master/contracts/icons/token.png#207ff68b0406eaa56618b08bda81d6a0954543f36adc328ab3065f31a5c5d654 32 | --- 33 | Remove token information by token id 34 | 35 | 36 |

updblacklist

37 | 38 | --- 39 | spec_version: "0.2.0" 40 | title: Update Token blacklisted status 41 | summary: 'Update Token blacklisted status' 42 | icon: https://raw.githubusercontent.com/EOSIO/eosio.contracts/master/contracts/icons/token.png#207ff68b0406eaa56618b08bda81d6a0954543f36adc328ab3065f31a5c5d654 43 | --- 44 | Update add or edit entries to token blacklist 45 | -------------------------------------------------------------------------------- /tests/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | 13 | #include "eosio.system_tester.hpp" 14 | 15 | using namespace eosio_system; 16 | #define BOOST_TEST_STATIC_LINK 17 | 18 | void translate_fc_exception(const fc::exception &e) { 19 | std::cerr << "\033[33m" << e.to_detail_string() << "\033[0m" << std::endl; 20 | BOOST_TEST_FAIL("Caught Unexpected Exception"); 21 | } 22 | 23 | boost::unit_test::test_suite* init_unit_test_suite(int argc, char* argv[]) { 24 | // Turn off blockchain logging if no --verbose parameter is not added 25 | // To have verbose enabled, call "tests/chain_test -- --verbose" 26 | bool is_verbose = false; 27 | std::string verbose_arg = "--verbose"; 28 | for (int i = 0; i < argc; i++) { 29 | if (verbose_arg == argv[i]) { 30 | is_verbose = true; 31 | break; 32 | } 33 | } 34 | 35 | if(is_verbose) { 36 | fc::logger::get(DEFAULT_LOGGER).set_log_level(fc::log_level::debug); 37 | } else { 38 | fc::logger::get(DEFAULT_LOGGER).set_log_level(fc::log_level::off); 39 | } 40 | 41 | // Register fc::exception translator 42 | boost::unit_test::unit_test_monitor.template register_exception_translator(&translate_fc_exception); 43 | 44 | std::srand(time(NULL)); 45 | std::cout << "Random number generator seeded to " << time(NULL) << std::endl; 46 | return nullptr; 47 | } 48 | -------------------------------------------------------------------------------- /contracts/memochecker/include/memochecker.hpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | using namespace eosio; 8 | using namespace std; 9 | 10 | const vector default_memo = { "Stake", "Unstake", "stake bandwidth", "unstake XPR" }; 11 | 12 | CONTRACT memochecker : public contract{ 13 | public: 14 | using contract::contract; 15 | 16 | ACTION addmemo(const string& memo); 17 | using addmemo_action = action_wrapper<"addmemo"_n, &memochecker::addmemo>; 18 | 19 | ACTION delmemo(const string& memo); 20 | using delmemo_action = action_wrapper<"delmemo"_n, &memochecker::delmemo>; 21 | 22 | ACTION delid(uint64_t id); 23 | using delid_action = action_wrapper<"delid"_n, &memochecker::delid>; 24 | 25 | [[eosio::on_notify("*::transfer")]] void ontransfer(name from, name to, asset quantity, string memo); 26 | 27 | checksum256 make_hash(const string& memo); 28 | optional get_memo_id(const string& memo); 29 | 30 | void add_default_memos(); 31 | 32 | 33 | public: 34 | TABLE memoholder{ 35 | uint64_t id; 36 | string memo; 37 | checksum256 hash; 38 | 39 | auto primary_key() const { 40 | return id; 41 | } 42 | 43 | checksum256 by_hash() const { 44 | return hash; 45 | } 46 | 47 | void set_memo(const string& str_memo) 48 | { 49 | hash = sha256(str_memo.c_str(), str_memo.size()); 50 | memo = str_memo; 51 | } 52 | 53 | }; 54 | typedef eosio::multi_index< "memoholders"_n, memoholder, 55 | eosio::indexed_by< "hash"_n, eosio::const_mem_fun> 56 | > memoholders; 57 | 58 | memoholders memoholders_ = { _self, _self.value }; 59 | }; -------------------------------------------------------------------------------- /contracts/eosio.wrap/include/eosio.wrap/eosio.wrap.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | namespace eosio { 8 | /** 9 | * @defgroup eosiowrap eosio.wrap 10 | * @ingroup eosiocontracts 11 | * eosio.wrap contract simplifies Block Producer superuser actions by making them more readable and easier to audit. 12 | 13 | * It does not grant block producers any additional powers that do not already exist within the 14 | * system. Currently, 15/21 block producers can already change an account's keys or modify an 15 | * account's contract at the request of ECAF or an account's owner. However, the current method 16 | * is opaque and leaves undesirable side effects on specific system accounts. 17 | * eosio.wrap allows for a cleaner method of implementing these important governance actions. 18 | * @{ 19 | */ 20 | class [[eosio::contract("eosio.wrap")]] wrap : public contract { 21 | public: 22 | using contract::contract; 23 | 24 | /** 25 | * Execute action. 26 | * 27 | * Execute a transaction while bypassing regular authorization checks. 28 | * 29 | * @param executer - account executing the transaction, 30 | * @param trx - the transaction to be executed. 31 | * 32 | * @pre Requires authorization of eosio.wrap which needs to be a privileged account. 33 | * 34 | * @post Deferred transaction RAM usage is billed to 'executer' 35 | */ 36 | [[eosio::action]] 37 | void exec( ignore executer, ignore trx ); 38 | 39 | using exec_action = eosio::action_wrapper<"exec"_n, &wrap::exec>; 40 | }; 41 | /** @}*/ // end of @defgroup eosiowrap eosio.wrap 42 | } /// namespace eosio 43 | -------------------------------------------------------------------------------- /contracts/eosio.assert/include/eosio.assert/eosio.assert.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | namespace assert_contract { 8 | 9 | using namespace eosio; 10 | using std::string; 11 | using std::vector; 12 | 13 | struct [[ eosio::contract("eosio.assert"), eosio::table("chain.params") ]] stored_chain_params { 14 | checksum256 chain_id; 15 | string chain_name; 16 | checksum256 icon; 17 | checksum256 hash; 18 | uint64_t next_unique_id = 1; 19 | }; 20 | 21 | using chains = singleton<"chain.params"_n, stored_chain_params>; 22 | 23 | struct contract_action { 24 | name contract; 25 | name action; 26 | }; 27 | 28 | inline bool operator==(const contract_action& a, const contract_action& b) { 29 | return std::tie(a.contract, a.action) == std::tie(b.contract, b.action); 30 | } 31 | 32 | struct [[ eosio::contract("eosio.assert"), eosio::table("manifests") ]] stored_manifest { 33 | uint64_t unique_id = 0; 34 | checksum256 id; 35 | name account; 36 | std::string domain; 37 | std::string appmeta; 38 | std::vector whitelist; 39 | 40 | uint64_t primary_key() const { return unique_id; } 41 | checksum256 id_key() const { return id; } 42 | }; 43 | 44 | using manifests = eosio::multi_index< 45 | "manifests"_n, stored_manifest, 46 | indexed_by<"id"_n, eosio::const_mem_fun>>; 47 | using manifests_id_index = decltype(std::declval().get_index<"id"_n>()); 48 | 49 | struct abi_hash { 50 | name owner; 51 | checksum256 hash; 52 | 53 | uint64_t primary_key() const { return owner.value; } 54 | }; 55 | 56 | using abi_hash_table = eosio::multi_index<"abihash"_n, abi_hash>; 57 | 58 | } // namespace assert_contract 59 | -------------------------------------------------------------------------------- /contracts/eosio.system/include/eosio.system/exchange_state.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | namespace eosiosystem { 7 | 8 | using eosio::asset; 9 | using eosio::symbol; 10 | 11 | /** 12 | * @addtogroup eosiosystem 13 | * @{ 14 | */ 15 | 16 | /** 17 | * Uses Bancor math to create a 50/50 relay between two asset types. 18 | * 19 | * The state of the bancor exchange is entirely contained within this struct. 20 | * There are no external side effects associated with using this API. 21 | */ 22 | struct [[eosio::table, eosio::contract("eosio.system")]] exchange_state { 23 | asset supply; 24 | 25 | struct connector { 26 | asset balance; 27 | double weight = .5; 28 | 29 | EOSLIB_SERIALIZE( connector, (balance)(weight) ) 30 | }; 31 | 32 | connector base; 33 | connector quote; 34 | 35 | uint64_t primary_key()const { return supply.symbol.raw(); } 36 | 37 | asset convert_to_exchange( connector& reserve, const asset& payment ); 38 | asset convert_from_exchange( connector& reserve, const asset& tokens ); 39 | asset convert( const asset& from, const symbol& to ); 40 | asset direct_convert( const asset& from, const symbol& to ); 41 | 42 | static int64_t get_bancor_output( int64_t inp_reserve, 43 | int64_t out_reserve, 44 | int64_t inp ); 45 | static int64_t get_bancor_input( int64_t out_reserve, 46 | int64_t inp_reserve, 47 | int64_t out ); 48 | 49 | EOSLIB_SERIALIZE( exchange_state, (supply)(base)(quote) ) 50 | }; 51 | 52 | typedef eosio::multi_index< "rammarket"_n, exchange_state > rammarket; 53 | /** @}*/ // enf of @addtogroup eosiosystem 54 | } /// namespace eosiosystem 55 | -------------------------------------------------------------------------------- /contracts/eosio.bios/src/eosio.bios.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | namespace eosiobios { 4 | 5 | void bios::setabi( name account, const std::vector& abi ) { 6 | abi_hash_table table(get_self(), get_self().value); 7 | auto itr = table.find( account.value ); 8 | if( itr == table.end() ) { 9 | table.emplace( account, [&]( auto& row ) { 10 | row.owner = account; 11 | row.hash = eosio::sha256(const_cast(abi.data()), abi.size()); 12 | }); 13 | } else { 14 | table.modify( itr, eosio::same_payer, [&]( auto& row ) { 15 | row.hash = eosio::sha256(const_cast(abi.data()), abi.size()); 16 | }); 17 | } 18 | } 19 | 20 | void bios::onerror( ignore, ignore> ) { 21 | check( false, "the onerror action cannot be called directly" ); 22 | } 23 | 24 | void bios::setpriv( name account, uint8_t is_priv ) { 25 | require_auth( get_self() ); 26 | set_privileged( account, is_priv ); 27 | } 28 | 29 | void bios::setalimits( name account, int64_t ram_bytes, int64_t net_weight, int64_t cpu_weight ) { 30 | require_auth( get_self() ); 31 | set_resource_limits( account, ram_bytes, net_weight, cpu_weight ); 32 | } 33 | 34 | void bios::setprods( const std::vector& schedule ) { 35 | require_auth( get_self() ); 36 | set_proposed_producers( schedule ); 37 | } 38 | 39 | void bios::setparams( const eosio::blockchain_parameters& params ) { 40 | require_auth( get_self() ); 41 | set_blockchain_parameters( params ); 42 | } 43 | 44 | void bios::reqauth( name from ) { 45 | require_auth( from ); 46 | } 47 | 48 | void bios::activate( const eosio::checksum256& feature_digest ) { 49 | require_auth( get_self() ); 50 | preactivate_feature( feature_digest ); 51 | } 52 | 53 | void bios::reqactivated( const eosio::checksum256& feature_digest ) { 54 | check( is_feature_activated( feature_digest ), "protocol feature is not activated" ); 55 | } 56 | 57 | } 58 | -------------------------------------------------------------------------------- /contracts/cfund.proton/ricardian/cfund.proton.contracts.md: -------------------------------------------------------------------------------- 1 |

reg

2 | 3 | --- 4 | spec_version: "0.2.0" 5 | title: Register Committee member 6 | summary: 'Register {{nowrap account}} as Committee member' 7 | icon: https://raw.githubusercontent.com/EOSIO/eosio.contracts/master/contracts/icons/admin.png#9bf1cec664863bd6aaac0f814b235f8799fb02c850e9aa5da34e8a004bd6518e 8 | --- 9 | Register {{account}} as Committee member 10 | 11 |

unreg

12 | 13 | --- 14 | spec_version: "0.2.0" 15 | title: Unregister Committee member 16 | summary: 'Unregister {{nowrap account}} Committee member' 17 | icon: https://raw.githubusercontent.com/EOSIO/eosio.contracts/master/contracts/icons/admin.png#9bf1cec664863bd6aaac0f814b235f8799fb02c850e9aa5da34e8a004bd6518e 18 | --- 19 | Unregister {{account}} Committee member 20 | 21 |

activate

22 | 23 | --- 24 | spec_version: "0.2.0" 25 | title: Activate Committee member 26 | summary: 'Activate {{nowrap account}} Committee member' 27 | icon: https://raw.githubusercontent.com/EOSIO/eosio.contracts/master/contracts/icons/admin.png#9bf1cec664863bd6aaac0f814b235f8799fb02c850e9aa5da34e8a004bd6518e 28 | --- 29 | Activate {{account}} Committee member 30 | 31 | 32 |

claimreward

33 | --- 34 | spec_version: "0.2.0" 35 | title: Claim Committee Rewards 36 | summary: '{{nowrap account}} claims Committee rewards' 37 | icon: https://raw.githubusercontent.com/EOSIO/eosio.contracts/master/contracts/icons/token.png#207ff68b0406eaa56618b08bda81d6a0954543f36adc328ab3065f31a5c5d654 38 | --- 39 | {{account}} claims Committee reward from the system. 40 | 41 | 42 |

process

43 | 44 | --- 45 | spec_version: "0.2.0" 46 | title: sharing rewards (internal) 47 | summary: 'sharing rewards (internal)' 48 | icon: https://raw.githubusercontent.com/EOSIO/eosio.contracts/master/contracts/icons/transfer.png#5dfad0df72772ee1ccc155e670c1d124f5c5122f1d5027565df38b418042d1dd 49 | --- 50 | sharing/allocating rewards to active Committee members (internal) 51 | -------------------------------------------------------------------------------- /contracts/eosio.system/include/eosio.system/rex.results.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | using eosio::action_wrapper; 8 | using eosio::asset; 9 | using eosio::name; 10 | 11 | /** 12 | * The actions `buyresult`, `sellresult`, `rentresult`, and `orderresult` of `rex.results` are all no-ops. 13 | * They are added as inline convenience actions to `rentnet`, `rentcpu`, `buyrex`, `unstaketorex`, and `sellrex`. 14 | * An inline convenience action does not have any effect, however, 15 | * its data includes the result of the parent action and appears in its trace. 16 | */ 17 | class [[eosio::contract("rex.results")]] rex_results : eosio::contract { 18 | public: 19 | 20 | using eosio::contract::contract; 21 | 22 | /** 23 | * Buyresult action. 24 | * 25 | * @param rex_received - amount of tokens used in buy order 26 | */ 27 | [[eosio::action]] 28 | void buyresult( const asset& rex_received ); 29 | 30 | /** 31 | * Sellresult action. 32 | * 33 | * @param proceeds - amount of tokens used in sell order 34 | */ 35 | [[eosio::action]] 36 | void sellresult( const asset& proceeds ); 37 | 38 | /** 39 | * Orderresult action. 40 | * 41 | * @param owner - the owner of the order 42 | * @param proceeds - amount of tokens used in order 43 | */ 44 | [[eosio::action]] 45 | void orderresult( const name& owner, const asset& proceeds ); 46 | 47 | /** 48 | * Rentresult action. 49 | * 50 | * @param rented_tokens - amount of rented tokens 51 | */ 52 | [[eosio::action]] 53 | void rentresult( const asset& rented_tokens ); 54 | 55 | using buyresult_action = action_wrapper<"buyresult"_n, &rex_results::buyresult>; 56 | using sellresult_action = action_wrapper<"sellresult"_n, &rex_results::sellresult>; 57 | using orderresult_action = action_wrapper<"orderresult"_n, &rex_results::orderresult>; 58 | using rentresult_action = action_wrapper<"rentresult"_n, &rex_results::rentresult>; 59 | }; 60 | -------------------------------------------------------------------------------- /contracts/memochecker/src/memochecker.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | optional memochecker::get_memo_id(const string& memo) 4 | { 5 | optional result = nullopt; 6 | 7 | auto index_hash = memoholders_.get_index<"hash"_n>(); 8 | auto it = index_hash.find(make_hash(memo)); 9 | 10 | if (it != index_hash.end()) 11 | { 12 | result = optional(it->id); 13 | } 14 | 15 | return result; 16 | } 17 | 18 | ACTION memochecker::addmemo(const string& memo) { 19 | require_auth(get_self()); 20 | 21 | auto id = get_memo_id(memo); 22 | check(!(id.has_value() == true), "memo already exist at record id: " + to_string((id.has_value() == true)?id.value():0)); 23 | 24 | memoholders_.emplace(_self, [&](auto& s) { 25 | s.id = memoholders_.available_primary_key(); 26 | s.set_memo(memo); 27 | }); 28 | } 29 | 30 | ACTION memochecker::delid(uint64_t id) { 31 | require_auth(get_self()); 32 | 33 | auto it = memoholders_.require_find(id, string("id " + to_string(id) + " does not exist").c_str()); 34 | memoholders_.erase(it); 35 | } 36 | 37 | checksum256 memochecker::make_hash(const string& memo) 38 | { 39 | return sha256(memo.c_str(), memo.size()); 40 | } 41 | 42 | ACTION memochecker::delmemo(const string& memo) { 43 | require_auth(get_self()); 44 | 45 | auto id = get_memo_id(memo); 46 | check(!(id.has_value() == false), "memo does not exist at memoholder table"); 47 | 48 | auto it = memoholders_.require_find(id.value(), string("id " + to_string(id.value()) + " does not exist").c_str()); 49 | memoholders_.erase(it); 50 | } 51 | 52 | void memochecker::ontransfer(name from, name to, asset quantity, string memo) 53 | { 54 | if (to != get_self() || from == get_self()) { 55 | return; 56 | } 57 | 58 | require_auth(from); 59 | 60 | 61 | add_default_memos(); 62 | //const auto token_contract = get_first_receiver(); 63 | 64 | auto id = get_memo_id(memo); 65 | check(!(id.has_value() == false), "memo does not exist at memoholder table"); 66 | } 67 | 68 | void memochecker::add_default_memos() 69 | { 70 | if (memoholders_.begin() == memoholders_.end()) 71 | { 72 | for (const auto & memo : default_memo) 73 | { 74 | memoholders_.emplace(_self, [&](auto& s) { 75 | s.id = memoholders_.available_primary_key(); 76 | s.set_memo(memo); 77 | }); 78 | } 79 | } 80 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # PROTON eosio.contracts 2 | 3 | ## Version : 1.9.1-8 4 | 5 | The design of the EOSIO blockchain calls for a number of smart contracts that are run at a privileged permission level in order to support functions such as block producer registration and voting, token staking for CPU and network bandwidth, RAM purchasing, multi-sig, etc. These smart contracts are referred to as the bios, system, msig, wrap (formerly known as sudo) and token contracts. 6 | 7 | This repository contains examples of these privileged contracts that are useful when deploying, managing, and/or using an EOSIO blockchain. They are provided for reference purposes: 8 | 9 | * [eosio.bios](./contracts/eosio.bios) 10 | * [eosio.system](./contracts/eosio.system) 11 | * [eosio.msig](./contracts/eosio.msig) 12 | * [eosio.wrap](./contracts/eosio.wrap) 13 | 14 | The following unprivileged contract(s) are also part of the system. 15 | * [eosio.token](./contracts/eosio.token) 16 | * [eosio.proton](./contracts/eosio.proton) 17 | * [token.proton](./contracts/token.proton) 18 | * [cfund.proton](./contracts/cfund.proton) 19 | 20 | Dependencies: 21 | * [eosio.cdt v1.7.x](https://github.com/EOSIO/eosio.cdt/releases/tag/v1.7.0) 22 | * [eosio v2.0.x](https://github.com/EOSIO/eos/releases/tag/v2.0.1) (optional dependency only needed to build unit tests) 23 | 24 | To build the contracts follow the instructions in [`Build and deploy` section](./docs/02_build-and-deploy.md). 25 | 26 | ## Contributing 27 | 28 | [Contributing Guide](./CONTRIBUTING.md) 29 | 30 | [Code of Conduct](./CONTRIBUTING.md#conduct) 31 | 32 | ## License 33 | 34 | [MIT](./LICENSE) 35 | 36 | The included icons are provided under the same terms as the software and accompanying documentation, the MIT License. We welcome contributions from the artistically-inclined members of the community, and if you do send us alternative icons, then you are providing them under those same terms. 37 | 38 | ## Important 39 | 40 | See [LICENSE](./LICENSE) for copyright and license terms. 41 | 42 | All repositories and other materials are provided subject to the terms of this [IMPORTANT](./IMPORTANT.md) notice and you must familiarize yourself with its terms. The notice contains important information, limitations and restrictions relating to our software, publications, trademarks, third-party resources, and forward-looking statements. By accessing any of our repositories and other materials, you accept and agree to the terms of the notice. 43 | -------------------------------------------------------------------------------- /contracts/eosio.msig.old/ricardian/eosio.msig.contracts.md.in: -------------------------------------------------------------------------------- 1 |

approve

2 | 3 | --- 4 | spec_version: "0.2.0" 5 | title: Approve Proposed Transaction 6 | summary: '{{nowrap level.actor}} approves the {{nowrap proposal_name}} proposal' 7 | icon: @ICON_BASE_URL@/@MULTISIG_ICON_URI@ 8 | --- 9 | 10 | {{level.actor}} approves the {{proposal_name}} proposal proposed by {{proposer}} with the {{level.permission}} permission of {{level.actor}}. 11 | 12 |

cancel

13 | 14 | --- 15 | spec_version: "0.2.0" 16 | title: Cancel Proposed Transaction 17 | summary: '{{nowrap canceler}} cancels the {{nowrap proposal_name}} proposal' 18 | icon: @ICON_BASE_URL@/@MULTISIG_ICON_URI@ 19 | --- 20 | 21 | {{canceler}} cancels the {{proposal_name}} proposal submitted by {{proposer}}. 22 | 23 |

exec

24 | 25 | --- 26 | spec_version: "0.2.0" 27 | title: Execute Proposed Transaction 28 | summary: '{{nowrap executer}} executes the {{nowrap proposal_name}} proposal' 29 | icon: @ICON_BASE_URL@/@MULTISIG_ICON_URI@ 30 | --- 31 | 32 | {{executer}} executes the {{proposal_name}} proposal submitted by {{proposer}} if the minimum required approvals for the proposal have been secured. 33 | 34 |

invalidate

35 | 36 | --- 37 | spec_version: "0.2.0" 38 | title: Invalidate All Approvals 39 | summary: '{{nowrap account}} invalidates approvals on outstanding proposals' 40 | icon: @ICON_BASE_URL@/@MULTISIG_ICON_URI@ 41 | --- 42 | 43 | {{account}} invalidates all approvals on proposals which have not yet executed. 44 | 45 |

propose

46 | 47 | --- 48 | spec_version: "0.2.0" 49 | title: Propose Transaction 50 | summary: '{{nowrap proposer}} creates the {{nowrap proposal_name}}' 51 | icon: @ICON_BASE_URL@/@MULTISIG_ICON_URI@ 52 | --- 53 | 54 | {{proposer}} creates the {{proposal_name}} proposal for the following transaction: 55 | {{to_json trx}} 56 | 57 | The proposal requests approvals from the following accounts at the specified permission levels: 58 | {{#each requested}} 59 | + {{this.permission}} permission of {{this.actor}} 60 | {{/each}} 61 | 62 | If the proposed transaction is not executed prior to {{trx.expiration}}, the proposal will automatically expire. 63 | 64 |

unapprove

65 | 66 | --- 67 | spec_version: "0.2.0" 68 | title: Unapprove Proposed Transaction 69 | summary: '{{nowrap level.actor}} revokes the approval previously provided to {{nowrap proposal_name}} proposal' 70 | icon: @ICON_BASE_URL@/@MULTISIG_ICON_URI@ 71 | --- 72 | 73 | {{level.actor}} revokes the approval previously provided at their {{level.permission}} permission level from the {{proposal_name}} proposal proposed by {{proposer}}. 74 | -------------------------------------------------------------------------------- /contracts/eosio.msig/ricardian/eosio.msig.contracts.md.in: -------------------------------------------------------------------------------- 1 |

approve

2 | 3 | --- 4 | spec_version: "0.2.0" 5 | title: Approve Proposed Transaction 6 | summary: '{{nowrap level.actor}} approves the {{nowrap proposal_name}} proposal' 7 | icon: @ICON_BASE_URL@/@MULTISIG_ICON_URI@ 8 | --- 9 | 10 | {{level.actor}} approves the {{proposal_name}} proposal proposed by {{proposer}} with the {{level.permission}} permission of {{level.actor}}. 11 | 12 |

cancel

13 | 14 | --- 15 | spec_version: "0.2.0" 16 | title: Cancel Proposed Transaction 17 | summary: '{{nowrap canceler}} cancels the {{nowrap proposal_name}} proposal' 18 | icon: @ICON_BASE_URL@/@MULTISIG_ICON_URI@ 19 | --- 20 | 21 | {{canceler}} cancels the {{proposal_name}} proposal submitted by {{proposer}}. 22 | 23 |

exec

24 | 25 | --- 26 | spec_version: "0.2.0" 27 | title: Execute Proposed Transaction 28 | summary: '{{nowrap executer}} executes the {{nowrap proposal_name}} proposal' 29 | icon: @ICON_BASE_URL@/@MULTISIG_ICON_URI@ 30 | --- 31 | 32 | {{executer}} executes the {{proposal_name}} proposal submitted by {{proposer}} if the minimum required approvals for the proposal have been secured. 33 | 34 |

invalidate

35 | 36 | --- 37 | spec_version: "0.2.0" 38 | title: Invalidate All Approvals 39 | summary: '{{nowrap account}} invalidates approvals on outstanding proposals' 40 | icon: @ICON_BASE_URL@/@MULTISIG_ICON_URI@ 41 | --- 42 | 43 | {{account}} invalidates all approvals on proposals which have not yet executed. 44 | 45 |

propose

46 | 47 | --- 48 | spec_version: "0.2.0" 49 | title: Propose Transaction 50 | summary: '{{nowrap proposer}} creates the {{nowrap proposal_name}}' 51 | icon: @ICON_BASE_URL@/@MULTISIG_ICON_URI@ 52 | --- 53 | 54 | {{proposer}} creates the {{proposal_name}} proposal for the following transaction: 55 | {{to_json trx}} 56 | 57 | The proposal requests approvals from the following accounts at the specified permission levels: 58 | {{#each requested}} 59 | + {{this.permission}} permission of {{this.actor}} 60 | {{/each}} 61 | 62 | If the proposed transaction is not executed prior to {{trx.expiration}}, the proposal will automatically expire. 63 | 64 |

unapprove

65 | 66 | --- 67 | spec_version: "0.2.0" 68 | title: Unapprove Proposed Transaction 69 | summary: '{{nowrap level.actor}} revokes the approval previously provided to {{nowrap proposal_name}} proposal' 70 | icon: @ICON_BASE_URL@/@MULTISIG_ICON_URI@ 71 | --- 72 | 73 | {{level.actor}} revokes the approval previously provided at their {{level.permission}} permission level from the {{proposal_name}} proposal proposed by {{proposer}}. 74 | -------------------------------------------------------------------------------- /tests/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required( VERSION 3.5 ) 2 | 3 | set(EOSIO_VERSION_MIN "2.0") 4 | set(EOSIO_VERSION_SOFT_MAX "2.0") 5 | #set(EOSIO_VERSION_HARD_MAX "") 6 | 7 | find_package(eosio) 8 | 9 | ### Check the version of eosio 10 | set(VERSION_MATCH_ERROR_MSG "") 11 | EOSIO_CHECK_VERSION(VERSION_OUTPUT "${EOSIO_VERSION}" 12 | "${EOSIO_VERSION_MIN}" 13 | "${EOSIO_VERSION_SOFT_MAX}" 14 | "${EOSIO_VERSION_HARD_MAX}" 15 | VERSION_MATCH_ERROR_MSG) 16 | if(VERSION_OUTPUT STREQUAL "MATCH") 17 | message(STATUS "Using eosio version ${EOSIO_VERSION}") 18 | elseif(VERSION_OUTPUT STREQUAL "WARN") 19 | message(WARNING "Using eosio version ${EOSIO_VERSION} even though it exceeds the maximum supported version of ${EOSIO_VERSION_SOFT_MAX}; continuing with configuration, however build may fail.\nIt is recommended to use eosio version ${EOSIO_VERSION_SOFT_MAX}.x") 20 | else() # INVALID OR MISMATCH 21 | message(FATAL_ERROR "Found eosio version ${EOSIO_VERSION} but it does not satisfy version requirements: ${VERSION_MATCH_ERROR_MSG}\nPlease use eosio version ${EOSIO_VERSION_SOFT_MAX}.x") 22 | endif(VERSION_OUTPUT STREQUAL "MATCH") 23 | 24 | configure_file(${CMAKE_SOURCE_DIR}/contracts.hpp.in ${CMAKE_BINARY_DIR}/contracts.hpp) 25 | 26 | include_directories(${CMAKE_BINARY_DIR}) 27 | ### UNIT TESTING ### 28 | include(CTest) # eliminates DartConfiguration.tcl errors at test runtime 29 | enable_testing() 30 | # build unit test executable 31 | file(GLOB UNIT_TESTS "*.cpp" "*.hpp") # find all unit test suites 32 | add_eosio_test_executable(unit_test ${UNIT_TESTS}) # build unit tests as one executable 33 | # mark test suites for execution 34 | foreach(TEST_SUITE ${UNIT_TESTS}) # create an independent target for each test suite 35 | execute_process(COMMAND bash -c "grep -E 'BOOST_AUTO_TEST_SUITE\\s*[(]' ${TEST_SUITE} | grep -vE '//.*BOOST_AUTO_TEST_SUITE\\s*[(]' | cut -d ')' -f 1 | cut -d '(' -f 2" OUTPUT_VARIABLE SUITE_NAME OUTPUT_STRIP_TRAILING_WHITESPACE) # get the test suite name from the *.cpp file 36 | if (NOT "" STREQUAL "${SUITE_NAME}") # ignore empty lines 37 | execute_process(COMMAND bash -c "echo ${SUITE_NAME} | sed -e 's/s$//' | sed -e 's/_test$//'" OUTPUT_VARIABLE TRIMMED_SUITE_NAME OUTPUT_STRIP_TRAILING_WHITESPACE) # trim "_test" or "_tests" from the end of ${SUITE_NAME} 38 | # to run unit_test with all log from blockchain displayed, put "--verbose" after "--", i.e. "unit_test -- --verbose" 39 | add_test(NAME ${TRIMMED_SUITE_NAME}_unit_test COMMAND unit_test --run_test=${SUITE_NAME} --report_level=detailed --color_output) 40 | endif() 41 | endforeach(TEST_SUITE) 42 | -------------------------------------------------------------------------------- /tests/contracts.hpp.in: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | 4 | namespace eosio { namespace testing { 5 | 6 | struct contracts { 7 | static std::vector system_wasm() { return read_wasm("${CMAKE_BINARY_DIR}/../contracts/eosio.system/eosio.system.wasm"); } 8 | static std::vector system_abi() { return read_abi("${CMAKE_BINARY_DIR}/../contracts/eosio.system/eosio.system.abi"); } 9 | static std::vector token_wasm() { return read_wasm("${CMAKE_BINARY_DIR}/../contracts/eosio.token/eosio.token.wasm"); } 10 | static std::vector token_abi() { return read_abi("${CMAKE_BINARY_DIR}/../contracts/eosio.token/eosio.token.abi"); } 11 | static std::vector msig_wasm() { return read_wasm("${CMAKE_BINARY_DIR}/../contracts/eosio.msig/eosio.msig.wasm"); } 12 | static std::vector msig_abi() { return read_abi("${CMAKE_BINARY_DIR}/../contracts/eosio.msig/eosio.msig.abi"); } 13 | static std::vector wrap_wasm() { return read_wasm("${CMAKE_BINARY_DIR}/../contracts/eosio.wrap/eosio.wrap.wasm"); } 14 | static std::vector wrap_abi() { return read_abi("${CMAKE_BINARY_DIR}/../contracts/eosio.wrap/eosio.wrap.abi"); } 15 | static std::vector bios_wasm() { return read_wasm("${CMAKE_BINARY_DIR}/../contracts/eosio.bios/eosio.bios.wasm"); } 16 | static std::vector bios_abi() { return read_abi("${CMAKE_BINARY_DIR}/../contracts/eosio.bios/eosio.bios.abi"); } 17 | 18 | struct util { 19 | static std::vector reject_all_wasm() { return read_wasm("${CMAKE_SOURCE_DIR}/test_contracts/reject_all.wasm"); } 20 | static std::vector exchange_wasm() { return read_wasm("${CMAKE_SOURCE_DIR}/test_contracts/exchange.wasm"); } 21 | static std::vector system_wasm_v1_8() { return read_wasm("${CMAKE_SOURCE_DIR}/test_contracts/old_versions/v1.8.3/eosio.system/eosio.system.wasm"); } 22 | static std::vector system_abi_v1_8() { return read_abi("${CMAKE_SOURCE_DIR}/test_contracts/old_versions/v1.8.3/eosio.system/eosio.system.abi"); } 23 | static std::vector system_wasm_old() { return read_wasm("${CMAKE_SOURCE_DIR}/test_contracts/old_versions/v1.2.1/eosio.system/eosio.system.wasm"); } 24 | static std::vector system_abi_old() { return read_abi("${CMAKE_SOURCE_DIR}/test_contracts/old_versions/v1.2.1/eosio.system/eosio.system.abi"); } 25 | static std::vector msig_wasm_old() { return read_wasm("${CMAKE_SOURCE_DIR}/test_contracts/old_versions/v1.2.1/eosio.msig/eosio.msig.wasm"); } 26 | static std::vector msig_abi_old() { return read_abi("${CMAKE_SOURCE_DIR}/test_contracts/old_versions/v1.2.1/eosio.msig/eosio.msig.abi"); } 27 | }; 28 | }; 29 | }} //ns eosio::testing 30 | -------------------------------------------------------------------------------- /contracts/token.proton/include/token.proton/token.proton.hpp: -------------------------------------------------------------------------------- 1 | /*##################################*\ 2 | # 3 | # 4 | # Created by CryptoLions.io 5 | # 6 | # 7 | \*##################################*/ 8 | 9 | #pragma once 10 | 11 | #include 12 | #include 13 | #include 14 | 15 | using namespace eosio; 16 | using namespace std; 17 | 18 | namespace eosiosystem { 19 | class system_contract; 20 | } 21 | 22 | namespace eosio { 23 | 24 | class [[eosio::contract("token.proton")]] tokenproton : public contract { 25 | public: 26 | using contract::contract; 27 | 28 | [[eosio::action]] 29 | void reg(name tcontract, string tname, string url, string desc, string iconurl, symbol symbol); 30 | using reg_action = eosio::action_wrapper<"reg"_n, &tokenproton::reg>; 31 | 32 | //[[eosio::action]] 33 | //void reglog(uint64_t id, name tcontract, string tname, string url, string desc, string iconurl, symbol symbol); 34 | //using reglog_action = eosio::action_wrapper<"reglog"_n, &tokenproton::reglog>; 35 | 36 | [[eosio::action]] 37 | void update(uint64_t id, name tcontract, string tname, string url, string desc, string iconurl, symbol symbol); 38 | using update_action = eosio::action_wrapper<"update"_n, &tokenproton::update>; 39 | 40 | [[eosio::action]] 41 | void remove(uint64_t id); 42 | using remove_action = eosio::action_wrapper<"remove"_n, &tokenproton::remove>; 43 | 44 | [[eosio::action]] 45 | void updblacklist(uint64_t id, bool blisted); 46 | using updblacklist_action = eosio::action_wrapper<"updblacklist"_n, &tokenproton::updblacklist>; 47 | 48 | 49 | private: 50 | uint64_t getid( ); 51 | 52 | 53 | struct [[eosio::table]] token { 54 | uint64_t id; 55 | name tcontract; 56 | string tname; 57 | string url; 58 | string desc; 59 | string iconurl; 60 | symbol symbol; 61 | bool blisted; 62 | 63 | auto primary_key() const { 64 | return id; 65 | } 66 | uint64_t by_tcontract() const { 67 | return tcontract.value; 68 | } 69 | 70 | 71 | }; 72 | 73 | 74 | typedef eosio::multi_index< "tokens"_n, token, 75 | eosio::indexed_by< "tcontract"_n, eosio::const_mem_fun > 76 | > tokens; 77 | 78 | 79 | 80 | /* 81 | * global singelton table, used for id building. Scope: self 82 | */ 83 | TABLE global { 84 | global() {} 85 | uint64_t tid = 1000000; 86 | 87 | uint64_t spare1 = 0; 88 | uint64_t spare2 = 0; 89 | 90 | EOSLIB_SERIALIZE( global, ( tid )( spare1 )( spare2 ) ) 91 | }; 92 | 93 | typedef eosio::singleton< "global"_n, global > conf; /// singleton 94 | global _cstate; /// global state 95 | 96 | }; 97 | 98 | } /// namespace eosio 99 | -------------------------------------------------------------------------------- /contracts/eosio.msig/ricardian/eosio.msig.contracts.md: -------------------------------------------------------------------------------- 1 |

approve

2 | 3 | --- 4 | spec_version: "0.2.0" 5 | title: Approve Proposed Transaction 6 | summary: '{{nowrap level.actor}} approves the {{nowrap proposal_name}} proposal' 7 | icon: https://raw.githubusercontent.com/EOSIO/eosio.contracts/master/contracts/icons/multisig.png#4fb41d3cf02d0dd2d35a29308e93c2d826ec770d6bb520db668f530764be7153 8 | --- 9 | 10 | {{level.actor}} approves the {{proposal_name}} proposal proposed by {{proposer}} with the {{level.permission}} permission of {{level.actor}}. 11 | 12 |

cancel

13 | 14 | --- 15 | spec_version: "0.2.0" 16 | title: Cancel Proposed Transaction 17 | summary: '{{nowrap canceler}} cancels the {{nowrap proposal_name}} proposal' 18 | icon: https://raw.githubusercontent.com/EOSIO/eosio.contracts/master/contracts/icons/multisig.png#4fb41d3cf02d0dd2d35a29308e93c2d826ec770d6bb520db668f530764be7153 19 | --- 20 | 21 | {{canceler}} cancels the {{proposal_name}} proposal submitted by {{proposer}}. 22 | 23 |

exec

24 | 25 | --- 26 | spec_version: "0.2.0" 27 | title: Execute Proposed Transaction 28 | summary: '{{nowrap executer}} executes the {{nowrap proposal_name}} proposal' 29 | icon: https://raw.githubusercontent.com/EOSIO/eosio.contracts/master/contracts/icons/multisig.png#4fb41d3cf02d0dd2d35a29308e93c2d826ec770d6bb520db668f530764be7153 30 | --- 31 | 32 | {{executer}} executes the {{proposal_name}} proposal submitted by {{proposer}} if the minimum required approvals for the proposal have been secured. 33 | 34 |

invalidate

35 | 36 | --- 37 | spec_version: "0.2.0" 38 | title: Invalidate All Approvals 39 | summary: '{{nowrap account}} invalidates approvals on outstanding proposals' 40 | icon: https://raw.githubusercontent.com/EOSIO/eosio.contracts/master/contracts/icons/multisig.png#4fb41d3cf02d0dd2d35a29308e93c2d826ec770d6bb520db668f530764be7153 41 | --- 42 | 43 | {{account}} invalidates all approvals on proposals which have not yet executed. 44 | 45 |

propose

46 | 47 | --- 48 | spec_version: "0.2.0" 49 | title: Propose Transaction 50 | summary: '{{nowrap proposer}} creates the {{nowrap proposal_name}}' 51 | icon: https://raw.githubusercontent.com/EOSIO/eosio.contracts/master/contracts/icons/multisig.png#4fb41d3cf02d0dd2d35a29308e93c2d826ec770d6bb520db668f530764be7153 52 | --- 53 | 54 | {{proposer}} creates the {{proposal_name}} proposal for the following transaction: 55 | {{to_json trx}} 56 | 57 | The proposal requests approvals from the following accounts at the specified permission levels: 58 | {{#each requested}} 59 | + {{this.permission}} permission of {{this.actor}} 60 | {{/each}} 61 | 62 | If the proposed transaction is not executed prior to {{trx.expiration}}, the proposal will automatically expire. 63 | 64 |

unapprove

65 | 66 | --- 67 | spec_version: "0.2.0" 68 | title: Unapprove Proposed Transaction 69 | summary: '{{nowrap level.actor}} revokes the approval previously provided to {{nowrap proposal_name}} proposal' 70 | icon: https://raw.githubusercontent.com/EOSIO/eosio.contracts/master/contracts/icons/multisig.png#4fb41d3cf02d0dd2d35a29308e93c2d826ec770d6bb520db668f530764be7153 71 | --- 72 | 73 | {{level.actor}} revokes the approval previously provided at their {{level.permission}} permission level from the {{proposal_name}} proposal proposed by {{proposer}}. 74 | -------------------------------------------------------------------------------- /docs/02_build-and-deploy.md: -------------------------------------------------------------------------------- 1 | ## How to build the eosio.contracts 2 | 3 | ### Preconditions 4 | Ensure an appropriate version of `eosio.cdt` is installed. Installing `eosio.cdt` from binaries is sufficient, follow the [`eosio.cdt` installation instructions steps](https://github.com/EOSIO/eosio.cdt/tree/master/#binary-releases) to install it. To verify if you have `eosio.cdt` installed and its version run the following command 5 | 6 | ```sh 7 | eosio-cpp -v 8 | ``` 9 | 10 | #### Build contracts using the build script 11 | 12 | ##### To build contracts alone 13 | Run the `build.sh` script in the top directory to build all the contracts. 14 | 15 | ##### To build the contracts and unit tests 16 | 1. Ensure an appropriate version of `eosio` has been built from source and installed. Installing `eosio` from binaries `is not` sufficient. You can find instructions on how to do it [here](https://github.com/EOSIO/eos/blob/master/README.md) in section `Building from Sources`. 17 | 2. Run the `build.sh` script in the top directory with the `-t` flag to build all the contracts and the unit tests for these contracts. 18 | 19 | #### Build contracts manually 20 | 21 | To build the `eosio.contracts` execute the following commands. 22 | 23 | On all platforms except macOS: 24 | ```sh 25 | cd you_local_path_to/eosio.contracts/ 26 | rm -fr build 27 | mkdir build 28 | cd build 29 | cmake .. 30 | make -j$( nproc ) 31 | cd .. 32 | ``` 33 | 34 | For macOS: 35 | ```sh 36 | cd you_local_path_to/eosio.contracts/ 37 | rm -fr build 38 | mkdir build 39 | cd build 40 | cmake .. 41 | make -j$(sysctl -n hw.ncpu) 42 | cd .. 43 | ``` 44 | 45 | #### After build: 46 | * If the build was configured to also build unit tests, the unit tests executable is placed in the _build/tests_ folder and is named __unit_test__. 47 | * The contracts (both `.wasm` and `.abi` files) are built into their corresponding _build/contracts/\_ folder. 48 | * Finally, simply use __cleos__ to _set contract_ by pointing to the previously mentioned directory for the specific contract. 49 | 50 | ## How to deploy the eosio.contracts 51 | 52 | ### To deploy eosio.bios contract execute the following command: 53 | Let's assume your account name to which you want to deploy the contract is `testerbios` 54 | ``` 55 | cleos set contract testerbios you_local_path_to/eosio.contracts/build/contracts/eosio.bios/ -p testerbios 56 | ``` 57 | 58 | ### To deploy eosio.msig contract execute the following command: 59 | Let's assume your account name to which you want to deploy the contract is `testermsig` 60 | ``` 61 | cleos set contract testermsig you_local_path_to/eosio.contracts/build/contracts/eosio.msig/ -p testermsig 62 | ``` 63 | 64 | ### To deploy eosio.system contract execute the following command: 65 | Let's assume your account name to which you want to deploy the contract is `testersystem` 66 | ``` 67 | cleos set contract testersystem you_local_path_to/eosio.contracts/build/contracts/eosio.system/ -p testersystem 68 | ``` 69 | 70 | ### To deploy eosio.token contract execute the following command: 71 | Let's assume your account name to which you want to deploy the contract is `testertoken` 72 | ``` 73 | cleos set contract testertoken you_local_path_to/eosio.contracts/build/contracts/eosio.token/ -p testertoken 74 | ``` 75 | 76 | ### To deploy eosio.wrap contract execute the following command: 77 | Let's assume your account name to which you want to deploy the contract is `testerwrap` 78 | ``` 79 | cleos set contract testerwrap you_local_path_to/eosio.contracts/build/contracts/eosio.wrap/ -p testerwrap 80 | ``` -------------------------------------------------------------------------------- /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.5) 2 | 3 | project(eosio_contracts) 4 | 5 | set(VERSION_MAJOR 1) 6 | set(VERSION_MINOR 9) 7 | set(VERSION_PATCH 1) 8 | #set(VERSION_SUFFIX rc4) 9 | 10 | if (VERSION_SUFFIX) 11 | set(VERSION_FULL "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}-${VERSION_SUFFIX}") 12 | else() 13 | set(VERSION_FULL "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}") 14 | endif() 15 | 16 | include(ExternalProject) 17 | 18 | find_package(eosio.cdt) 19 | 20 | message(STATUS "Building eosio.contracts v${VERSION_FULL}") 21 | 22 | set(EOSIO_CDT_VERSION_MIN "1.7") 23 | set(EOSIO_CDT_VERSION_SOFT_MAX "1.7") 24 | #set(EOSIO_CDT_VERSION_HARD_MAX "") 25 | 26 | ### Check the version of eosio.cdt 27 | set(VERSION_MATCH_ERROR_MSG "") 28 | EOSIO_CHECK_VERSION(VERSION_OUTPUT "${EOSIO_CDT_VERSION}" 29 | "${EOSIO_CDT_VERSION_MIN}" 30 | "${EOSIO_CDT_VERSION_SOFT_MAX}" 31 | "${EOSIO_CDT_VERSION_HARD_MAX}" 32 | VERSION_MATCH_ERROR_MSG) 33 | if(VERSION_OUTPUT STREQUAL "MATCH") 34 | message(STATUS "Using eosio.cdt version ${EOSIO_CDT_VERSION}") 35 | elseif(VERSION_OUTPUT STREQUAL "WARN") 36 | 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") 37 | else() # INVALID OR MISMATCH 38 | 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") 39 | endif(VERSION_OUTPUT STREQUAL "MATCH") 40 | 41 | if(CMAKE_BUILD_TYPE STREQUAL "Debug") 42 | set(TEST_BUILD_TYPE "Debug") 43 | set(CMAKE_BUILD_TYPE "Release") 44 | else() 45 | set(TEST_BUILD_TYPE ${CMAKE_BUILD_TYPE}) 46 | endif() 47 | 48 | ExternalProject_Add( 49 | contracts_project 50 | SOURCE_DIR ${CMAKE_SOURCE_DIR}/contracts 51 | BINARY_DIR ${CMAKE_BINARY_DIR}/contracts 52 | CMAKE_ARGS -DCMAKE_TOOLCHAIN_FILE=${EOSIO_CDT_ROOT}/lib/cmake/eosio.cdt/EosioWasmToolchain.cmake 53 | UPDATE_COMMAND "" 54 | PATCH_COMMAND "" 55 | TEST_COMMAND "" 56 | INSTALL_COMMAND "" 57 | BUILD_ALWAYS 1 58 | ) 59 | 60 | if (APPLE) 61 | set(OPENSSL_ROOT "/usr/local/opt/openssl") 62 | elseif (UNIX) 63 | set(OPENSSL_ROOT "/usr/include/openssl") 64 | endif() 65 | set(SECP256K1_ROOT "/usr/local") 66 | 67 | if (APPLE) 68 | set(OPENSSL_ROOT "/usr/local/opt/openssl") 69 | elseif (UNIX) 70 | set(OPENSSL_ROOT "/usr/include/openssl") 71 | endif() 72 | set(SECP256K1_ROOT "/usr/local") 73 | 74 | string(REPLACE ";" "|" TEST_PREFIX_PATH "${CMAKE_PREFIX_PATH}") 75 | string(REPLACE ";" "|" TEST_FRAMEWORK_PATH "${CMAKE_FRAMEWORK_PATH}") 76 | string(REPLACE ";" "|" TEST_MODULE_PATH "${CMAKE_MODULE_PATH}") 77 | 78 | set(BUILD_TESTS FALSE CACHE BOOL "Build unit tests") 79 | 80 | if(BUILD_TESTS) 81 | message(STATUS "Building unit tests.") 82 | ExternalProject_Add( 83 | contracts_unit_tests 84 | LIST_SEPARATOR | # Use the alternate list separator 85 | CMAKE_ARGS -DCMAKE_BUILD_TYPE=${TEST_BUILD_TYPE} -DCMAKE_PREFIX_PATH=${TEST_PREFIX_PATH} -DCMAKE_FRAMEWORK_PATH=${TEST_FRAMEWORK_PATH} -DCMAKE_MODULE_PATH=${TEST_MODULE_PATH} -DEOSIO_ROOT=${EOSIO_ROOT} -DLLVM_DIR=${LLVM_DIR} -DBOOST_ROOT=${BOOST_ROOT} 86 | SOURCE_DIR ${CMAKE_SOURCE_DIR}/tests 87 | BINARY_DIR ${CMAKE_BINARY_DIR}/tests 88 | BUILD_ALWAYS 1 89 | TEST_COMMAND "" 90 | INSTALL_COMMAND "" 91 | ) 92 | else() 93 | message(STATUS "Unit tests will not be built. To build unit tests, set BUILD_TESTS to true.") 94 | endif() 95 | -------------------------------------------------------------------------------- /contracts/token.proton/src/token.proton.cpp: -------------------------------------------------------------------------------- 1 | /*##################################*\ 2 | # 3 | # 4 | # Created by CryptoLions.io 5 | # 6 | # 7 | \*##################################*/ 8 | 9 | 10 | #include 11 | #include 12 | 13 | 14 | namespace eosio { 15 | 16 | 17 | void tokenproton::reg(name tcontract, string tname, string url, string desc, string iconurl, symbol symbol){ 18 | 19 | check( is_account( tcontract ), "tcontract account does not exist"); 20 | 21 | check( tname.size() <= 16 , "max length for token name is 16."); 22 | check( url.size() <= 256 , "max length for url is 256."); 23 | check( iconurl.size() <= 256 , "max length for iconurl is 256."); 24 | check( desc.size() <= 512 , "max length for description is 512."); 25 | 26 | check( symbol.is_valid(), "invalid symbol name" ); 27 | 28 | require_auth( tcontract ); 29 | require_recipient( tcontract ); 30 | 31 | tokens tokens_( get_self(), get_self().value ); 32 | 33 | auto tcontract_index = tokens_.template get_index< "tcontract"_n >(); 34 | for ( auto itro = tcontract_index.find( tcontract.value ); itro != tcontract_index.end(); itro++ ) { 35 | check( itro->symbol != symbol, "Token already registered"); 36 | } 37 | 38 | auto newid = getid(); 39 | tokens_.emplace( tcontract, [&]( auto& t ) { 40 | t.id = newid; 41 | t.tcontract = tcontract; 42 | t.tname = tname; 43 | t.url = url; 44 | t.desc = desc; 45 | t.iconurl = iconurl; 46 | t.symbol = symbol; 47 | t.blisted = false; 48 | }); 49 | } 50 | 51 | void tokenproton::update(uint64_t id, name tcontract, string tname, string url, string desc, string iconurl, symbol symbol){ 52 | 53 | check( is_account( tcontract ), "tcontract account does not exist"); 54 | 55 | check( tname.size() <= 16 , "max length for token name is 16."); 56 | check( url.size() <= 256 , "max length for url is 256."); 57 | check( iconurl.size() <= 256 , "max length for iconurl is 256."); 58 | check( desc.size() <= 512 , "max length for description is 512."); 59 | 60 | check( symbol.is_valid(), "invalid symbol name" ); 61 | 62 | tokens tokens_( get_self(), get_self().value ); 63 | auto itr = tokens_.require_find( id, string("id: " + to_string( id ) + " cannot be found").c_str() ); 64 | 65 | require_auth( tcontract ); 66 | require_auth( itr->tcontract ); 67 | 68 | require_recipient( tcontract ); 69 | 70 | tokens_.modify( itr, tcontract, [&]( auto& t ) { 71 | t.tcontract = tcontract; 72 | t.tname = tname; 73 | t.url = url; 74 | t.desc = desc; 75 | t.iconurl = iconurl; 76 | t.symbol = symbol; 77 | }); 78 | } 79 | 80 | 81 | void tokenproton::remove(uint64_t id){ 82 | 83 | tokens tokens_( get_self(), get_self().value ); 84 | auto itr = tokens_.require_find( id, string("id: " + to_string( id ) + " cannot be found").c_str() ); 85 | require_auth( itr->tcontract ); 86 | 87 | check (!(itr->blisted), "Blacklisted tokens cannot be removed."); 88 | tokens_.erase( itr ); 89 | } 90 | 91 | 92 | void tokenproton::updblacklist(uint64_t id, bool blisted){ 93 | 94 | require_auth( get_self() ); 95 | 96 | tokens tokens_( get_self(), get_self().value ); 97 | auto itr = tokens_.require_find( id, string("id: " + to_string( id ) + " cannot be found").c_str() ); 98 | 99 | tokens_.modify( itr, get_self(), [&]( auto& t ) { 100 | t.blisted = blisted; 101 | }); 102 | 103 | } 104 | 105 | 106 | uint64_t tokenproton::getid() { 107 | uint64_t resid; 108 | 109 | conf config( get_self(), get_self().value ); 110 | _cstate = config.exists() ? config.get() : global{}; 111 | 112 | _cstate.tid++; 113 | resid = _cstate.tid; 114 | config.set( _cstate, get_self() ); 115 | 116 | return resid; 117 | } 118 | } 119 | 120 | 121 | EOSIO_DISPATCH( eosio::tokenproton, (reg)(update)(remove)(updblacklist)) -------------------------------------------------------------------------------- /contracts/eosio.token/ricardian/eosio.token.contracts.md.in: -------------------------------------------------------------------------------- 1 |

close

2 | 3 | --- 4 | spec_version: "0.2.0" 5 | title: Close Token Balance 6 | summary: 'Close {{nowrap owner}}’s zero quantity balance' 7 | icon: @ICON_BASE_URL@/@TOKEN_ICON_URI@ 8 | --- 9 | 10 | {{owner}} agrees to close their zero quantity balance for the {{symbol_to_symbol_code symbol}} token. 11 | 12 | RAM will be refunded to the RAM payer of the {{symbol_to_symbol_code symbol}} token balance for {{owner}}. 13 | 14 |

create

15 | 16 | --- 17 | spec_version: "0.2.0" 18 | title: Create New Token 19 | summary: 'Create a new token' 20 | icon: @ICON_BASE_URL@/@TOKEN_ICON_URI@ 21 | --- 22 | 23 | {{$action.account}} agrees to create a new token with symbol {{asset_to_symbol_code maximum_supply}} to be managed by {{issuer}}. 24 | 25 | This action will not result any any tokens being issued into circulation. 26 | 27 | {{issuer}} will be allowed to issue tokens into circulation, up to a maximum supply of {{maximum_supply}}. 28 | 29 | RAM will deducted from {{$action.account}}’s resources to create the necessary records. 30 | 31 |

issue

32 | 33 | --- 34 | spec_version: "0.2.0" 35 | title: Issue Tokens into Circulation 36 | summary: 'Issue {{nowrap quantity}} into circulation and transfer into {{nowrap to}}’s account' 37 | icon: @ICON_BASE_URL@/@TOKEN_ICON_URI@ 38 | --- 39 | 40 | The token manager agrees to issue {{quantity}} into circulation, and transfer it into {{to}}’s account. 41 | 42 | {{#if memo}}There is a memo attached to the transfer stating: 43 | {{memo}} 44 | {{/if}} 45 | 46 | If {{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. 47 | 48 | This action does not allow the total quantity to exceed the max allowed supply of the token. 49 | 50 |

open

51 | 52 | --- 53 | spec_version: "0.2.0" 54 | title: Open Token Balance 55 | summary: 'Open a zero quantity balance for {{nowrap owner}}' 56 | icon: @ICON_BASE_URL@/@TOKEN_ICON_URI@ 57 | --- 58 | 59 | {{ram_payer}} agrees to establish a zero quantity balance for {{owner}} for the {{symbol_to_symbol_code symbol}} token. 60 | 61 | If {{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. 62 | 63 |

retire

64 | 65 | --- 66 | spec_version: "0.2.0" 67 | title: Remove Tokens from Circulation 68 | summary: 'Remove {{nowrap quantity}} from circulation' 69 | icon: @ICON_BASE_URL@/@TOKEN_ICON_URI@ 70 | --- 71 | 72 | The token manager agrees to remove {{quantity}} from circulation, taken from their own account. 73 | 74 | {{#if memo}} There is a memo attached to the action stating: 75 | {{memo}} 76 | {{/if}} 77 | 78 |

transfer

79 | 80 | --- 81 | spec_version: "0.2.0" 82 | title: Transfer Tokens 83 | summary: 'Send {{nowrap quantity}} from {{nowrap from}} to {{nowrap to}}' 84 | icon: @ICON_BASE_URL@/@TRANSFER_ICON_URI@ 85 | --- 86 | 87 | {{from}} agrees to send {{quantity}} to {{to}}. 88 | 89 | {{#if memo}}There is a memo attached to the transfer stating: 90 | {{memo}} 91 | {{/if}} 92 | 93 | If {{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. 94 | 95 | If {{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. 96 | -------------------------------------------------------------------------------- /contracts/eosio.system/src/name_bidding.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | 6 | namespace eosiosystem { 7 | 8 | using eosio::current_time_point; 9 | using eosio::token; 10 | 11 | void system_contract::bidname( const name& bidder, const name& newname, const asset& bid ) { 12 | require_auth( bidder ); 13 | check( newname.suffix() == newname, "you can only bid on top-level suffix" ); 14 | 15 | check (checkPermission(bidder, "namebids")==1, "You are not authorised to namebids"); // PROTON Check Permissions 16 | 17 | check( (bool)newname, "the empty name is not a valid account name to bid on" ); 18 | check( (newname.value & 0xFull) == 0, "13 character names are not valid account names to bid on" ); 19 | check( (newname.value & 0x1F0ull) == 0, "accounts with 12 character names and no dots can be created without bidding required" ); 20 | check( !is_account( newname ), "account already exists" ); 21 | check( bid.symbol == core_symbol(), "asset must be system token" ); 22 | check( bid.amount > 0, "insufficient bid" ); 23 | token::transfer_action transfer_act{ token_account, { {bidder, active_permission} } }; 24 | transfer_act.send( bidder, names_account, bid, std::string("bid name ")+ newname.to_string() ); 25 | name_bid_table bids(get_self(), get_self().value); 26 | print( name{bidder}, " bid ", bid, " on ", name{newname}, "\n" ); 27 | auto current = bids.find( newname.value ); 28 | if( current == bids.end() ) { 29 | bids.emplace( bidder, [&]( auto& b ) { 30 | b.newname = newname; 31 | b.high_bidder = bidder; 32 | b.high_bid = bid.amount; 33 | b.last_bid_time = current_time_point(); 34 | }); 35 | } else { 36 | check( current->high_bid > 0, "this auction has already closed" ); 37 | check( bid.amount - current->high_bid > (current->high_bid / 10), "must increase bid by 10%" ); 38 | check( current->high_bidder != bidder, "account is already highest bidder" ); 39 | 40 | bid_refund_table refunds_table(get_self(), newname.value); 41 | 42 | auto it = refunds_table.find( current->high_bidder.value ); 43 | if ( it != refunds_table.end() ) { 44 | refunds_table.modify( it, same_payer, [&](auto& r) { 45 | r.amount += asset( current->high_bid, core_symbol() ); 46 | }); 47 | } else { 48 | refunds_table.emplace( bidder, [&](auto& r) { 49 | r.bidder = current->high_bidder; 50 | r.amount = asset( current->high_bid, core_symbol() ); 51 | }); 52 | } 53 | 54 | eosio::transaction t; 55 | t.actions.emplace_back( permission_level{current->high_bidder, active_permission}, 56 | get_self(), "bidrefund"_n, 57 | std::make_tuple( current->high_bidder, newname ) 58 | ); 59 | t.delay_sec = 0; 60 | uint128_t deferred_id = (uint128_t(newname.value) << 64) | current->high_bidder.value; 61 | eosio::cancel_deferred( deferred_id ); 62 | t.send( deferred_id, bidder ); 63 | 64 | bids.modify( current, bidder, [&]( auto& b ) { 65 | b.high_bidder = bidder; 66 | b.high_bid = bid.amount; 67 | b.last_bid_time = current_time_point(); 68 | }); 69 | } 70 | } 71 | 72 | void system_contract::bidrefund( const name& bidder, const name& newname ) { 73 | bid_refund_table refunds_table(get_self(), newname.value); 74 | auto it = refunds_table.find( bidder.value ); 75 | check( it != refunds_table.end(), "refund not found" ); 76 | 77 | token::transfer_action transfer_act{ token_account, { {names_account, active_permission}, {bidder, active_permission} } }; 78 | transfer_act.send( names_account, bidder, asset(it->amount), std::string("refund bid on name ")+(name{newname}).to_string() ); 79 | refunds_table.erase( it ); 80 | } 81 | 82 | } 83 | -------------------------------------------------------------------------------- /contracts/eosio.system/src/exchange_state.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include 4 | 5 | #include 6 | 7 | namespace eosiosystem { 8 | 9 | using eosio::check; 10 | 11 | asset exchange_state::convert_to_exchange( connector& reserve, const asset& payment ) 12 | { 13 | const double S0 = supply.amount; 14 | const double R0 = reserve.balance.amount; 15 | const double dR = payment.amount; 16 | const double F = reserve.weight; 17 | 18 | double dS = S0 * ( std::pow(1. + dR / R0, F) - 1. ); 19 | if ( dS < 0 ) dS = 0; // rounding errors 20 | reserve.balance += payment; 21 | supply.amount += int64_t(dS); 22 | return asset( int64_t(dS), supply.symbol ); 23 | } 24 | 25 | asset exchange_state::convert_from_exchange( connector& reserve, const asset& tokens ) 26 | { 27 | const double R0 = reserve.balance.amount; 28 | const double S0 = supply.amount; 29 | const double dS = -tokens.amount; // dS < 0, tokens are subtracted from supply 30 | const double Fi = double(1) / reserve.weight; 31 | 32 | double dR = R0 * ( std::pow(1. + dS / S0, Fi) - 1. ); // dR < 0 since dS < 0 33 | if ( dR > 0 ) dR = 0; // rounding errors 34 | reserve.balance.amount -= int64_t(-dR); 35 | supply -= tokens; 36 | return asset( int64_t(-dR), reserve.balance.symbol ); 37 | } 38 | 39 | asset exchange_state::convert( const asset& from, const symbol& to ) 40 | { 41 | const auto& sell_symbol = from.symbol; 42 | const auto& base_symbol = base.balance.symbol; 43 | const auto& quote_symbol = quote.balance.symbol; 44 | check( sell_symbol != to, "cannot convert to the same symbol" ); 45 | 46 | asset out( 0, to ); 47 | if ( sell_symbol == base_symbol && to == quote_symbol ) { 48 | const asset tmp = convert_to_exchange( base, from ); 49 | out = convert_from_exchange( quote, tmp ); 50 | } else if ( sell_symbol == quote_symbol && to == base_symbol ) { 51 | const asset tmp = convert_to_exchange( quote, from ); 52 | out = convert_from_exchange( base, tmp ); 53 | } else { 54 | check( false, "invalid conversion" ); 55 | } 56 | return out; 57 | } 58 | 59 | asset exchange_state::direct_convert( const asset& from, const symbol& to ) 60 | { 61 | const auto& sell_symbol = from.symbol; 62 | const auto& base_symbol = base.balance.symbol; 63 | const auto& quote_symbol = quote.balance.symbol; 64 | check( sell_symbol != to, "cannot convert to the same symbol" ); 65 | 66 | asset out( 0, to ); 67 | if ( sell_symbol == base_symbol && to == quote_symbol ) { 68 | out.amount = get_bancor_output( base.balance.amount, quote.balance.amount, from.amount ); 69 | base.balance += from; 70 | quote.balance -= out; 71 | } else if ( sell_symbol == quote_symbol && to == base_symbol ) { 72 | out.amount = get_bancor_output( quote.balance.amount, base.balance.amount, from.amount ); 73 | quote.balance += from; 74 | base.balance -= out; 75 | } else { 76 | check( false, "invalid conversion" ); 77 | } 78 | return out; 79 | } 80 | 81 | int64_t exchange_state::get_bancor_output( int64_t inp_reserve, 82 | int64_t out_reserve, 83 | int64_t inp ) 84 | { 85 | const double ib = inp_reserve; 86 | const double ob = out_reserve; 87 | const double in = inp; 88 | 89 | int64_t out = int64_t( (in * ob) / (ib + in) ); 90 | 91 | if ( out < 0 ) out = 0; 92 | 93 | return out; 94 | } 95 | 96 | int64_t exchange_state::get_bancor_input( int64_t out_reserve, 97 | int64_t inp_reserve, 98 | int64_t out ) 99 | { 100 | const double ob = out_reserve; 101 | const double ib = inp_reserve; 102 | 103 | int64_t inp = (ib * out) / (ob - out); 104 | 105 | if ( inp < 0 ) inp = 0; 106 | 107 | return inp; 108 | } 109 | 110 | } /// namespace eosiosystem 111 | -------------------------------------------------------------------------------- /contracts/cfund.proton/include/cfund.proton/cfund.proton.hpp: -------------------------------------------------------------------------------- 1 | /*##################################*\ 2 | # 3 | # 4 | # Created by CryptoLions.io 5 | # 6 | # 7 | \*##################################*/ 8 | 9 | #pragma once 10 | 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | 17 | #include 18 | 19 | using namespace eosio; 20 | using std::string; 21 | 22 | #define TOKEN_SYMB symbol("XPR", 4) 23 | 24 | const name TOKEN_CONTRACT = "eosio.token"_n; 25 | 26 | 27 | const uint64_t claimInterval = 60 * 60 * 24 * 1; //1 day 28 | const uint64_t processIntreval = 60 * 60 * 6; //6 h 29 | 30 | //const uint64_t claimInterval = 2 * 60 ; //2m TEST !!!!!!!!!! 31 | //const uint64_t processIntreval = 10 * 60 ; //10min TEST !!!!!!!!!! 32 | 33 | 34 | namespace eosiosystem { 35 | class system_contract; 36 | } 37 | 38 | namespace eosio { 39 | 40 | class [[eosio::contract("cfund.proton")]] cfundproton : public contract { 41 | public: 42 | using contract::contract; 43 | 44 | /** 45 | * Register (Add) New Committee Member 46 | * 47 | * 48 | * @param name 49 | */ 50 | [[eosio::action]] 51 | void reg( const name& account); 52 | using reg_action = eosio::action_wrapper<"reg"_n, &cfundproton::reg>; 53 | 54 | 55 | /** 56 | * Unregister (Remove) Commitee Member 57 | * 58 | * 59 | * @param name 60 | */ 61 | [[eosio::action]] 62 | void unreg( const name& account ); 63 | using unreg_action = eosio::action_wrapper<"unreg"_n, &cfundproton::unreg>; 64 | 65 | /** 66 | * Activate Comittee Member 67 | * 68 | * Set Committee Member to active or not active. 69 | * 70 | * @param account 71 | * @param status 72 | */ 73 | [[eosio::action]] 74 | void activate( const name& account, const bool& status ); 75 | using activate_action = eosio::action_wrapper<"activate"_n, &cfundproton::activate>; 76 | 77 | /** 78 | * Claim Reward 79 | * 80 | * Called by Committee Members to claim their inflation-based rewards. 81 | * 82 | * @param name 83 | */ 84 | [[eosio::action]] 85 | void claimreward( const name& account); 86 | using claimreward_action = eosio::action_wrapper<"claimreward"_n, &cfundproton::claimreward>; 87 | 88 | /** 89 | * Process 90 | * 91 | * Internal function used to process rewards distribution. 92 | * 93 | */ 94 | [[eosio::action]] 95 | void process( ); 96 | using process_action = eosio::action_wrapper<"process"_n, &cfundproton::process>; 97 | 98 | void onTokenReceive( const name& from, const name& to, const asset& quantity, const string& memo ); 99 | 100 | private: 101 | 102 | TABLE user { 103 | name account; 104 | uint8_t rate; 105 | bool active; 106 | uint64_t claimamount; 107 | uint64_t lastclaim; 108 | 109 | auto primary_key() const { 110 | return account.value; 111 | } 112 | }; 113 | 114 | typedef eosio::multi_index< "users"_n, user> users; 115 | 116 | TABLE global { 117 | global(){} 118 | uint64_t totalusr = 0; 119 | uint64_t totalausr = 0; 120 | uint64_t notclaimed = 0; 121 | uint64_t pool = 0; 122 | uint64_t processtime = 0; 123 | 124 | bool isprocessing = false; 125 | name processFrom = ""_n; 126 | uint8_t processBy = 10; 127 | uint64_t processQuant = 0; 128 | uint64_t processed = 0; 129 | 130 | EOSLIB_SERIALIZE( global, (totalusr)(totalausr)(notclaimed)(pool)(processtime)(isprocessing)(processFrom)(processBy)(processQuant)(processed) ) //(data) 131 | }; 132 | 133 | typedef eosio::singleton< "global"_n, global> conf; 134 | global _gstate; 135 | 136 | }; 137 | } /// namespace eosio 138 | 139 | extern "C" 140 | void apply( uint64_t receiver, uint64_t code, uint64_t action ){ 141 | 142 | if ( code == TOKEN_CONTRACT.value && action == "transfer"_n.value ) { 143 | eosio::execute_action( eosio::name( receiver ), eosio::name( code ), &cfundproton::onTokenReceive ); 144 | } else if ( code == receiver ) { 145 | switch ( action ) { 146 | EOSIO_DISPATCH_HELPER( cfundproton, ( reg )( unreg )( activate )( claimreward )( process ) ) 147 | } 148 | } 149 | } 150 | -------------------------------------------------------------------------------- /contracts/eosio.token/ricardian/eosio.token.contracts.md: -------------------------------------------------------------------------------- 1 |

close

2 | 3 | --- 4 | spec_version: "0.2.0" 5 | title: Close Token Balance 6 | summary: 'Close {{nowrap owner}}’s zero quantity balance' 7 | icon: https://raw.githubusercontent.com/EOSIO/eosio.contracts/master/contracts/icons/token.png#207ff68b0406eaa56618b08bda81d6a0954543f36adc328ab3065f31a5c5d654 8 | --- 9 | 10 | {{owner}} agrees to close their zero quantity balance for the {{symbol_to_symbol_code symbol}} token. 11 | 12 | RAM will be refunded to the RAM payer of the {{symbol_to_symbol_code symbol}} token balance for {{owner}}. 13 | 14 |

create

15 | 16 | --- 17 | spec_version: "0.2.0" 18 | title: Create New Token 19 | summary: 'Create a new token' 20 | icon: https://raw.githubusercontent.com/EOSIO/eosio.contracts/master/contracts/icons/token.png#207ff68b0406eaa56618b08bda81d6a0954543f36adc328ab3065f31a5c5d654 21 | --- 22 | 23 | {{$action.account}} agrees to create a new token with symbol {{asset_to_symbol_code maximum_supply}} to be managed by {{issuer}}. 24 | 25 | This action will not result any any tokens being issued into circulation. 26 | 27 | {{issuer}} will be allowed to issue tokens into circulation, up to a maximum supply of {{maximum_supply}}. 28 | 29 | RAM will deducted from {{$action.account}}’s resources to create the necessary records. 30 | 31 |

issue

32 | 33 | --- 34 | spec_version: "0.2.0" 35 | title: Issue Tokens into Circulation 36 | summary: 'Issue {{nowrap quantity}} into circulation and transfer into {{nowrap to}}’s account' 37 | icon: https://raw.githubusercontent.com/EOSIO/eosio.contracts/master/contracts/icons/token.png#207ff68b0406eaa56618b08bda81d6a0954543f36adc328ab3065f31a5c5d654 38 | --- 39 | 40 | The token manager agrees to issue {{quantity}} into circulation, and transfer it into {{to}}’s account. 41 | 42 | {{#if memo}}There is a memo attached to the transfer stating: 43 | {{memo}} 44 | {{/if}} 45 | 46 | If {{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. 47 | 48 | This action does not allow the total quantity to exceed the max allowed supply of the token. 49 | 50 |

open

51 | 52 | --- 53 | spec_version: "0.2.0" 54 | title: Open Token Balance 55 | summary: 'Open a zero quantity balance for {{nowrap owner}}' 56 | icon: https://raw.githubusercontent.com/EOSIO/eosio.contracts/master/contracts/icons/token.png#207ff68b0406eaa56618b08bda81d6a0954543f36adc328ab3065f31a5c5d654 57 | --- 58 | 59 | {{ram_payer}} agrees to establish a zero quantity balance for {{owner}} for the {{symbol_to_symbol_code symbol}} token. 60 | 61 | If {{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. 62 | 63 |

retire

64 | 65 | --- 66 | spec_version: "0.2.0" 67 | title: Remove Tokens from Circulation 68 | summary: 'Remove {{nowrap quantity}} from circulation' 69 | icon: https://raw.githubusercontent.com/EOSIO/eosio.contracts/master/contracts/icons/token.png#207ff68b0406eaa56618b08bda81d6a0954543f36adc328ab3065f31a5c5d654 70 | --- 71 | 72 | The token manager agrees to remove {{quantity}} from circulation, taken from their own account. 73 | 74 | {{#if memo}} There is a memo attached to the action stating: 75 | {{memo}} 76 | {{/if}} 77 | 78 |

transfer

79 | 80 | --- 81 | spec_version: "0.2.0" 82 | title: Transfer Tokens 83 | summary: 'Send {{nowrap quantity}} from {{nowrap from}} to {{nowrap to}}' 84 | icon: https://raw.githubusercontent.com/EOSIO/eosio.contracts/master/contracts/icons/transfer.png#5dfad0df72772ee1ccc155e670c1d124f5c5122f1d5027565df38b418042d1dd 85 | --- 86 | 87 | {{from}} agrees to send {{quantity}} to {{to}}. 88 | 89 | {{#if memo}}There is a memo attached to the transfer stating: 90 | {{memo}} 91 | {{/if}} 92 | 93 | If {{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. 94 | 95 | If {{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. 96 | -------------------------------------------------------------------------------- /tests/test_contracts/old_versions/v1.2.1/eosio.msig/eosio.msig.abi: -------------------------------------------------------------------------------- 1 | { 2 | "version": "eosio::abi/1.0", 3 | "types": [{ 4 | "new_type_name": "account_name", 5 | "type": "name" 6 | },{ 7 | "new_type_name": "permission_name", 8 | "type": "name" 9 | },{ 10 | "new_type_name": "action_name", 11 | "type": "name" 12 | }], 13 | "structs": [{ 14 | "name": "permission_level", 15 | "base": "", 16 | "fields": [ 17 | {"name": "actor", "type": "account_name"}, 18 | {"name": "permission", "type": "permission_name"} 19 | ] 20 | },{ 21 | "name": "action", 22 | "base": "", 23 | "fields": [ 24 | {"name": "account", "type": "account_name"}, 25 | {"name": "name", "type": "action_name"}, 26 | {"name": "authorization", "type": "permission_level[]"}, 27 | {"name": "data", "type": "bytes"} 28 | ] 29 | },{ 30 | "name": "transaction_header", 31 | "base": "", 32 | "fields": [ 33 | {"name": "expiration", "type": "time_point_sec"}, 34 | {"name": "ref_block_num", "type": "uint16"}, 35 | {"name": "ref_block_prefix", "type": "uint32"}, 36 | {"name": "max_net_usage_words", "type": "varuint32"}, 37 | {"name": "max_cpu_usage_ms", "type": "uint8"}, 38 | {"name": "delay_sec", "type": "varuint32"} 39 | ] 40 | },{ 41 | "name": "extension", 42 | "base": "", 43 | "fields": [ 44 | {"name": "type", "type" : "uint16" }, 45 | {"name": "data", "type": "bytes"} 46 | ] 47 | },{ 48 | "name": "transaction", 49 | "base": "transaction_header", 50 | "fields": [ 51 | {"name": "context_free_actions", "type": "action[]"}, 52 | {"name": "actions", "type": "action[]"}, 53 | {"name": "transaction_extensions", "type": "extension[]"} 54 | ] 55 | },{ 56 | "name": "propose", 57 | "base": "", 58 | "fields": [ 59 | {"name":"proposer", "type":"account_name"}, 60 | {"name":"proposal_name", "type":"name"}, 61 | {"name":"requested", "type":"permission_level[]"}, 62 | {"name":"trx", "type":"transaction"} 63 | ] 64 | },{ 65 | "name": "approve", 66 | "base": "", 67 | "fields": [ 68 | {"name":"proposer", "type":"account_name"}, 69 | {"name":"proposal_name", "type":"name"}, 70 | {"name":"level", "type":"permission_level"} 71 | ] 72 | },{ 73 | "name": "unapprove", 74 | "base": "", 75 | "fields": [ 76 | {"name":"proposer", "type":"account_name"}, 77 | {"name":"proposal_name", "type":"name"}, 78 | {"name":"level", "type":"permission_level"} 79 | ] 80 | },{ 81 | "name": "cancel", 82 | "base": "", 83 | "fields": [ 84 | {"name":"proposer", "type":"account_name"}, 85 | {"name":"proposal_name", "type":"name"}, 86 | {"name":"canceler", "type":"account_name"} 87 | ] 88 | },{ 89 | "name": "exec", 90 | "base": "", 91 | "fields": [ 92 | {"name":"proposer", "type":"account_name"}, 93 | {"name":"proposal_name", "type":"name"}, 94 | {"name":"executer", "type":"account_name"} 95 | ] 96 | },{ 97 | "name": "proposal", 98 | "base": "", 99 | "fields": [ 100 | {"name": "proposal_name", "type": "name"}, 101 | {"name": "packed_transaction", "type": "bytes"} 102 | ] 103 | },{ 104 | "name": "approvals_info", 105 | "base": "", 106 | "fields": [ 107 | {"name": "proposal_name", "type": "name"}, 108 | {"name": "requested_approvals", "type": "permission_level[]"}, 109 | {"name": "provided_approvals", "type": "permission_level[]"} 110 | ] 111 | } 112 | ], 113 | "actions": [{ 114 | "name": "propose", 115 | "type": "propose", 116 | "ricardian_contract": "" 117 | },{ 118 | "name": "approve", 119 | "type": "approve", 120 | "ricardian_contract": "" 121 | },{ 122 | "name": "unapprove", 123 | "type": "unapprove", 124 | "ricardian_contract": "" 125 | }, { 126 | "name": "cancel", 127 | "type": "cancel", 128 | "ricardian_contract": "" 129 | }, { 130 | "name": "exec", 131 | "type": "exec", 132 | "ricardian_contract": "" 133 | } 134 | 135 | ], 136 | "tables": [{ 137 | "name": "proposal", 138 | "type": "proposal", 139 | "index_type": "i64", 140 | "key_names" : ["proposal_name"], 141 | "key_types" : ["name"] 142 | },{ 143 | "name": "approvals", 144 | "type": "approvals_info", 145 | "index_type": "i64", 146 | "key_names" : ["proposal_name"], 147 | "key_types" : ["name"] 148 | } 149 | ], 150 | "ricardian_clauses": [], 151 | "abi_extensions": [] 152 | } 153 | -------------------------------------------------------------------------------- /contracts/eosio.proton/ricardian/eosio.proton.contracts.md.in: -------------------------------------------------------------------------------- 1 |

setperm2

2 | 3 | --- 4 | spec_version: "0.2.0" 5 | title: setperm2 6 | summary: 'setperm2' 7 | icon: @ICON_BASE_URL@/@ACCOUNT_ICON_URI@ 8 | --- 9 | Initializes permissions for account {{acc}} for whitelisted EOSIO functionality. 10 | 11 | 12 | 13 |

setperm

14 | 15 | --- 16 | spec_version: "0.2.0" 17 | title: setperm 18 | summary: 'setperm' 19 | icon: @ICON_BASE_URL@/@ACCOUNT_ICON_URI@ 20 | --- 21 | Initializes permissions for account {{acc}} for whitelisted EOSIO functionality. (no longer used) 22 | 23 | 24 |

setuserava

25 | 26 | --- 27 | spec_version: "0.2.0" 28 | title: setuserava 29 | summary: 'setuserava' 30 | icon: @ICON_BASE_URL@/@ACCOUNT_ICON_URI@ 31 | --- 32 | Set or update avatar for account {{acc}} 33 | 34 | 35 | 36 |

setusername

37 | 38 | --- 39 | spec_version: "0.2.0" 40 | title: setusername 41 | summary: 'setusername' 42 | icon: @ICON_BASE_URL@/@ACCOUNT_ICON_URI@ 43 | --- 44 | Set or update nickname for account {{acc}} 45 | 46 | 47 | 48 |

userverify

49 | 50 | --- 51 | spec_version: "0.2.0" 52 | title: userverify 53 | summary: 'userverify' 54 | icon: @ICON_BASE_URL@/@ACCOUNT_ICON_URI@ 55 | --- 56 | Adds identity verification for {{acc}} by verification authority {{verifier}} 57 | 58 | 59 | 60 |

updateraccs

61 | 62 | --- 63 | spec_version: "0.2.0" 64 | title: updateraccs 65 | summary: 'updateraccs' 66 | icon: @ICON_BASE_URL@/@ACCOUNT_ICON_URI@ 67 | --- 68 | Updates a whitelist of accounts for user {{acc}} for additional security. 69 | 70 | 71 | 72 |

updateaacts

73 | 74 | --- 75 | spec_version: "0.2.0" 76 | title: updateaacts 77 | summary: 'updateaacts' 78 | icon: @ICON_BASE_URL@/@ACCOUNT_ICON_URI@ 79 | --- 80 | Updates a whitelist of actions for user {{acc}} for additional security. 81 | 82 | 83 | 84 |

updateac

85 | 86 | --- 87 | spec_version: "0.2.0" 88 | title: updateac 89 | summary: 'updateac' 90 | icon: @ICON_BASE_URL@/@ACCOUNT_ICON_URI@ 91 | --- 92 | Updates a whitelist of tokens for user {{acc}} for additional security. 93 | 94 | 95 | 96 |

reqperm

97 | 98 | --- 99 | spec_version: "0.2.0" 100 | title: reqperm 101 | summary: 'reqperm' 102 | icon: @ICON_BASE_URL@/@ACCOUNT_ICON_URI@ 103 | --- 104 | Request Permissions for {{acc}} for whitelisted Proton actions 105 | 106 | 107 | 108 |

remove

109 | 110 | --- 111 | spec_version: "0.2.0" 112 | title: remove 113 | summary: 'remove' 114 | icon: @ICON_BASE_URL@/@ACCOUNT_ICON_URI@ 115 | --- 116 | Removes user info data for {{acc}} 117 | 118 |

newaccres

119 | 120 | --- 121 | spec_version: "0.2.0" 122 | title: newaccres 123 | summary: 'newaccres' 124 | icon: @ICON_BASE_URL@/@ACCOUNT_ICON_URI@ 125 | --- 126 | 127 | Give resources to new account 128 | 129 | 130 |

kickbp

131 | 132 | --- 133 | spec_version: "0.2.0" 134 | title: kickbp 135 | summary: 'kickbp' 136 | icon: @ICON_BASE_URL@/@ADMIN_ICON_URI@ 137 | --- 138 | Removes the ability of account {{producer}} to register as a block producer. This is probably called from kickbp in eosio.system. 139 | 140 | 141 | 142 |

addkyc

143 | 144 | --- 145 | spec_version: "0.2.0" 146 | title: addkyc 147 | summary: 'addkyc' 148 | icon: @ICON_BASE_URL@/@ACCOUNT_ICON_URI@ 149 | --- 150 | Adds KYC approval to account {{acc}} from kyc provider {{kyc}} 151 | 152 | 153 | 154 |

updatekyc

155 | 156 | --- 157 | spec_version: "0.2.0" 158 | title: updatekyc 159 | summary: 'updatekyc' 160 | icon: @ICON_BASE_URL@/@ACCOUNT_ICON_URI@ 161 | --- 162 | Updates KYC approval for account {{acc}} from kyc provider {{kyc}} 163 | 164 | 165 | 166 |

removekyc

167 | 168 | --- 169 | spec_version: "0.2.0" 170 | title: removekyc 171 | summary: 'removekyc' 172 | icon: @ICON_BASE_URL@/@ACCOUNT_ICON_URI@ 173 | --- 174 | Removes KYC approval for account {{acc}} from kyc provider {{kyc}} 175 | 176 | 177 | 178 |

addkycprov

179 | 180 | --- 181 | spec_version: "0.2.0" 182 | title: addkycprov 183 | summary: 'addkycprov' 184 | icon: @ICON_BASE_URL@/@ACCOUNT_ICON_URI@ 185 | --- 186 | Adds {{kyc_provider}} as a kyc_provider 187 | 188 | 189 | 190 |

blkycprov

191 | 192 | --- 193 | spec_version: "0.2.0" 194 | title: blkycprov 195 | summary: 'blkycprov' 196 | icon: @ICON_BASE_URL@/@ACCOUNT_ICON_URI@ 197 | --- 198 | Blacklists KYC provider {{kyc_provider}} 199 | 200 | 201 | 202 |

rmvkycprov

203 | 204 | --- 205 | spec_version: "0.2.0" 206 | title: rmvkycprov 207 | summary: 'rmvkycprov' 208 | icon: @ICON_BASE_URL@/@ACCOUNT_ICON_URI@ 209 | --- 210 | Removes KYC provider {{kyc_provider}} 211 | 212 | -------------------------------------------------------------------------------- /docs/03_guides/05_how-to-create-issue-and-transfer-a-token.md: -------------------------------------------------------------------------------- 1 | ## How to create, issue and transfer a token 2 | 3 | ## Step 1: Obtain Contract Source 4 | 5 | Navigate to your contracts directory. 6 | 7 | ```text 8 | cd CONTRACTS_DIR 9 | ``` 10 | 11 | Pull the source 12 | ```text 13 | git clone https://github.com/EOSIO/eosio.contracts --branch master --single-branch 14 | ``` 15 | 16 | ```text 17 | cd eosio.contracts/contracts/eosio.token 18 | ``` 19 | 20 | ## Step 2: Create Account for Contract 21 | [[info]] 22 | | You may have to unlock your wallet first! 23 | 24 | ```shell 25 | cleos create account eosio eosio.token EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV 26 | ``` 27 | 28 | ## Step 3: Compile the Contract 29 | 30 | ```shell 31 | eosio-cpp -I include -o eosio.token.wasm src/eosio.token.cpp --abigen 32 | ``` 33 | 34 | ## Step 4: Deploy the Token Contract 35 | 36 | ```shell 37 | cleos set contract eosio.token CONTRACTS_DIR/eosio.contracts/contracts/eosio.token --abi eosio.token.abi -p eosio.token@active 38 | ``` 39 | 40 | Result should look similar to the one below: 41 | ```shell 42 | Reading WASM from ... 43 | Publishing contract... 44 | executed transaction: 69c68b1bd5d61a0cc146b11e89e11f02527f24e4b240731c4003ad1dc0c87c2c 9696 bytes 6290 us 45 | # eosio <= eosio::setcode {"account":"eosio.token","vmtype":0,"vmversion":0,"code":"0061736d0100000001aa011c60037f7e7f0060047f... 46 | # eosio <= eosio::setabi {"account":"eosio.token","abi":"0e656f73696f3a3a6162692f312e30000605636c6f73650002056f776e6572046e61... 47 | warning: transaction executed locally, but may not be confirmed by the network yet ] 48 | ``` 49 | 50 | ## Step 5: Create the Token 51 | 52 | ```shell 53 | cleos push action eosio.token create '[ "eosio", "1000000000.0000 SYS"]' -p eosio.token@active 54 | ``` 55 | 56 | Result should look similar to the one below: 57 | ```shell 58 | executed transaction: 0e49a421f6e75f4c5e09dd738a02d3f51bd18a0cf31894f68d335cd70d9c0e12 120 bytes 1000 cycles 59 | # eosio.token <= eosio.token::create {"issuer":"eosio","maximum_supply":"1000000000.0000 SYS"} 60 | ``` 61 | 62 | An alternate approach uses named arguments: 63 | 64 | ```shell 65 | cleos push action eosio.token create '{"issuer":"eosio", "maximum_supply":"1000000000.0000 SYS"}' -p eosio.token@active 66 | ``` 67 | 68 | Result should look similar to the one below: 69 | ```shell 70 | executed transaction: 0e49a421f6e75f4c5e09dd738a02d3f51bd18a0cf31894f68d335cd70d9c0e12 120 bytes 1000 cycles 71 | # eosio.token <= eosio.token::create {"issuer":"eosio","maximum_supply":"1000000000.0000 SYS"} 72 | ``` 73 | This command created a new token `SYS` with a precision of 4 decimals and a maximum supply of 1000000000.0000 SYS. To create this token requires the permission of the `eosio.token` contract. For this reason, `-p eosio.token@active` was passed to authorize the request. 74 | 75 | ## Step 6: Issue Tokens 76 | 77 | The issuer can issue new tokens to the issuer account in our case `eosio`. 78 | 79 | ```text 80 | cleos push action eosio.token issue '[ "eosio", "100.0000 SYS", "memo" ]' -p eosio@active 81 | ``` 82 | 83 | Result should look similar to the one below: 84 | ```shell 85 | executed transaction: a26b29d66044ad95edf0fc04bad3073e99718bc26d27f3c006589adedb717936 128 bytes 337 us 86 | # eosio.token <= eosio.token::issue {"to":"eosio","quantity":"100.0000 SYS","memo":"memo"} 87 | warning: transaction executed locally, but may not be confirmed by the network yet ] 88 | ``` 89 | 90 | ## Step 7: Transfer Tokens 91 | 92 | Now that account `eosio` has been issued tokens, transfer some of them to account `bob`. 93 | 94 | ```shell 95 | cleos push action eosio.token transfer '[ "eosio", "bob", "25.0000 SYS", "m" ]' -p eosio@active 96 | ``` 97 | 98 | Result should look similar to the one below: 99 | ```text 100 | executed transaction: 60d334850151cb95c35fe31ce2e8b536b51441c5fd4c3f2fea98edcc6d69f39d 128 bytes 497 us 101 | # eosio.token <= eosio.token::transfer {"from":"eosio","to":"bob","quantity":"25.0000 SYS","memo":"m"} 102 | # eosio <= eosio.token::transfer {"from":"eosio","to":"bob","quantity":"25.0000 SYS","memo":"m"} 103 | # bob <= eosio.token::transfer {"from":"eosio","to":"bob","quantity":"25.0000 SYS","memo":"m"} 104 | warning: transaction executed locally, but may not be confirmed by the network yet ] 105 | ``` 106 | Now check if "bob" got the tokens using [cleos get currency balance](https://developers.eos.io/eosio-cleos/reference#currency-balance) 107 | 108 | ```shell 109 | cleos get currency balance eosio.token bob SYS 110 | ``` 111 | 112 | Result: 113 | ```text 114 | 25.00 SYS 115 | ``` 116 | 117 | Check "eosio's" balance, notice that tokens were deducted from the account 118 | 119 | ```shell 120 | cleos get currency balance eosio.token eosio SYS 121 | ``` 122 | 123 | Result: 124 | ```text 125 | 75.00 SYS 126 | ``` 127 | -------------------------------------------------------------------------------- /contracts/eosio.proton/ricardian/eosio.proton.clauses.md: -------------------------------------------------------------------------------- 1 |

Warranty

2 | The invoker of the contract action shall uphold its Obligations under this Contract in a timely and workmanlike manner, using knowledge and recommendations for performing the services which meet generally acceptable standards set forth by EOS.IO Blockchain Block Producers. 3 | 4 |

Default

5 | The occurrence of any of the following shall constitute a material default under this Contract: 6 | 7 |

Remedies

8 | In addition to any and all other rights a party may have available according to law, if a party defaults by failing to substantially perform any provision, term or condition of this Contract, the other party may terminate the Contract by providing written notice to the defaulting party. This notice shall describe with sufficient detail the nature of the default. The party receiving such notice shall promptly be removed from being a Block Producer and this Contract shall be automatically terminated. 9 | 10 |

ForceMajeure

11 | If performance of this Contract or any obligation under this Contract is prevented, restricted, or interfered with by causes beyond either party's reasonable control ("Force Majeure"), and if the party unable to carry out its obligations gives the other party prompt written notice of such event, then the obligations of the party invoking this provision shall be suspended to the extent necessary by such event. The term Force Majeure shall include, without limitation, acts of God, fire, explosion, vandalism, storm or other similar occurrence, orders or acts of military or civil authority, or by national emergencies, insurrections, riots, or wars, or strikes, lock-outs, work stoppages, or supplier failures. The excused party shall use reasonable efforts under the circumstances to avoid or remove such causes of non-performance and shall proceed to perform with reasonable dispatch whenever such causes are removed or ceased. An act or omission shall be deemed within the reasonable control of a party if committed, omitted, or caused by such party, or its employees, officers, agents, or affiliates. 12 | 13 |

DisputeResolution

14 | Any controversies or disputes arising out of or relating to this Contract will be resolved by binding arbitration under the default rules set forth by the EOS.IO Blockchain. The arbitrator's award will be final, and judgment may be entered upon it by any court having proper jurisdiction. 15 | 16 |

EntireAgreement

17 | This Contract contains the entire agreement of the parties, and there are no other promises or conditions in any other agreement whether oral or written concerning the subject matter of this Contract. This Contract supersedes any prior written or oral agreements between the parties. 18 | 19 |

Severability

20 | If any provision of this Contract will be held to be invalid or unenforceable for any reason, the remaining provisions will continue to be valid and enforceable. If a court finds that any provision of this Contract is invalid or unenforceable, but that by limiting such provision it would become valid and enforceable, then such provision will be deemed to be written, construed, and enforced as so limited. 21 | 22 |

Amendment

23 | This Contract may be modified or amended in writing by mutual agreement between the parties, if the writing is signed by the party obligated under the amendment. 24 | 25 |

GoverningLaw

26 | This Contract shall be construed in accordance with the Maxims of Equity. 27 | 28 |

Notice

29 | Any notice or communication required or permitted under this Contract shall be sufficiently given if delivered to a verifiable email address or to such other email address as one party may have publicly furnished in writing, or published on a broadcast contract provided by this blockchain for purposes of providing notices of this type. 30 | 31 |

WaiverOfContractualRight

32 | The failure of either party to enforce any provision of this Contract shall not be construed as a waiver or limitation of that party's right to subsequently enforce and compel strict compliance with every provision of this Contract. 33 | 34 |

ArbitratorsFees_

35 | In any action arising hereunder or any separate action pertaining to the validity of this Agreement, both sides shall pay half the initial cost of arbitration, and the prevailing party shall be awarded reasonable arbitrator's fees and costs. 36 | 37 |

ConstructionAndInterpretation

38 | The rule requiring construction or interpretation against the drafter is waived. The document shall be deemed as if it were drafted by both parties in a mutual effort. 39 | 40 |

InWitnessWhereof

41 | In witness whereof, the parties hereto have caused this Agreement to be executed by themselves or their duly authorized representatives as of the date of execution, and authorized as proven by the cryptographic signature on the transaction that invokes this contract. 42 | 43 | 44 | -------------------------------------------------------------------------------- /contracts/eosio.assert/src/eosio.assert.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | namespace assert_contract { 8 | 9 | using bytes = std::vector; 10 | 11 | bytes get_action_bytes() { 12 | bytes result(action_data_size()); 13 | read_action_data(result.data(), result.size()); 14 | return result; 15 | } 16 | 17 | struct[[eosio::contract("eosio.assert")]] asserter : eosio::contract { 18 | using contract::contract; 19 | 20 | manifests manifest_table{get_self(), get_self().value}; 21 | manifests_id_index manifest_id_idx = manifest_table.get_index<"id"_n>(); 22 | chains chain_table{get_self(), get_self().value}; 23 | stored_chain_params chain = chain_table.get_or_default(); 24 | 25 | [[eosio::action]] void setchain(ignore chain_id, ignore chain_name, ignore icon) { 26 | require_auth("eosio"_n); 27 | auto hash = eosio::sha256(_ds.pos(), _ds.remaining()); 28 | _ds >> chain.chain_id; 29 | _ds >> chain.chain_name; 30 | _ds >> chain.icon; 31 | chain.hash = hash; 32 | chain_table.set(chain, get_self()); 33 | }; 34 | 35 | [[eosio::action("add.manifest")]] void add_manifest( 36 | ignore account, ignore domain, ignore appmeta, 37 | ignore> whitelist) { 38 | auto hash = eosio::sha256(_ds.pos(), _ds.remaining()); 39 | auto stored = stored_manifest{ 40 | .unique_id = chain.next_unique_id++, 41 | .id = hash, 42 | }; 43 | _ds >> stored.account; 44 | _ds >> stored.domain; 45 | _ds >> stored.appmeta; 46 | _ds >> stored.whitelist; 47 | 48 | require_auth(stored.account); 49 | auto it = manifest_id_idx.find(stored.id_key()); 50 | check(it == manifest_id_idx.end(), "manifest already present"); 51 | manifest_table.emplace(stored.account, [&](auto& x) { x = stored; }); 52 | chain_table.set(chain, get_self()); 53 | }; 54 | 55 | [[eosio::action("del.manifest")]] void del_manifest(checksum256 id) { 56 | auto it = manifest_id_idx.find(id); 57 | check(it != manifest_id_idx.end(), "manifest not found"); 58 | require_auth(it->account); 59 | manifest_id_idx.erase(it); 60 | }; 61 | 62 | bool in(contract_action action, const std::vector& actions) { 63 | return std::find(actions.begin(), actions.end(), action) != actions.end() || // 64 | std::find(actions.begin(), actions.end(), contract_action{action.contract, name{0}}) != actions.end() || 65 | std::find(actions.begin(), actions.end(), contract_action{name{0}, action.action}) != actions.end() || 66 | std::find(actions.begin(), actions.end(), contract_action{name{0}, name{0}}) != actions.end(); 67 | } 68 | 69 | static std::string hash_to_str(const checksum256& hash) { 70 | static const char table[] = "0123456789abcdef"; 71 | auto bytes = hash.extract_as_byte_array(); 72 | std::string result; 73 | for (uint8_t byte : bytes) { 74 | result += table[byte >> 4]; 75 | result += table[byte & 0xf]; 76 | } 77 | return result; 78 | } 79 | 80 | [[eosio::action()]] void require( 81 | const checksum256& chain_params_hash, const checksum256& manifest_id, const vector& actions, 82 | const vector& abi_hashes) { 83 | if (!(chain_params_hash == chain.hash)) 84 | check( 85 | false, 86 | ("chain hash is " + hash_to_str(chain.hash) + " but user expected " + hash_to_str(chain_params_hash)) 87 | .c_str()); 88 | auto it = manifest_id_idx.find(manifest_id); 89 | check(it != manifest_id_idx.end(), "manifest not found"); 90 | std::vector contracts; 91 | for (auto& action : actions) { 92 | auto contract_it = std::lower_bound(contracts.begin(), contracts.end(), action.contract); 93 | if (contract_it == contracts.end() || *contract_it != action.contract) 94 | contracts.insert(contract_it, action.contract); 95 | if (!in(action, it->whitelist)) 96 | check( 97 | false, 98 | (action.action.to_string() + "@" + action.contract.to_string() + " is not in whitelist").c_str()); 99 | } 100 | abi_hash_table table{"eosio"_n, "eosio"_n.value}; 101 | check(abi_hashes.size() == contracts.size(), "incorrect number of abi hashes"); 102 | for (size_t i = 0; i < abi_hashes.size(); ++i) { 103 | auto it = table.find(contracts[i].value); 104 | checksum256 hash{}; 105 | if (it != table.end()) 106 | hash = it->hash; 107 | if (!(abi_hashes[i] == hash)) 108 | check( 109 | false, (contracts[i].to_string() + " abi hash is " + hash_to_str(hash) + " but user expected " + 110 | hash_to_str(abi_hashes[i])) 111 | .c_str()); 112 | } 113 | } 114 | }; 115 | 116 | } // namespace assert_contract 117 | -------------------------------------------------------------------------------- /scripts/helper.sh: -------------------------------------------------------------------------------- 1 | # Ensures passed in version values are supported. 2 | function check-version-numbers() { 3 | CHECK_VERSION_MAJOR=$1 4 | CHECK_VERSION_MINOR=$2 5 | 6 | if [[ $CHECK_VERSION_MAJOR -lt $EOSIO_MIN_VERSION_MAJOR ]]; then 7 | exit 1 8 | fi 9 | if [[ $CHECK_VERSION_MAJOR -gt $EOSIO_MAX_VERSION_MAJOR ]]; then 10 | exit 1 11 | fi 12 | if [[ $CHECK_VERSION_MAJOR -eq $EOSIO_MIN_VERSION_MAJOR ]]; then 13 | if [[ $CHECK_VERSION_MINOR -lt $EOSIO_MIN_VERSION_MINOR ]]; then 14 | exit 1 15 | fi 16 | fi 17 | if [[ $CHECK_VERSION_MAJOR -eq $EOSIO_MAX_VERSION_MAJOR ]]; then 18 | if [[ $CHECK_VERSION_MINOR -gt $EOSIO_MAX_VERSION_MINOR ]]; then 19 | exit 1 20 | fi 21 | fi 22 | exit 0 23 | } 24 | 25 | 26 | # Handles choosing which EOSIO directory to select when the default location is used. 27 | function default-eosio-directories() { 28 | REGEX='^[0-9]+([.][0-9]+)?$' 29 | ALL_EOSIO_SUBDIRS=() 30 | if [[ -d ${HOME}/eosio ]]; then 31 | ALL_EOSIO_SUBDIRS=($(ls ${HOME}/eosio | sort -V)) 32 | fi 33 | for ITEM in "${ALL_EOSIO_SUBDIRS[@]}"; do 34 | if [[ "$ITEM" =~ $REGEX ]]; then 35 | DIR_MAJOR=$(echo $ITEM | cut -f1 -d '.') 36 | DIR_MINOR=$(echo $ITEM | cut -f2 -d '.') 37 | if $(check-version-numbers $DIR_MAJOR $DIR_MINOR); then 38 | PROMPT_EOSIO_DIRS+=($ITEM) 39 | fi 40 | fi 41 | done 42 | for ITEM in "${PROMPT_EOSIO_DIRS[@]}"; do 43 | if [[ "$ITEM" =~ $REGEX ]]; then 44 | EOSIO_VERSION=$ITEM 45 | fi 46 | done 47 | } 48 | 49 | 50 | # Prompts or sets default behavior for choosing EOSIO directory. 51 | function eosio-directory-prompt() { 52 | if [[ -z $EOSIO_DIR_PROMPT ]]; then 53 | default-eosio-directories; 54 | echo 'No EOSIO location was specified.' 55 | while true; do 56 | if [[ $NONINTERACTIVE != true ]]; then 57 | if [[ -z $EOSIO_VERSION ]]; then 58 | echo "No default EOSIO installations detected..." 59 | PROCEED=n 60 | else 61 | printf "Is EOSIO installed in the default location: $HOME/eosio/$EOSIO_VERSION (y/n)" && read -p " " PROCEED 62 | fi 63 | fi 64 | echo "" 65 | case $PROCEED in 66 | "" ) 67 | echo "Is EOSIO installed in the default location?";; 68 | 0 | true | [Yy]* ) 69 | break;; 70 | 1 | false | [Nn]* ) 71 | if [[ $PROMPT_EOSIO_DIRS ]]; then 72 | echo "Found these compatible EOSIO versions in the default location." 73 | printf "$HOME/eosio/%s\n" "${PROMPT_EOSIO_DIRS[@]}" 74 | fi 75 | printf "Enter the installation location of EOSIO:" && read -e -p " " EOSIO_DIR_PROMPT; 76 | EOSIO_DIR_PROMPT="${EOSIO_DIR_PROMPT/#\~/$HOME}" 77 | break;; 78 | * ) 79 | echo "Please type 'y' for yes or 'n' for no.";; 80 | esac 81 | done 82 | fi 83 | export EOSIO_INSTALL_DIR="${EOSIO_DIR_PROMPT:-${HOME}/eosio/${EOSIO_VERSION}}" 84 | } 85 | 86 | 87 | # Prompts or default behavior for choosing EOSIO.CDT directory. 88 | function cdt-directory-prompt() { 89 | if [[ -z $CDT_DIR_PROMPT ]]; then 90 | echo 'No EOSIO.CDT location was specified.' 91 | while true; do 92 | if [[ $NONINTERACTIVE != true ]]; then 93 | printf "Is EOSIO.CDT installed in the default location? /usr/local/eosio.cdt (y/n)" && read -p " " PROCEED 94 | fi 95 | echo "" 96 | case $PROCEED in 97 | "" ) 98 | echo "Is EOSIO.CDT installed in the default location?";; 99 | 0 | true | [Yy]* ) 100 | break;; 101 | 1 | false | [Nn]* ) 102 | printf "Enter the installation location of EOSIO.CDT:" && read -e -p " " CDT_DIR_PROMPT; 103 | CDT_DIR_PROMPT="${CDT_DIR_PROMPT/#\~/$HOME}" 104 | break;; 105 | * ) 106 | echo "Please type 'y' for yes or 'n' for no.";; 107 | esac 108 | done 109 | fi 110 | export CDT_INSTALL_DIR="${CDT_DIR_PROMPT:-/usr/local/eosio.cdt}" 111 | } 112 | 113 | 114 | # Ensures EOSIO is installed and compatible via version listed in tests/CMakeLists.txt. 115 | function nodeos-version-check() { 116 | INSTALLED_VERSION=$(echo $($EOSIO_INSTALL_DIR/bin/nodeos --version)) 117 | INSTALLED_VERSION_MAJOR=$(echo $INSTALLED_VERSION | cut -f1 -d '.' | sed 's/v//g') 118 | INSTALLED_VERSION_MINOR=$(echo $INSTALLED_VERSION | cut -f2 -d '.' | sed 's/v//g') 119 | 120 | if [[ -z $INSTALLED_VERSION_MAJOR || -z $INSTALLED_VERSION_MINOR ]]; then 121 | echo "Could not determine EOSIO version. Exiting..." 122 | exit 1; 123 | fi 124 | 125 | if $(check-version-numbers $INSTALLED_VERSION_MAJOR $INSTALLED_VERSION_MINOR); then 126 | if [[ $INSTALLED_VERSION_MAJOR -gt $EOSIO_SOFT_MAX_MAJOR ]]; then 127 | echo "Detected EOSIO version is greater than recommended soft max: $EOSIO_SOFT_MAX_MAJOR.$EOSIO_SOFT_MAX_MINOR. Proceed with caution." 128 | fi 129 | if [[ $INSTALLED_VERSION_MAJOR -eq $EOSIO_SOFT_MAX_MAJOR && $INSTALLED_VERSION_MINOR -gt $EOSIO_SOFT_MAX_MINOR ]]; then 130 | echo "Detected EOSIO version is greater than recommended soft max: $EOSIO_SOFT_MAX_MAJOR.$EOSIO_SOFT_MAX_MINOR. Proceed with caution." 131 | fi 132 | else 133 | echo "Supported versions are: $EOSIO_MIN_VERSION_MAJOR.$EOSIO_MIN_VERSION_MINOR - $EOSIO_MAX_VERSION_MAJOR.$EOSIO_MAX_VERSION_MINOR" 134 | echo "Invalid EOSIO installation. Exiting..." 135 | exit 1; 136 | fi 137 | } 138 | -------------------------------------------------------------------------------- /IMPORTANT.md: -------------------------------------------------------------------------------- 1 | # Important Notice 2 | 3 | We (block.one and its affiliates) make available EOSIO and other software, updates, patches and documentation (collectively, Software) on a voluntary basis as a member of the EOSIO community. A condition of you accessing any Software, websites, articles, media, publications, documents or other material (collectively, Material) is your acceptance of the terms of this important notice. 4 | 5 | ## Software 6 | We are not responsible for ensuring the overall performance of Software or any related applications. Any test results or performance figures are indicative and will not reflect performance under all conditions. Software may contain components that are open sourced and subject to their own licenses; you are responsible for ensuring your compliance with those licenses. 7 | 8 | We make no representation, warranty, guarantee or undertaking in respect of Software, whether expressed or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose and noninfringement. In no event shall we be liable for any claim, damages or other liability, whether in an action of contract, tort or otherwise, arising from, out of or in connection with the Software or the use or other dealings in the Software. 9 | 10 | Wallets and related components are complex software that require the highest levels of security. If incorrectly built or used, they may compromise users’ private keys and digital assets. Wallet applications and related components should undergo thorough security evaluations before being used. Only experienced developers should work with such Software. 11 | 12 | Material is not made available to any person or entity that is the subject of sanctions administered or enforced by any country or government or otherwise designated on any list of prohibited or restricted parties (including but not limited to the lists maintained by the United Nations Security Council, the U.S. Government, the European Union or its Member States, or other applicable government authority) or organized or resident in a country or territory that is the subject of country-wide or territory-wide sanctions. You represent and warrant that neither you nor any party having a direct or indirect beneficial interest in you or on whose behalf you are acting as agent or nominee is such a person or entity and you will comply with all applicable import, re-import, sanctions, anti-boycott, export, and re-export control laws and regulations. If this is not accurate or you do not agree, then you must immediately cease accessing our Material and delete all copies of Software. 13 | 14 | Any person using or offering Software in connection with providing software, goods or services to third parties shall advise such third parties of this important notice, including all limitations, restrictions and exclusions of liability. 15 | 16 | ## Trademarks 17 | Block.one, EOSIO, EOS, the heptahedron and associated logos and related marks are our trademarks. Other trademarks referenced in Material are the property of their respective owners. 18 | 19 | ## Third parties 20 | Any reference in Material to any third party or third-party product, resource or service is not an endorsement or recommendation by Block.one. We are not responsible for, and disclaim any and all responsibility and liability for, your use of or reliance on any of these resources. Third-party resources may be updated, changed or terminated at any time, so information in Material may be out of date or inaccurate. 21 | 22 | ## Forward-looking statements 23 | Please note that in making statements expressing Block.one’s vision, we do not guarantee anything, and all aspects of our vision are subject to change at any time and in all respects at Block.one’s sole discretion, with or without notice. We call these “forward-looking statements”, which includes statements on our website and in other Material, other than statements of historical facts, such as statements regarding EOSIO’s development, expected performance, and future features, or our business strategy, plans, prospects, developments and objectives. These statements are only predictions and reflect Block.one’s current beliefs and expectations with respect to future events; they are based on assumptions and are subject to risk, uncertainties and change at any time. 24 | 25 | We operate in a rapidly changing environment and new risks emerge from time to time. Given these risks and uncertainties, you are cautioned not to rely on these forward-looking statements. Actual results, performance or events may differ materially from what is predicted in the forward-looking statements. Some of the factors that could cause actual results, performance or events to differ materially from the forward-looking statements include, without limitation: technical feasibility and barriers; market trends and volatility; continued availability of capital, financing and personnel; product acceptance; the commercial success of any new products or technologies; competition; government regulation and laws; and general economic, market or business conditions. 26 | 27 | All statements are valid only as of the date of first posting and Block.one is under no obligation to, and expressly disclaims any obligation to, update or alter any statements, whether as a result of new information, subsequent events or otherwise. Nothing in any Material constitutes technological, financial, investment, legal or other advice, either in general or with regard to any particular situation or implementation. Please consult with experts in appropriate areas before implementing or utilizing anything contained in Material. 28 | -------------------------------------------------------------------------------- /contracts/eosio.system/ricardian/eosio.system.clauses.md: -------------------------------------------------------------------------------- 1 |

UserAgreement

2 | 3 | User agreement for the chain can go here. 4 | 5 |

BlockProducerAgreement

6 | 7 | I, {{producer}}, hereby nominate myself for consideration as an elected block producer. 8 | 9 | If {{producer}} is selected to produce blocks by the system contract, I will sign blocks with my registered block signing keys and I hereby attest that I will keep these keys secret and secure. 10 | 11 | If {{producer}} is unable to perform obligations under this contract I will resign my position using the unregprod action. 12 | 13 | I 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. 14 | 15 | {{producer}} hereby agrees to only use my registered block signing keys to sign messages under the following scenarios: 16 | 17 | * proposing an objectively valid block at the time appointed by the block scheduling algorithm; 18 | * pre-confirming a block produced by another producer in the schedule when I find said block objectively valid; 19 | * and, confirming a block for which {{producer}} has received pre-confirmation messages from more than two-thirds of the active block producers. 20 | 21 | I hereby accept liability for any and all provable damages that result from my: 22 | 23 | * signing two different block proposals with the same timestamp; 24 | * signing two different block proposals with the same block number; 25 | * signing any block proposal which builds off of an objectively invalid block; 26 | * signing a pre-confirmation for an objectively invalid block; 27 | * 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. 28 | 29 | I 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: 30 | 31 | * a fine equal to the past year of compensation received, 32 | * immediate disqualification from being a producer, 33 | * and/or other damages. 34 | 35 | An 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}}. 36 | 37 | I 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. 38 | 39 | I 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. 40 | 41 | If {{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. 42 | 43 | The 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. 44 | 45 | I agree to process transactions on a FIFO (first in, first out) best-effort basis and to honestly bill transactions for measured execution time. 46 | 47 | I {{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. 48 | 49 | I, {{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. 50 | 51 | I, {{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. 52 | 53 | I, {{producer}}, agree to maintain a website hosted at {{url}} which contains up-to-date information on all disclosures required by this contract. 54 | 55 | I, {{producer}}, agree to set the location value of {{location}} such that {{producer}} is scheduled with minimal latency between my previous and next peer. 56 | 57 | I, {{producer}}, agree to maintain time synchronization within 10 ms of global atomic clock time, using a method agreed to among block producers. 58 | 59 | I, {{producer}}, agree not to produce blocks before my scheduled time unless I have received all blocks produced by the prior block producer. 60 | 61 | I, {{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. 62 | 63 | I, {{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. 64 | -------------------------------------------------------------------------------- /scripts/package-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "requires": true, 3 | "lockfileVersion": 1, 4 | "dependencies": { 5 | "@bloks/constants": { 6 | "version": "22.0.86", 7 | "resolved": "https://registry.npmjs.org/@bloks/constants/-/constants-22.0.86.tgz", 8 | "integrity": "sha512-IkHWw/zqHRohdtyXWgDu7kVb/Vf7pV5cGQR5i5ZC20u6HZqG43GTl7X6uxNyqcu95MyurwMjEtXxnA22jChjaQ==" 9 | }, 10 | "@proton/js": { 11 | "version": "22.0.86", 12 | "resolved": "https://registry.npmjs.org/@proton/js/-/js-22.0.86.tgz", 13 | "integrity": "sha512-DYAN98J+90SPnCl9+uvR98+HOXDZ9Mv4+VzV/cGsi4vj9kE7s8BVv3vcq21PqldRoxnqnKZVCaD6bEESZ50dvQ==", 14 | "requires": { 15 | "@bloks/constants": "^22.0.86", 16 | "bs58": "^4.0.1", 17 | "cross-fetch": "^3.1.4", 18 | "elliptic": "^6.5.4", 19 | "fast-text-encoding": "^1.0.3", 20 | "hash.js": "1.1.7", 21 | "pako": "2.0.3", 22 | "ripemd-ts": "0.0.2", 23 | "zod": "^1.11.13" 24 | } 25 | }, 26 | "base-x": { 27 | "version": "3.0.8", 28 | "resolved": "https://registry.npmjs.org/base-x/-/base-x-3.0.8.tgz", 29 | "integrity": "sha512-Rl/1AWP4J/zRrk54hhlxH4drNxPJXYUaKffODVI53/dAsV4t9fBxyxYKAVPU1XBHxYwOWP9h9H0hM2MVw4YfJA==", 30 | "requires": { 31 | "safe-buffer": "^5.0.1" 32 | } 33 | }, 34 | "bn.js": { 35 | "version": "4.12.0", 36 | "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.0.tgz", 37 | "integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==" 38 | }, 39 | "brorand": { 40 | "version": "1.1.0", 41 | "resolved": "https://registry.npmjs.org/brorand/-/brorand-1.1.0.tgz", 42 | "integrity": "sha1-EsJe/kCkXjwyPrhnWgoM5XsiNx8=" 43 | }, 44 | "bs58": { 45 | "version": "4.0.1", 46 | "resolved": "https://registry.npmjs.org/bs58/-/bs58-4.0.1.tgz", 47 | "integrity": "sha1-vhYedsNU9veIrkBx9j806MTwpCo=", 48 | "requires": { 49 | "base-x": "^3.0.2" 50 | } 51 | }, 52 | "cross-fetch": { 53 | "version": "3.1.4", 54 | "resolved": "https://registry.npmjs.org/cross-fetch/-/cross-fetch-3.1.4.tgz", 55 | "integrity": "sha512-1eAtFWdIubi6T4XPy6ei9iUFoKpUkIF971QLN8lIvvvwueI65+Nw5haMNKUwfJxabqlIIDODJKGrQ66gxC0PbQ==", 56 | "requires": { 57 | "node-fetch": "2.6.1" 58 | } 59 | }, 60 | "elliptic": { 61 | "version": "6.5.4", 62 | "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.4.tgz", 63 | "integrity": "sha512-iLhC6ULemrljPZb+QutR5TQGB+pdW6KGD5RSegS+8sorOZT+rdQFbsQFJgvN3eRqNALqJer4oQ16YvJHlU8hzQ==", 64 | "requires": { 65 | "bn.js": "^4.11.9", 66 | "brorand": "^1.1.0", 67 | "hash.js": "^1.0.0", 68 | "hmac-drbg": "^1.0.1", 69 | "inherits": "^2.0.4", 70 | "minimalistic-assert": "^1.0.1", 71 | "minimalistic-crypto-utils": "^1.0.1" 72 | } 73 | }, 74 | "fast-text-encoding": { 75 | "version": "1.0.3", 76 | "resolved": "https://registry.npmjs.org/fast-text-encoding/-/fast-text-encoding-1.0.3.tgz", 77 | "integrity": "sha512-dtm4QZH9nZtcDt8qJiOH9fcQd1NAgi+K1O2DbE6GG1PPCK/BWfOH3idCTRQ4ImXRUOyopDEgDEnVEE7Y/2Wrig==" 78 | }, 79 | "hash.js": { 80 | "version": "1.1.7", 81 | "resolved": "https://registry.npmjs.org/hash.js/-/hash.js-1.1.7.tgz", 82 | "integrity": "sha512-taOaskGt4z4SOANNseOviYDvjEJinIkRgmp7LbKP2YTTmVxWBl87s/uzK9r+44BclBSp2X7K1hqeNfz9JbBeXA==", 83 | "requires": { 84 | "inherits": "^2.0.3", 85 | "minimalistic-assert": "^1.0.1" 86 | } 87 | }, 88 | "hmac-drbg": { 89 | "version": "1.0.1", 90 | "resolved": "https://registry.npmjs.org/hmac-drbg/-/hmac-drbg-1.0.1.tgz", 91 | "integrity": "sha1-0nRXAQJabHdabFRXk+1QL8DGSaE=", 92 | "requires": { 93 | "hash.js": "^1.0.3", 94 | "minimalistic-assert": "^1.0.0", 95 | "minimalistic-crypto-utils": "^1.0.1" 96 | } 97 | }, 98 | "inherits": { 99 | "version": "2.0.4", 100 | "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", 101 | "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" 102 | }, 103 | "minimalistic-assert": { 104 | "version": "1.0.1", 105 | "resolved": "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz", 106 | "integrity": "sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A==" 107 | }, 108 | "minimalistic-crypto-utils": { 109 | "version": "1.0.1", 110 | "resolved": "https://registry.npmjs.org/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz", 111 | "integrity": "sha1-9sAMHAsIIkblxNmd+4x8CDsrWCo=" 112 | }, 113 | "node-fetch": { 114 | "version": "2.6.1", 115 | "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.1.tgz", 116 | "integrity": "sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw==" 117 | }, 118 | "pako": { 119 | "version": "2.0.3", 120 | "resolved": "https://registry.npmjs.org/pako/-/pako-2.0.3.tgz", 121 | "integrity": "sha512-WjR1hOeg+kki3ZIOjaf4b5WVcay1jaliKSYiEaB1XzwhMQZJxRdQRv0V31EKBYlxb4T7SK3hjfc/jxyU64BoSw==" 122 | }, 123 | "ripemd-ts": { 124 | "version": "0.0.2", 125 | "resolved": "https://registry.npmjs.org/ripemd-ts/-/ripemd-ts-0.0.2.tgz", 126 | "integrity": "sha512-2XZ9cVFtjpQ3z6LmN+Kylz518XcPKmKHzxEXUEPJfqi8vZs+0reY65YU9wzhzrPGtqHzH3ARGZNnGNASlPaWfw==" 127 | }, 128 | "safe-buffer": { 129 | "version": "5.2.1", 130 | "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", 131 | "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==" 132 | }, 133 | "zod": { 134 | "version": "1.11.17", 135 | "resolved": "https://registry.npmjs.org/zod/-/zod-1.11.17.tgz", 136 | "integrity": "sha512-UzIwO92D0dSFwIRyyqAfRXICITLjF0IP8tRbEK/un7adirMssWZx8xF/1hZNE7t61knWZ+lhEuUvxlu2MO8qqA==" 137 | } 138 | } 139 | } 140 | -------------------------------------------------------------------------------- /contracts/eosio.bios/ricardian/eosio.bios.contracts.md.in: -------------------------------------------------------------------------------- 1 |

activate

2 | 3 | --- 4 | spec_version: "0.2.0" 5 | title: Activate Protocol Feature 6 | summary: 'Activate protocol feature {{nowrap feature_digest}}' 7 | icon: @ICON_BASE_URL@/@ADMIN_ICON_URI@ 8 | --- 9 | 10 | {{$action.account}} activates the protocol feature with a digest of {{feature_digest}}. 11 | 12 |

canceldelay

13 | 14 | --- 15 | spec_version: "0.2.0" 16 | title: Cancel Delayed Transaction 17 | summary: '{{nowrap canceling_auth.actor}} cancels a delayed transaction' 18 | icon: @ICON_BASE_URL@/@ACCOUNT_ICON_URI@ 19 | --- 20 | 21 | {{canceling_auth.actor}} cancels the delayed transaction with id {{trx_id}}. 22 | 23 |

deleteauth

24 | 25 | --- 26 | spec_version: "0.2.0" 27 | title: Delete Account Permission 28 | summary: 'Delete the {{nowrap permission}} permission of {{nowrap account}}' 29 | icon: @ICON_BASE_URL@/@ACCOUNT_ICON_URI@ 30 | --- 31 | 32 | Delete the {{permission}} permission of {{account}}. 33 | 34 |

linkauth

35 | 36 | --- 37 | spec_version: "0.2.0" 38 | title: Link Action to Permission 39 | summary: '{{nowrap account}} sets the minimum required permission for the {{#if type}}{{nowrap type}} action of the{{/if}} {{nowrap code}} contract to {{nowrap requirement}}' 40 | icon: @ICON_BASE_URL@/@ACCOUNT_ICON_URI@ 41 | --- 42 | 43 | {{account}} sets the minimum required permission for the {{#if type}}{{type}} action of the{{/if}} {{code}} contract to {{requirement}}. 44 | 45 | {{#if type}}{{else}}Any links explicitly associated to specific actions of {{code}} will take precedence.{{/if}} 46 | 47 |

newaccount

48 | 49 | --- 50 | spec_version: "0.2.0" 51 | title: Create New Account 52 | summary: '{{nowrap creator}} creates a new account with the name {{nowrap name}}' 53 | icon: @ICON_BASE_URL@/@ACCOUNT_ICON_URI@ 54 | --- 55 | 56 | {{creator}} creates a new account with the name {{name}} and the following permissions: 57 | 58 | owner permission with authority: 59 | {{to_json owner}} 60 | 61 | active permission with authority: 62 | {{to_json active}} 63 | 64 |

reqactivated

65 | 66 | --- 67 | spec_version: "0.2.0" 68 | title: Assert Protocol Feature Activation 69 | summary: 'Assert that protocol feature {{nowrap feature_digest}} has been activated' 70 | icon: @ICON_BASE_URL@/@ADMIN_ICON_URI@ 71 | --- 72 | 73 | Assert that the protocol feature with a digest of {{feature_digest}} has been activated. 74 | 75 |

reqauth

76 | 77 | --- 78 | spec_version: "0.2.0" 79 | title: Assert Authorization 80 | summary: 'Assert that authorization by {{nowrap from}} is provided' 81 | icon: @ICON_BASE_URL@/@ACCOUNT_ICON_URI@ 82 | --- 83 | 84 | Assert that authorization by {{from}} is provided. 85 | 86 |

setabi

87 | 88 | --- 89 | spec_version: "0.2.0" 90 | title: Deploy Contract ABI 91 | summary: 'Deploy contract ABI on account {{nowrap account}}' 92 | icon: @ICON_BASE_URL@/@ACCOUNT_ICON_URI@ 93 | --- 94 | 95 | Deploy the ABI file associated with the contract on account {{account}}. 96 | 97 |

setalimits

98 | 99 | --- 100 | spec_version: "0.2.0" 101 | title: Adjust Resource Limits of Account 102 | summary: 'Adjust resource limits of account {{nowrap account}}' 103 | icon: @ICON_BASE_URL@/@ADMIN_ICON_URI@ 104 | --- 105 | 106 | {{$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}}. 107 | 108 |

setcode

109 | 110 | --- 111 | spec_version: "0.2.0" 112 | title: Deploy Contract Code 113 | summary: 'Deploy contract code on account {{nowrap account}}' 114 | icon: @ICON_BASE_URL@/@ACCOUNT_ICON_URI@ 115 | --- 116 | 117 | Deploy compiled contract code to the account {{account}}. 118 | 119 |

setparams

120 | 121 | --- 122 | spec_version: "0.2.0" 123 | title: Set System Parameters 124 | summary: 'Set system parameters' 125 | icon: @ICON_BASE_URL@/@ADMIN_ICON_URI@ 126 | --- 127 | 128 | {{$action.account}} sets system parameters to: 129 | {{to_json params}} 130 | 131 |

setpriv

132 | 133 | --- 134 | spec_version: "0.2.0" 135 | title: Make an Account Privileged or Unprivileged 136 | summary: '{{#if is_priv}}Make {{nowrap account}} privileged{{else}}Remove privileged status of {{nowrap account}}{{/if}}' 137 | icon: @ICON_BASE_URL@/@ADMIN_ICON_URI@ 138 | --- 139 | 140 | {{#if is_priv}} 141 | {{$action.account}} makes {{account}} privileged. 142 | {{else}} 143 | {{$action.account}} removes privileged status of {{account}}. 144 | {{/if}} 145 | 146 |

setprods

147 | 148 | --- 149 | spec_version: "0.2.0" 150 | title: Set Block Producers 151 | summary: 'Set block producer schedule' 152 | icon: @ICON_BASE_URL@/@ADMIN_ICON_URI@ 153 | --- 154 | 155 | {{$action.account}} proposes a block producer schedule of: 156 | {{#each schedule}} 157 | 1. {{this.producer_name}} 158 | {{/each}} 159 | 160 | The block signing authorities of each of the producers in the above schedule are listed below: 161 | {{#each schedule}} 162 | ### {{this.producer_name}} 163 | {{to_json this.authority}} 164 | {{/each}} 165 | 166 |

unlinkauth

167 | 168 | --- 169 | spec_version: "0.2.0" 170 | title: Unlink Action from Permission 171 | summary: '{{nowrap account}} unsets the minimum required permission for the {{#if type}}{{nowrap type}} action of the{{/if}} {{nowrap code}} contract' 172 | icon: @ICON_BASE_URL@/@ACCOUNT_ICON_URI@ 173 | --- 174 | 175 | {{account}} removes the association between the {{#if type}}{{type}} action of the{{/if}} {{code}} contract and its minimum required permission. 176 | 177 | {{#if type}}{{else}}This will not remove any links explicitly associated to specific actions of {{code}}.{{/if}} 178 | 179 |

updateauth

180 | 181 | --- 182 | spec_version: "0.2.0" 183 | title: Modify Account Permission 184 | summary: 'Add or update the {{nowrap permission}} permission of {{nowrap account}}' 185 | icon: @ICON_BASE_URL@/@ACCOUNT_ICON_URI@ 186 | --- 187 | 188 | Modify, and create if necessary, the {{permission}} permission of {{account}} to have a parent permission of {{parent}} and the following authority: 189 | {{to_json auth}} 190 | -------------------------------------------------------------------------------- /contracts/eosio.proton/test.sh: -------------------------------------------------------------------------------- 1 | 2 | ### Deploy 3 | #./cleos.sh set contract eosio.proton ./eosio.proton -p eosio.proton 4 | 5 | 6 | ### Admins actions ################ 7 | # 8 | #ALL PERMISSIONS: ["createacc",1],["vote",1],["regprod",1],["regproxy",1],["setcontract",1],["namebids",1],["rex",1],["delegate",1],["undelegate",1],["sellram",1],["buyram",1]] 9 | # 10 | #./cleos.sh push action eosio.proton setperm '{"name": "cryptoloins", "perms": [["regprod",1]]}' -p eosio.proton@active 11 | 12 | #./cleos.sh push action eosio.proton setuserava '{"acc": "tester", "ava": "ava_base64"}' -p wlcm.proton@update 13 | #./cleos.sh push action eosio.proton setusername '{"acc": "tester", "name": "Bohdan CryptoLions"}' -p wlcm.proton@update 14 | #./cleos.sh push action eosio.proton userverify '{"acc": "tester", "verifier": "cryptoloins", "verified": 1}' -p admin.proton@verifier -p cryptolions 15 | 16 | #./cleos.sh push action eosio.proton remove '{"acc": "tester"}' -p wlcm.proton@update 17 | 18 | #./cleos.sh push action eosio.proton kickbp '{"producer": "tester"}' -p admin.proton@committee 19 | 20 | 21 | ### Users Actions ################## 22 | # 23 | #./cleos.sh push action eosio.proton reqperm '{"acc": "cryptolions", "permission": "namebids"}' -p cryptolions 24 | 25 | #./cleos.sh push action eosio.proton updateraccs '{"acc": "tester1", "raccs": ["taskly", "tasklybank", "tasklyother"]}' -p tester1 26 | #./cleos.sh push action eosio.proton updateaacts '{"acc": "tester1", "aacts": [["eosio.token","transfer"], ["taskly", "markcheck"], ["taskly", "removecheck"]]}' -p tester1 27 | #./cleos.sh push action eosio.proton updateac '{"acc": "tester1", "ac": [["eosio.token","XPR"], ["eosio.token","XYZ"], ["usdtoken","USD"]]}' -p tester1 28 | 29 | 30 | ## Committee KickBP Permissions ################## 31 | # ./cleos.sh push action eosio updateauth '{"account": "eosio", "permission": "committee", "parent": "active", "auth": { "threshold": 1, "keys": [], "waits": [], "accounts": [{ "weight": 1, "permission": {"actor": "admin.proton", "permission": "committee"} }] } } ' -p eosio 32 | # ./cleos.sh set action permission eosio eosio kickbp committee 33 | # ./cleos.sh set action permission eosio eosio.proton kickbp committee 34 | # 35 | # ./cleos.sh push action eosio kickbp '{"producer": "protonbpa"}' -p eosio@committee 36 | 37 | 38 | ## KYC logic ############################### 39 | # 40 | # - Add Permissions 41 | # ./cleos.sh set action permission admin.proton eosio.proton addkycprov committee -p admin.proton 42 | # ./cleos.sh set action permission admin.proton eosio.proton blkycprov committee -p admin.proton 43 | # ./cleos.sh set action permission admin.proton eosio.proton rmvkycprov committee -p admin.proton 44 | 45 | 46 | ## ADD KYC Provider 47 | # 48 | ##./cleos.sh push action eosio.proton addkycprov '{"kyc_provider": "test1", "desc": "My desc as KYC testT prov 1", "url": "protonchain.com", "iconurl": "https://www.protonchain.com/static/protonLogo@3x-f30ef900442eabc13be4f1bcf1ad6683.png", "name": "Super Tester"}' -p admin.proton@committee 49 | #./cleos.sh push action eosio.proton addkycprov '{"kyc_provider": "test1", "desc": "My desc as KYC testT prov 1", "url": "protonchain.com", "iconurl": "https://www.protonchain.com/static/protonLogo@3x-f30ef900442eabc13be4f1bcf1ad6683.png", "name": "Super Tester1"}' -p admin.proton@light 50 | #./cleos.sh push action eosio.proton addkycprov '{"kyc_provider": "test2", "desc": "My desc as KYC testT prov 2", "url": "protonchain.com", "iconurl": "https://www.protonchain.com/static/protonLogo@3x-f30ef900442eabc13be4f1bcf1ad6683.png", "name": "Super Tester2"}' -p admin.proton@light 51 | #./cleos.sh push action eosio.proton addkycprov '{"kyc_provider": "test3", "desc": "My desc as KYC testT prov 3", "url": "protonchain.com", "iconurl": "https://www.protonchain.com/static/protonLogo@3x-f30ef900442eabc13be4f1bcf1ad6683.png", "name": "Super Tester3"}' -p admin.proton@light 52 | #./cleos.sh push action eosio.proton addkycprov '{"kyc_provider": "test4", "desc": "My desc as KYC testT prov 4", "url": "protonchain.com", "iconurl": "https://www.protonchain.com/static/protonLogo@3x-f30ef900442eabc13be4f1bcf1ad6683.png", "name": "Super Tester4"}' -p admin.proton@light 53 | #./cleos.sh push action eosio.proton addkycprov '{"kyc_provider": "test5", "desc": "My desc as KYC testT prov 5", "url": "protonchain.com", "iconurl": "https://www.protonchain.com/static/protonLogo@3x-f30ef900442eabc13be4f1bcf1ad6683.png", "name": "Super Tester5"}' -p admin.proton@light 54 | 55 | 56 | ## BList KYC Provider 57 | # 58 | ##./cleos.sh push action eosio.proton blkycprov '{"kyc_provider": "tester", "state": true}' -p admin.proton@committee 59 | #./cleos.sh push action eosio.proton blkycprov '{"kyc_provider": "tester", "state": true}' -p admin.proton@light 60 | #./cleos.sh push action eosio.proton blkycprov '{"kyc_provider": "tester", "state": false}' -p admin.proton@light 61 | 62 | 63 | ## Remove KYC Provider 64 | # 65 | ##./cleos.sh push action eosio.proton rmvkycprov '{"kyc_provider": "tester"}' -p admin.proton@committee 66 | #./cleos.sh push action eosio.proton rmvkycprov '{"kyc_provider": "tester"}' -p admin.proton@light 67 | 68 | 69 | ## Add KYC 70 | #./cleos.sh push action eosio.proton addkyc '{"acc": "cryptolions", "kyc":{ "kyc_provider": "test1", "kyc_level": "level 1, some data", "kyc_date": 1602532882}}' -p test1 71 | #./cleos.sh push action eosio.proton addkyc '{"acc": "cryptolions", "kyc":{ "kyc_provider": "test2", "kyc_level": "level 2, some data", "kyc_date": 1602532882}}' -p test2 72 | #./cleos.sh push action eosio.proton addkyc '{"acc": "bohdan", "kyc":{ "kyc_provider": "test3", "kyc_level": "level 3, some data", "kyc_date": 1602532882}}' -p test3 73 | #./cleos.sh push action eosio.proton addkyc '{"acc": "bohdan", "kyc":{ "kyc_provider": "test4", "kyc_level": "level 4, some data", "kyc_date": 1602532882}}' -p test4 74 | #./cleos.sh push action eosio.proton addkyc '{"acc": "bohdan", "kyc":{ "kyc_provider": "test5", "kyc_level": "level 5, some data", "kyc_date": 1602532882}}' -p test5 75 | 76 | ## Update KYC 77 | #./cleos.sh push action eosio.proton updatekyc '{"acc": "bohdan", "kyc":{ "kyc_provider": "test3", "kyc_level": "level 333, some data", "kyc_date": 1602532882}}' -p test3 78 | 79 | ## Remove KYC 80 | #./cleos.sh push action eosio.proton removekyc '{"acc": "bohdan", "kyc_provider": "test5"}' -p test5 81 | 82 | 83 | 84 | ### Tables ################ 85 | # 86 | #./cleos.sh get table eosio.proton eosio.proton usersinfo 87 | #./cleos.sh get table eosio.proton eosio.proton permissions 88 | #./cleos.sh get table eosio.proton eosio.proton kycproviders 89 | 90 | 91 | #### 92 | 93 | -------------------------------------------------------------------------------- /contracts/eosio.token/src/eosio.token.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | namespace eosio { 4 | 5 | void token::create( const name& issuer, 6 | const asset& maximum_supply ) 7 | { 8 | require_auth( get_self() ); 9 | 10 | auto sym = maximum_supply.symbol; 11 | check( sym.is_valid(), "invalid symbol name" ); 12 | check( maximum_supply.is_valid(), "invalid supply"); 13 | //check( maximum_supply.amount > 0, "max-supply must be positive"); // PROTON 14 | 15 | stats statstable( get_self(), sym.code().raw() ); 16 | auto existing = statstable.find( sym.code().raw() ); 17 | check( existing == statstable.end(), "token with symbol already exists" ); 18 | 19 | statstable.emplace( get_self(), [&]( auto& s ) { 20 | s.supply.symbol = maximum_supply.symbol; 21 | // s.max_supply = maximum_supply; // PROTON 22 | s.max_supply = asset{0, sym}; // PROTON 23 | s.issuer = issuer; 24 | }); 25 | } 26 | 27 | 28 | void token::issue( const name& to, const asset& quantity, const string& memo ) 29 | { 30 | auto sym = quantity.symbol; 31 | check( sym.is_valid(), "invalid symbol name" ); 32 | check( memo.size() <= 256, "memo has more than 256 bytes" ); 33 | 34 | stats statstable( get_self(), sym.code().raw() ); 35 | auto existing = statstable.find( sym.code().raw() ); 36 | check( existing != statstable.end(), "token with symbol does not exist, create token before issue" ); 37 | const auto& st = *existing; 38 | check( to == st.issuer, "tokens can only be issued to issuer account" ); 39 | 40 | require_auth( st.issuer ); 41 | check( quantity.is_valid(), "invalid quantity" ); 42 | check( quantity.amount > 0, "must issue positive quantity" ); 43 | 44 | check( quantity.symbol == st.supply.symbol, "symbol precision mismatch" ); 45 | //check( quantity.amount <= st.max_supply.amount - st.supply.amount, "quantity exceeds available supply"); // PROTON 46 | check( quantity.amount + st.supply.amount <= MAX_AMOUNT, "quantity exceeds available supply"); // PROTON 47 | 48 | statstable.modify( st, same_payer, [&]( auto& s ) { 49 | s.max_supply = asset{0, st.supply.symbol}; // PROTON 50 | s.supply += quantity; 51 | }); 52 | 53 | add_balance( st.issuer, quantity, st.issuer ); 54 | } 55 | 56 | void token::retire( const asset& quantity, const string& memo ) 57 | { 58 | auto sym = quantity.symbol; 59 | check( sym.is_valid(), "invalid symbol name" ); 60 | check( memo.size() <= 256, "memo has more than 256 bytes" ); 61 | 62 | stats statstable( get_self(), sym.code().raw() ); 63 | auto existing = statstable.find( sym.code().raw() ); 64 | check( existing != statstable.end(), "token with symbol does not exist" ); 65 | const auto& st = *existing; 66 | 67 | require_auth( st.issuer ); 68 | check( quantity.is_valid(), "invalid quantity" ); 69 | check( quantity.amount > 0, "must retire positive quantity" ); 70 | 71 | check( quantity.symbol == st.supply.symbol, "symbol precision mismatch" ); 72 | 73 | statstable.modify( st, same_payer, [&]( auto& s ) { 74 | s.supply -= quantity; 75 | }); 76 | 77 | sub_balance( st.issuer, quantity ); 78 | } 79 | 80 | void token::transfer( const name& from, 81 | const name& to, 82 | const asset& quantity, 83 | const string& memo ) 84 | { 85 | check( from != to, "cannot transfer to self" ); 86 | require_auth( from ); 87 | check( is_account( to ), "to account does not exist"); 88 | auto sym = quantity.symbol.code(); 89 | stats statstable( get_self(), sym.raw() ); 90 | const auto& st = statstable.get( sym.raw() ); 91 | 92 | require_recipient( from ); 93 | require_recipient( to ); 94 | 95 | check( quantity.is_valid(), "invalid quantity" ); 96 | check( quantity.amount > 0, "must transfer positive quantity" ); 97 | check( quantity.symbol == st.supply.symbol, "symbol precision mismatch" ); 98 | check( memo.size() <= 256, "memo has more than 256 bytes" ); 99 | 100 | auto payer = has_auth( to ) ? to : from; 101 | 102 | sub_balance( from, quantity ); 103 | add_balance( to, quantity, payer ); 104 | } 105 | 106 | void token::sub_balance( const name& owner, const asset& value ) { 107 | accounts from_acnts( get_self(), owner.value ); 108 | 109 | const auto& from = from_acnts.get( value.symbol.code().raw(), "no balance object found" ); 110 | check( from.balance.amount >= value.amount, "overdrawn balance" ); 111 | 112 | from_acnts.modify( from, owner, [&]( auto& a ) { 113 | a.balance -= value; 114 | }); 115 | } 116 | 117 | void token::add_balance( const name& owner, const asset& value, const name& ram_payer ) 118 | { 119 | accounts to_acnts( get_self(), owner.value ); 120 | auto to = to_acnts.find( value.symbol.code().raw() ); 121 | if( to == to_acnts.end() ) { 122 | to_acnts.emplace( ram_payer, [&]( auto& a ){ 123 | a.balance = value; 124 | }); 125 | } else { 126 | to_acnts.modify( to, same_payer, [&]( auto& a ) { 127 | a.balance += value; 128 | }); 129 | } 130 | } 131 | 132 | void token::open( const name& owner, const symbol& symbol, const name& ram_payer ) 133 | { 134 | require_auth( ram_payer ); 135 | 136 | check( is_account( owner ), "owner account does not exist" ); 137 | 138 | auto sym_code_raw = symbol.code().raw(); 139 | stats statstable( get_self(), sym_code_raw ); 140 | const auto& st = statstable.get( sym_code_raw, "symbol does not exist" ); 141 | check( st.supply.symbol == symbol, "symbol precision mismatch" ); 142 | 143 | accounts acnts( get_self(), owner.value ); 144 | auto it = acnts.find( sym_code_raw ); 145 | if( it == acnts.end() ) { 146 | acnts.emplace( ram_payer, [&]( auto& a ){ 147 | a.balance = asset{0, symbol}; 148 | }); 149 | } 150 | } 151 | 152 | void token::close( const name& owner, const symbol& symbol ) 153 | { 154 | require_auth( owner ); 155 | accounts acnts( get_self(), owner.value ); 156 | auto it = acnts.find( symbol.code().raw() ); 157 | check( it != acnts.end(), "Balance row already deleted or never existed. Action won't have any effect." ); 158 | check( it->balance.amount == 0, "Cannot close because the balance is not zero." ); 159 | acnts.erase( it ); 160 | } 161 | 162 | } /// namespace eosio 163 | -------------------------------------------------------------------------------- /contracts/eosio.token/include/eosio.token/eosio.token.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | #include 7 | 8 | namespace eosiosystem { 9 | class system_contract; 10 | } 11 | 12 | namespace eosio { 13 | 14 | using std::string; 15 | 16 | /** 17 | * eosio.token contract defines the structures and actions that allow users to create, issue, and manage 18 | * tokens on EOSIO based blockchains. 19 | */ 20 | class [[eosio::contract("eosio.token")]] token : public contract { 21 | public: 22 | using contract::contract; 23 | const int64_t MAX_AMOUNT = eosio::asset::max_amount; 24 | /** 25 | * 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. 26 | * 27 | * @param issuer - the account that creates the token, 28 | * @param maximum_supply - the maximum supply set for the token created. 29 | * 30 | * @pre Token symbol has to be valid, 31 | * @pre Token symbol must not be already created, 32 | * @pre maximum_supply has to be smaller than the maximum supply allowed by the system: 1^62 - 1. 33 | * @pre Maximum supply must be positive; 34 | */ 35 | [[eosio::action]] 36 | void create( const name& issuer, 37 | const asset& maximum_supply); 38 | /** 39 | * This action issues to `to` account a `quantity` of tokens. 40 | * 41 | * @param to - the account to issue tokens to, it must be the same as the issuer, 42 | * @param quntity - the amount of tokens to be issued, 43 | * @memo - the memo string that accompanies the token issue transaction. 44 | */ 45 | [[eosio::action]] 46 | void issue( const name& to, const asset& quantity, const string& memo ); 47 | 48 | /** 49 | * The opposite for create action, if all validations succeed, 50 | * it debits the statstable.supply amount. 51 | * 52 | * @param quantity - the quantity of tokens to retire, 53 | * @param memo - the memo string to accompany the transaction. 54 | */ 55 | [[eosio::action]] 56 | void retire( const asset& quantity, const string& memo ); 57 | 58 | /** 59 | * Allows `from` account to transfer to `to` account the `quantity` tokens. 60 | * One account is debited and the other is credited with quantity tokens. 61 | * 62 | * @param from - the account to transfer from, 63 | * @param to - the account to be transferred to, 64 | * @param quantity - the quantity of tokens to be transferred, 65 | * @param memo - the memo string to accompany the transaction. 66 | */ 67 | [[eosio::action]] 68 | void transfer( const name& from, 69 | const name& to, 70 | const asset& quantity, 71 | const string& memo ); 72 | /** 73 | * Allows `ram_payer` to create an account `owner` with zero balance for 74 | * token `symbol` at the expense of `ram_payer`. 75 | * 76 | * @param owner - the account to be created, 77 | * @param symbol - the token to be payed with by `ram_payer`, 78 | * @param ram_payer - the account that supports the cost of this action. 79 | * 80 | * More information can be read [here](https://github.com/EOSIO/eosio.contracts/issues/62) 81 | * and [here](https://github.com/EOSIO/eosio.contracts/issues/61). 82 | */ 83 | [[eosio::action]] 84 | void open( const name& owner, const symbol& symbol, const name& ram_payer ); 85 | 86 | /** 87 | * This action is the opposite for open, it closes the account `owner` 88 | * for token `symbol`. 89 | * 90 | * @param owner - the owner account to execute the close action for, 91 | * @param symbol - the symbol of the token to execute the close action for. 92 | * 93 | * @pre The pair of owner plus symbol has to exist otherwise no action is executed, 94 | * @pre If the pair of owner plus symbol exists, the balance has to be zero. 95 | */ 96 | [[eosio::action]] 97 | void close( const name& owner, const symbol& symbol ); 98 | 99 | static asset get_supply( const name& token_contract_account, const symbol_code& sym_code ) 100 | { 101 | stats statstable( token_contract_account, sym_code.raw() ); 102 | const auto& st = statstable.get( sym_code.raw() ); 103 | return st.supply; 104 | } 105 | 106 | static asset get_balance( const name& token_contract_account, const name& owner, const symbol_code& sym_code ) 107 | { 108 | accounts accountstable( token_contract_account, owner.value ); 109 | const auto& ac = accountstable.get( sym_code.raw() ); 110 | return ac.balance; 111 | } 112 | 113 | using create_action = eosio::action_wrapper<"create"_n, &token::create>; 114 | using issue_action = eosio::action_wrapper<"issue"_n, &token::issue>; 115 | using retire_action = eosio::action_wrapper<"retire"_n, &token::retire>; 116 | using transfer_action = eosio::action_wrapper<"transfer"_n, &token::transfer>; 117 | using open_action = eosio::action_wrapper<"open"_n, &token::open>; 118 | using close_action = eosio::action_wrapper<"close"_n, &token::close>; 119 | private: 120 | struct [[eosio::table]] account { 121 | asset balance; 122 | 123 | uint64_t primary_key()const { return balance.symbol.code().raw(); } 124 | }; 125 | 126 | struct [[eosio::table]] currency_stats { 127 | asset supply; 128 | asset max_supply; 129 | name issuer; 130 | 131 | uint64_t primary_key()const { return supply.symbol.code().raw(); } 132 | }; 133 | 134 | typedef eosio::multi_index< "accounts"_n, account > accounts; 135 | typedef eosio::multi_index< "stat"_n, currency_stats > stats; 136 | 137 | void sub_balance( const name& owner, const asset& value ); 138 | void add_balance( const name& owner, const asset& value, const name& ram_payer ); 139 | }; 140 | 141 | } 142 | -------------------------------------------------------------------------------- /docs/03_guides/06_how-to-sign-a-multisig-transaction-with-eosio.msig.md: -------------------------------------------------------------------------------- 1 | ## eosio.msig examples 2 | 3 | ### Cleos usage example for issuing tokens. 4 | 5 | #### Prerequisites: 6 | - eosio.token contract installed to eosio.token account, eosio.msig contract installed on eosio.msig account which is a priviliged account. 7 | - account 'treasury' is the issuer of SYS token. 8 | - account 'tester' exists. 9 | - keys to accounts 'treasury' and 'tester' imported into local wallet, the wallet is unlocked. 10 | 11 | #### One user creates a proposal: 12 | ```` 13 | $ cleos multisig propose test '[{"actor": "treasury", "permission": "active"}]' '[{"actor": "treasury", "permission": "active"}]' eosio.token issue '{"to": "tester", "quantity": "1000.0000 SYS", "memo": ""}' -p tester 14 | 15 | executed transaction: e26f3a3a7cba524a7b15a0b6c77c7daa73d3ba9bf84e83f9c2cdf27fcb183d61 336 bytes 107520 cycles 16 | # eosio.msig <= eosio.msig::propose {"proposer":"tester","proposal_name":"test","requested":[{"actor":"treasury","permission":"active"}]... 17 | ```` 18 | 19 | #### Another user reviews the transaction: 20 | ```` 21 | $ cleos multisig review tester test 22 | { 23 | "proposal_name": "test", 24 | "requested_approvals": [{ 25 | "actor": "treasury", 26 | "permission": "active" 27 | } 28 | ], 29 | "provided_approvals": [], 30 | "packed_transaction": "00aee75a0000000000000000000000000100a6823403ea30550000000000a5317601000000fe6a6cd4cd00000000a8ed323219000000005c95b1ca809698000000000004454f530000000000", 31 | "transaction": { 32 | "expiration": "2018-05-01T00:00:00", 33 | "region": 0, 34 | "ref_block_num": 0, 35 | "ref_block_prefix": 0, 36 | "max_net_usage_words": 0, 37 | "max_kcpu_usage": 0, 38 | "delay_sec": 0, 39 | "context_free_actions": [], 40 | "actions": [{ 41 | "account": "eosio.token", 42 | "name": "issue", 43 | "authorization": [{ 44 | "actor": "treasury", 45 | "permission": "active" 46 | } 47 | ], 48 | "data": { 49 | "to": "tester", 50 | "quantity": "1000.0000 SYS", 51 | "memo": "" 52 | }, 53 | "hex_data": "000000005c95b1ca809698000000000004454f530000000000" 54 | } 55 | ] 56 | } 57 | } 58 | ```` 59 | 60 | #### And then approves it: 61 | ```` 62 | $ cleos multisig approve tester test '{"actor": "treasury", "permission": "active"}' -p treasury 63 | 64 | executed transaction: 475970a4b0016368d0503d1ce01577376f91f5a5ba63dd4353683bd95101b88d 256 bytes 108544 cycles 65 | # eosio.msig <= eosio.msig::approve {"proposer":"tester","proposal_name":"test","level":{"actor":"treasury","permission":"active"}} 66 | ```` 67 | 68 | #### First user initiates execution: 69 | ```` 70 | $ cleos multisig exec tester test -p tester 71 | 72 | executed transaction: 64e5eaceb77362694055f572ae35876111e87b637a55250de315b1b55e56d6c2 248 bytes 109568 cycles 73 | # eosio.msig <= eosio.msig::exec {"proposer":"tester","proposal_name":"test","executer":"tester"} 74 | ```` 75 | 76 | 77 | ### Cleos usage example for transferring tokens. 78 | 79 | #### Prerequisites: 80 | - eosio.token contract installed to eosio.token account, eosio.msig contract installed on eosio.msig account which is a priviliged account. 81 | - account 'treasury' has at least 1.1000 SYS token balance. 82 | - account 'tester' exists. 83 | - keys to accounts 'treasury' and 'tester' imported into local wallet, the wallet is unlocked. 84 | 85 | #### One user creates a proposal: 86 | ```` 87 | $ cleos multisig propose test '[{"actor": "treasury", "permission": "active"}]' '[{"actor": "treasury", "permission": "active"}]' eosio.token transfer '{"from": "treasury", "to": "tester", "quantity": "1.0000 SYS", "memo": ""}' -p tester 88 | 89 | executed transaction: e26f3a3a7cba524a7b15a0b6c77c7daa73d3ba9bf84e83f9c2cdf27fcb183d61 336 bytes 107520 cycles 90 | # eosio.msig <= eosio.msig::propose {"proposer":"tester","proposal_name":"test","requested":[{"actor":"treasury","permission":"active"}]... 91 | ```` 92 | 93 | #### Another user reviews the transaction: 94 | ```` 95 | $ cleos multisig review tester test 96 | { 97 | "proposal_name": "test", 98 | "requested_approvals": [{ 99 | "actor": "treasury", 100 | "permission": "active" 101 | } 102 | ], 103 | "provided_approvals": [], 104 | "packed_transaction": "00aee75a0000000000000000000000000100a6823403ea30550000000000a5317601000000fe6a6cd4cd00000000a8ed323219000000005c95b1ca809698000000000004454f530000000000", 105 | "transaction": { 106 | "expiration": "2018-05-01T00:00:00", 107 | "region": 0, 108 | "ref_block_num": 0, 109 | "ref_block_prefix": 0, 110 | "max_net_usage_words": 0, 111 | "max_kcpu_usage": 0, 112 | "delay_sec": 0, 113 | "context_free_actions": [], 114 | "actions": [{ 115 | "account": "eosio.token", 116 | "name": "transfer", 117 | "authorization": [{ 118 | "actor": "treasury", 119 | "permission": "active" 120 | } 121 | ], 122 | "data": { 123 | "from": "treasury", 124 | "to": "tester", 125 | "quantity": "1.0000 SYS", 126 | "memo": "" 127 | }, 128 | "hex_data": "000000005c95b1ca809698000000000004454f530000000000" 129 | } 130 | ] 131 | } 132 | } 133 | ```` 134 | 135 | #### And then approves it: 136 | ```` 137 | $ cleos multisig approve tester test '{"actor": "treasury", "permission": "active"}' -p treasury 138 | 139 | executed transaction: 475970a4b0016368d0503d1ce01577376f91f5a5ba63dd4353683bd95101b88d 256 bytes 108544 cycles 140 | # eosio.msig <= eosio.msig::approve {"proposer":"tester","proposal_name":"test","level":{"actor":"treasury","permission":"active"}} 141 | ```` 142 | 143 | #### First user check account balance before executing the proposed transaction 144 | ```` 145 | $ cleos get account tester 146 | ... 147 | SYS balances: 148 | liquid: 1.0487 SYS 149 | staked: 2.0000 SYS 150 | unstaking: 0.0000 SYS 151 | total: 4.0487 SYS 152 | ```` 153 | 154 | #### First user initiates execution of proposed transaction: 155 | ```` 156 | $ cleos multisig exec tester test -p tester 157 | 158 | executed transaction: 64e5eaceb77362694055f572ae35876111e87b637a55250de315b1b55e56d6c2 248 bytes 109568 cycles 159 | # eosio.msig <= eosio.msig::exec {"proposer":"tester","proposal_name":"test","executer":"tester"} 160 | ```` 161 | 162 | #### First user can check account balance, it should be increased by 1.0000 SYS 163 | ```` 164 | $ cleos get account tester 165 | ... 166 | SYS balances: 167 | liquid: 2.0487 SYS 168 | staked: 2.0000 SYS 169 | unstaking: 0.0000 SYS 170 | total: 4.0487 SYS 171 | ```` 172 | -------------------------------------------------------------------------------- /contracts/eosio.proton/ricardian/eosio.proton.contracts.md: -------------------------------------------------------------------------------- 1 |

setperm2

2 | 3 | --- 4 | spec_version: "0.2.0" 5 | title: setperm2 6 | summary: 'setperm2' 7 | icon: https://raw.githubusercontent.com/EOSIO/eosio.contracts/master/contracts/icons/account.png#3d55a2fc3a5c20b456f5657faf666bc25ffd06f4836c5e8256f741149b0b294f 8 | --- 9 | Initializes permissions for account {{acc}} for whitelisted EOSIO functionality. 10 | 11 | 12 | 13 |

setperm

14 | 15 | --- 16 | spec_version: "0.2.0" 17 | title: setperm 18 | summary: 'setperm' 19 | icon: https://raw.githubusercontent.com/EOSIO/eosio.contracts/master/contracts/icons/account.png#3d55a2fc3a5c20b456f5657faf666bc25ffd06f4836c5e8256f741149b0b294f 20 | --- 21 | Initializes permissions for account {{acc}} for whitelisted EOSIO functionality. (no longer used) 22 | 23 | 24 |

setuserava

25 | 26 | --- 27 | spec_version: "0.2.0" 28 | title: setuserava 29 | summary: 'setuserava' 30 | icon: https://raw.githubusercontent.com/EOSIO/eosio.contracts/master/contracts/icons/account.png#3d55a2fc3a5c20b456f5657faf666bc25ffd06f4836c5e8256f741149b0b294f 31 | --- 32 | Set or update avatar for account {{acc}} 33 | 34 | 35 | 36 |

setusername

37 | 38 | --- 39 | spec_version: "0.2.0" 40 | title: setusername 41 | summary: 'setusername' 42 | icon: https://raw.githubusercontent.com/EOSIO/eosio.contracts/master/contracts/icons/account.png#3d55a2fc3a5c20b456f5657faf666bc25ffd06f4836c5e8256f741149b0b294f 43 | --- 44 | Set or update nickname for account {{acc}} 45 | 46 | 47 | 48 |

userverify

49 | 50 | --- 51 | spec_version: "0.2.0" 52 | title: userverify 53 | summary: 'userverify' 54 | icon: https://raw.githubusercontent.com/EOSIO/eosio.contracts/master/contracts/icons/account.png#3d55a2fc3a5c20b456f5657faf666bc25ffd06f4836c5e8256f741149b0b294f 55 | --- 56 | Adds identity verification for {{acc}} by verification authority {{verifier}} 57 | 58 | 59 | 60 |

updateraccs

61 | 62 | --- 63 | spec_version: "0.2.0" 64 | title: updateraccs 65 | summary: 'updateraccs' 66 | icon: https://raw.githubusercontent.com/EOSIO/eosio.contracts/master/contracts/icons/account.png#3d55a2fc3a5c20b456f5657faf666bc25ffd06f4836c5e8256f741149b0b294f 67 | --- 68 | Updates a whitelist of accounts for user {{acc}} for additional security. 69 | 70 | 71 | 72 |

updateaacts

73 | 74 | --- 75 | spec_version: "0.2.0" 76 | title: updateaacts 77 | summary: 'updateaacts' 78 | icon: https://raw.githubusercontent.com/EOSIO/eosio.contracts/master/contracts/icons/account.png#3d55a2fc3a5c20b456f5657faf666bc25ffd06f4836c5e8256f741149b0b294f 79 | --- 80 | Updates a whitelist of actions for user {{acc}} for additional security. 81 | 82 | 83 | 84 |

updateac

85 | 86 | --- 87 | spec_version: "0.2.0" 88 | title: updateac 89 | summary: 'updateac' 90 | icon: https://raw.githubusercontent.com/EOSIO/eosio.contracts/master/contracts/icons/account.png#3d55a2fc3a5c20b456f5657faf666bc25ffd06f4836c5e8256f741149b0b294f 91 | --- 92 | Updates a whitelist of tokens for user {{acc}} for additional security. 93 | 94 | 95 | 96 |

reqperm

97 | 98 | --- 99 | spec_version: "0.2.0" 100 | title: reqperm 101 | summary: 'reqperm' 102 | icon: https://raw.githubusercontent.com/EOSIO/eosio.contracts/master/contracts/icons/account.png#3d55a2fc3a5c20b456f5657faf666bc25ffd06f4836c5e8256f741149b0b294f 103 | --- 104 | Request Permissions for {{acc}} for whitelisted Proton actions 105 | 106 | 107 | 108 |

remove

109 | 110 | --- 111 | spec_version: "0.2.0" 112 | title: remove 113 | summary: 'remove' 114 | icon: https://raw.githubusercontent.com/EOSIO/eosio.contracts/master/contracts/icons/account.png#3d55a2fc3a5c20b456f5657faf666bc25ffd06f4836c5e8256f741149b0b294f 115 | --- 116 | Removes user info data for {{acc}} 117 | 118 |

newaccres

119 | 120 | --- 121 | spec_version: "0.2.0" 122 | title: newaccres 123 | summary: 'newaccres' 124 | icon: https://raw.githubusercontent.com/EOSIO/eosio.contracts/master/contracts/icons/account.png#3d55a2fc3a5c20b456f5657faf666bc25ffd06f4836c5e8256f741149b0b294f 125 | --- 126 | 127 | Give resources to new account 128 | 129 | 130 |

kickbp

131 | 132 | --- 133 | spec_version: "0.2.0" 134 | title: kickbp 135 | summary: 'kickbp' 136 | icon: https://raw.githubusercontent.com/EOSIO/eosio.contracts/master/contracts/icons/admin.png#9bf1cec664863bd6aaac0f814b235f8799fb02c850e9aa5da34e8a004bd6518e 137 | --- 138 | Removes the ability of account {{producer}} to register as a block producer. This is probably called from kickbp in eosio.system. 139 | 140 | 141 | 142 |

addkyc

143 | 144 | --- 145 | spec_version: "0.2.0" 146 | title: addkyc 147 | summary: 'addkyc' 148 | icon: https://raw.githubusercontent.com/EOSIO/eosio.contracts/master/contracts/icons/account.png#3d55a2fc3a5c20b456f5657faf666bc25ffd06f4836c5e8256f741149b0b294f 149 | --- 150 | Adds KYC approval to account {{acc}} from kyc provider {{kyc}} 151 | 152 | 153 | 154 |

updatekyc

155 | 156 | --- 157 | spec_version: "0.2.0" 158 | title: updatekyc 159 | summary: 'updatekyc' 160 | icon: https://raw.githubusercontent.com/EOSIO/eosio.contracts/master/contracts/icons/account.png#3d55a2fc3a5c20b456f5657faf666bc25ffd06f4836c5e8256f741149b0b294f 161 | --- 162 | Updates KYC approval for account {{acc}} from kyc provider {{kyc}} 163 | 164 | 165 | 166 |

removekyc

167 | 168 | --- 169 | spec_version: "0.2.0" 170 | title: removekyc 171 | summary: 'removekyc' 172 | icon: https://raw.githubusercontent.com/EOSIO/eosio.contracts/master/contracts/icons/account.png#3d55a2fc3a5c20b456f5657faf666bc25ffd06f4836c5e8256f741149b0b294f 173 | --- 174 | Removes KYC approval for account {{acc}} from kyc provider {{kyc}} 175 | 176 | 177 | 178 |

addkycprov

179 | 180 | --- 181 | spec_version: "0.2.0" 182 | title: addkycprov 183 | summary: 'addkycprov' 184 | icon: https://raw.githubusercontent.com/EOSIO/eosio.contracts/master/contracts/icons/account.png#3d55a2fc3a5c20b456f5657faf666bc25ffd06f4836c5e8256f741149b0b294f 185 | --- 186 | Adds {{kyc_provider}} as a kyc_provider 187 | 188 | 189 | 190 |

blkycprov

191 | 192 | --- 193 | spec_version: "0.2.0" 194 | title: blkycprov 195 | summary: 'blkycprov' 196 | icon: https://raw.githubusercontent.com/EOSIO/eosio.contracts/master/contracts/icons/account.png#3d55a2fc3a5c20b456f5657faf666bc25ffd06f4836c5e8256f741149b0b294f 197 | --- 198 | Blacklists KYC provider {{kyc_provider}} 199 | 200 | 201 | 202 |

rmvkycprov

203 | 204 | --- 205 | spec_version: "0.2.0" 206 | title: rmvkycprov 207 | summary: 'rmvkycprov' 208 | icon: https://raw.githubusercontent.com/EOSIO/eosio.contracts/master/contracts/icons/account.png#3d55a2fc3a5c20b456f5657faf666bc25ffd06f4836c5e8256f741149b0b294f 209 | --- 210 | Removes KYC provider {{kyc_provider}} 211 | 212 | -------------------------------------------------------------------------------- /contracts/cfund.proton/src/cfund.proton.cpp: -------------------------------------------------------------------------------- 1 | /*##################################*\ 2 | # 3 | # 4 | # Created by CryptoLions.io 5 | # 6 | # 7 | \*##################################*/ 8 | 9 | 10 | #include 11 | #include 12 | 13 | namespace eosio { 14 | 15 | ACTION cfundproton::reg( const name& account ){ 16 | 17 | require_auth( get_self() ); 18 | check( is_account( account ), "Account does not exist."); 19 | 20 | conf config(get_self(), get_self().value); 21 | _gstate = config.exists() ? config.get() : global{}; 22 | 23 | users users_( get_self(), get_self().value ); 24 | auto itr = users_.find( account.value ); 25 | check ( itr == users_.end(), "committee already registered."); 26 | 27 | // now = current_time_point().sec_since_epoch(); 28 | if ( itr == users_.end() ) { 29 | users_.emplace( get_self(), [&](auto& s) { 30 | s.account = account; 31 | s.rate = 100; 32 | s.active = true; 33 | s.claimamount = 0; 34 | s.lastclaim = 0; 35 | }); 36 | 37 | _gstate.totalusr++; 38 | _gstate.totalausr++; 39 | 40 | config.set( _gstate, get_self() ); 41 | } 42 | } 43 | 44 | 45 | ACTION cfundproton::unreg( const name& account ){ 46 | 47 | require_auth( get_self() ); 48 | 49 | conf config( get_self(), get_self().value); 50 | _gstate = config.exists() ? config.get() : global{}; 51 | 52 | users users_( get_self(), get_self().value ); 53 | auto itr = users_.find( account.value ); 54 | 55 | check(itr != users_.end(), "committee not registered."); 56 | 57 | if ( itr->active ) { 58 | _gstate.totalausr--; 59 | } 60 | 61 | users_.erase(itr); 62 | 63 | _gstate.totalusr--; 64 | config.set( _gstate, get_self() ); 65 | } 66 | 67 | 68 | ACTION cfundproton::activate( const name& account, const bool& status ){ 69 | require_auth( get_self() ); 70 | 71 | conf config( get_self(), get_self().value); 72 | _gstate = config.exists() ? config.get() : global{}; 73 | 74 | users users_( get_self(), get_self().value ); 75 | auto itr = users_.find( account.value ); 76 | 77 | check(itr != users_.end(), "Committee not found."); 78 | 79 | check(status != itr->active, "status is the same"); 80 | 81 | if (status) { 82 | _gstate.totalausr++; 83 | } else { 84 | _gstate.totalausr--; 85 | } 86 | 87 | users_.modify(itr, get_self(), [&](auto& s) { 88 | s.active = status; 89 | }); 90 | 91 | config.set( _gstate, get_self() ); 92 | } 93 | 94 | 95 | ACTION cfundproton::claimreward( const name& account){ 96 | require_auth( account ); 97 | 98 | conf config( get_self(), get_self().value); 99 | _gstate = config.exists() ? config.get() : global{}; 100 | 101 | users users_( get_self(), get_self().value ); 102 | auto itr = users_.find(account.value); 103 | 104 | check(itr != users_.end(), "Committee not found."); 105 | check ( current_time_point().sec_since_epoch() - itr->lastclaim > claimInterval, "You last claim was less than 24h ago."); 106 | check ( itr->claimamount > 0, "Nothing to claim."); 107 | check ( itr->active == true, "committee member is not activated."); 108 | 109 | auto sendClaim = action( 110 | permission_level{ get_self(), "active"_n }, 111 | TOKEN_CONTRACT, 112 | "transfer"_n, 113 | std::make_tuple( get_self(), itr->account, asset(itr->claimamount, TOKEN_SYMB), std::string("Committee claim reward") ) 114 | ); 115 | 116 | sendClaim.send(); 117 | 118 | if ( _gstate.notclaimed > itr->claimamount) // should be always greater . 119 | _gstate.notclaimed -= itr->claimamount; 120 | 121 | users_.modify(itr, account, [&](auto& s) { 122 | s.claimamount = 0; 123 | s.lastclaim = current_time_point().sec_since_epoch(); 124 | }); 125 | 126 | config.set( _gstate, get_self() ); 127 | } 128 | 129 | 130 | ACTION cfundproton::process( ){ 131 | require_auth( get_self() ); 132 | 133 | conf config( get_self(), get_self().value); 134 | _gstate = config.exists() ? config.get() : global{}; 135 | 136 | users users_( get_self(), get_self().value ); 137 | 138 | uint64_t now = current_time_point().sec_since_epoch(); 139 | 140 | bool isWork = false; 141 | 142 | if (_gstate.isprocessing == true) { 143 | isWork = true; 144 | } else if ( now - _gstate.processtime >= processIntreval){ 145 | isWork = true; 146 | _gstate.processtime = now; 147 | _gstate.processQuant = _gstate.pool; 148 | _gstate.pool = 0; 149 | _gstate.isprocessing = true; 150 | _gstate.processFrom = ""_n; 151 | 152 | //Deferred for auto next call 153 | eosio::transaction out; 154 | out.actions.emplace_back( permission_level{get_self(), "active"_n}, get_self(), "process"_n, get_self() ); 155 | out.delay_sec = processIntreval + 1; 156 | out.send( get_self().value, get_self(), true ); 157 | } else { 158 | print("nothing to do."); 159 | } 160 | 161 | if (isWork ){ 162 | auto itr = users_.begin(); 163 | if (_gstate.processFrom.value) { 164 | itr = users_.lower_bound(_gstate.processFrom.value); 165 | } 166 | 167 | uint64_t count = 0; 168 | 169 | while ( itr != users_.end() && count < _gstate.processBy ){ 170 | count++; 171 | if ( itr->active ){ 172 | uint64_t claim = 0; 173 | if ( _gstate.totalausr > 0 ) { 174 | claim = _gstate.processQuant / _gstate.totalausr ; 175 | } 176 | 177 | _gstate.processed += claim; 178 | 179 | users_.modify(itr, get_self(), [&](auto& s) { 180 | s.claimamount += claim; 181 | }); 182 | } 183 | itr++; 184 | } 185 | 186 | if ( itr != users_.end() ){ 187 | _gstate.processFrom = itr->account; 188 | print("Not Finished. "); 189 | //Deferred for auto next call 190 | eosio::transaction out; 191 | out.actions.emplace_back( permission_level{get_self(), "active"_n}, get_self(), "process"_n, get_self() ); 192 | out.delay_sec = 0; 193 | out.send( get_self().value, get_self(), true ); 194 | } else { 195 | _gstate.isprocessing = false; 196 | _gstate.processFrom = ""_n; 197 | 198 | if (_gstate.processed < _gstate.processQuant){ 199 | print("Finished. Tokens returned to pool: ", (_gstate.processQuant - _gstate.processed)); 200 | _gstate.pool += _gstate.processQuant - _gstate.processed; 201 | } 202 | 203 | _gstate.processQuant = 0; 204 | _gstate.processed = 0; 205 | } 206 | config.set( _gstate, get_self() ); 207 | } 208 | } 209 | 210 | 211 | 212 | void cfundproton::onTokenReceive( const name& from, const name& to, const asset& quantity, const string& memo ){ 213 | if ( to != get_self() ) { 214 | return; 215 | } 216 | if ( from == get_self() ) { 217 | return; 218 | } 219 | 220 | if ( quantity.symbol.code().raw() != TOKEN_SYMB.code().raw() ) { 221 | return; 222 | } 223 | 224 | conf config(get_self(), get_self().value); 225 | _gstate = config.exists() ? config.get() : global{}; 226 | 227 | _gstate.pool += quantity.amount; 228 | _gstate.notclaimed += quantity.amount; 229 | 230 | config.set( _gstate, get_self() ); 231 | } 232 | 233 | } 234 | -------------------------------------------------------------------------------- /contracts/eosio.bios/ricardian/eosio.bios.contracts.md: -------------------------------------------------------------------------------- 1 |

activate

2 | 3 | --- 4 | spec_version: "0.2.0" 5 | title: Activate Protocol Feature 6 | summary: 'Activate protocol feature {{nowrap feature_digest}}' 7 | icon: https://raw.githubusercontent.com/EOSIO/eosio.contracts/master/contracts/icons/admin.png#9bf1cec664863bd6aaac0f814b235f8799fb02c850e9aa5da34e8a004bd6518e 8 | --- 9 | 10 | {{$action.account}} activates the protocol feature with a digest of {{feature_digest}}. 11 | 12 |

canceldelay

13 | 14 | --- 15 | spec_version: "0.2.0" 16 | title: Cancel Delayed Transaction 17 | summary: '{{nowrap canceling_auth.actor}} cancels a delayed transaction' 18 | icon: https://raw.githubusercontent.com/EOSIO/eosio.contracts/master/contracts/icons/account.png#3d55a2fc3a5c20b456f5657faf666bc25ffd06f4836c5e8256f741149b0b294f 19 | --- 20 | 21 | {{canceling_auth.actor}} cancels the delayed transaction with id {{trx_id}}. 22 | 23 |

deleteauth

24 | 25 | --- 26 | spec_version: "0.2.0" 27 | title: Delete Account Permission 28 | summary: 'Delete the {{nowrap permission}} permission of {{nowrap account}}' 29 | icon: https://raw.githubusercontent.com/EOSIO/eosio.contracts/master/contracts/icons/account.png#3d55a2fc3a5c20b456f5657faf666bc25ffd06f4836c5e8256f741149b0b294f 30 | --- 31 | 32 | Delete the {{permission}} permission of {{account}}. 33 | 34 |

linkauth

35 | 36 | --- 37 | spec_version: "0.2.0" 38 | title: Link Action to Permission 39 | summary: '{{nowrap account}} sets the minimum required permission for the {{#if type}}{{nowrap type}} action of the{{/if}} {{nowrap code}} contract to {{nowrap requirement}}' 40 | icon: https://raw.githubusercontent.com/EOSIO/eosio.contracts/master/contracts/icons/account.png#3d55a2fc3a5c20b456f5657faf666bc25ffd06f4836c5e8256f741149b0b294f 41 | --- 42 | 43 | {{account}} sets the minimum required permission for the {{#if type}}{{type}} action of the{{/if}} {{code}} contract to {{requirement}}. 44 | 45 | {{#if type}}{{else}}Any links explicitly associated to specific actions of {{code}} will take precedence.{{/if}} 46 | 47 |

newaccount

48 | 49 | --- 50 | spec_version: "0.2.0" 51 | title: Create New Account 52 | summary: '{{nowrap creator}} creates a new account with the name {{nowrap name}}' 53 | icon: https://raw.githubusercontent.com/EOSIO/eosio.contracts/master/contracts/icons/account.png#3d55a2fc3a5c20b456f5657faf666bc25ffd06f4836c5e8256f741149b0b294f 54 | --- 55 | 56 | {{creator}} creates a new account with the name {{name}} and the following permissions: 57 | 58 | owner permission with authority: 59 | {{to_json owner}} 60 | 61 | active permission with authority: 62 | {{to_json active}} 63 | 64 |

reqactivated

65 | 66 | --- 67 | spec_version: "0.2.0" 68 | title: Assert Protocol Feature Activation 69 | summary: 'Assert that protocol feature {{nowrap feature_digest}} has been activated' 70 | icon: https://raw.githubusercontent.com/EOSIO/eosio.contracts/master/contracts/icons/admin.png#9bf1cec664863bd6aaac0f814b235f8799fb02c850e9aa5da34e8a004bd6518e 71 | --- 72 | 73 | Assert that the protocol feature with a digest of {{feature_digest}} has been activated. 74 | 75 |

reqauth

76 | 77 | --- 78 | spec_version: "0.2.0" 79 | title: Assert Authorization 80 | summary: 'Assert that authorization by {{nowrap from}} is provided' 81 | icon: https://raw.githubusercontent.com/EOSIO/eosio.contracts/master/contracts/icons/account.png#3d55a2fc3a5c20b456f5657faf666bc25ffd06f4836c5e8256f741149b0b294f 82 | --- 83 | 84 | Assert that authorization by {{from}} is provided. 85 | 86 |

setabi

87 | 88 | --- 89 | spec_version: "0.2.0" 90 | title: Deploy Contract ABI 91 | summary: 'Deploy contract ABI on account {{nowrap account}}' 92 | icon: https://raw.githubusercontent.com/EOSIO/eosio.contracts/master/contracts/icons/account.png#3d55a2fc3a5c20b456f5657faf666bc25ffd06f4836c5e8256f741149b0b294f 93 | --- 94 | 95 | Deploy the ABI file associated with the contract on account {{account}}. 96 | 97 |

setalimits

98 | 99 | --- 100 | spec_version: "0.2.0" 101 | title: Adjust Resource Limits of Account 102 | summary: 'Adjust resource limits of account {{nowrap account}}' 103 | icon: https://raw.githubusercontent.com/EOSIO/eosio.contracts/master/contracts/icons/admin.png#9bf1cec664863bd6aaac0f814b235f8799fb02c850e9aa5da34e8a004bd6518e 104 | --- 105 | 106 | {{$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}}. 107 | 108 |

setcode

109 | 110 | --- 111 | spec_version: "0.2.0" 112 | title: Deploy Contract Code 113 | summary: 'Deploy contract code on account {{nowrap account}}' 114 | icon: https://raw.githubusercontent.com/EOSIO/eosio.contracts/master/contracts/icons/account.png#3d55a2fc3a5c20b456f5657faf666bc25ffd06f4836c5e8256f741149b0b294f 115 | --- 116 | 117 | Deploy compiled contract code to the account {{account}}. 118 | 119 |

setparams

120 | 121 | --- 122 | spec_version: "0.2.0" 123 | title: Set System Parameters 124 | summary: 'Set system parameters' 125 | icon: https://raw.githubusercontent.com/EOSIO/eosio.contracts/master/contracts/icons/admin.png#9bf1cec664863bd6aaac0f814b235f8799fb02c850e9aa5da34e8a004bd6518e 126 | --- 127 | 128 | {{$action.account}} sets system parameters to: 129 | {{to_json params}} 130 | 131 |

setpriv

132 | 133 | --- 134 | spec_version: "0.2.0" 135 | title: Make an Account Privileged or Unprivileged 136 | summary: '{{#if is_priv}}Make {{nowrap account}} privileged{{else}}Remove privileged status of {{nowrap account}}{{/if}}' 137 | icon: https://raw.githubusercontent.com/EOSIO/eosio.contracts/master/contracts/icons/admin.png#9bf1cec664863bd6aaac0f814b235f8799fb02c850e9aa5da34e8a004bd6518e 138 | --- 139 | 140 | {{#if is_priv}} 141 | {{$action.account}} makes {{account}} privileged. 142 | {{else}} 143 | {{$action.account}} removes privileged status of {{account}}. 144 | {{/if}} 145 | 146 |

setprods

147 | 148 | --- 149 | spec_version: "0.2.0" 150 | title: Set Block Producers 151 | summary: 'Set block producer schedule' 152 | icon: https://raw.githubusercontent.com/EOSIO/eosio.contracts/master/contracts/icons/admin.png#9bf1cec664863bd6aaac0f814b235f8799fb02c850e9aa5da34e8a004bd6518e 153 | --- 154 | 155 | {{$action.account}} proposes a block producer schedule of: 156 | {{#each schedule}} 157 | 1. {{this.producer_name}} 158 | {{/each}} 159 | 160 | The block signing authorities of each of the producers in the above schedule are listed below: 161 | {{#each schedule}} 162 | ### {{this.producer_name}} 163 | {{to_json this.authority}} 164 | {{/each}} 165 | 166 |

unlinkauth

167 | 168 | --- 169 | spec_version: "0.2.0" 170 | title: Unlink Action from Permission 171 | summary: '{{nowrap account}} unsets the minimum required permission for the {{#if type}}{{nowrap type}} action of the{{/if}} {{nowrap code}} contract' 172 | icon: https://raw.githubusercontent.com/EOSIO/eosio.contracts/master/contracts/icons/account.png#3d55a2fc3a5c20b456f5657faf666bc25ffd06f4836c5e8256f741149b0b294f 173 | --- 174 | 175 | {{account}} removes the association between the {{#if type}}{{type}} action of the{{/if}} {{code}} contract and its minimum required permission. 176 | 177 | {{#if type}}{{else}}This will not remove any links explicitly associated to specific actions of {{code}}.{{/if}} 178 | 179 |

updateauth

180 | 181 | --- 182 | spec_version: "0.2.0" 183 | title: Modify Account Permission 184 | summary: 'Add or update the {{nowrap permission}} permission of {{nowrap account}}' 185 | icon: https://raw.githubusercontent.com/EOSIO/eosio.contracts/master/contracts/icons/account.png#3d55a2fc3a5c20b456f5657faf666bc25ffd06f4836c5e8256f741149b0b294f 186 | --- 187 | 188 | Modify, and create if necessary, the {{permission}} permission of {{account}} to have a parent permission of {{parent}} and the following authority: 189 | {{to_json auth}} 190 | --------------------------------------------------------------------------------