A Sticky Asset Native (SAN) is a token ERC20 or an NFT collection ERC721E that is built on top of StickyAsset.sol, our library to natively interact with Glue and take advantage of native Glue functions support and Hooks. (More info about hooks Expansions Pack)

How to make your asset SAN

Import to your project the Glue Expansions Pack

To implement the Expansions Pack you can go on Github or easily install via npm

npm install @glue-finance/expansions-pack

After import Expansions Pack to your project you just need to import StickyAsset into your asset:

import {StickyAsset} from "@glueExpansionsPack/contracts/base/StickyAsset.sol";

// If you need external interactions import also IStickyAsset Interface
import {IStickyAsset} from "@glueExpansionsPack/contracts/interfaces/IStickyAsset.sol";

// Enounce Sticky asset in your contract
contract MyStickyToken is .., .., StickyAsset {...}

Finally, add the required setup to your constructor:

constructor(...) ...
StickyAsset(contractURI, [isFungible, hasHooks]) {

contractURI = "YOUR JSON URL (EX:ipfs://metadata)" // To add token/NFT 
										                              // info on-chain (ERC-7572)
                              
isFungible = true // if the asset is an ERC20 | 
									// false if is an ERC721E
									
hasHooks = true // if you implement custom hooks
								// false if you dont implement hooks logic

}

// FYI: 
// - If you wrongly use isFungible, the deployment operation of 
//   your asset will fail.
// - If you wrongly setup hasHooks has false when should be true, 
//   hooks will not works properly. At the countrary (true when should be false),
//   you'll just make  the unglue function a bit more expensive for users.

🎉 Congratulations! You've successfully implemented Sticky Asset! Here are all the advantages you now have access to:

Implementing Sticky Asset in your new token or NFT provides a complete, simplified native integration with Glue. It reduces development time through pre-built integrations and eliminates the need to study Glue extensively. Additionally, it expands your asset's Glue functionalities with hooks—programmable actions that execute during the unglue process.

🧮 Plus, We've Made Math Simpler for You

Expansions pack comes with Glued Math integrated, our math library that simplifies classic math operations in Solidity programming. It includes ultra-precise fixed-point math operations and tools to adjust decimal places between different tokens and ETH.

We built Glue and Glue Expansions using GluedMath.sol, and it's been transformative! Both GluedLoanReceiver and StickyAsset come with GluedMath's capabilities built in, making it easy to implement these functions in your own logic.

🪝 Expand Your Glue With Hooks

The hook system in StickyAsset is a powerful mechanism that allows you to intercept and process tokens during ungluing operations. Think of it as "middleware" that runs automatically whenever someone unglues tokens from your Glue Address.

To interact with hooks, you can either import the IGluedHooks.sol interface to your asset's contract, or directly import Expansions Pack and set up a Sticky Asset Native for simpler and more reliable hook interactions.

Hooks only work when they are implemented in both the Sticky Asset contract and its own Glue.

How to use StickyAsset to simplify your development experience with Glue

You want to build a factory to create Sticky Assets?