Skip to content

Commit

Permalink
Merge pull request #278 from EOSIO/merge-release-1.6.1-to-master
Browse files Browse the repository at this point in the history
Version 1.6.1
  • Loading branch information
arhag authored Jun 28, 2019
2 parents c046863 + 08c156a commit 0c18e54
Show file tree
Hide file tree
Showing 50 changed files with 1,178 additions and 70 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ project(eosio_contracts)

set(VERSION_MAJOR 1)
set(VERSION_MINOR 6)
set(VERSION_PATCH 0)
set(VERSION_PATCH 1)
#set(VERSION_SUFFIX rc3)

if (VERSION_SUFFIX)
Expand Down
15 changes: 9 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
# eosio.contracts

## Version : 1.6.0
## Version : 1.6.1

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 system, token, msig and wrap (formerly known as sudo) contracts.

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:

* [eosio.system](https://github.com/eosio/eosio.contracts/tree/master/eosio.system)
* [eosio.msig](https://github.com/eosio/eosio.contracts/tree/master/eosio.msig)
* [eosio.wrap](https://github.com/eosio/eosio.contracts/tree/master/eosio.wrap)
* [eosio.bios](./contracts/eosio.bios)
* [eosio.system](./contracts/eosio.system)
* [eosio.msig](./contracts/eosio.msig)
* [eosio.wrap](./contracts/eosio.wrap)

The following unprivileged contract(s) are also part of the system.
* [eosio.token](https://github.com/eosio/eosio.contracts/tree/master/eosio.token)
* [eosio.token](./contracts/eosio.token)

Dependencies:
* [eosio v1.7.x](https://github.com/EOSIO/eos/releases/tag/v1.7.0)
* [eosio v1.7.x](https://github.com/EOSIO/eos/releases/tag/v1.7.4)
* [eosio.cdt v1.5.x](https://github.com/EOSIO/eosio.cdt/releases/tag/v1.5.0)

To build the contracts and the unit tests:
Expand All @@ -37,6 +38,8 @@ After build:

[MIT](./LICENSE)

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.

## Important

See LICENSE for copyright and license terms. Block.one makes its contribution on a voluntary basis as a member of the EOSIO community and is not responsible for ensuring the overall performance of the software or any related applications. We make no representation, warranty, guarantee or undertaking in respect of the software or any related documentation, whether expressed or implied, including but not limited to the warranties or 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 documentation or the use or other dealings in the software or documentation. Any test results or performance figures are indicative and will not reflect performance under all conditions. Any reference to any third party or third-party product, service or other resource is not an endorsement or recommendation by Block.one. We are not responsible, 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 the information here may be out of date or inaccurate.
11 changes: 11 additions & 0 deletions contracts/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,17 @@ project(contracts)
set(EOSIO_WASM_OLD_BEHAVIOR "Off")
find_package(eosio.cdt)

set(ICON_BASE_URL "http://127.0.0.1/ricardian_assets/eosio.contracts/icons")

set(ACCOUNT_ICON_URI "account.png#3d55a2fc3a5c20b456f5657faf666bc25ffd06f4836c5e8256f741149b0b294f")
set(ADMIN_ICON_URI "admin.png#9bf1cec664863bd6aaac0f814b235f8799fb02c850e9aa5da34e8a004bd6518e")
set(MULTISIG_ICON_URI "multisig.png#4fb41d3cf02d0dd2d35a29308e93c2d826ec770d6bb520db668f530764be7153")
set(RESOURCE_ICON_URI "resource.png#3830f1ce8cb07f7757dbcf383b1ec1b11914ac34a1f9d8b065f07600fa9dac19")
set(REX_ICON_URI "rex.png#d229837fa62a464b9c71e06060aa86179adf0b3f4e3b8c4f9702f4f4b0c340a8")
set(TOKEN_ICON_URI "token.png#207ff68b0406eaa56618b08bda81d6a0954543f36adc328ab3065f31a5c5d654")
set(TRANSFER_ICON_URI "transfer.png#5dfad0df72772ee1ccc155e670c1d124f5c5122f1d5027565df38b418042d1dd")
set(VOTING_ICON_URI "voting.png#db28cd3db6e62d4509af3644ce7d377329482a14bb4bfaca2aa5f1400d8e8a84")

add_subdirectory(eosio.bios)
add_subdirectory(eosio.msig)
add_subdirectory(eosio.system)
Expand Down
4 changes: 4 additions & 0 deletions contracts/eosio.bios/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,7 @@ target_include_directories(eosio.bios
set_target_properties(eosio.bios
PROPERTIES
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")

configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/ricardian/eosio.bios.contracts.md.in ${CMAKE_CURRENT_BINARY_DIR}/ricardian/eosio.bios.contracts.md @ONLY )

target_compile_options( eosio.bios PUBLIC -R${CMAKE_CURRENT_SOURCE_DIR}/ricardian -R${CMAKE_CURRENT_BINARY_DIR}/ricardian )
9 changes: 1 addition & 8 deletions contracts/eosio.bios/include/eosio.bios/eosio.bios.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,12 +111,6 @@ namespace eosio {
set_resource_limits( account.value, ram_bytes, net_weight, cpu_weight );
}

[[eosio::action]]
void setglimits( uint64_t ram, uint64_t net, uint64_t cpu ) {
(void)ram; (void)net; (void)cpu;
require_auth( _self );
}

[[eosio::action]]
void setprods( std::vector<eosio::producer_key> schedule ) {
(void)schedule; // schedule argument just forces the deserialization of the action data into vector<producer_key> (necessary check)
Expand Down Expand Up @@ -165,7 +159,7 @@ namespace eosio {
};

typedef eosio::multi_index< "abihash"_n, abi_hash > abi_hash_table;

using newaccount_action = action_wrapper<"newaccount"_n, &bios::newaccount>;
using updateauth_action = action_wrapper<"updateauth"_n, &bios::updateauth>;
using deleteauth_action = action_wrapper<"deleteauth"_n, &bios::deleteauth>;
Expand All @@ -175,7 +169,6 @@ namespace eosio {
using setcode_action = action_wrapper<"setcode"_n, &bios::setcode>;
using setpriv_action = action_wrapper<"setpriv"_n, &bios::setpriv>;
using setalimits_action = action_wrapper<"setalimits"_n, &bios::setalimits>;
using setglimits_action = action_wrapper<"setglimits"_n, &bios::setglimits>;
using setprods_action = action_wrapper<"setprods"_n, &bios::setprods>;
using setparams_action = action_wrapper<"setparams"_n, &bios::setparams>;
using reqauth_action = action_wrapper<"reqauth"_n, &bios::reqauth>;
Expand Down
161 changes: 161 additions & 0 deletions contracts/eosio.bios/ricardian/eosio.bios.contracts.md.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,161 @@
<h1 class="contract">canceldelay</h1>

---
spec_version: "0.2.0"
title: Cancel Delayed Transaction
summary: '{{nowrap canceling_auth.actor}} cancels a delayed transaction'
icon: @ICON_BASE_URL@/@ACCOUNT_ICON_URI@
---

{{canceling_auth.actor}} cancels the delayed transaction with id {{trx_id}}.

<h1 class="contract">deleteauth</h1>

---
spec_version: "0.2.0"
title: Delete Account Permission
summary: 'Delete the {{nowrap permission}} permission of {{nowrap account}}'
icon: @ICON_BASE_URL@/@ACCOUNT_ICON_URI@
---

Delete the {{permission}} permission of {{account}}.

<h1 class="contract">linkauth</h1>

---
spec_version: "0.2.0"
title: Link Action to Permission
summary: '{{nowrap account}} sets the minimum required permission for the {{#if type}}{{nowrap type}} action of the{{/if}} {{nowrap code}} contract to {{nowrap requirement}}'
icon: @ICON_BASE_URL@/@ACCOUNT_ICON_URI@
---

{{account}} sets the minimum required permission for the {{#if type}}{{type}} action of the{{/if}} {{code}} contract to {{requirement}}.

{{#if type}}{{else}}Any links explicitly associated to specific actions of {{code}} will take precedence.{{/if}}

<h1 class="contract">newaccount</h1>

---
spec_version: "0.2.0"
title: Create New Account
summary: '{{nowrap creator}} creates a new account with the name {{nowrap name}}'
icon: @ICON_BASE_URL@/@ACCOUNT_ICON_URI@
---

{{creator}} creates a new account with the name {{name}} and the following permissions:

owner permission with authority:
{{to_json owner}}

active permission with authority:
{{to_json active}}

<h1 class="contract">reqauth</h1>

---
spec_version: "0.2.0"
title: Assert Authorization
summary: 'Assert that authorization by {{nowrap from}} is provided'
icon: @ICON_BASE_URL@/@ACCOUNT_ICON_URI@
---

Assert that authorization by {{from}} is provided.

<h1 class="contract">setabi</h1>

---
spec_version: "0.2.0"
title: Deploy Contract ABI
summary: 'Deploy contract ABI on account {{nowrap account}}'
icon: @ICON_BASE_URL@/@ACCOUNT_ICON_URI@
---

Deploy the ABI file associated with the contract on account {{account}}.

<h1 class="contract">setalimits</h1>

---
spec_version: "0.2.0"
title: Adjust Resource Limits of Account
summary: 'Adjust resource limits of account {{nowrap account}}'
icon: @ICON_BASE_URL@/@ADMIN_ICON_URI@
---

{{$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}}.

<h1 class="contract">setcode</h1>

---
spec_version: "0.2.0"
title: Deploy Contract Code
summary: 'Deploy contract code on account {{nowrap account}}'
icon: @ICON_BASE_URL@/@ACCOUNT_ICON_URI@
---

Deploy compiled contract code to the account {{account}}.

<h1 class="contract">setparams</h1>

---
spec_version: "0.2.0"
title: Set System Parameters
summary: 'Set system parameters'
icon: @ICON_BASE_URL@/@ADMIN_ICON_URI@
---

{{$action.account}} sets system parameters to:
{{to_json params}}

<h1 class="contract">setpriv</h1>

---
spec_version: "0.2.0"
title: Make an Account Privileged or Unprivileged
summary: '{{#if is_priv}}Make {{nowrap account}} privileged{{else}}Remove privileged status of {{nowrap account}}{{/if}}'
icon: @ICON_BASE_URL@/@ADMIN_ICON_URI@
---

{{#if is_priv}}
{{$action.account}} makes {{account}} privileged.
{{else}}
{{$action.account}} removes privileged status of {{account}}.
{{/if}}

<h1 class="contract">setprods</h1>

---
spec_version: "0.2.0"
title: Set Block Producers
summary: 'Set block producer schedule'
icon: @ICON_BASE_URL@/@ADMIN_ICON_URI@
---

{{$action.account}} proposes a block producer schedule of:
{{#each schedule}}
1. {{this.producer_name}} with a block signing key of {{this.block_signing_key}}
{{/each}}

<h1 class="contract">unlinkauth</h1>

---
spec_version: "0.2.0"
title: Unlink Action from Permission
summary: '{{nowrap account}} unsets the minimum required permission for the {{#if type}}{{nowrap type}} action of the{{/if}} {{nowrap code}} contract'
icon: @ICON_BASE_URL@/@ACCOUNT_ICON_URI@
---

{{account}} removes the association between the {{#if type}}{{type}} action of the{{/if}} {{code}} contract and its minimum required permission.

{{#if type}}{{else}}This will not remove any links explicitly associated to specific actions of {{code}}.{{/if}}

<h1 class="contract">updateauth</h1>

---
spec_version: "0.2.0"
title: Modify Account Permission
summary: 'Add or update the {{nowrap permission}} permission of {{nowrap account}}'
icon: @ICON_BASE_URL@/@ACCOUNT_ICON_URI@
---

Modify, and create if necessary, the {{permission}} permission of {{account}} to have a parent permission of {{parent}} and the following authority:
{{to_json auth}}
2 changes: 1 addition & 1 deletion contracts/eosio.bios/src/eosio.bios.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#include <eosio.bios/eosio.bios.hpp>

EOSIO_DISPATCH( eosio::bios, (setpriv)(setalimits)(setglimits)(setprods)(setparams)(reqauth)(setabi) )
EOSIO_DISPATCH( eosio::bios, (setpriv)(setalimits)(setprods)(setparams)(reqauth)(setabi) )
4 changes: 4 additions & 0 deletions contracts/eosio.msig/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,7 @@ target_include_directories(eosio.msig
set_target_properties(eosio.msig
PROPERTIES
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")

configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/ricardian/eosio.msig.contracts.md.in ${CMAKE_CURRENT_BINARY_DIR}/ricardian/eosio.msig.contracts.md @ONLY )

target_compile_options( eosio.msig PUBLIC -R${CMAKE_CURRENT_SOURCE_DIR}/ricardian -R${CMAKE_CURRENT_BINARY_DIR}/ricardian )
73 changes: 73 additions & 0 deletions contracts/eosio.msig/ricardian/eosio.msig.contracts.md.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
<h1 class="contract">approve</h1>

---
spec_version: "0.2.0"
title: Approve Proposed Transaction
summary: '{{nowrap level.actor}} approves the {{nowrap proposal_name}} proposal'
icon: @ICON_BASE_URL@/@MULTISIG_ICON_URI@
---

{{level.actor}} approves the {{proposal_name}} proposal proposed by {{proposer}} with the {{level.permission}} permission of {{level.actor}}.

<h1 class="contract">cancel</h1>

---
spec_version: "0.2.0"
title: Cancel Proposed Transaction
summary: '{{nowrap canceler}} cancels the {{nowrap proposal_name}} proposal'
icon: @ICON_BASE_URL@/@MULTISIG_ICON_URI@
---

{{canceler}} cancels the {{proposal_name}} proposal submitted by {{proposer}}.

<h1 class="contract">exec</h1>

---
spec_version: "0.2.0"
title: Execute Proposed Transaction
summary: '{{nowrap executer}} executes the {{nowrap proposal_name}} proposal'
icon: @ICON_BASE_URL@/@MULTISIG_ICON_URI@
---

{{executer}} executes the {{proposal_name}} proposal submitted by {{proposer}} if the minimum required approvals for the proposal have been secured.

<h1 class="contract">invalidate</h1>

---
spec_version: "0.2.0"
title: Invalidate All Approvals
summary: '{{nowrap account}} invalidates approvals on outstanding proposals'
icon: @ICON_BASE_URL@/@MULTISIG_ICON_URI@
---

{{account}} invalidates all approvals on proposals which have not yet executed.

<h1 class="contract">propose</h1>

---
spec_version: "0.2.0"
title: Propose Transaction
summary: '{{nowrap proposer}} creates the {{nowrap proposal_name}}'
icon: @ICON_BASE_URL@/@MULTISIG_ICON_URI@
---

{{proposer}} creates the {{proposal_name}} proposal for the following transaction:
{{to_json trx}}

The proposal requests approvals from the following accounts at the specified permission levels:
{{#each requested}}
+ {{this.permission}} permission of {{this.actor}}
{{/each}}

If the proposed transaction is not executed prior to {{trx.expiration}}, the proposal will automatically expire.

<h1 class="contract">unapprove</h1>

---
spec_version: "0.2.0"
title: Unapprove Proposed Transaction
summary: '{{nowrap level.actor}} revokes the approval previously provided to {{nowrap proposal_name}} proposal'
icon: @ICON_BASE_URL@/@MULTISIG_ICON_URI@
---

{{level.actor}} revokes the approval previously provided at their {{level.permission}} permission level from the {{proposal_name}} proposal proposed by {{proposer}}.
4 changes: 4 additions & 0 deletions contracts/eosio.system/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,7 @@ target_include_directories(rex.results
set_target_properties(rex.results
PROPERTIES
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/.rex")

configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/ricardian/eosio.system.contracts.md.in ${CMAKE_CURRENT_BINARY_DIR}/ricardian/eosio.system.contracts.md @ONLY )

target_compile_options( eosio.system PUBLIC -R${CMAKE_CURRENT_SOURCE_DIR}/ricardian -R${CMAKE_CURRENT_BINARY_DIR}/ricardian )
4 changes: 2 additions & 2 deletions contracts/eosio.system/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,8 @@ The naming convention is codeaccount::actionname followed by a list of paramters
- **loan_num** loan id
- **amount** tokens transfered from CPU loan fund to REX fund

## eosio::defnetloan from loan\_num amount
- Withdraws tokens from the fund of a specific NET loan and adds them to REX fund
## eosio::defcpuloan from loan\_num amount
- Withdraws tokens from the fund of a specific CPU loan and adds them to REX fund
- **from** loan creator account
- **loan_num** loan id
- **amount** tokens transfered from NET loan fund to REX fund
Expand Down
10 changes: 3 additions & 7 deletions contracts/eosio.system/include/eosio.system/eosio.system.hpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
/**
* @file
* @copyright defined in eos/LICENSE.txt
*/
#pragma once

#include <eosio.system/native.hpp>
Expand Down Expand Up @@ -481,10 +477,10 @@ namespace eosiosystem {
*/
[[eosio::action]]
void mvtosavings( const name& owner, const asset& rex );

/**
* Moves a specified amount of REX out of savings bucket. The moved amount
* will have the regular REX maturity period of 4 days.
* will have the regular REX maturity period of 4 days.
*/
[[eosio::action]]
void mvfrsavings( const name& owner, const asset& rex );
Expand Down Expand Up @@ -702,7 +698,7 @@ namespace eosiosystem {
template <typename... Args>
static constexpr void call( system_contract* this_contract, Args&&... args )
{
std::invoke( P, this_contract, std::forward<Args>(args)... );
std::invoke( P, this_contract, args... );
for_each<Ps...>::call( this_contract, std::forward<Args>(args)... );
}
};
Expand Down
Loading

0 comments on commit 0c18e54

Please sign in to comment.