<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 function applyTheGlue
creates a new Glue contract for a given asset
address.
This process makes the token "sticky" by associating it with a Glue Address that can hold collateral.
/** @notice Creates a new Glue contract for the specified asset
* @dev Performs validation checks, creates a deterministic clone of the implementation contract,
* initializes it with the token address, and registers it in the protocol's mappings.
* The created glue instance becomes the collateral vault for the sticky token.
*
* @param asset The address of the asset to be glued
* @return glueAddress The address of the newly created glue instance
*
* Use cases:
* - Adding asset backing capability to existing tokens
* - Creating on-chain collateralization mechanisms for tokens
* - Establishing new tokenomics models with withdrawal mechanisms
* - Supporting floor price protection for collections through backing
*/
function applyTheGlue(address asset) external returns (address glueAddress);
The GlueStick checks if the token is a standard ERC20 (GlueStickERC20) or an ERC721 Enumerable (GlueStickERC721) using the checkAsset
method. Learn more here: Check Asset Compatibility.
The function returns a glueAddress
— the address of the newly created Glue. This Glue Address hosts collateral and implements functions to unglue collateral (see Glue Collateral and Unglue Collateral).
Before applying Glue to an asset, you can predict its Glue Address by calling computeGlueAddress
with the asset address. This returns the predictedGlueAddress
. More info: Predict the Glue Address.
To check if an asset is already Sticky (has a glue), call isStickyAsset
with the asset's address. This returns a boolean isSticky
(true if the asset is sticky) and the glueAddress
(address(0) if isSticky
is false). More info Find the Sticky Asset Address of a Glue
.applyTheGlue(
"0x32.ffa" // Passing the asset address to glue.
);
// it'll returns "0x90.7fa" The Glue address
-------------
// You can also check if the asset is compatible, before gluing it, by calling the same function
// that is called internally for this scope checkAsset:
.checkAsset(
"0x32.ffa" // Passing the asset address to check.
);
// it'll returns "true/false" A boolean representing if the address is gluable.
-------------
// You can also predict the Glue Address:
.computeGlueAddress(
"0x32.ffa" // Passing the asset address.
);
// it'll returns "0x90.7fa" The predicted Glue Address before to apply the Glue.
-------------
// You can also check if the asset is a;ready sticky:
.isStickyAsset(
"0x32.ffa" // Passing the asset address to check.
);
// If sticky, it'll returns bolean: "true" and "0x90.7fa" The Glue Address.
// If not sticky, it'll returns bolean: "false" and "0x00.000" address(0).
<aside> ⚠️
It's important to note that in the Glue Ecosystem, there can only be one Glue per token; any attempt to apply Glue multiple times will be reverted.
</aside>
This function emits a GlueAdded
, you can find more information here: Events
event GlueAdded(address indexed asset, address glueAddress, uint256 glueIndex);
// asset: the Asset Address
// glueAddress: the Glue Address
// glueIndex: the Glue Index
applyTheGlue
function?