Skip to content

Latest commit

 

History

History
177 lines (84 loc) · 5.63 KB

transaction_fee.md

File metadata and controls

177 lines (84 loc) · 5.63 KB

Module 0x3::transaction_fee

The transaction fee module is used to manage the transaction fee pool. Distribution of Transaction Gas Fees:

  1. RoochNetwork 40%
  • Before Mainnet launch: Used to repay the debt from Gas airdrops
  • After Mainnet launch: Used to buy back Mainnet tokens
  1. Sequencer 30%
  2. Application Developers 30%
  • Goes to the developer of the entry function contract called by the transaction
  • If the entry contract is a system Framework contract, this portion goes to the Rooch network

Resource TransactionFeePool

struct TransactionFeePool has key

Constants

Error code for invalid gas used in transaction

const ErrorInvalidGasUsed: u64 = 1;

const SystemFeeAddress: address = 0x3;

Function genesis_init

public(friend) fun genesis_init(_genesis_account: &signer)

Function get_gas_factor

Returns the gas factor of gas.

public fun get_gas_factor(): u64

Function calculate_gas

public fun calculate_gas(gas_amount: u64): u256

Function withdraw_fee

public(friend) fun withdraw_fee(amount: u256): coin::Coin<gas_coin::RGas>

Function deposit_fee

Function distribute_fee

public(friend) fun distribute_fee(total_paid_gas: u256, gas_used: u256, contract_address: address, sequencer_address: address): coin::Coin<gas_coin::RGas>

Function withdraw_gas_revenue

Withdraw the gas revenue for the sender The contract address can use moveos_std::signer::module_signer to get the signer

public fun withdraw_gas_revenue(sender: &signer, amount: u256): coin::Coin<gas_coin::RGas>

Function withdraw_gas_revenue_entry

The entry function to withdraw the gas revenue for the sender

public entry fun withdraw_gas_revenue_entry(sender: &signer, amount: u256)

Function gas_revenue_balance

Get the gas revenue balance for the given address

public fun gas_revenue_balance(addr: address): u256