Skip to content

Commit

Permalink
[Framework] Release framework v17
Browse files Browse the repository at this point in the history
  • Loading branch information
jolestar committed Dec 8, 2024
1 parent 45851eb commit dcf2023
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 2 deletions.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
4 changes: 4 additions & 0 deletions frameworks/framework-release/released/17/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Rooch Move Framework v17

[rooch_framework] #2988 Init the Babylon cap3 global parameter and auto process Babylon protocol transaction.
[rooch_framework] Add entry function `withdraw_gas_revenue_entry` for `transaction_fee`.
Binary file added frameworks/framework-release/released/17/stdlib
Binary file not shown.
16 changes: 15 additions & 1 deletion frameworks/rooch-framework/doc/transaction_fee.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,14 @@ Distribution of Transaction Gas Fees:
- [Function `deposit_fee`](#0x3_transaction_fee_deposit_fee)
- [Function `distribute_fee`](#0x3_transaction_fee_distribute_fee)
- [Function `withdraw_gas_revenue`](#0x3_transaction_fee_withdraw_gas_revenue)
- [Function `withdraw_gas_revenue_entry`](#0x3_transaction_fee_withdraw_gas_revenue_entry)
- [Function `gas_revenue_balance`](#0x3_transaction_fee_gas_revenue_balance)


<pre><code><b>use</b> <a href="">0x2::core_addresses</a>;
<b>use</b> <a href="">0x2::object</a>;
<b>use</b> <a href="">0x2::signer</a>;
<b>use</b> <a href="account_coin_store.md#0x3_account_coin_store">0x3::account_coin_store</a>;
<b>use</b> <a href="coin.md#0x3_coin">0x3::coin</a>;
<b>use</b> <a href="coin_store.md#0x3_coin_store">0x3::coin_store</a>;
<b>use</b> <a href="gas_coin.md#0x3_gas_coin">0x3::gas_coin</a>;
Expand Down Expand Up @@ -143,7 +145,7 @@ Returns the gas factor of gas.

## Function `withdraw_gas_revenue`

Withdraw all the gas revenue for the sender
Withdraw the gas revenue for the sender
The contract address can use <code>moveos_std::signer::module_signer</code> to get the signer


Expand All @@ -152,6 +154,18 @@ The contract address can use <code>moveos_std::signer::module_signer</code> to g



<a name="0x3_transaction_fee_withdraw_gas_revenue_entry"></a>

## Function `withdraw_gas_revenue_entry`

The entry function to withdraw the gas revenue for the sender


<pre><code><b>public</b> entry <b>fun</b> <a href="transaction_fee.md#0x3_transaction_fee_withdraw_gas_revenue_entry">withdraw_gas_revenue_entry</a>(sender: &<a href="">signer</a>, amount: <a href="">u256</a>)
</code></pre>



<a name="0x3_transaction_fee_gas_revenue_balance"></a>

## Function `gas_revenue_balance`
Expand Down
9 changes: 8 additions & 1 deletion frameworks/rooch-framework/sources/transaction_fee.move
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ module rooch_framework::transaction_fee {
use rooch_framework::coin_store::{Self, CoinStore};
use rooch_framework::coin::{Self,Coin};
use rooch_framework::gas_coin::{RGas};
use rooch_framework::account_coin_store;

friend rooch_framework::genesis;
friend rooch_framework::transaction_validator;
Expand Down Expand Up @@ -104,14 +105,20 @@ module rooch_framework::transaction_fee {
total_paid_gas_coin
}

/// Withdraw all the gas revenue for the sender
/// 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<RGas> {
let addr = signer::address_of(sender);
let gas_revenue_store = borrow_mut_or_init_gas_revenue_store(addr);
coin_store::withdraw(gas_revenue_store, amount)
}

/// The entry function to withdraw the gas revenue for the sender
public entry fun withdraw_gas_revenue_entry(sender: &signer, amount: u256){
let coin = withdraw_gas_revenue(sender, amount);
account_coin_store::deposit(signer::address_of(sender), coin);
}

/// Get the gas revenue balance for the given address
public fun gas_revenue_balance(addr: address): u256 {
let fee_pool_id = object::named_object_id<TransactionFeePool>();
Expand Down

0 comments on commit dcf2023

Please sign in to comment.