eosnetworkfoundation / eos-system-contracts

Other
28 stars 20 forks source link

Implement "Log System Fee" ACTION #122

Closed DenisCarriere closed 6 months ago

DenisCarriere commented 7 months ago

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

References

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

DenisCarriere commented 6 months ago

Implemented via: https://github.com/AntelopeIO/reference-contracts/pull/71