Skip to main content

Module sui_system::storage_fund

use std::address;
use std::ascii;
use std::bcs;
use std::internal;
use std::option;
use std::string;
use std::type_name;
use std::u128;
use std::vector;
use sui::accumulator;
use sui::accumulator_settlement;
use sui::address;
use sui::bag;
use sui::balance;
use sui::bcs;
use sui::coin;
use sui::config;
use sui::deny_list;
use sui::dynamic_field;
use sui::dynamic_object_field;
use sui::event;
use sui::funds_accumulator;
use sui::hash;
use sui::hex;
use sui::object;
use sui::party;
use sui::protocol_config;
use sui::sui;
use sui::table;
use sui::transfer;
use sui::tx_context;
use sui::types;
use sui::url;
use sui::vec_map;
use sui::vec_set;

Struct StorageFund

Struct representing the storage fund, containing two Balances:

  • total_object_storage_rebates has the invariant that it's the sum of storage_rebate of all objects currently stored on-chain. To maintain this invariant, the only inflow of this balance is storage charges collected from transactions, and the only outflow is storage rebates of transactions, including both the portion refunded to the transaction senders as well as the non-refundable portion taken out and put into non_refundable_balance.
  • non_refundable_balance contains any remaining inflow of the storage fund that should not be taken out of the fund.
public struct StorageFund has store

Function new

Called by sui_system at genesis time.

public(package) fun new(initial_fund: sui::balance::Balance<sui::sui::SUI>): sui_system::storage_fund::StorageFund

Function advance_epoch

Called by sui_system at epoch change times to process the inflows and outflows of storage fund.

public(package) fun advance_epoch(self: &mut sui_system::storage_fund::StorageFund, storage_charges: sui::balance::Balance<sui::sui::SUI>, storage_fund_reinvestment: sui::balance::Balance<sui::sui::SUI>, leftover_staking_rewards: sui::balance::Balance<sui::sui::SUI>, storage_rebate_amount: u64, non_refundable_storage_fee_amount: u64): sui::balance::Balance<sui::sui::SUI>

Function total_object_storage_rebates

public fun total_object_storage_rebates(self: &sui_system::storage_fund::StorageFund): u64

Function total_balance

public fun total_balance(self: &sui_system::storage_fund::StorageFund): u64