Skip to content

Commit

Permalink
Merge pull request #138 from eosnetworkfoundation/tokenomics
Browse files Browse the repository at this point in the history
Tokenomics Changes
  • Loading branch information
nsjames authored May 16, 2024
2 parents 0e73ed5 + 48e279f commit ab4d63a
Show file tree
Hide file tree
Showing 24 changed files with 1,213 additions and 246 deletions.
1 change: 1 addition & 0 deletions .cspell/eos-system-contracts-custom-dictionary.txt
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ setacctram
setalimits
setcode
setinflation
setpayfactor
setparams
setpriv
setram
Expand Down
1 change: 1 addition & 0 deletions contracts/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,6 @@ add_subdirectory(eosio.msig)
add_subdirectory(eosio.system)
add_subdirectory(eosio.token)
add_subdirectory(eosio.wrap)
add_subdirectory(eosio.fees)

add_subdirectory(test_contracts)
11 changes: 11 additions & 0 deletions contracts/eosio.fees/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
add_contract(eosio.fees eosio.fees ${CMAKE_CURRENT_SOURCE_DIR}/src/eosio.fees.cpp)

target_include_directories(eosio.fees PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/include
${CMAKE_CURRENT_SOURCE_DIR}/../eosio.system/include)

set_target_properties(eosio.fees
PROPERTIES
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")

target_compile_options( eosio.fees PUBLIC )
35 changes: 35 additions & 0 deletions contracts/eosio.fees/include/eosio.fees/eosio.fees.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#pragma once

#include <eosio/asset.hpp>
#include <eosio/eosio.hpp>
#include <eosio.system/eosio.system.hpp>

#include <string>

namespace eosiosystem {
class system_contract;
}

namespace eosio {

using std::string;
/**
* The eosio.fees smart contract facilitates the collection of transaction fees from system accounts and their subsequent distribution to the Resource Exchange (REX) pool.
*
* This contract serves as an essential component for inclusion in system-level unit tests.
*
* A comprehensive implementation of the eosio.fees contract can be accessed at EOS Network Foundation GitHub repository.
* https://github.com/eosnetworkfoundation/eosio.fees
*/
class [[eosio::contract("eosio.fees")]] fees : public contract {
public:
using contract::contract;

[[eosio::on_notify("eosio.token::transfer")]]
void on_transfer( const name from, const name to, const asset quantity, const string memo );

[[eosio::action]]
void noop();
};

}
21 changes: 21 additions & 0 deletions contracts/eosio.fees/src/eosio.fees.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#include <eosio.fees/eosio.fees.hpp>

namespace eosio {

void fees::on_transfer( const name from, const name to, const asset quantity, const string memo )
{
if ( to != get_self() ) {
return;
}
if (eosiosystem::system_contract::rex_available()) {
eosiosystem::system_contract::donatetorex_action donatetorex( "eosio"_n, { get_self(), "active"_n });
donatetorex.send(get_self(), quantity, memo);
}
}

void fees::noop()
{
require_auth( get_self() );
}

} /// namespace eosio
154 changes: 136 additions & 18 deletions contracts/eosio.system/include/eosio.system/eosio.system.hpp

Large diffs are not rendered by default.

67 changes: 66 additions & 1 deletion contracts/eosio.system/ricardian/eosio.system.contracts.md.in
Original file line number Diff line number Diff line change
Expand Up @@ -454,6 +454,21 @@ Burn {{bytes}} bytes of unused RAM from account {{owner}}.
{{memo}}
{{/if}}

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

---
spec_version: "0.2.0"
title: Buy and Burn RAM
summary: 'Buy and immediately Burn {{quantity}} of RAM from {{nowrap payer}}'
icon: @ICON_BASE_URL@/@RESOURCE_ICON_URI@
---

Buy and Burn {{quantity}} of RAM from account {{payer}}.

{{#if memo}}There is a memo attached to the action stating:
{{memo}}
{{/if}}

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

---
Expand Down Expand Up @@ -626,6 +641,20 @@ icon: @ICON_BASE_URL@/@ADMIN_ICON_URI@
* Fraction of inflation used to reward block producers: 10000/{{inflation_pay_factor}}
* Fraction of block producer rewards to be distributed proportional to blocks produced: 10000/{{votepay_factor}}

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

---
spec_version: "0.2.0"
title: Set Pay Factors
summary: 'Set pay factors'
icon: @ICON_BASE_URL@/@ADMIN_ICON_URI@
---

{{$action.account}} sets the inflation parameters as follows:

* Fraction of inflation used to reward block producers: 10000/{{inflation_pay_factor}}
* Fraction of block producer rewards to be distributed proportional to blocks produced: 10000/{{votepay_factor}}

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

---
Expand Down Expand Up @@ -752,4 +781,40 @@ summary: 'User may powerup to reserve resources'
icon: @ICON_BASE_URL@/@RESOURCE_ICON_URI@
---

Users may use the powerup action to reserve resources.
Users may use the powerup action to reserve resources.

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

---
spec_version: "0.2.0"
title: Set Annual Rate Schedule
summary: 'Set annual rate parameters'
icon: @ICON_BASE_URL@/@ADMIN_ICON_URI@
---

{{$action.account}} sets a pre-determined inflation schedule to adjust parameters as follows:

* Start time of the schedule: {{start_time}}
* The continuous rate of inflation: {{continuous_rate}}

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

---
spec_version: "0.2.0"
title: Delete Annual Rate Schedule
summary: 'Delete annual rate schedule'
icon: @ICON_BASE_URL@/@ADMIN_ICON_URI@
---

{{$action.account}} to delete a pre-determined inflation schedule from {{start_time}} start time.

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

---
spec_version: "0.2.0"
title: Execute Next Annual Rate Schedule
summary: 'Execute next annual rate schedule'
icon: @ICON_BASE_URL@/@ADMIN_ICON_URI@
---

{{$action.account}} to execute the next upcoming annual rate schedule.
Loading

0 comments on commit ab4d63a

Please sign in to comment.