At Glue, we're focused on making the development experience as easy and friendly as possible. We want to empower the next generation of builders to create their own expanded tools and assets on top of Glue without needing to be experts in how Glue works internally. We've created a series of Mocks to simplify the testing and development lifecycle, reducing your development and testing time by a x10.
With Mocks, you can quickly test protocol responses using one-to-one interface calls that offer custom programmability for your specific testing scenarios.
<aside> 🔒
License Compliance (more License & Deployments)
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
Glued Mocks are core Glue functions that use the official interface but are designed to accept custom parameters and responses for your specific tests. This allows you to test interactions with main Glue functions in your private environment by simply passing the parameters for your test scenario, eliminating the need to recreate scenarios from scratch.
<aside> 💡
Best Practices
Mocks are helpful for:
MockUnglueERC20
Mock for testing IGlueERC20.unglue
functionality with ERC20 amount parameter and accurate hook simulation. - Code
Usage Example
// Deploy and setup
MockUnglueERC20 mockUnglue = new MockUnglueERC20();
// Configure
mockUnglue.setStickyAsset(myToken);
mockUnglue.setMockTotalSupply(1000e18); // 1000 total supply
mockUnglue.addCollateral(USDC, 1000e6); // 1000 USDC available
mockUnglue.configureHooks(true, 5e16); // Enable hooks, 5% sticky hook
mockUnglue.setAssetHookSize(USDC, 2e16); // 2% USDC hook
// Execute unglue
address[] memory collaterals = new address[](1);
collaterals[0] = USDC;
mockUnglue.unglue(collaterals, 100e18, alice);
// Burns 100 tokens, Alice receives collateral based on proportion minus hooks and fees
MockUnglueERC721
Mock for testing IGlueERC721.unglue
functionality with NFT tokenIds parameter and accurate hook simulation. - Code