SteakHut Finance
Search…
⌃K
Links

Integrating SteakHut Liquidity

Receipt Token:

SteakHut Liquidity pools automatically issue an ERC20 receipt token which represents the users underlying position.
The receipt token may be used to review the underlying shares in the vault and also hence the underlying tokens that a user may withdraw at any time.

Underlying Assets

In the Vault contracts there exists a function named getUnderlyingAssets(). If you pass in the amount of shares that a user holds the function will output the amount of tokenX and tokenY which is redeemable with that proportion of shares.
This returns all of the underlying assets including both the assets currently at work in the Liquidity Book and those assets which are sitting idle (waiting to be put to work) in the Strategy Contract.
/// @notice Gets the underlying assets in the vault i.e tokenX and tokenY
/// includes all tokenX and tokenY idle in the strategy and supplied as liquidity
/// @param _shares amount of shares
/// @return totalX amounts of tokenX
/// @return totalY amounts of tokenY
function getUnderlyingAssets(
uint256 _shares
) external view returns (uint256 totalX, uint256 totalY) {
uint256 _totalSupply = totalSupply();
if (_totalSupply == 0) {
return (0, 0);
}
​
//add currently active tokens supplied as liquidity
(totalX, totalY) = LiquidityAmounts.getAmountsOf(
address(strategy),
strategy.strategyActiveBins(),
address(strategy.lbPair())
);
​
//add currently unused tokens in the strategy
totalX += strategy.getBalanceX();
totalY += strategy.getBalanceY();
​
totalX = (totalX * _shares) / _totalSupply;
totalY = (totalY * _shares) / _totalSupply;
}
​

Questions Regarding Integrations

If you need any assistance in integrating with SteakHut Liquidity, feel free to reach out at anytime on any of our social links and a member of our development team will be in touch.