SkillAgentSearch skills...

FtmStableCoin

No description available

Install / Use

/learn @Fantom-foundation/FtmStableCoin
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

Fantom FMint DeFi module

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.

Deployment Requirements

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.
  • Band Protocol price oracle proxy, compatible with our proxy interface, or Fantom Price Oracle Proxy Fantom Oracle PriceFeed.
  • You need ChainLink compatible price oracle aggregate for each ERC20 token, if the deployment uses Fantom Price Oracle proxy. See AggregatorInterface.
  • Fantom DeFi Token Storage contract, available in this repository.
  • 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. The Fantom own deployment uses Band Protocol price oracle proxy to offer accurate and precise price value calculations.

Deployment using Lachesis JavaScript Console

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;

Deployment Steps

  1. Deploy wFTM and ERC20 tokens you will be using with the fMint.
  2. Obtain address of a price oracle proxy of your choice. Continue with the step 5, if you are going to use an external proxy. Alternatively, deploy ChainLink compatible Price Oracle Aggregates and continue with the next step.
  3. 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 = "0x608060405234801561001057600080fd5b50600080546001600160a01b03191633179055610a6f806100326000396000f3fe608060405234801561001057600080fd5b506004361061007d5760003560e01c80638da5cb5b1161005b5780638da5cb5b14610160578063e0a3581e14610168578063e889e5d6146101a1578063eb470ebf146101da5761007d565b8063112cdab91461008257806341976e09146100de5780637394a7f614610123575b600080fd5b6100b56004803603602081101561009857600080fd5b503573ffffffffffffffffffffffffffffffffffffffff1661020d565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b610111600480360360208110156100f457600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16610235565b60408051918252519081900360200190f35b61015e6004803603604081101561013957600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81358116916020013516610373565b005b6100b561048c565b6101116004803603604081101561017e57600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81351690602001356104a8565b610111600480360360408110156101b757600080fd5b5073ffffffffffffffffffffffffffffffffffffffff8135169060200135610705565b610111600480360360208110156101f057600080fd5b503573ffffffffffffffffffffffffffffffffffffffff1661092e565b60016020526000908152604090205473ffffffffffffffffffffffffffffffffffffffff1681565b73ffffffffffffffffffffffffffffffffffffffff8181166000908152600160205260408120549091166102ca57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f6f7261636c65206e6f7420617661696c61626c65000000000000000000000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff8083166000908152600160209081526040918290205482517f50d25bcd00000000000000000000000000000000000000000000000000000000815292519316926350d25bcd926004808201939291829003018186803b15801561034157600080fd5b505afa158015610355573d6000803e3d6000fd5b505050506040513d602081101561036b57600080fd5b505192915050565b60005473ffffffffffffffffffffffffffffffffffffffff1633146103f957604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f6163636573732072657374726963746564000000000000000000000000000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff82811660008181526001602090815260409182902080547fffffffffffffffffffffffff000000000000000000000000000000000000000016948616948517905581519384524290840152805191927f51012bc010926f3f948f99b90ed487a209375a900797c69e70dbc17f09264357929081900390910190a25050565b60005473ffffffffffffffffffffffffffffffffffffffff1681565b73ffffffffffffffffffffffffffffffffffffffff82811660009081526001602052604081205490911661053d57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f6f7261636c65206e6f7420617661696c61626c65000000000000000000000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff80841660009081526001602090815260408083205481517f668a0f0200000000000000000000000000000000000000000000000000000000815291519394169263668a0f0292600480840193919291829003018186803b1580156105b557600080fd5b505afa1580156105c9573d6000803e3d6000fd5b505050506040513d60208110156105df57600080fd5b505190508083111561065257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f6e6f7420656e6f75676820686973746f72790000000000000000000000000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff8085166000908152600160209081526040918290205482517fb633620c0000000000000000000000000000000000000000000000000000000081528786036004820152925193169263b633620c926024808201939291829003018186803b1580156106d157600080fd5b505afa1580156106e5573d6000803e3d6000fd5b505050506040513d60208110156106fb57600080fd5b5051949350505050565b73ffffffffffffffffffffffffffffffffffffffff82811660009081526001602052604081205490911661079a57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f6f7261636c65206e6f7420617661696c61626c65000000000000000000000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff80841660009081526001602090815260408083205481517f668a0f0200000000000000000000000000000000000000000000000000000000815291519394169263668a0f0292600480840193919291829003018186803b15801561081257600080fd5b505afa158015610826573d6000803e3d6000fd5b505050506040513d602081101561083c57600080fd5b50519050808311156108af57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f6e6f7420656e6f75676820686973746f72790000000000000000000000000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff8085166000908152600160209081526040918290205482517fb5ab58dc0000000000000000000000000000000000000000000000000000000081528786036004820152925193169263b5ab58dc926024808201939291829003018186803b15801561
    

Related Skills

View on GitHub
GitHub Stars12
CategoryDevelopment
Updated2mo ago
Forks10

Languages

Solidity

Security Score

85/100

Audited on Jan 24, 2026

No findings