Calamus Finance - Money Streaming on multichains
Supported platform: BNB Chain, Polygon, Avalanche, Optimism, Arbitrum, Fantom
Currently, many platforms support payments with fiat money, which could be used for investing, payroll, purchases, etc. Nevertheless, these platforms encounter several shortcomings, including:
Lack of automation: Most platforms do not allow periodic automation of payments. Instead, users must manually transfer the money, even for recurring payments.
Trust-related risk: Workers have to depend on their employers to keep their promises and always stand a risk of wage theft. Inversely, labour hirers might risk low-quality work, for example, if payment is made in advance.
Delay time: Workers have to wait for a specific date to receive/use the money, usually every month or after the contract ends.
Most platforms do not support payment with tokens.
Thus, to solve these issues, we have made use of blockchain and (the application of) tokens to create a multi-functional crypto streaming protocol.
At Calamus Finance, we aim to facilitate the process of constant payments transparently and securely.
The protocol is currently available on Fantom, BNB, Polygon, Avalanche, Optimism, and Arbitrum mainnets.
Calamus Finance is a decentralized crypto streaming protocol that allows people to send/receive payments on any time basis and vest tokens automatically. It can function well from small payments like subscriptions or allowances to bigger ones like company's payroll or startup vesting.
Calamus Finance supports all ERC-20 tokens.
Potential use cases: Company’s payroll, Token vesting, Subscription, Airdrop, etc.
Connect their wallet (i.e., MetaMask) with the app
Choose any available token on their wallet, as long as its balance exceeds 0.
Configure a payment frequency: per second, minute, hour, day, week, month or year. Most traditional companies would pay their employees by week or month.
Set start and end time of payments.
Configure advanced settings like cancellation or stream transferring.
Set total payment amount.
Fill in the recipient's address and extra information like email address, contract title, etc.
Cancel stream at any time if mutual consensus is not met.
Transfer the stream to a new recipient’s address.
Set an initial release amount at cliff date (for startup vesting).
Data from these features are validated at DApp and Smart Contract, hence minimizing human risk and improving security.
1: Recipient's unlocked amount: calculated from start time to the current time (block.timestamp)
2: Recipient's withdraw amount: the amount that recipient has withdrawn
3: Recipient's remain balance = unlocked amount (1) - withdraw amount (2)
4: Sender balance = total amount (5) - unlocked amount (3)
5: Total stream amount
When a stream is canceled, smart contracts ensure the unlocked amount (1) will be transferred to the recipient account, and the sender balance (4) will be transferred to the sender account.
When a stream is transferred to a new recipient address, smart contracts ensure the unlocked amount (1) will be transferred to the current recipient account, while the sender balance (4) will continue to be streamed to the new recipient.
All-in-one app for all features and all chains.
Every time users change their blockchain, the app will use Network adapters to be able to execute code that matches that chain.
Linked to each network adapter is a set of supporting JS libraries to connect to different wallets and call smart contracts.
The app uses a cloud database to store user data such as account and connection history. This database helps enhance the customer experience in managing their connected wallets and reduce the number of smart contract calls.
The app architecture is built to scale quickly and adopt more Blockchains without affecting any features running on existing Blockchains.
Smart Contracts usage map:
Our tech stack:
NodeJS, React, NextJS, Redux, Typescript…
Charka UI: a React UI component highly suitable for building admin apps.
ChartJS to build reports on the dashboard.
Moment JS to process stream time on the Frontend and contribute to data reporting.
Mongo Atlas DB to store Recipient’s extra information because storing unnecessary information on-chain will increase fee when creating streams and sometimes exceed the logic limit of a Solidity Smart Contract.
Covalenthq API to collect user’s token balance on the registered wallet address.
Binance public API to collect token to USD price information, thus providing an insightful display for users.
To deploy Smart Contracts on Mumbai Testnet, we use Truffle to deploy and debug Smart Contracts.
In addition, we also have business-related problems that are by no means less challenging:
The problem of rounding and handling residuals when creating a stream by the second, minute, hour, day, month and year.
The problem of transferring or canceling the stream midway, which interrupts the current stream data.
The problem of account security and validation in the process of manipulating streams.
##Accomplishments that we're proud of
Build a Money Streaming protocol on multiple chains (6 and counting).
Overcome technical challenges to accomplish goals.
Develop technical functions so that users on Fantom Network can pay, receive and vest tokens easily.
Gain a lot of in-depth knowledge about blockchain and finance.
TRON Grand Hackathon 2022: Web3 2nd place