Single Glue Collateral Request

<aside> 💡

To use this function, you must use GlueERC20 or GlueERC721 contract of a specific Sticky Token. To better understand the Glue Ecosystem architecture and find the correct deployment addresses, visit visit Lore and Architecture | License & Deployments

</aside>

The collateralByAmount function enable users to calculate the exact amount of collateral they can withdraw based on a specified amount of sticky asset they intend to burn. This view function provides a preview of withdrawal outcomes without actually executing the transaction.

/**
* @notice Calculates the amount of collateral tokens that can be unglued for a given amount of sticky tokens.
* @dev This function is used to calculate the amount of collateral tokens that can be unglued for a given amount of sticky tokens.
*
* @param stickyAmount The amount of sticky tokens to be burned.
* @param collaterals An array of addresses representing the collateral tokens to unglue.
* @return amounts An array containing the corresponding amounts that can be unglued.
* @dev This function accounts for the protocol fee in its calculations.
*
* Use cases:
* - Calculating the amount of collateral tokens that can be unglued for a given amount of sticky tokens.
*/
function collateralByAmount(uint256 stickyAmount, address[] calldata collaterals) external view returns (uint256[] memory amounts);

To use this function, you need to pass:

The collateralByAmount function takes into account Protocol Fees and Hooks. This means you can rely on this function for both on-chain contract-to-contract operations and as a data point for user interfaces.

.**collateralByAmount**(
	"1000000000000" // Passing the amount of sticky asset to check.
	["0x34..5454","0x00.000","0x34..fa3"] // An array of collateral addresses.
);

// The function returns an array of Uint256 amounts extractable 
// for the given Sticky Amount

Multi-Glue Collateral Request

<aside> 💡

This function is from the GlueStickERC20 or the GlueStickERC721. To better understand the Glue Ecosystem architecture and find the correct deployment addresses, visit Lore and Architecture | License & Deployments

</aside>

The getBatchCollaterals function enable users to calculate the exact amount of collateral they can withdraw based on specified amounts of multiple sticky assets they intend to burn. This view function provides a preview of withdrawal outcomes without actually executing the transaction.

/**
* @notice Retrieves expected collateral amounts from batch ungluing operations for NFTs
* @dev View function to calculate expected collateral returns for multiple NFT collections.
* This is essential for front-end applications and integrations to estimate expected
* returns before executing batch unglue operations.
* 
* @param stickyAssets Array of NFT collection addresses
* @param stickyAmounts Array of NFT counts to simulate ungluing (number of NFTs, not IDs)
* @param collaterals Array of collateral addresses to check
* @return collateralAmounts 2D array of corresponding collateral amounts [glueIndex][collateralIndex]
*
* Use cases:
* - Pre-transaction estimation for front-end applications
* - Strategy optimization based on expected returns
* - User interface displays showing potential redemption values
*/
function getBatchCollaterals(address[] calldata stickyAssets,uint256[] calldata stickyAmounts,address[] calldata collaterals) external view returns (uint256[][] memory collateralAmounts);

To use this function, you need to pass:

The collateralByAmount function takes into account Protocol Fees and Hooks. This means you can rely on this function for both on-chain contract-to-contract operations and as a data point for user interfaces.

.**getBatchCollaterals**(
	["0x33..554","0x11.65f"] // An array of Sticky Asset addresses.
	["1000000000000","60000000"] // An array of amount of each sticky asset to check.
	["0x34..5454","0x00.000","0x34..fa3"] // An array of collateral addresses.
);

// The function returns a 2d array of Uint256 amounts extractable 
// for each given Sticky Amount