<aside> đź’ľ CLICK for a link to current deployments on Mainnet, Goerli and Rinkeby Network
</aside>
meTokens has implemented the Diamond Standard for ease in querying and implementing the meTokens protocol contracts.
Developers may choose to query the entire meTokens protocol through a core proxy “diamond” contract, or separate a contract into its own respective “facets” for modularization of functionality. We utilize Hardhat’s hardhat-diamond-abi plugin to create one universal ABI, where developers can utilize the functions for all facet contracts in one source and simply call the diamond address with the function of the facet desired. You no longer need to dig through multiple contracts to find state!
Here’s a code snippet on how you can fetch contract state with ease:
// NOTE: all calls are done on rinkeby
import { ethers } from "hardhat";
import j from "MeTokensDiamond.json";
async function main() {
const diamondAddr = "0x357d636c40A8E3FbFC983D960292D9fEf56104cb";
const meTokenAddr = "0x9539e3629e12E89B5a04A2E5703246A1bB5F5052";
const diamond = new ethers.Contract(diamondAddr, j.abi, ethers.provider);
const {owner} = await diamond.getMeTokenInfo(meTokenAddr);
console.log(owner);
}
main();
There are four levels of access within meTokens protocol:
OwnershipFacet.sol
), including:
RegisterController
)DurationsController
)DeactivateController
)DiamondController
)FeesController
)MigrationRegistry.sol
)Manages all minting and burning of meTokens, enables the donation of assets to a meToken owner, and provides calculations for the amount of meTokens minted from mint()
and assets returned from burn()
.
Manages all state for a meToken within meTokens protocol. From it you can create your meToken and subscribe to a hub, resubscribe your meToken to a different hub, and transfer ownership of your meToken to another user.