accountability

Stars
4

Accountability Smart Contract

This project builds a smart contract that allows users to commit to a goal by locking funds into the contract.

The user can request to withdraw their funds after the lock period has passed.

Using a combination of the Discord API and thirdweb's signature based minting, we check if the user has sent a message to a specific channel each day.

If they have, they are minted an NFT that allows them to withdraw their funds from the smart contract.

On the server-side, we combine thirdweb Auth and Next Auth to authenticate users and allow them to connect their Discord account and their web3 wallet.

Setup

First, deploy the smart contracts

cd contracts

yarn

yarn deploy

Then, you're ready to setup your application.

cd .. # go back to the root directory

cd application

yarn

You'll need to create a .env.local file with the following:

CLIENT_ID=xxx # Discord Client ID
CLIENT_SECRET=xxx # Discord API client secret
BOT_TOKEN=xxx # Discord bot token
PRIVATE_KEY=xxx # Wallet Private key

Follow the Discord Role Granter Guide to setup the Discord server, bot, and channel.

Update all of the variables in the constants file

Run the local dev server:

yarn dev