Skip to main content

BPTLens

a contract to read manipulation resistant balances from BPTs

Functions

constructor

function constructor(
address _token,
contract IWeightedPool _pool,
contract IOracle _reportedOracle,
contract IOracle _otherOracle,
bool _feiIsReportedIn,
bool _feiIsOther
) public

Parameters

NameTypeDescription
_tokenaddress
_poolcontract IWeightedPool
_reportedOraclecontract IOracle
_otherOraclecontract IOracle
_feiIsReportedInbool
_feiIsOtherbool

balance

function balance() public returns (uint256)

gets the effective balance of "balanceReportedIn" token if the deposit were fully withdrawn

resistantBalanceAndFei

function resistantBalanceAndFei() public returns (uint256, uint256)

Calculates the manipulation resistant balances of Balancer pool tokens using the logic described here: https://docs.gyro.finance/learn/oracles/bpt-oracle This is robust to price manipulations within the Balancer pool.

_getIdealReserves

function _getIdealReserves(
uint256[] balances,
uint256[] prices,
uint256[] weights,
uint256 i
) internal returns (uint256 reserves)

Parameters

NameTypeDescription
balancesuint256[]
pricesuint256[]
weightsuint256[]
iuint256