Injective’s Permissions Module
Thepermissions module
is native to Injective, and allows custom management (e.g. roles) for Denoms.
This capability is extended to MultiVM Token Standard (MTS) tokens,
where you can implement those custom management rules within your EVM smart contract code.
Why Use Permissions on MTS Tokens?
If you are tokenizing real-world assets (RWAs) using MTS on Injective, and that underlying asset inherently requires permissions, that is a great use case for tapping into Injective’spermissions module.
The EVM smart contract of your MTS token simply needs to implement
an additional Solidity interface to leverage the power of the permissions module.
Smart Contract Implementation
In your smart contract, importIPermissionsHook from PermissionsHook.sol and extend it.
isTransferRestricted function,
with the following signature:
PermissionsHook.sol
Smart Contract Example
Create a smart contract that extendsPermissionsHook:
isTransferRestricted function.
For example, this function will allow all transfers,
except for ones involving a specific address:
PermissionsHookExamples.sol
Registering Hook
To register the hook for the permissions, you will need the following:- Control of the same account that deployed the MTS token.
- The deployed address of the MTS token
- The deployed address of the Permissions Hook
injectived for the registration,
using the same account that deployed the MTS token.
Note that the MTS token and the Permissions Hook can have the same address.
That is an architectural decision that is up to you.
Registering Hook Example
Create a file namedregister-hooks.json, with the following content:
denom and evm_hook fields with the appropriate values.
Delete all comments as well, so that the file is valid JSON.
Reference Implementation
A more complete example that demonstrates the use of permissioned MTS tokens for a stable coin is also available. This example involves a permissions hook which prevents transfers when the token is paused, and also maintains a blacklist of addresses.PermissionsHook_Inj.sol.