A Serverless Discord bot for DAO treasury management. The funds are managed using Enzyme's infrastructure.
A tool to manage the Treasury of a DAO through Discord. The tool's capabilities are the following: - Attribute a specific Discord role to users who have invested in the DAO's fund. This verification is done using Ethereum Authentication through Discord which I've built for a previous hackathon, but here with the added twist that the users only get authenticated if their address owns shares from the Enzyme vault in which the DAO's Treasury is stored. - Once a user is assigned the investor role, they become able to call slash commands which give them information about the current state of the Treasury, such as the shares balances of all the other authenticated users. - Upon authentication, if the address corresponds to that of the owner of the vault (the Treasury manager), the user also gets assigned the manager role on Discord, which enables them to call slash commands to start polls to decide what the DAO's Treasury funds should be allocated to. Only the authenticated investors can vote on these polls and the more shares an investor owns, the more weight their vote has. - Upon poll expiration, case the result of the poll was to go through with a certain trade, the execution of the trade through the Enzyme vault is triggered.
How it's made
The infrastructure is pretty much all based on AWS Lambda, and so is fully serverless. I took this project I had built for a previous Gitcoin hackathon as the starting point: https://github.com/EsteFilipe/discord-ethereum-authentication. It's a bot that gives a Discord user a specific role after they successfully authenticate their Ethereum address. The authentication is done through a nonce sent by the backend to the user, which then the user signs using his address key, and finally the backend verifies if the signature is valid for that nonce. On top of that, for the authentication here I added fetching data from Enzyme to verify that the authenticated address owns shares from the target Enzyme Finance's vault, and whether the address is, or not, the owner of the vault. Some more technologies I've used: - For the creation of the Discord slash commands I used slash-create. - For the authentication front-end I used scaffold-eth. - The DB to store the authenticated users' data is DynamoDB. - All the calculations and data fetching is done using AWS Lambda (with node.js), and the infrastructure templates were built using AWS SAM. - Scheduling of the poll resolution was done using AWS EventBridge.