The repository implements fMint module of the Fantom DeFi smart contracts in Solidity based on Andre Cronje's implementation.
Please note we use OpenZeppelin library version 2.5 along with the Solidity 0.5 and truffle to conform with the EVM implemented in the Opera block chain. Consult the Truffle documents to find out how to build and deploy the smart contract implemented here.
In general, all you should need to do is to call truffle build
to get the deployable contract code and ABI inside build/
folder.
The Fantom fMint contract has following dependencies:
- Wrapped FTM ERC20 contract wFTM.
- At least one ERC20 token contract with minting and burning capability, see IERC20Detailed. We use OpenZeppelin implementation internally.
- ChainLink compatible price oracle aggregates for each ERC20 token used, see AggregatorInterface.
- Fantom Price Oracle Proxy Fantom Oracle PriceFeed.
- Fantom DeFi Token Registry contract, available in this repository.
- Fantom fMint Address Provider contract, available in this repository.
- Fantom fMint Reward Distribution contract, available in this repository.
Price oracle aggregates must receive price feeds from trusted external sources. Tokens will be rejected without a price tag even if they are registered in the token registry to be used with the fMint.
We assume you have the deployment account unlocked
using personal.unlockAccount()
call and you have the account address
stored in account
variable.
var account = "0x11111111111111111111111111111111";
personal.unlockAccount(account, "very-secret-password", 300);
web3.ftm.defaultAccount = account;
-
Deploy wFTM and ERC20 tokens you will be using with the fMint.
-
Deploy ChainLink compatible Price Oracle Aggregates.
-
Deploy Fantom Price Oracle Proxy contract.
/** * This deploys Fantom Price Oracle Proxy contract. */ var priceProxyAbi = JSON.parse('[{"inputs":[],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"address","name":"aggregator","type":"address"},{"indexed":false,"internalType":"uint256","name":"timestamp","type":"uint256"}],"name":"AggregatorChanged","type":"event"},{"constant":true,"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"aggregators","outputs":[{"internalType":"contract AggregatorInterface","name":"","type":"address"}],"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":[{"internalType":"address","name":"token","type":"address"},{"internalType":"address","name":"aggregator","type":"address"}],"name":"setAggregator","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"getPrice","outputs":[{"internalType":"int256","name":"","type":"int256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"getTimeStamp","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"_back","type":"uint256"}],"name":"getPreviousPrice","outputs":[{"internalType":"int256","name":"","type":"int256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"_back","type":"uint256"}],"name":"getPreviousTimeStamp","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"}]'); var priceProxyByteCode = "0x608060405234801561001057600080fd5b50600080546001600160a01b03191633179055610a6f806100326000396000f3fe608060405234801561001057600080fd5b506004361061007d5760003560e01c80638da5cb5b1161005b5780638da5cb5b14610160578063e0a3581e14610168578063e889e5d6146101a1578063eb470ebf146101da5761007d565b8063112cdab91461008257806341976e09146100de5780637394a7f614610123575b600080fd5b6100b56004803603602081101561009857600080fd5b503573ffffffffffffffffffffffffffffffffffffffff1661020d565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b610111600480360360208110156100f457600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16610235565b60408051918252519081900360200190f35b61015e6004803603604081101561013957600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81358116916020013516610373565b005b6100b561048c565b6101116004803603604081101561017e57600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81351690602001356104a8565b610111600480360360408110156101b757600080fd5b5073ffffffffffffffffffffffffffffffffffffffff8135169060200135610705565b610111600480360360208110156101f057600080fd5b503573ffffffffffffffffffffffffffffffffffffffff1661092e565b60016020526000908152604090205473ffffffffffffffffffffffffffffffffffffffff1681565b73ffffffffffffffffffffffffffffffffffffffff8181166000908152600160205260408120549091166102ca57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f6f7261636c65206e6f7420617661696c61626c65000000000000000000000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff8083166000908152600160209081526040918290205482517f50d25bcd00000000000000000000000000000000000000000000000000000000815292519316926350d25bcd926004808201939291829003018186803b15801561034157600080fd5b505afa158015610355573d6000803e3d6000fd5b505050506040513d602081101561036b57600080fd5b505192915050565b60005473ffffffffffffffffffffffffffffffffffffffff1633146103f957604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f6163636573732072657374726963746564000000000000000000000000000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff82811660008181526001602090815260409182902080547fffffffffffffffffffffffff000000000000000000000000000000000000000016948616948517905581519384524290840152805191927f51012bc010926f3f948f99b90ed487a209375a900797c69e70dbc17f09264357929081900390910190a25050565b60005473ffffffffffffffffffffffffffffffffffffffff1681565b73ffffffffffffffffffffffffffffffffffffffff82811660009081526001602052604081205490911661053d57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f6f7261636c65206e6f7420617661696c61626c65000000000000000000000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff80841660009081526001602090815260408083205481517f668a0f0200000000000000000000000000000000000000000000000000000000815291519394169263668a0f0292600480840193919291829003018186803b1580156105b557600080fd5b505afa1580156105c9573d6000803e3d6000fd5b505050506040513d60208110156105df57600080fd5b505190508083111561065257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f6e6f7420656e6f75676820686973746f72790000000000000000000000000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff8085166000908152600160209081526040918290205482517fb633620c0000000000000000000000000000000000000000000000000000000081528786036004820152925193169263b633620c926024808201939291829003018186803b1580156106d157600080fd5b505afa1580156106e5573d6000803e3d6000fd5b505050506040513d60208110156106fb57600080fd5b5051949350505050565b73ffffffffffffffffffffffffffffffffffffffff82811660009081526001602052604081205490911661079a57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f6f7261636c65206e6f7420617661696c61626c65000000000000000000000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff80841660009081526001602090815260408083205481517f668a0f0200000000000000000000000000000000000000000000000000000000815291519394169263668a0f0292600480840193919291829003018186803b15801561081257600080fd5b505afa158015610826573d6000803e3d6000fd5b505050506040513d602081101561083c57600080fd5b50519050808311156108af57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f6e6f7420656e6f75676820686973746f72790000000000000000000000000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff8085166000908152600160209081526040918290205482517fb5ab58dc0000000000000000000000000000000000000000000000000000000081528786036004820152925193169263b5ab58dc926024808201939291829003018186803b1580156106d157600080fd5b73ffffffffffffffffffffffffffffffffffffffff8181166000908152600160205260408120549091166109c357604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f6f7261636c65206e6f7420617661696c61626c65000000000000000000000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff8083166000908152600160209081526040918290205482517f8205bf6a0000000000000000000000000000000000000000000000000000000081529251931692638205bf6a926004808201939291829003018186803b15801561034157600080fdfea265627a7a7231582020c96c6178829d5ee97ee37c16a1ea29e4a79c770479522721dc4c11f52c349464736f6c63430005110032"; // create new contract contract = web3.ftm.contract(priceProxyAbi); deploy = contract.new({ data: priceProxyByteCode, from: account, gas: 4000000 }); // get the contract address (you may need to wait for the receipt to be available) priceProxyAddress = ftm.getTransactionReceipt(deploy.transactionHash).contractAddress;
-
Assign Price Oracle Aggregates to your ERC20 tokens on the Price Proxy.
// instantiate the oracle proxy deployed above var priceProxy = web3.ftm.contract(priceProxyAbi).at(priceProxyAddress); // what tokens do we use var tokenWFTM = "0xf1277d1ed8ad466beddf92ef448a132661956621"; var tokenUSD = "0x91ea991bd52ee3c40eda2509701d905e1ee54074"; // what price oracle aggregates we use var oracleFTM = "0xb1c29bf02fe3bad77dc25c70ad7f680936fc84ef"; var oracleUSD = "0x8019db8a3ff1887d047f2dc1c7265ea8dab1ca80"; // assign the oracles to tokens priceProxy.setAggregator(tokenWFTM, oracleFTM); priceProxy.setAggregator(tokenUSD, oracleUSD);
-
Deploy Token Registry from this repository.
/** * This deploys Fantom DeFi Tokens Registry */ var registryAbi = JSON.parse('[{"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":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"string","name":"name","type":"string"},{"indexed":false,"internalType":"uint256","name":"index","type":"uint256"}],"name":"TokenAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"string","name":"name","type":"string"}],"name":"TokenUpdated","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":true,"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"tokens","outputs":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"symbol","type":"string"},{"internalType":"uint8","name":"decimals","type":"uint8"},{"internalType":"string","name":"logo","type":"string"},{"internalType":"address","name":"oracle","type":"address"},{"internalType":"uint8","name":"priceDecimals","type":"uint8"},{"internalType":"bool","name":"isActive","type":"bool"},{"internalType":"bool","name":"canDeposit","type":"bool"},{"internalType":"bool","name":"canMint","type":"bool"},{"internalType":"bool","name":"canBorrow","type":"bool"},{"internalType":"bool","name":"canTrade","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"tokensList","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"tokensCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"_token","type":"address"}],"name":"tokenPriceDecimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"_token","type":"address"}],"name":"isActive","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"_token","type":"address"}],"name":"canDeposit","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"_token","type":"address"}],"name":"canMint","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"_token","type":"address"}],"name":"canBorrow","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"_token","type":"address"}],"name":"canTrade","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"string","name":"_logo","type":"string"},{"internalType":"address","name":"_oracle","type":"address"},{"internalType":"uint8","name":"_priceDecimals","type":"uint8"},{"internalType":"bool","name":"_isActive","type":"bool"},{"internalType":"bool","name":"_canDeposit","type":"bool"},{"internalType":"bool","name":"_canMint","type":"bool"},{"internalType":"bool","name":"_canBorrow","type":"bool"},{"internalType":"bool","name":"_canTrade","type":"bool"}],"name":"addToken","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"string","name":"_logo","type":"string"},{"internalType":"address","name":"_oracle","type":"address"},{"internalType":"uint8","name":"_priceDecimals","type":"uint8"},{"internalType":"bool","name":"_isActive","type":"bool"},{"internalType":"bool","name":"_canDeposit","type":"bool"},{"internalType":"bool","name":"_canMint","type":"bool"},{"internalType":"bool","name":"_canBorrow","type":"bool"},{"internalType":"bool","name":"_canTrade","type":"bool"}],"name":"updateToken","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"}]'); var registryByteCode = "0x608060405260006100176001600160e01b0361006616565b600080546001600160a01b0319166001600160a01b0383169081178255604051929350917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a35061006a565b3390565b611d40806100796000396000f3fe608060405234801561001057600080fd5b50600436106100f55760003560e01c80638f32d59b11610097578063c2ba474411610066578063c2ba4744146103fe578063e486033914610431578063f2fde38b14610636578063f713535414610669576100f5565b80638f32d59b146102d45780639f8a13d7146102dc578063a64ed8ba1461030f578063ba7b436914610329576100f5565b8063559f05dc116100d3578063559f05dc146101ba578063715018a6146101ed5780638241e156146101f75780638da5cb5b146102cc576100f5565b80630e7fc864146100fa5780634bf0d331146101415780634d12e34e14610174575b600080fd5b61012d6004803603602081101561011057600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166106b2565b604080519115158252519081900360200190f35b61012d6004803603602081101561015757600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166106fc565b6101916004803603602081101561018a57600080fd5b5035610744565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b61012d600480360360208110156101d057600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16610778565b6101f56107c3565b005b6101f5600480360361012081101561020e57600080fd5b73ffffffffffffffffffffffffffffffffffffffff823516919081019060408101602082013564010000000081111561024657600080fd5b82018360208201111561025857600080fd5b8035906020019184600183028401116401000000008311171561027a57600080fd5b919350915073ffffffffffffffffffffffffffffffffffffffff8135169060ff6020820135169060408101351515906060810135151590608081013515159060a081013515159060c0013515156108a5565b61019161111f565b61012d61113c565b61012d600480360360208110156102f257600080fd5b503573ffffffffffffffffffffffffffffffffffffffff1661117a565b6103176111c1565b60408051918252519081900360200190f35b6101f5600480360361012081101561034057600080fd5b73ffffffffffffffffffffffffffffffffffffffff823516919081019060408101602082013564010000000081111561037857600080fd5b82018360208201111561038a57600080fd5b803590602001918460018302840111640100000000831117156103ac57600080fd5b919350915073ffffffffffffffffffffffffffffffffffffffff8135169060ff6020820135169060408101351515906060810135151590608081013515159060a081013515159060c0013515156111c7565b61012d6004803603602081101561041457600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166116ba565b6104646004803603602081101561044757600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16611703565b604051808d815260200180602001806020018c60ff1660ff168152602001806020018b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018a60ff1660ff168152602001891515151581526020018815151515815260200187151515158152602001861515151581526020018515151515815260200184810384528f818151815260200191508051906020019080838360005b8381101561052b578181015183820152602001610513565b50505050905090810190601f1680156105585780820380516001836020036101000a031916815260200191505b5084810383528e818151815260200191508051906020019080838360005b8381101561058e578181015183820152602001610576565b50505050905090810190601f1680156105bb5780820380516001836020036101000a031916815260200191505b5084810382528c5181528c516020918201918e019080838360005b838110156105ee5781810151838201526020016105d6565b50505050905090810190601f16801561061b5780820380516001836020036101000a031916815260200191505b509f5050505050505050505050505050505060405180910390f35b6101f56004803603602081101561064c57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166119ff565b61069c6004803603602081101561067f57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16611a7e565b6040805160ff9092168252519081900360200190f35b73ffffffffffffffffffffffffffffffffffffffff166000908152600160205260409020600501547801000000000000000000000000000000000000000000000000900460ff1690565b73ffffffffffffffffffffffffffffffffffffffff16600090815260016020526040902060050154760100000000000000000000000000000000000000000000900460ff1690565b6002818154811061075157fe5b60009182526020909120015473ffffffffffffffffffffffffffffffffffffffff16905081565b73ffffffffffffffffffffffffffffffffffffffff16600090815260016020526040902060050154790100000000000000000000000000000000000000000000000000900460ff1690565b6107cb61113c565b61083657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6000805460405173ffffffffffffffffffffffffffffffffffffffff909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080547fffffffffffffffffffffffff0000000000000000000000000000000000000000169055565b6108ad61113c565b61091857604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff8a16600090815260016020526040902054156109aa57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f746f6b656e20616c7265616479206b6e6f776e00000000000000000000000000604482015290519081900360640190fd5b60008a73ffffffffffffffffffffffffffffffffffffffff1663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b1580156109f257600080fd5b505afa158015610a06573d6000803e3d6000fd5b505050506040513d6020811015610a1c57600080fd5b5051905060ff8116610a8f57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601660248201527f746f6b656e20646563696d616c7320696e76616c696400000000000000000000604482015290519081900360640190fd5b6002805460018101825560009182527f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ace0180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff8e16908117909155604080517f06fdde0300000000000000000000000000000000000000000000000000000000815290516060936306fdde039260048082019391829003018186803b158015610b4e57600080fd5b505afa158015610b62573d6000803e3d6000fd5b505050506040513d6000823e601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01682016040526020811015610ba957600080fd5b8101908080516040519392919084640100000000821115610bc957600080fd5b908301906020820185811115610bde57600080fd5b8251640100000000811182820188101715610bf857600080fd5b82525081516020918201929091019080838360005b83811015610c25578181015183820152602001610c0d565b50505050905090810190601f168015610c525780820380516001836020036101000a031916815260200191505b50604052505050905060405180610180016040528060028054905081526020018281526020018d73ffffffffffffffffffffffffffffffffffffffff166395d89b416040518163ffffffff1660e01b815260040160006040518083038186803b158015610cbe57600080fd5b505afa158015610cd2573d6000803e3d6000fd5b505050506040513d6000823e601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01682016040526020811015610d1957600080fd5b8101908080516040519392919084640100000000821115610d3957600080fd5b908301906020820185811115610d4e57600080fd5b8251640100000000811182820188101715610d6857600080fd5b82525081516020918201929091019080838360005b83811015610d95578181015183820152602001610d7d565b50505050905090810190601f168015610dc25780820380516001836020036101000a031916815260200191505b5060405250505081526020018360ff1681526020018c8c8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505081526020018a73ffffffffffffffffffffffffffffffffffffffff1681526020018960ff1681526020018815158152602001871515815260200186151581526020018515158152602001841515815250600160008e73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082015181600001556020820151816001019080519060200190610ed1929190611bc1565b5060408201518051610eed916002840191602090910190611bc1565b5060608201516003820180547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660ff90921691909117905560808201518051610f41916004840191602090910190611bc1565b5060a08201518160050160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060c08201518160050160146101000a81548160ff021916908360ff16021790555060e08201518160050160156101000a81548160ff0219169083151502179055506101008201518160050160166101000a81548160ff0219169083151502179055506101208201518160050160176101000a81548160ff0219169083151502179055506101408201518160050160186101000a81548160ff0219169083151502179055506101608201518160050160196101000a81548160ff0219169083151502179055509050508b73ffffffffffffffffffffffffffffffffffffffff167f4af7419360b60cfcf01ac8a5c1487814e666a0af47877d73e82476772ac9150f826001600280549050036040518080602001838152602001828103825284818151815260200191508051906020019080838360005b838110156110d65781810151838201526020016110be565b50505050905090810190601f1680156111035780820380516001836020036101000a031916815260200191505b50935050505060405180910390a2505050505050505050505050565b60005473ffffffffffffffffffffffffffffffffffffffff165b90565b6000805473ffffffffffffffffffffffffffffffffffffffff1661115e611ac4565b73ffffffffffffffffffffffffffffffffffffffff1614905090565b73ffffffffffffffffffffffffffffffffffffffff166000908152600160205260409020600501547501000000000000000000000000000000000000000000900460ff1690565b60025490565b6111cf61113c565b61123a57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff8a166000908152600160205260409020546112cb57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600d60248201527f746f6b656e20756e6b6e6f776e00000000000000000000000000000000000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff8a1660009081526001602052604090206112fe906004018a8a611c3f565b5086600160008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060050160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555085600160008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060050160146101000a81548160ff021916908360ff16021790555084600160008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060050160156101000a81548160ff02191690831515021790555083600160008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060050160166101000a81548160ff02191690831515021790555082600160008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060050160166101000a81548160ff02191690831515021790555081600160008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060050160186101000a81548160ff02191690831515021790555080600160008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060050160196101000a81548160ff0219169083151502179055508973ffffffffffffffffffffffffffffffffffffffff167f7dfa4f44638df9ca9c035c37f4954edb0383135db7751b81208a86345775a159600160008d73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010160405180806020018281038252838181546001816001161561010002031660029004815260200191508054600181600116156101000203166002900480156116a05780601f10611675576101008083540402835291602001916116a0565b820191906000526020600020905b81548152906001019060200180831161168357829003601f168201915b50509250505060405180910390a250505050505050505050565b73ffffffffffffffffffffffffffffffffffffffff1660009081526001602052604090206005015477010000000000000000000000000000000000000000000000900460ff1690565b600160208181526000928352604092839020805481840180548651600296821615610100027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0190911695909504601f810185900485028601850190965285855290949193929091908301828280156117bd5780601f10611792576101008083540402835291602001916117bd565b820191906000526020600020905b8154815290600101906020018083116117a057829003601f168201915b50505060028085018054604080516020601f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff610100600187161502019094169590950492830185900485028101850190915281815295969594509092509083018282801561186d5780601f106118425761010080835404028352916020019161186d565b820191906000526020600020905b81548152906001019060200180831161185057829003601f168201915b50505050600383015460048401805460408051602060026101006001861615027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0190941693909304601f8101849004840282018401909252818152959660ff90941695939450908301828280156119265780601f106118fb57610100808354040283529160200191611926565b820191906000526020600020905b81548152906001019060200180831161190957829003601f168201915b5050506005909301549192505073ffffffffffffffffffffffffffffffffffffffff81169060ff740100000000000000000000000000000000000000008204811691750100000000000000000000000000000000000000000081048216917601000000000000000000000000000000000000000000008204811691770100000000000000000000000000000000000000000000008104821691780100000000000000000000000000000000000000000000000082048116917901000000000000000000000000000000000000000000000000009004168c565b611a0761113c565b611a7257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b611a7b81611ac8565b50565b73ffffffffffffffffffffffffffffffffffffffff1660009081526001602052604090206005015474010000000000000000000000000000000000000000900460ff1690565b3390565b73ffffffffffffffffffffffffffffffffffffffff8116611b34576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526026815260200180611ce66026913960400191505060405180910390fd5b6000805460405173ffffffffffffffffffffffffffffffffffffffff808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10611c0257805160ff1916838001178555611c2f565b82800160010185558215611c2f579182015b82811115611c2f578251825591602001919060010190611c14565b50611c3b929150611ccb565b5090565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10611c9e578280017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00823516178555611c2f565b82800160010185558215611c2f579182015b82811115611c2f578235825591602001919060010190611cb0565b61113991905b80821115611c3b5760008155600101611cd156fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373a265627a7a72315820f8915b552a7d0ec985c34b1bb070664a4cba0525fcf2e259d22121f500fbbd9664736f6c63430005110032"; // create new contract contract = web3.ftm.contract(registryAbi); deploy = contract.new({ data: registryByteCode, from: account, gas: 4000000 }); // get the contract address (you may need to wait for the receipt to be available) registryAddress = ftm.getTransactionReceipt(deploy.transactionHash).contractAddress;
-
Add your ERC20 tokens to the Token Registry.
// instantiate the token registry var tokenRegistry = web3.ftm.contract(registryAbi).at(registryAddress); // add tokens to the registry tokenRegistry.addToken( tokenWFTM, 'https://cryptologos.cc/logos/fantom-ftm-logo.svg?v=003', oracleFTM, 8, true, true, false, false, false); tokenRegistry.addToken( tokenUSD, 'https://cdn.worldvectorlogo.com/logos/usd-1.svg', oracleUSD, 8, true, true, true, false, false);
-
Deploy Address Provider from this repository.
/** * This deploys Fantom DeFi fMint Address Provider */ var adrProviderAbi = JSON.parse('[{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"newAddress","type":"address"}],"name":"FeeTokenChanged","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":"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":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":"address","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":"address","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":"getFeeToken","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"_addr","type":"address"}],"name":"setFeeToken","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"getRewardDistribution","outputs":[{"internalType":"address","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":"getRewardPool","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"_addr","type":"address"}],"name":"setRewardPool","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"getFantomMint","outputs":[{"internalType":"address","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"}]'); var adrProviderByteCode = "0x608060405260006100176001600160e01b0361006616565b600080546001600160a01b0319166001600160a01b0383169081178255604051929350917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a35061006a565b3390565b610c48806100796000396000f3fe608060405234801561001057600080fd5b506004361061011b5760003560e01c8063715018a6116100b25780638f32d59b11610081578063cc653b9a11610066578063cc653b9a14610290578063f2fde38b146102c3578063fcc3c074146102f65761011b565b80638f32d59b1461026c578063ca709a25146102885761011b565b8063715018a61461022157806378238c371461022957806384d9319e1461025c5780638da5cb5b146102645761011b565b80631b8b13a7116100ee5780631b8b13a7146101c157806321f8a721146101c957806335a5af92146101e657806344969711146102195761011b565b8063045bb7f814610120578063057838bd146101515780630d68b7611461015957806315cce2241461018e575b600080fd5b610128610329565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b610128610359565b61018c6004803603602081101561016f57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16610384565b005b61018c600480360360208110156101a457600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16610424565b61012861050d565b610128600480360360208110156101df57600080fd5b5035610534565b61018c600480360360208110156101fc57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff1661055c565b610128610645565b61018c610670565b61018c6004803603602081101561023f57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16610752565b6101286107ef565b61012861081a565b610274610836565b604080519115158252519081900360200190f35b610128610874565b61018c600480360360208110156102a657600080fd5b503573ffffffffffffffffffffffffffffffffffffffff1661089f565b61018c600480360360208110156102d957600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16610988565b61018c6004803603602081101561030c57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16610a04565b60006103547f70726963655f6f7261636c655f70726f78790000000000000000000000000000610534565b905090565b60006103547f746f6b656e5f7265676973747279000000000000000000000000000000000000610534565b61038c610836565b6103f757604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6104217f7265776172645f646973747269627574696f6e0000000000000000000000000082610a9d565b50565b61042c610836565b61049757604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6104c17f65726332305f6665655f746f6b656e000000000000000000000000000000000082610a9d565b6040805173ffffffffffffffffffffffffffffffffffffffff8316815290517fcb8c2156aad54c05780be84f46fd46c30c34524ac9501a0824d09f51a48c45309181900360200190a150565b60006103547f65726332305f7265776172645f706f6f6c0000000000000000000000000000005b60009081526001602052604090205473ffffffffffffffffffffffffffffffffffffffff1690565b610564610836565b6105cf57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6105f97f746f6b656e5f726567697374727900000000000000000000000000000000000082610a9d565b6040805173ffffffffffffffffffffffffffffffffffffffff8316815290517fb6f925ec7d36d613e5d1aa87c0de3ee16a0167e6bdfa2ea254e5fee9870a941e9181900360200190a150565b60006103547f66616e746f6d5f6d696e74000000000000000000000000000000000000000000610534565b610678610836565b6106e357604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6000805460405173ffffffffffffffffffffffffffffffffffffffff909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080547fffffffffffffffffffffffff0000000000000000000000000000000000000000169055565b61075a610836565b6107c557604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6104217f65726332305f7265776172645f706f6f6c00000000000000000000000000000082610a9d565b60006103547f7265776172645f646973747269627574696f6e00000000000000000000000000610534565b60005473ffffffffffffffffffffffffffffffffffffffff1690565b6000805473ffffffffffffffffffffffffffffffffffffffff16610858610af0565b73ffffffffffffffffffffffffffffffffffffffff1614905090565b60006103547f65726332305f6665655f746f6b656e0000000000000000000000000000000000610534565b6108a7610836565b61091257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b61093c7f70726963655f6f7261636c655f70726f7879000000000000000000000000000082610a9d565b6040805173ffffffffffffffffffffffffffffffffffffffff8316815290517fb36d86785c7d32b1ad714bb705e00e93eccc37b8cf47549043e61e10908ad2519181900360200190a150565b610990610836565b6109fb57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b61042181610af4565b610a0c610836565b610a7757604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6104217f66616e746f6d5f6d696e74000000000000000000000000000000000000000000825b60009182526001602052604090912080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff909216919091179055565b3390565b73ffffffffffffffffffffffffffffffffffffffff8116610b60576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526026815260200180610bee6026913960400191505060405180910390fd5b6000805460405173ffffffffffffffffffffffffffffffffffffffff808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9290921691909117905556fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373a265627a7a7231582051dd1afedf5fe36cd8809cc113e1737523379911eb0385bc77f21e4639a0cb3364736f6c63430005110032"; // create new contract contract = web3.ftm.contract(adrProviderAbi); deploy = contract.new({ data: adrProviderByteCode, from: account, gas: 4000000 }); // get the contract address (you may need to wait for the receipt to be available) adrProviderAddress = ftm.getTransactionReceipt(deploy.transactionHash).contractAddress;
-
Add Price Oracle Proxy, Token Registry and special ERC20 tokens to the Address Provider.
// instantiate the address provider var adrProvider = web3.ftm.contract(adrProviderAbi).at(adrProviderAddress); // assign addresses adrProvider.setPriceOracleProxy(priceProxy.address); adrProvider.setTokenRegistry(tokenRegistry.address); // add fee token and reward token to the address provider adrProvider.setFeeToken(tokenUSD); adrProvider.setRewardPool(tokenWFTM);
-
Deploy Reward Distribution from this repository.
/** * This deploys Fantom DeFi fMint Reward Distribution */ var rewardDistributionAbi = JSON.parse('[{"inputs":[{"internalType":"address","name":"_addressProvider","type":"address"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"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":"uint256","name":"rewardPerYear","type":"uint256"}],"name":"RateUpdated","type":"event"},{"constant":true,"inputs":[],"name":"ERR_DEBT_EXCEEDED","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"ERR_LOW_ALLOWANCE","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"ERR_LOW_BALANCE","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"ERR_LOW_COLLATERAL_RATIO","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"ERR_MINTING_PROHIBITED","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"ERR_NOT_AUTHORIZED","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"ERR_NO_COLLATERAL","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"ERR_NO_ERROR","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"ERR_NO_REWARD","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"ERR_NO_VALUE","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"ERR_REWARDS_DEPLETED","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"ERR_REWARDS_EARLY","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"ERR_REWARDS_NONE","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"ERR_REWARD_CLAIM_REJECTED","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"ERR_ZERO_AMOUNT","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"addressProvider","outputs":[{"internalType":"contract IFantomMintAddressProvider","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"isOwner","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"lastRewardPush","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"minRewardPushInterval","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"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":true,"inputs":[],"name":"rewardPerSecond","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"pushReward","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"updateRate","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"}]'); var rewardDistributionByteCode = "0x608060405234801561001057600080fd5b50604051610e45380380610e458339818101604052602081101561003357600080fd5b505160006100486001600160e01b036100b716565b600080546001600160a01b0319166001600160a01b0383169081178255604051929350917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a350600180546001600160a01b0319166001600160a01b03929092169190911790556100bb565b3390565b610d7b806100ca6000396000f3fe608060405234801561001057600080fd5b50600436106101a35760003560e01c8063715018a6116100ee578063911fc3f111610097578063bc99d6ae11610071578063bc99d6ae146102b6578063c0464d45146102be578063c7222c72146102c6578063f2fde38b146102ce576101a3565b8063911fc3f11461029e578063a664150a146102a6578063b76361c2146102ae576101a3565b80638da5cb5b116100c85780638da5cb5b146102725780638f10369a1461027a5780638f32d59b14610282576101a3565b8063715018a61461025a57806373a93af6146102625780638c7b99801461026a576101a3565b806335052d6e1161015057806367fc176b1161012a57806367fc176b1461022b57806369d1cb271461023357806369ea17711461023b576101a3565b806335052d6e14610213578063372ce3df1461021b5780634846e34514610223576101a3565b80631a52edd7116101815780631a52edd7146101d25780631ac919b0146101da5780632954018c146101e2576101a3565b806304b62f29146101a85780630a19dd33146101c25780630aff90bb146101ca575b600080fd5b6101b0610301565b60408051918252519081900360200190f35b6101b0610307565b6101b061030d565b6101b0610313565b6101b06105fe565b6101ea610604565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b6101b0610620565b6101b0610625565b6101b061062b565b6101b0610631565b6101b0610637565b6102586004803603602081101561025157600080fd5b503561063d565b005b61025861076c565b6101b061084e565b6101b0610854565b6101ea61085a565b6101b0610876565b61028a61087c565b604080519115158252519081900360200190f35b6101b06108ba565b6101b06108c0565b6101b06108c6565b6101b06108cc565b6101b06108d2565b6101b06108d9565b610258600480360360208110156102e457600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166108df565b61100581565b610f0381565b61100181565b60025460009061032c906202a30063ffffffff61095e16565b42101561033c5750610f016105fb565b6000610365600354610359600254426109db90919063ffffffff16565b9063ffffffff610a1d16565b90508061037757610f029150506105fb565b600154604080517f44969711000000000000000000000000000000000000000000000000000000008152905160009273ffffffffffffffffffffffffffffffffffffffff16916344969711916004808301926020929190829003018186803b1580156103e257600080fd5b505afa1580156103f6573d6000803e3d6000fd5b505050506040513d602081101561040c57600080fd5b5051600154604080517f1b8b13a7000000000000000000000000000000000000000000000000000000008152905192935073ffffffffffffffffffffffffffffffffffffffff90911691631b8b13a791600480820192602092909190829003018186803b15801561047c57600080fd5b505afa158015610490573d6000803e3d6000fd5b505050506040513d60208110156104a657600080fd5b5051604080517f70a0823100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8481166004830152915191909216916370a08231916024808301926020929190829003018186803b15801561051857600080fd5b505afa15801561052c573d6000803e3d6000fd5b505050506040513d602081101561054257600080fd5b505182111561055757610f03925050506105fb565b42600255604080517f2eac3b8700000000000000000000000000000000000000000000000000000000815260048101849052905173ffffffffffffffffffffffffffffffffffffffff831691632eac3b879160248083019260209291908290030181600087803b1580156105ca57600080fd5b505af11580156105de573d6000803e3d6000fd5b505050506040513d60208110156105f457600080fd5b5051925050505b90565b61100281565b60015473ffffffffffffffffffffffffffffffffffffffff1681565b600081565b61100881565b61100a81565b610f0181565b61100781565b61064561087c565b6106b057604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6000811161071f57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f696e76616c69642072657761726420616d6f756e740000000000000000000000604482015290519081900360640190fd5b610733816301e1338063ffffffff610a9016565b6003556040805182815290517fe65c987b2e4668e09ba867026921588005b2b2063607a1e7e7d91683c8f91b7b9181900360200190a150565b61077461087c565b6107df57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6000805460405173ffffffffffffffffffffffffffffffffffffffff909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080547fffffffffffffffffffffffff0000000000000000000000000000000000000000169055565b61100981565b61100681565b60005473ffffffffffffffffffffffffffffffffffffffff1690565b60035481565b6000805473ffffffffffffffffffffffffffffffffffffffff1661089e610ad2565b73ffffffffffffffffffffffffffffffffffffffff1614905090565b61100381565b60025481565b61100481565b610a0081565b6202a30081565b610f0281565b6108e761087c565b61095257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b61095b81610ad6565b50565b6000828201838110156109d257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b90505b92915050565b60006109d283836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610bcf565b600082610a2c575060006109d5565b82820282848281610a3957fe5b04146109d2576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180610d266021913960400191505060405180910390fd5b60006109d283836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250610c80565b3390565b73ffffffffffffffffffffffffffffffffffffffff8116610b42576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526026815260200180610d006026913960400191505060405180910390fd5b6000805460405173ffffffffffffffffffffffffffffffffffffffff808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b60008184841115610c78576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610c3d578181015183820152602001610c25565b50505050905090810190601f168015610c6a5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b60008183610ce9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201818152835160248401528351909283926044909101919085019080838360008315610c3d578181015183820152602001610c25565b506000838581610cf557fe5b049594505050505056fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f77a265627a7a72315820c0f83fa7131e5cec98c557b6879aeb657e0629147e70423a98d4e3dde292a1de64736f6c63430005110032"; // create new contract contract = web3.ftm.contract(rewardDistributionAbi); deploy = contract.new(adrProvider.address, { data: rewardDistributionByteCode, from: account, gas: 4000000 }); // get the contract address (you may need to wait for the receipt to be available) rewardDistributionAddress = ftm.getTransactionReceipt(deploy.transactionHash).contractAddress; // instantiate the reward distribution contract var rewardDistribution = web3.ftm.contract(rewardDistributionAbi).at(rewardDistributionAddress);
-
Add the Reward Distribution to the Address Provider.
adrProvider.setRewardDistribution(rewardDistribution.address);
-
Deploy Fantom fMint contract.
/** * This deploys Fantom DeFi fMint Core Minter */ var fMintAbi = JSON.parse('[{"inputs":[{"internalType":"address","name":"_addressProvider","type":"address"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Deposited","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Minted","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":true,"internalType":"address","name":"token","type":"address"},{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Repaid","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"reward","type":"uint256"}],"name":"RewardAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"reward","type":"uint256"}],"name":"RewardPaid","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Withdrawn","type":"event"},{"constant":true,"inputs":[],"name":"ERR_DEBT_EXCEEDED","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"ERR_LOW_ALLOWANCE","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"ERR_LOW_BALANCE","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"ERR_LOW_COLLATERAL_RATIO","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"ERR_MINTING_PROHIBITED","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"ERR_NOT_AUTHORIZED","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"ERR_NO_COLLATERAL","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"ERR_NO_ERROR","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"ERR_NO_REWARD","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"ERR_NO_VALUE","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"ERR_REWARDS_DEPLETED","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"ERR_REWARDS_EARLY","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"ERR_REWARDS_NONE","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"ERR_REWARD_CLAIM_REJECTED","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"ERR_ZERO_AMOUNT","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"addressProvider","outputs":[{"internalType":"contract IFantomMintAddressProvider","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"}],"name":"collateralBalance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"_account","type":"address"},{"internalType":"address","name":"_token","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"collateralCanDecrease","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"collateralLowestDebtRatio4dec","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"collateralRatioDecimalsCorrection","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"collateralTokens","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"collateralTokensCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"collateralTotal","outputs":[{"internalType":"uint256","name":"value","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"collateralTotalBalance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"_account","type":"address"}],"name":"collateralValueOf","outputs":[{"internalType":"uint256","name":"value","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"}],"name":"debtBalance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"_account","type":"address"},{"internalType":"address","name":"_token","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"debtCanIncrease","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"debtTokens","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"debtTokensCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"debtTotal","outputs":[{"internalType":"uint256","name":"value","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"debtTotalBalance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"_account","type":"address"}],"name":"debtValueOf","outputs":[{"internalType":"uint256","name":"value","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"deposit","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"fMintFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"fMintFeeDigitsCorrection","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"fMintPriceDigitsCorrection","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"feePool","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"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":true,"inputs":[],"name":"principalBalance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"_account","type":"address"}],"name":"principalBalanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"renounceOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"rewardApplicableUntil","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"_account","type":"address"}],"name":"rewardCanClaim","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"rewardClaim","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"_account","type":"address"}],"name":"rewardEarned","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"rewardEligibilityRatio4dec","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"rewardEpochEnds","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"rewardEpochLength","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"rewardLastPerToken","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"reward","type":"uint256"}],"name":"rewardNotifyAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"rewardPerToken","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"rewardPerTokenDecimalsCorrection","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"rewardPerTokenPaid","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"rewardRate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"rewardStash","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"rewardUpdated","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"tokenValue","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","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":"_token","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"withdraw","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"rewardPoolAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"rewardDistributionAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"tokenRegistryAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"feeTokenAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"_token","type":"address"}],"name":"getPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getPriceDigitsCorrection","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"mint","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"repay","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"}]'); var fMintByteCode = "0x60806040523480156200001157600080fd5b506040516200311538038062003115833981810160405260208110156200003757600080fd5b505160006200004e6001600160e01b03620000d216565b600080546001600160a01b0319166001600160a01b0383169081178255604051929350917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a3506000805460ff60a01b1916600160a01b179055600e80546001600160a01b039092166001600160a01b0319909216919091179055620000d6565b3390565b61302f80620000e66000396000f3fe608060405234801561001057600080fd5b506004361061043c5760003560e01c806373a93af611610235578063c634dfaa11610135578063e7e7e387116100c8578063f2fde38b11610097578063f4305a991161007c578063f4305a9914610a2b578063f48f3b4014610a6e578063fadeada214610a8b5761043c565b8063f2fde38b146109bf578063f3fef3a3146109f25761043c565b8063e7e7e38714610918578063f182178314610920578063f2392c8d14610959578063f2423ea11461098c5761043c565b8063da0a043211610104578063da0a0432146108a2578063db16e0b5146108d5578063e69993ac14610892578063e7602b9d146108dd5761043c565b8063c634dfaa14610857578063c7222c721461088a578063cbf02fd514610892578063cd3daf9d1461089a5761043c565b806396427a2b116101c8578063ad8f240e11610197578063b76361c21161017c578063b76361c21461083f578063b8df0dea14610847578063bc99d6ae1461084f5761043c565b8063ad8f240e146107fc578063ae2e933b146108375761043c565b806396427a2b146107dc5780639ccf1201146107e45780639ee4736d146107ec578063a83e53ac146107f45761043c565b80638da5cb5b116102045780638da5cb5b1461076d5780638f32d59b14610775578063905ca24714610791578063911fc3f1146107d45761043c565b806373a93af61461074d5780637b0a47ee14610755578063845a51ec1461075d5780638c7b9980146107655761043c565b806340c10f19116103405780636409f921116102d357806367fc176b116102a25780636e718e04116102875780636e718e0414610733578063715018a61461073b57806372e13848146107455761043c565b806367fc176b1461072357806369d1cb271461072b5761043c565b80636409f921146106d857806364631d9b146106e0578063653a8da1146106e857806365b612591461071b5761043c565b80634846e3451161030f5780634846e345146106b857806350fca4bd146106c0578063544bb473146106c85780635be2aca0146106d05761043c565b806340c10f191461060b57806341976e0914610644578063458936f51461067757806347e7ef241461067f5761043c565b806322867d78116103d357806335052d6e116103a25780633a65a350116103875780633a65a350146105c85780633b8b09b7146105fb5780633ce9b316146106035761043c565b806335052d6e146105b8578063372ce3df146105c05761043c565b806322867d78146105275780632954018c146105605780632eac3b87146105685780632f573910146105855761043c565b8063172c48c71161040f578063172c48c71461049e5780631ac919b0146104e45780631d842131146104ec57806320a0a0e91461051f5761043c565b806304b62f29146104415780630a19dd331461045b5780630aff90bb1461046357806316ba6bf31461046b575b600080fd5b610449610a93565b60408051918252519081900360200190f35b610449610a99565b610449610a9f565b6104496004803603602081101561048157600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16610aa5565b6104bb600480360360208110156104b457600080fd5b5035610b35565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b610449610b69565b6104496004803603602081101561050257600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16610b6f565b610449610b81565b6104496004803603604081101561053d57600080fd5b5073ffffffffffffffffffffffffffffffffffffffff8135169060200135610b88565b6104bb610e64565b6104496004803603602081101561057e57600080fd5b5035610e80565b6104496004803603602081101561059b57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16610f75565b6104496110d1565b6104496110d6565b610449600480360360208110156105de57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166110dc565b6104496111ee565b6104496111f4565b6104496004803603604081101561062157600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81351690602001356111fa565b6104496004803603602081101561065a57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16611540565b610449611679565b6104496004803603604081101561069557600080fd5b5073ffffffffffffffffffffffffffffffffffffffff8135169060200135611680565b61044961197c565b610449611982565b610449611988565b6104bb61198e565b610449611a2a565b610449611aeb565b610449600480360360208110156106fe57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16611af2565b610449611b04565b610449611b0c565b610449611b12565b610449611b18565b610743611b1e565b005b6104bb611c00565b610449611c6b565b610449611c71565b6104bb611c77565b610449611ce2565b6104bb611ce8565b61077d611d04565b604080519115158252519081900360200190f35b61077d600480360360608110156107a757600080fd5b5073ffffffffffffffffffffffffffffffffffffffff813581169160208101359091169060400135611d42565b610449611d64565b610449611d6a565b610449611dd5565b610449611dda565b610449611de0565b6104496004803603604081101561081257600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81358116916020013516611def565b610449611e0c565b610449611e12565b6104bb611e18565b610449611e83565b6104496004803603602081101561086d57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16611e89565b610449611e94565b610449611e9a565b610449611ea0565b61077d600480360360208110156108b857600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16611ef3565b610449611f04565b610449600480360360408110156108f357600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81358116916020013516611f12565b610449611f2f565b6104496004803603604081101561093657600080fd5b5073ffffffffffffffffffffffffffffffffffffffff8135169060200135611f96565b6104496004803603602081101561096f57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16611fc5565b610449600480360360208110156109a257600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16611fd7565b610743600480360360208110156109d557600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16611fe9565b61044960048036036040811015610a0857600080fd5b5073ffffffffffffffffffffffffffffffffffffffff8135169060200135612068565b61077d60048036036060811015610a4157600080fd5b5073ffffffffffffffffffffffffffffffffffffffff813581169160208101359091169060400135612250565b6104bb60048036036020811015610a8457600080fd5b503561226a565b610449612277565b61100581565b610f0381565b61100181565b73ffffffffffffffffffffffffffffffffffffffff81166000908152600c6020908152604080832054600b909252822054610b2d9190610b2190620f424090610b1590610b0090610af4611ea0565b9063ffffffff61227f16565b610b0988611e89565b9063ffffffff6122c116565b9063ffffffff61233416565b9063ffffffff61237616565b90505b919050565b60038181548110610b4257fe5b60009182526020909120015473ffffffffffffffffffffffffffffffffffffffff16905081565b61100281565b60026020526000908152604090205481565b62093a8081565b6000805474010000000000000000000000000000000000000000900460ff16610c1257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff16905581610c485750611001610e1f565b33600090815260046020908152604080832073ffffffffffffffffffffffffffffffffffffffff87168452909152902054821115610c895750611002610e1f565b604080517fdd62ed3e000000000000000000000000000000000000000000000000000000008152336004820152306024820152905173ffffffffffffffffffffffffffffffffffffffff85169163dd62ed3e916044808301926020929190829003018186803b158015610cfb57600080fd5b505afa158015610d0f573d6000803e3d6000fd5b505050506040513d6020811015610d2557600080fd5b5051821115610d375750611003610e1f565b604080517f79cc679000000000000000000000000000000000000000000000000000000000815233600482015260248101849052905173ffffffffffffffffffffffffffffffffffffffff8516916379cc679091604480830192600092919082900301818387803b158015610dab57600080fd5b505af1158015610dbf573d6000803e3d6000fd5b50505050610dce3384846123ea565b604080518381529051339173ffffffffffffffffffffffffffffffffffffffff8616917f0a3fbbea70e93f2daafa3102f5c9a1b8315e6d7a1e43e4bc020bc1162327470a9181900360200190a35060005b600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff167401000000000000000000000000000000000000000017905592915050565b600e5473ffffffffffffffffffffffffffffffffffffffff1681565b6000610e8a611c00565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610ec55750610a00610b30565b610ecd6124ab565b600854421015610f0a576000610ef4600754610b094260085461227f90919063ffffffff16565b9050610f06838263ffffffff61237616565b9250505b610f1d8262093a8063ffffffff61233416565b600755610f334262093a8063ffffffff61237616565b600855426009556040805183815290517fde88a922e0d3b88b24e9623efeb464919c6bf9f66857a65e2bfcf2ce87a9433d9181900360200190a1506000919050565b6000805b6006548110156110cb5773ffffffffffffffffffffffffffffffffffffffff831660009081526004602052604081206006805491929184908110610fb957fe5b600091825260208083209091015473ffffffffffffffffffffffffffffffffffffffff168352820192909252604001902054156110c3576110c06110b36006838154811061100357fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600460008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006006868154811061107c57fe5b600091825260208083209091015473ffffffffffffffffffffffffffffffffffffffff168352820192909252604001902054611f96565b839063ffffffff61237616565b91505b600101610f79565b50919050565b600081565b61100881565b6000805b6003548110156110cb5773ffffffffffffffffffffffffffffffffffffffff83166000908152600160205260408120600380549192918490811061112057fe5b600091825260208083209091015473ffffffffffffffffffffffffffffffffffffffff168352820192909252604001902054156111e6576111e36110b36003838154811061116a57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006003868154811061107c57fe5b91505b6001016110e0565b61753081565b60085481565b6000805474010000000000000000000000000000000000000000900460ff1661128457604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055816112ba5750611001610e1f565b6112c261198e565b73ffffffffffffffffffffffffffffffffffffffff1663c2ba4744846040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b15801561133e57600080fd5b505afa158015611352573d6000803e3d6000fd5b505050506040513d602081101561136857600080fd5b50516113775750611006610e1f565b600061138284611540565b90508061139457611007915050610e1f565b61139f338585611d42565b6113ae57611005915050610e1f565b6113b93385856124c3565b60006113dc6305f5e100610b15612710816019610b098a8963ffffffff6122c116565b600d549091506113f2908263ffffffff61237616565b600d5561140733611401611e18565b836124c3565b604080517f40c10f1900000000000000000000000000000000000000000000000000000000815233600482015260248101869052905173ffffffffffffffffffffffffffffffffffffffff8716916340c10f199160448083019260209291908290030181600087803b15801561147c57600080fd5b505af1158015611490573d6000803e3d6000fd5b505050506040513d60208110156114a657600080fd5b5050604080518581529051339173ffffffffffffffffffffffffffffffffffffffff8816917f9d228d69b5fdb8d273a2336f8fb8612d039631024ea9bf09c424a9503aa078f09181900360200190a3600092505050600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff167401000000000000000000000000000000000000000017905592915050565b600e54604080517f045bb7f8000000000000000000000000000000000000000000000000000000008152905160009273ffffffffffffffffffffffffffffffffffffffff169163045bb7f8916004808301926020929190829003018186803b1580156115ab57600080fd5b505afa1580156115bf573d6000803e3d6000fd5b505050506040513d60208110156115d557600080fd5b5051604080517f41976e0900000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8581166004830152915191909216916341976e09916024808301926020929190829003018186803b15801561164757600080fd5b505afa15801561165b573d6000803e3d6000fd5b505050506040513d602081101561167157600080fd5b505192915050565b6003545b90565b6000805474010000000000000000000000000000000000000000900460ff1661170a57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055816117405750611001610e1f565b604080517f70a08231000000000000000000000000000000000000000000000000000000008152336004820152905173ffffffffffffffffffffffffffffffffffffffff8516916370a08231916024808301926020929190829003018186803b1580156117ac57600080fd5b505afa1580156117c0573d6000803e3d6000fd5b505050506040513d60208110156117d657600080fd5b50518211156117e85750611002610e1f565b604080517fdd62ed3e000000000000000000000000000000000000000000000000000000008152336004820152306024820152905173ffffffffffffffffffffffffffffffffffffffff85169163dd62ed3e916044808301926020929190829003018186803b15801561185a57600080fd5b505afa15801561186e573d6000803e3d6000fd5b505050506040513d602081101561188457600080fd5b50518211156118965750611003610e1f565b61189f83611540565b6118ac5750611007610e1f565b6118d473ffffffffffffffffffffffffffffffffffffffff841633308563ffffffff61258a16565b6118dd33612625565b6118e8338484612697565b604080518381529051339173ffffffffffffffffffffffffffffffffffffffff8616917f8752a472e571a816aea92eec8dae9baf628e840f4929fbcc2d155e6233ff68a79181900360200190a35060008080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff167401000000000000000000000000000000000000000017905592915050565b61100a81565b61c35081565b600a5481565b600e54604080517f057838bd000000000000000000000000000000000000000000000000000000008152905160009273ffffffffffffffffffffffffffffffffffffffff169163057838bd916004808301926020929190829003018186803b1580156119f957600080fd5b505afa158015611a0d573d6000803e3d6000fd5b505050506040513d6020811015611a2357600080fd5b5051905090565b6000611a3533612625565b336000908152600c602052604090205480611a555761100991505061167d565b611a5e33611ef3565b611a6d5761100a91505061167d565b336000818152600c6020526040812055611aad9082611a8a611c77565b73ffffffffffffffffffffffffffffffffffffffff16919063ffffffff61275916565b60408051828152905133917fe2403640ba68fed3a2f88b7557551d1993f84b99bb10ff833f0cf8db0c5e0486919081900360200190a2600091505090565b620f424081565b600b6020526000908152604090205481565b6305f5e10081565b610f0181565b61100781565b60095481565b611b26611d04565b611b9157604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6000805460405173ffffffffffffffffffffffffffffffffffffffff909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080547fffffffffffffffffffffffff0000000000000000000000000000000000000000169055565b600e54604080517f84d9319e000000000000000000000000000000000000000000000000000000008152905160009273ffffffffffffffffffffffffffffffffffffffff16916384d9319e916004808301926020929190829003018186803b1580156119f957600080fd5b61100981565b60075481565b600e54604080517f1b8b13a7000000000000000000000000000000000000000000000000000000008152905160009273ffffffffffffffffffffffffffffffffffffffff1691631b8b13a7916004808301926020929190829003018186803b1580156119f957600080fd5b61100681565b60005473ffffffffffffffffffffffffffffffffffffffff1690565b6000805473ffffffffffffffffffffffffffffffffffffffff16611d266127e6565b73ffffffffffffffffffffffffffffffffffffffff1614905090565b6000611d5c846000611d548686611f96565b6175306127ea565b949350505050565b61100381565b6000805b600354811015611dd157611dc76110b360038381548110611d8b57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600260006003868154811061107c57fe5b9150600101611d6e565b5090565b601981565b60065490565b6000611dea611f2f565b905090565b600460209081526000928352604080842090915290825290205481565b600d5481565b61100481565b600e54604080517fca709a25000000000000000000000000000000000000000000000000000000008152905160009273ffffffffffffffffffffffffffffffffffffffff169163ca709a25916004808301926020929190829003018186803b1580156119f957600080fd5b610a0081565b6000610b2d82610f75565b610f0281565b61271081565b600080611eab611de0565b905080611ebc575050600a5461167d565b611eed611ede82610b15620f4240610b09600754610b09600954610af4611f04565b600a549063ffffffff61237616565b91505090565b6000610b2d826000806175306127ea565b6000611dea42600854612834565b600160209081526000928352604080842090915290825290205481565b6000805b600654811015611dd157611f8c6110b360068381548110611f5057fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600560006006868154811061107c57fe5b9150600101611f33565b6000611fbc611fa3612277565b610b15611faf86611540565b859063ffffffff6122c116565b90505b92915050565b600c6020526000908152604090205481565b60056020526000908152604090205481565b611ff1611d04565b61205c57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6120658161284a565b50565b6000805474010000000000000000000000000000000000000000900460ff166120f257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055816121285750611001610e1f565b33600090815260016020908152604080832073ffffffffffffffffffffffffffffffffffffffff871684529091529020548211156121695750611002610e1f565b612174338484612250565b6121815750611005610e1f565b61218a33612625565b612195338484612943565b6121bc73ffffffffffffffffffffffffffffffffffffffff8416338463ffffffff61275916565b604080518381529051339173ffffffffffffffffffffffffffffffffffffffff8616917fd1c19fbcd4551a5edfb66d43d2e337c04837afda3482b42bdf569a8fccdae5fb9181900360200190a35060008080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff167401000000000000000000000000000000000000000017905592915050565b6000611d5c846122608585611f96565b60006175306127ea565b60068181548110610b4257fe5b6305f5e10090565b6000611fbc83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250612a04565b6000826122d057506000611fbf565b828202828482816122dd57fe5b0414611fbc576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180612fb06021913960400191505060405180910390fd5b6000611fbc83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612ab5565b600082820183811015611fbc57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff80841660009081526004602090815260408083209386168352929052205461242d908263ffffffff61227f16565b73ffffffffffffffffffffffffffffffffffffffff8085166000908152600460209081526040808320938716835292815282822093909355600590925290205461247d908263ffffffff61227f16565b73ffffffffffffffffffffffffffffffffffffffff9092166000908152600560205260409020919091555050565b6124b3611ea0565b600a556124be611f04565b600955565b73ffffffffffffffffffffffffffffffffffffffff808416600090815260046020908152604080832093861683529290522054612506908263ffffffff61237616565b73ffffffffffffffffffffffffffffffffffffffff80851660009081526004602090815260408083209387168352928152828220939093556005909252902054612556908263ffffffff61237616565b73ffffffffffffffffffffffffffffffffffffffff831660009081526005602052604090205561258582612b34565b505050565b6040805173ffffffffffffffffffffffffffffffffffffffff85811660248301528416604482015260648082018490528251808303909101815260849091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f23b872dd0000000000000000000000000000000000000000000000000000000017905261261f908590612c1a565b50505050565b61262d6124ab565b61263681612e58565b1561266b5761264481610aa5565b73ffffffffffffffffffffffffffffffffffffffff82166000908152600c60205260409020555b600a5473ffffffffffffffffffffffffffffffffffffffff9091166000908152600b6020526040902055565b73ffffffffffffffffffffffffffffffffffffffff8084166000908152600160209081526040808320938616835292905220546126da908263ffffffff61237616565b73ffffffffffffffffffffffffffffffffffffffff8085166000908152600160209081526040808320938716835292815282822093909355600290925290205461272a908263ffffffff61237616565b73ffffffffffffffffffffffffffffffffffffffff831660009081526002602052604090205561258582612e69565b6040805173ffffffffffffffffffffffffffffffffffffffff8416602482015260448082018490528251808303909101815260649091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb00000000000000000000000000000000000000000000000000000000179052612585908490612c1a565b3390565b6000806127fa84610b2188610f75565b9050600061280b86610af4896110dc565b90506000612825612710610b15858863ffffffff6122c116565b90911015979650505050505050565b60008183106128435781611fbc565b5090919050565b73ffffffffffffffffffffffffffffffffffffffff81166128b6576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526026815260200180612f8a6026913960400191505060405180910390fd5b6000805460405173ffffffffffffffffffffffffffffffffffffffff808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b73ffffffffffffffffffffffffffffffffffffffff808416600090815260016020908152604080832093861683529290522054612986908263ffffffff61227f16565b73ffffffffffffffffffffffffffffffffffffffff808516600090815260016020908152604080832093871683529281528282209390935560029092529020546129d6908263ffffffff61227f16565b73ffffffffffffffffffffffffffffffffffffffff9092166000908152600260205260409020919091555050565b60008184841115612aad576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015612a72578181015183820152602001612a5a565b50505050905090810190601f168015612a9f5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b60008183612b1e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201818152835160248401528351909283926044909101919085019080838360008315612a72578181015183820152602001612a5a565b506000838581612b2a57fe5b0495945050505050565b6000805b600654811015612b9f578273ffffffffffffffffffffffffffffffffffffffff1660068281548110612b6657fe5b60009182526020909120015473ffffffffffffffffffffffffffffffffffffffff161415612b975760019150612b9f565b600101612b38565b5080612c1657600680546001810182556000919091527ff652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d3f0180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff84161790555b5050565b612c398273ffffffffffffffffffffffffffffffffffffffff16612f50565b612ca457604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5361666545524332303a2063616c6c20746f206e6f6e2d636f6e747261637400604482015290519081900360640190fd5b600060608373ffffffffffffffffffffffffffffffffffffffff16836040518082805190602001908083835b60208310612d0d57805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe09092019160209182019101612cd0565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114612d6f576040519150601f19603f3d011682016040523d82523d6000602084013e612d74565b606091505b509150915081612de557604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564604482015290519081900360640190fd5b80511561261f57808060200190516020811015612e0157600080fd5b505161261f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602a815260200180612fd1602a913960400191505060405180910390fd5b6000610b2d8260008061c3506127ea565b6000805b600354811015612ed4578273ffffffffffffffffffffffffffffffffffffffff1660038281548110612e9b57fe5b60009182526020909120015473ffffffffffffffffffffffffffffffffffffffff161415612ecc5760019150612ed4565b600101612e6d565b5080612c1657600380546001810182556000919091527fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b01805473ffffffffffffffffffffffffffffffffffffffff84167fffffffffffffffffffffffff00000000000000000000000000000000000000009091161790555050565b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470818114801590611d5c57505015159291505056fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f775361666545524332303a204552433230206f7065726174696f6e20646964206e6f742073756363656564a265627a7a723158202a86d57a2d76ef65cad82a51d1bb2b90ab5b4f8995593e3ca5a420999bc6901364736f6c63430005110032"; // create new contract contract = web3.ftm.contract(fMintAbi); deploy = contract.new(adrProvider.address, { data: fMintByteCode, from: account, gas: 4000000 }); // get the contract address (you may need to wait for the receipt to be available) fMintAddress = ftm.getTransactionReceipt(deploy.transactionHash).contractAddress; // instantiate the fMint contract var fMint = web3.ftm.contract(fMintAbi).at(fMintAddress);
-
Add Fantom fMint to the Address Provider.
// set the minter address adrProvider.setFantomMint(fMint.address);
-
Enable minter role on the ERC20 tokens for fMint.
// we will configure ERC20 tokens var erc20abi = JSON.parse('[{"inputs":[],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"}],"name":"MinterAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"}],"name":"MinterRemoved","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"}],"name":"PauserAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"}],"name":"PauserRemoved","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"constant":false,"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"addMinter","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"addPauser","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"burn","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"burnFrom","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"subtractedValue","type":"uint256"}],"name":"decreaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"addedValue","type":"uint256"}],"name":"increaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"isMinter","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"isPauser","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"mint","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"pause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"renounceMinter","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"renouncePauser","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"unpause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"}]'); // set USD var fUSD = web3.ftm.contract(erc20abi).at(tokenUSD); fUSD.addMinter(adrProvider.getFantomMint());