eosnetworkfoundation/eos-system-contracts

Implement "Log System Fee" ACTION

Closed this issue · 1 comments

Purpose

Create logsystemfee ACTION to be used for logging system fees (RAM, Name Bids, Powerup CPU & NET).

Analytics platforms can use this action to track system fees and provide insights to users.

Currently the only way to calculate fees is to parse each action and calculate the fees based on the action type.

Feedback provided by

logsystemfee ACTION

/**
 * Logging for actions resulting in system fees.
 * Notifies the "eosio.fee" account of the fees collected.
 *
 * @param protocol - name of protocol fees were earned from.
 * @param fee - the amount of fees collected by system.
 * @param memo - (optional) the memo associated with the action.
 */
[[eosio::action]]
void logsystemfee( const name& protocol, const asset& fee, const std::string& memo );

JSON payload examples

[
  {
    "protocol":"eosio.ram",
    "fee": "0.5000 EOS",
    "memo": "buy ram"
  },
  {
    "protocol":"eosio.ram",
    "fee": "0.1000 EOS",
    "memo": "sell ram"
  },
  {
    "protocol":"eosio.names",
    "fee": "50.0000 EOS",
    "memo": "buy name"
  },
  {
    "protocol":"eosio.powup",
    "fee": "1.0000 EOS",
    "memo": "buy powerup"
  },
  {
    "protocol":"eosio.rex",
    "fee": "0.2000 EOS",
    "memo": "buy rex"
  }
]

Preconditions

  • require_auth(get_self())
  • require_recipient("eosio.fee"_n)

References

Note: changes should be pushed to Antelope Reference contracts https://github.com/AntelopeIO/reference-contracts