Protocol Hooks
Protocol Hooks are Magna's offering to extend our escrow smart contract functionality at the protocol-level. This involves implementing our post-claim hook interface, which is a single function.
Need help designing or building your claim flow? Reach out to the Magna team for help!
Example Use Cases:
Claim and Stake
Stake tokens immediately upon claiming to secure your protocol and prevent sell pressure.
Claim and Bridge
Bridge tokens to a target chain automatically upon claiming.
Claim and Burn/Transfer
Re-route token amounts (e.g. royalities) depending on your customizable smart contract state.
Claim and Mint
Mint an NFT immediately upon claiming tokens to incentivize token engagement.
Implementation
Upon linking a hook contract to the Magna escrow contract (configurable in the Magna platform), claimed tokens will be sent to the hook contract to handle instead of directly to beneficiaries.
Note: it is extremely important that the hook contract (and all dependencies) are thoroughly audited. Magna does not provide any security guarantees on external contracts and may even reject your implementation if it does not uphold best practices.
Hook Contract Interface
Protocol Hook contracts should implement this following interface. All arguments must be defined in the function interface (even if they go unused).
Note that extraDatathat is passed from the Magna app is customizable. Please reach out to the Magna team for more deatils on how to configure this.
Example Implementation (Claim and Burn)
The below implementation implements a hook that burns tokens upon claiming with an optional donationRecipientstored in contract state.
Last updated
Was this helpful?