BinMargin.sol
BinMargin
struct BinMargin {
uint16 tradingFeeRate;
uint256 amount;
}
The BinMargin struct represents the margin information for an LP bin.
Name | Type | Description |
---|---|---|
tradingFeeRate | uint16 | The trading fee rate associated with the LP bin |
amount | uint256 | The maker margin amount specified for the LP bin |
BinMarginLib
The BinMarginLib library provides functions to operate on BinMargin structs.
TRADING_FEE_RATE_PRECISION
uint256 TRADING_FEE_RATE_PRECISION
tradingFee
function tradingFee(struct BinMargin self, uint16 _protocolFeeRate) internal pure returns (uint256)
Calculates the trading fee based on the margin amount and the trading fee rate.
Parameters:
Name Type Description self struct BinMargin The BinMargin struct _protocolFeeRate uint16 The protocol fee rate for the market Return Values:
Name Type Description [0] uint256 The trading fee amount
protocolFee
function protocolFee(struct BinMargin self, uint16 _protocolFeeRate) internal pure returns (uint256)
Calculates the protocol fee based on the margin amount and the trading fee rate.
Parameters:
Name Type Description self struct BinMargin The BinMargin struct _protocolFeeRate uint16 The protocol fee rate for the market Return Values:
Name Type Description [0] uint256 The protocol fee amount