Maximum Available Liquidity
The major concept is that we can get the rough available liquidity by getting the balance of the
YPoolVaultcontract If the deposit token is native token. If it's ERC20-like token, we get the balance of the Y
PoolVaultcontract from the deposit token contract.
However, the balance we get directly from the contract is just a rough number since some of the balance might belong to the XY worker.
If the deposit token of a
YPoolVaultis the native token,
depositAndWithdrawFeesshould be deducted.
closeSwapGasFeesshould always be deducted whether the deposit token of a
YPoolVaultis the native token or not
The last uncertainty is the asset accidentally sent to the
YPoolVault. This kind of asset will NOT be withdrawn immediately. Therefore, please make sure there's enough buffer when you're trying to initiate a cross-chain request directly with the smart contracts.