A decentralized expense settlement solution on Ethereum.
The founding premise of this project is to bring increased transparency, automation and trust to the process of settlement of expenses for employees and contractors from the PoV of an organization or corporate entity. This model can be extended to cover other use cases like settlement of vendor invoices, payouts for Advertisement networks etc. This demo is specifically built to showcase the very first use case sampled above. -> Employees or contractors get to file expenses against their organizations on MoneyVigil platform -> Organizations settle expenses with Crypto payments in a verifiable, transparent manner. -> Organizations earn interests on their crypto holdings through Compound Finance.
How it's made
This project has three major components powered by smart contracts: 1. an expensing engine smart contract 2. An ENS manager smart contract 3. An ACL manager smart contract that is also authorized to hold and release crypto funds (Dai for this hackathon project) The smart contracts are used in as stateless a manner as possible. Users, groups, organizations/corporate entities come into being on the chain when corresponding actions of filing, approving and disbursing of expenses takes place. The backend is built on Python services and extensively uses the EthVigil API gateway for Ethereum to read from, write to and consume the event stream from the smart contracts in real time. <-->The storage consists of three levels of caching and persistence: Redis, Neo4j Graph DB and MySQL (any other relational DB would do). --> Transient information such as pending contract deployments, cached debt information corresponding to an expense group, balances of Crypto holdings of organizations are stored on Redis. --> The debt graph is continually updated from event log streams corresponding to filing of expenses and we utilize the graph querying and reducing capabilities of Neo4j to generate correct settlements. Interestingly enough, involving multiple parties in an expense group leads to a classic NP-hard problem in computer science and is definitely an area of research for us going into the future. --> We built an elaborate role based access control system on a smart contract that is re-constructed on the backend in a relational database to maintain the hierarchies off-chain. The roles and their associated permissions on a corporate entity or expense group determine the actions that are allowed to take place on the web application itself. We have integrated Portis to ensure that every user in the organizational hierarchy is associated to their roles through a decentralized identity. --> Every organization/corporate entity on registration on the platform is assigned an ENS entry automatically for clearer identification and increased trust. They are also assigned a smart contract (mentioned in #3 in the very beginning) which intermediates the process of approval of expenses and release of accumulated reimbursements directly to the wallet of an end user. Approval and disbursal of funds are controlled by an EIP-712 state update that is tightly integrated with the Role Based Access Control maintained on the smart contract. --> The same ACL+fund manager contract acts as a vault to which organizations can transfer funds in Dai stablecoin. This contract prefers to keep its holdings in Compound Finance and accrue interests on them instead of letting them idle. --> It has some nifty features like automated computer vision processing of receipts, bills and checks to file expenses. These documents are being stored on the decentralized storage platform Sia securely (not using the public Skynet API).