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 tood-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
: CallsupdateRate
on therateSetter
contract/oracle
: CallsupdateCollateralPrice
andupdateResult
for each collateral type using theoracleRelayer
contract/accounting
: CallspopDebtFromQueue
,auctionDebt
,auctionSurplus
, andtransferExtraSurplus
on theaccountingEngine
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
: CallsliquidateSAFE(vaultID)
on theliquidationEngine
contract
Update the .env
DATABASE_URL=postgres://me:[email protected]: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.
- Update the Discord channel IDs in
manager/lib/discord/alert.js
. This is where logs will be posted. - Add the following to the
.env
file. TheENVIRONMENT
option selects which set of channels to notify.
ENVIRONMENT=dev
ENABLE_DISCORD_BOTS=true
DISCORD_BOT_TOKEN=your-token
- Add the bot to your server using the url:
`https://discord.com/api/oauth2/authorize?client_id=&permissions=0&scope=bot%20applications.commands``
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.