In this section are listed all of the helper function available in GlueStick and Glue that can be useful for your specific use cases:

GlueStickERC20 and GlueStickERC721

<aside> 💡

these functions are 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>

getGluesBalances

You can call getGluesBalances to receive the balances held multiple glues from selected collateral addresses.

/**
* @notice Retrieves the balances of multiple collaterals across multiple glues
* @dev Returns a 2D array where each row represents a glue and each column represents a collateral
*
* @param glues The addresses of the glues to check
* @param collaterals The addresses of the collaterals to check for each glue
* @return balances a 2D array of balances [glueIndex][collateralIndex]
*
* Use cases:
* - Batch querying collateral positions across multiple glues
* - Dashboard displays showing complete portfolio positions
* - Cross-glue analytics and reporting
*/
function getGluesBalances(address[] calldata glues, address[] calldata collaterals) external view returns (uint256[][] memory balances);

getGlueAtIndex

You can call getGlueAtIndex to retrieve the glue address for a specific index number. Each time a glue is created, it receives an incrementing index number.

/**
* @notice Retrieves a glue address by its index in the registry
* @dev Returns the address of a deployed glue at the specified index
* This provides indexed access to the array of all deployed glues
* 
* @param index The index in the allGlues array to query
* @return glueAddress The address of the glue at the specified index
*
* Use cases:
* - Enumeration of all deployed glues in the protocol
* - Accessing specific glues by index for reporting or integration
* - Batch operations on sequential glue addresses
*/
function getGlueAtIndex(uint256 index) external view returns (address glueAddress);

allGluesLength

You can call allGluesLength to retrieve the total number of existing Glues in the factory.

/**
* @notice Returns the total number of deployed glues.
* @return existingGlues The length of the allGlues array.
*
* Use cases:
* - Informational queries about the total number of deployed glues
*/
function allGluesLength() external view returns (uint256 existingGlues);

GlueERC20 and GlueERC721