IBorrowingFees

Contains the types for the GNSBorrowingFees facet

BorrowingFeesStorage

struct BorrowingFeesStorage {
  mapping(uint8 => mapping(uint16 => struct IBorrowingFees.BorrowingData)) pairs;
  mapping(uint8 => mapping(uint16 => struct IBorrowingFees.BorrowingPairGroup[])) pairGroups;
  mapping(uint8 => mapping(uint16 => struct IBorrowingFees.OpenInterest)) pairOis;
  mapping(uint8 => mapping(uint16 => struct IBorrowingFees.BorrowingData)) groups;
  mapping(uint8 => mapping(uint16 => struct IBorrowingFees.OpenInterest)) groupOis;
  mapping(uint8 => mapping(address => mapping(uint32 => struct IBorrowingFees.BorrowingInitialAccFees))) initialAccFees;
  uint256[44] __gap;
}

BorrowingData

struct BorrowingData {
  uint32 feePerBlock;
  uint64 accFeeLong;
  uint64 accFeeShort;
  uint48 accLastUpdatedBlock;
  uint48 feeExponent;
}

BorrowingPairGroup

struct BorrowingPairGroup {
  uint16 groupIndex;
  uint48 block;
  uint64 initialAccFeeLong;
  uint64 initialAccFeeShort;
  uint64 prevGroupAccFeeLong;
  uint64 prevGroupAccFeeShort;
  uint64 pairAccFeeLong;
  uint64 pairAccFeeShort;
  uint64 __placeholder;
}

OpenInterest

struct OpenInterest {
  uint72 long;
  uint72 short;
  uint72 max;
  uint40 __placeholder;
}

BorrowingInitialAccFees

struct BorrowingInitialAccFees {
  uint64 accPairFee;
  uint64 accGroupFee;
  uint48 block;
  uint80 __placeholder;
}

BorrowingPairParams

struct BorrowingPairParams {
  uint16 groupIndex;
  uint32 feePerBlock;
  uint48 feeExponent;
  uint72 maxOi;
}

BorrowingGroupParams

struct BorrowingGroupParams {
  uint32 feePerBlock;
  uint72 maxOi;
  uint48 feeExponent;
}

BorrowingFeeInput

struct BorrowingFeeInput {
  uint8 collateralIndex;
  address trader;
  uint16 pairIndex;
  uint32 index;
  bool long;
  uint256 collateral;
  uint256 leverage;
}

LiqPriceInput

struct LiqPriceInput {
  uint8 collateralIndex;
  address trader;
  uint16 pairIndex;
  uint32 index;
  uint64 openPrice;
  bool long;
  uint256 collateral;
  uint24 leverage;
}

PendingBorrowingAccFeesInput

struct PendingBorrowingAccFeesInput {
  uint64 accFeeLong;
  uint64 accFeeShort;
  uint256 oiLong;
  uint256 oiShort;
  uint32 feePerBlock;
  uint256 currentBlock;
  uint256 accLastUpdatedBlock;
  uint72 maxOi;
  uint48 feeExponent;
  uint128 collateralPrecision;
}