A decentralized invoice financing platform built on Mantle Network using Hardhat and TypeScript.
FlowFi enables suppliers to get immediate financing for their invoices through a trustless smart contract system on the Mantle Network.
- Invoice Creation: Suppliers can create invoices with buyer information and due dates
- Invoice Financing: Financiers can provide instant liquidity to suppliers
- Payment Tracking: Automated tracking of invoice payment status
- Security: Built with OpenZeppelin contracts for enhanced security
- Blockchain: Mantle Network (Testnet)
- Framework: Hardhat
- Language: TypeScript, Solidity 0.8.20
- Libraries: OpenZeppelin Contracts, Ethers.js
- Install dependencies:
npm install- Configure environment variables:
- Copy
.envfile and add your private key:
PRIVATE_KEY=your_private_key_here - Copy
npx hardhat compilenpx hardhat testnpx hardhat run scripts/deploy.ts --network mantleTestnetThe deployment script will:
- Deploy MockUSDC (test token with 6 decimals)
- Deploy InvoiceNFT (ERC721 for tokenizing invoices)
- Deploy LendingPool (main lending contract)
- Configure LendingPool as approved operator
- Save deployment addresses to
deployments/directory
# Start local node
npx hardhat node
# Deploy (in another terminal)
npx hardhat run scripts/deploy.ts --network localhostAfter deployment, verify contracts on block explorer:
npx hardhat verify --network mantleTestnet <CONTRACT_ADDRESS>ERC721 token representing invoices with metadata:
- Invoice amount, due date, debtor information
- Transfer restrictions (only borrower or contract owner)
- Minting function for creating invoice NFTs
Main lending contract with features:
- Lender deposits/withdrawals (USDC)
- Loan requests (80% LTV on invoice value)
- Loan funding and repayment
- NFT claiming for defaulted loans
- Borrower reputation tracking
Test ERC20 token (6 decimals) for local testing
- Network: Mantle Testnet
- RPC URL: https://rpc.testnet.mantle.xyz
- Chain ID: 5003
FlowFi/
├── contracts/ # Solidity smart contracts
├── scripts/ # Deployment scripts
├── test/ # Test files
├── hardhat.config.ts # Hardhat configuration
├── tsconfig.json # TypeScript configuration
└── .env # Environment variables
- Never commit your
.envfile - Keep your private keys secure
- Audit contracts before mainnet deployment
MIT