Variable Finance

A decentralized PoS (Proof Of Sale) mechanism for ERC20 tokens. From Smart Contract to Brick & Mortar Store, accept any ERC20 token as payments. Also, we implement an on-chain approval manager. Approve it Once, Use it Anywhere.

Description

Variable Finance introduces two new products to the market, Onchain PoS (Proof Of Sale) verified & entirely run by the smart contracts with real-time gross settlements under an efficient approval mechanism. An Approvals Manager for managing all the D-Apps you've approved for efficient & secure management of ERC20s. Currently on ethereum mainnet supporting CIRCLE DOLLAR (USDC), Compound (COMP) and Uniswap (UNI) Tokens. Features: ------------ 1. Register as a merchant to accept ERC20 token payments at your store. 2. Pay merchants using any ERC20 token. Currently (UNI. USDC. COMP) for PoC. 3. Manage all your ERC20 token approvals from one place irrespective of wallet. 4. Smart Contract has the ability to process n-ERC20 tokens without upgrading, so listing new tokens is just one step away. 5. Sub-Graphs are deployed for the POS network to enable faster indexing and complex queries. 6. Merchant information is store decentralized including their store logo in IPFS. POS Network: -------------------- ERC20s represents a wider class of assets ranging from a dollar to gold to liquidity in a defi pool. So we're looking to exploit the value of these assets by enabling holders to use them in their day-to-day activities. Like spending an LP token for buying coffee at Starbucks. Currently, it would be difficult for us to declare the value of the LP token so we implemented the PoC with wBTC, COMP & USDC that have well established and stable price feeds through chainlink. The user walks into a store and scan qr code and pays their ERC20 tokens in stores. It would be similar to the traditional approach where the merchant would have a payment pointer to which the user can pay their tokens. Decentralized Merchant Network - All merchant information including the logo is updated to IPFS and their hash is stored to the merchant oracle (variable merchant oracle). Merchant List: ------------------- https://www.variable.finance/merchants-list (Served from the graph, IPFS & smart contract) Merchant Oracle Contract: ----------------------------------- https://kovan.etherscan.io/address/0xb89844126ab8250a239d003e0117b13b62bfdd38 POS Contract: ------------------- https://kovan.etherscan.io/address/0xD6397aa8fC36ac8976977a568F6600F7BDfb0E6b#readContract For Tokens Listed on Our POS Network: ----------------------------------------------------- https://www.variable.finance/tokens-list (We can list all ERC20 tokens with a chainlink price oracle) We use chainlink for fetching real-time price and use our conversion inside the POS contract that resolved the value to the amount to be paid by the use for equivalent USD. Any other payment provided can use this smart contract to build their internal payment infrastructure. Future plan: ---------------- We're working on an on-chain POS gateway(Started but unable to complete in 3-weeks) for allowing smart contracts to process multiple token payments. Currently most of them depend on the native token of the blockchain but we wish to enable smart contracts to accept any token payment not just the native token or wrapped native token for wider acceptance & ease of use. Approvals Manager: --------------------------- The current ERC20 protocol allows third parties to transfer tokens only if they approve them before the transaction, making things more difficult for onboarding new users to the platform as there would be two transactions. ERC20 approvals consume approximately 50,000 GAS for every smart contract to use the token inside them, which can avoid using a single approval manager for all the ERC20 tickets that could control all the payments. We should acknowledge that the ERC20 approvals are one of the biggest gas guzzlers, and it takes up 1/3 of the total transaction on the ethereum network. So by removing the approval mechanism in play, we could allow room for other transactions to be allowed on the network. Approval itself is not safe: ----------------------------------- The ERC-20 allowance mechanism is susceptible to the multiple withdrawal attack/SWC-114 and encourages antipatterns such as using the "infinite" allowance. The wide prevalence of upgradeable contracts has made the conditions favourable for these attacks to happen in the wild. We don't even know how much we've approved for which application. So we plan to streamline it through our application. Approve Once, Use it Everywhere: ---------------------------------------------- Our PoS (Proof Of Sale) smart contract is self-governed. Once the oracle & token contracts are set, it will automatically process payments using a payment pointer (added by the merchant to merchant oracle). Hence the settlement happens in real-time. The client application / smart contract doesn't need to worry about approving/handling approvals; they can process payment using TICKER & USD value. Does it make a single point of failure easier? ---------------------------------------------------------- The POS(Proof of Sale) smart contract has a locking mechanism that allows users to lock their accounts from transferring; they can set limits per transaction and other cool features that cannot be added using current ERC20 approvals. Our repositories ---------------------- 1. https://github.com/Variable-Finance/variable-v1-subgraph-pos - our subgraphs for Proof Of Sale 2. https://github.com/Variable-Finance/variable-v1-subgraph - our subgraphs for approvals manager. 3. https://github.com/Variable-Finance/variable-v1-core - smart contracts. 4. https://github.com/Variable-Finance/variable-dapp-client - Client Code (Redux & React) Our Subgraphs --------------------- https://thegraph.com/explorer/subgraph/variable-finance/variable-finance https://thegraph.com/explorer/subgraph/variable-finance/variable-pos-v1 Staging URL ----------------- https://variable.finance (Approvals manager on ETH mainnet & POS on ETH Kovan testnet) Approvals Manager - https://variable.finance/dashboard/approvals-manager (Mainnet Ethereum) Paying Merchant - https://variable.finance/merchants/pay (KOVAN testnet) Merchant Dashboard - https://variable.finance/merchants/dashboard (KOVAN testnet) All merchant routes will connect to Kovan Testnet & others will be on the mainnet. We will change this once we push our app live on the mainnet.

Variable Finance showcase

How it's made

This project uses basic web3 wallets to allow users to interact with the system like metamask, wallet connect & coinbase wallet. This app used three major cryptocurrencies as payment options for its users. They are COMP, UNI, wBTC & USDC. Real-time price feeds powered by "Chainlink" We used solidity alongside truffle for the smart contract development. Both Ethereum mainnet & Testnets are being used. The project also used the "The Graph" protocol for indexing & querying information. Real-time price feeds are fetched from chainlink oracles. The frontend interaction to a blockchain is built using ethers & the client app is built using React & Redux.

Technologies used

BitcoinBitGoChainlinkCircleCompoundEthereumHardhatInfuraIPFSMetaMaskSolidityThe GraphUniswap