Address Provider
Different modules of the fMint protocol are connected through the Address Provider contract. Each protocol part is registered on the provider and other modules obtain the contract address here.

Access Address Provider

You need the Address Provider ABI and address to be able to access the contract, make changes of the references and obtain addresses of known modules.
1
// setup environment
2
var adrProviderAbi = JSON.parse('[{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"newAddress","type":"address"}],"name":"CollateralPoolChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"newAddress","type":"address"}],"name":"DebtPoolChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"newAddress","type":"address"}],"name":"MinterChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"newAddress","type":"address"}],"name":"PriceOracleChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"newAddress","type":"address"}],"name":"RewardDistributionChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"newAddress","type":"address"}],"name":"RewardTokenChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"newAddress","type":"address"}],"name":"TokenRegistryChanged","type":"event"},{"constant":true,"inputs":[],"name":"isOwner","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"renounceOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"initialize","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"internalType":"bytes32","name":"_id","type":"bytes32"}],"name":"getAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getPriceOracleProxy","outputs":[{"internalType":"contract IPriceOracleProxy","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"_addr","type":"address"}],"name":"setPriceOracleProxy","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"getTokenRegistry","outputs":[{"internalType":"contract IFantomMintTokenRegistry","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"_addr","type":"address"}],"name":"setTokenRegistry","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"getRewardDistribution","outputs":[{"internalType":"contract IFantomMintRewardManager","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"_addr","type":"address"}],"name":"setRewardDistribution","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"getRewardToken","outputs":[{"internalType":"contract ERC20","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"_addr","type":"address"}],"name":"setRewardToken","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"getFantomMint","outputs":[{"internalType":"contract IFantomMintBalanceGuard","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"_addr","type":"address"}],"name":"setFantomMint","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"getCollateralPool","outputs":[{"internalType":"contract IFantomDeFiTokenStorage","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"_addr","type":"address"}],"name":"setCollateralPool","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"getDebtPool","outputs":[{"internalType":"contract IFantomDeFiTokenStorage","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"_addr","type":"address"}],"name":"setDebtPool","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"}]');
3
var adrProviderAddress = "0xcb20a1a22976764b882c2f03f0c8523f3df54b10";
4
5
// instantiate the contract
6
var adrProvider = web3.ftm.contract(adrProviderAbi).at(adrProviderAddress);
Copied!

Obtain Module Address

You can use a general getAddress call to get an address of known fMint protocol module, or you can use a single-purpose call for each fMint module. Please consider the best way of using the provider based on your specific use case. The code below demonstrates both ways of doing so.
1
// use general call with identifier
2
> adrProvider.getAddress.call("price_oracle_proxy");
3
"0xb4120a75d22d800a61bdfad65be3786a20db10b7"
4
5
// use a module specific call
6
> adrProvider.getRewardToken.call();
7
"0x21be370d5312f44cb42ce377bc9b8a0cef1a4c83"
Copied!

Available Modules

The Address Provider registers the following modules. An internal identifier of each module is listed.
    Core fMint Contract fantom_mint
    Collateral Pool Contract collateral_pool
    Debt Pool Contract debt_pool
    Price Oracle Proxy Contract price_oracle_proxy
    Reward Distribution Contract reward_distribution
    Reward ERC20 Token Contract erc20_reward_token
    Token Registry Contract token_registry
Please check the AddressProvider contract source code for all the details about modules and their references.

Update Module Address

Address of any module of the fMint protocol can be changed through the Address Provider contract. To change a module address please use a module specific update function.
Please make sure to use maximum caution when changing fMint module address. All the fMint modules may be affected by the change. Also, changing the Collateral or Debt pool may directly affect users' positions and their funds invested in the protocol.
1
// update module address
2
adrProvider.setDebtPool("0xb4120a75d22d800a61bdfad65be3786a20db10b7");
Copied!
Please consult the AddressProvider source code for the ful list of available update functions and their meaning.
Last modified 10mo ago