REI Network Documents
  • REI Network
    • Welcome to REI Network
    • Why We build REI Network
    • Introduction to $REI
  • Developer
    • Quick Start
    • API Reference
    • Token Addresses
    • System Contracts
      • StakeManager
      • Fee
      • ContractFee
      • Router
      • AbstractToken
      • CommissionShare
      • FeeToken
      • FeePool
      • ValidatorRewardPool
      • FreeFee
      • UnstakePool
      • FreeFeeToken
      • Config
    • Guides
      • Using The Graph
        • Using The Graph on REI Network
        • Running a Graph Node on REI Network
      • Using Gnosis Safe
      • Exchange Integration
  • REI DAO
    • What is REI DAO?
      • Background
      • Management content of REI DAO
      • How the REI DAO is implemented?
      • How REI DAO works?
    • Governance
      • About Governance
      • Governance Process
      • Voting with Snapshot
      • FAQ
    • Guides
      • Dashboard
      • Become a Validator
      • Jail Mechanism
      • Slash Mechanism
      • Voting for a Validator
      • Stake for Free Gas
      • Using BLS
        • Check BLS
      • REI@3.0.X Upgrade Guide
Powered by GitBook
On this page
  • Contents
  • Globals
  • Functions
  • constructor
  • deposit
  • withdraw
  • estimateWithdrawableTimestamp
  • estimateWithdrawableAmount
  • estimateFee
  • estimateUsage
  • consume
  • Events
  • Deposit
  1. Developer
  2. System Contracts

Fee

Contents

Globals

Var
Type

userTotalAmount

mapping(address => uint256)

userUsage

mapping(address => struct IFee.UsageInfo)

userDeposit

mapping(address => mapping(address => struct IFee.DepositInfo))

totalAmount

uint256

Functions

constructor

No description

Declaration:

  function constructor(
  ) public Only

Modifiers:

Modifier

Only

deposit

Deposit amount to target user.

Declaration:

  function deposit(
    address user
  ) external nonReentrant

Modifiers:

Modifier

nonReentrant

Args:

Arg
Type
Description

user

address

Target user address

withdraw

Withdraw amount from target user.

Declaration:

  function withdraw(
    address user,
    uint256 desiredAmount,
    uint256 minAmount
  ) external nonReentrant

Modifiers:

Modifier

nonReentrant

Args:

Arg
Type
Description

user

address

Target user address

desiredAmount

uint256

Desired withdraw amount

minAmount

uint256

Min withdraw amount

estimateWithdrawableTimestamp

Estimate wtihdrawable timestamp, if the estimation fails, return 0.

Declaration:

  function estimateWithdrawableTimestamp(
    address user,
    address from
  ) external returns (uint256 timestamp)

Modifiers: No modifiers

Args:

Arg
Type
Description

user

address

Target user address

from

address

From user address

estimateWithdrawableAmount

Estimate wtihdrawable amount.

Declaration:

  function estimateWithdrawableAmount(
    address user,
    uint256 timestamp
  ) public returns (uint256)

Modifiers: No modifiers

Args:

Arg
Type
Description

user

address

Target user address

timestamp

uint256

Current timestamp

estimateFee

Estimate user fee.

 userFee = userTotalAmount * dailyFee / totalAmount - userUsage

Declaration:

  function estimateFee(
    address user,
    uint256 timestamp
  ) public returns (uint256 fee)

Modifiers: No modifiers

Args:

Arg
Type
Description

user

address

User address

timestamp

uint256

Current timestamp

estimateUsage

Estimate user usage

 T: current timestamp
 T': last timestamp
 userUsage': last fee usage

 if T - T' < feeRecoverInterval
     userUsage = (1 - (T - T') / feeRecoverInterval) * userUsage'
 else
     userUsage = 0

Declaration:

  function estimateUsage(
    struct IFee.UsageInfo ui,
    uint256 timestamp
  ) public returns (uint256 usage)

Modifiers: No modifiers

Args:

Arg
Type
Description

ui

struct IFee.UsageInfo

Usage information

timestamp

uint256

Current timestamp

consume

Consume user fee, can only be called by the system caller.

Declaration:

  function consume(
    address user,
    uint256 usage
  ) external nonReentrant onlyRouter

Modifiers:

Modifier

nonReentrant

onlyRouter

Args:

Arg
Type
Description

user

address

User address

usage

uint256

Number of usage fee

Events

Deposit

Emit when user deposits.

Params:

Param
Type
Indexed
Description

by

address

Deposit user

to

address

Receiver user

amount

uint256

Deposit amount

### Withdraw

Emit when user withdraws.

Params:

Param
Type
Indexed
Description

by

address

Withdraw user

from

address

From user

amount

uint256

Withdraw amount

PreviousStakeManagerNextContractFee

Last updated 3 years ago

✅
✅
✅
✅
✅
✅