Background worker and user-facing bot for the Open Dollar protocol
Open Bot is live in our Discord. See recent transactions at https://bot.dev.opendollar.com
Open Bot is divided into two parts:
od-bot
repo - Accepts http requests, sends transactions, and posts updates in Discordod-bot-slash-commands
repo - Accepts Discord Slash Commands and forward them to od-bot
Not all features can be exposed publicly, therefore a secret is required to call the bot endpoints.
NOTE: The rest of this readme is for bot developers and contributors.
Start the app:
yarn dev
Hit the endpoint /api/rate?secret=<some-secret>
to trigger the bot to call updateRate
.
Available options:
The bot is not using the "Jobs" contracts to perform these actions, and therefore does not collect any protocol rewards.
/rate
: Calls updateRate
on the rateSetter
contract/oracle
: Calls updateCollateralPrice
and updateResult
for each collateral type using the oracleRelayer
contract/accounting
: Calls popDebtFromQueue
, auctionDebt
, auctionSurplus
, and transferExtraSurplus
on the accountingEngine
contract/analytics
: Posts global analytics/auction
: Posts the number of surplus, debt, and collateral auctions/user
: Posts details about the user's OD vaults/vaults
: Posts details about OD vaults for all users/uservaults
: Posts specific details about the user's vaults (id, collateralType, collateral, debt, genesis)/claim
: Airdrops collateral tokens to the user (testnet only)/price
: Changes the price of collateral (testnet only)/liquidate
: Calls liquidateSAFE(vaultID)
on the liquidationEngine
contractUpdate the .env
DATABASE_URL=postgres://me:password@0.0.0.0:5432/od-bots-testing
Run migrations
npx prisma migrate dev
Useful logs are posted in Discord. While this isn't required, it can be very useful for troubleshooting.
manager/lib/discord/alert.js
. This is where logs will be posted..env
file. The ENVIRONMENT
option selects which set of channels to notify.ENVIRONMENT=dev
ENABLE_DISCORD_BOTS=true
DISCORD_BOT_TOKEN=your-token
`https://discord.com/api/oauth2/authorize?client_id=
Migrate your hosted database
npx prisma deploy
Update the cron job secret in vercel.json
(everyone can see your secret on Github- recommend using a private/separaten repo for cron jobs)
{
"buildCommand": "yarn prisma generate && yarn prisma migrate deploy && next build",
"crons": [
{
"path": "/api/rate?secret=<your-secret-here>",
"schedule": "0 */1 * * *"
}
//...
]
}
Improve onboarding and payments in your games & web3 apps effortlessly with OAuth logins for wallets and debit card transactions. Create a Keyp account; it's free!
Copyright © 2023 Nifty Chess, Inc.
This project is MIT licensed.