kodadot / grants

Grants program for KodaDot ecosystem
MIT License
5 stars 0 forks source link

Discord bot which check your $KSM balance and NFTs #15

Open yangwao opened 2 years ago

yangwao commented 2 years ago

Right now we are a bit fighting with spam.

To have quality people in the room, we would like to check if they are holding n amount of KSM (native asset for other parachains) to prove they are believers.

Probably use some serverless implementation, by your choice, probably use basic discord bot example from stdlib - we've got great vibes with them https://autocode.com/app/discord/basic-discord-example/ there are probably more interesting cases https://autocode.com/app/

Tasks are

M1

M2

Check if an address is

Hint you can use our KodaDot SubQuery for M2 - https://github.com/vikiival/magick

yangwao commented 2 years ago

I was thinking @AndreyGrin might be interested in this kind of hacking? 👀

AndreyGrin commented 2 years ago

Hey, this looks interesting. I can work on it.

yangwao commented 2 years ago

Can provide a list of testing addresses, i.e. one with balance and with some NFTs on https://kusama.subscan.io/account/CuHWHNcBt3ASMVSJmcJyiBWGxxiWLyjYoYbGjfhL4ovoeSd We can get some artists from spotlight to help test as well https://nft.kodadot.xyz/spotlight which are on our Discord :)

AndriiHrynchuk commented 2 years ago

I will start with M1. I guess you already have API key for subscan or should I make a new one?

yangwao commented 2 years ago

Originally thought using polkadotjs, but using Subscan might cut times to verify you I guess (i.e. connecting to chain takes ages) Let's try to go with Subscan :)

AndriiHrynchuk commented 2 years ago

Ok, I will request API key from them

AndriiHrynchuk commented 2 years ago

Their free API key has limit of 5 request/second. I guess that's fine for now. I will check what's Polkadot offers as well

AndriiHrynchuk commented 2 years ago

I got my API key, continue setting up.

AndriiHrynchuk commented 2 years ago

Bot now can reads user's wallet balance. Found a few issues:

  1. Discords API doesn't allow to save custom info into user's profile. That means we need to save it to external DB.
  2. We won't be able to kick user immediately if they sell their's KSM. I can setup scheduler that will check balance every X minutes/hours. What do you think @yangwao ?
AndriiHrynchuk commented 2 years ago

For DB we can use free tier on Heroku or Firebase if you don't have any existing one.

vikiival commented 2 years ago

For DB we can use free tier on Heroku or Firebase

If there are no catches on free tier I would use it.

I can setup scheduler that will check balance every X minutes/hours.

20-30 min interval should be fine imho

AndriiHrynchuk commented 2 years ago

What should we do when someone sold his KSM? Ban or kick off?

AndriiHrynchuk commented 2 years ago

We could ban until they have some money again

AndriiHrynchuk commented 2 years ago

Interesting that Subscan shows some balance for my account Gai2tc3mZ9u4bLdoXVTfaXjGLerijuXBZawZKTakuVdJuBh but actually I have 0 KSM there.

AndriiHrynchuk commented 2 years ago

What min amount of KSM customers should hold on the wallet?

AndriiHrynchuk commented 2 years ago

@vikiival @yangwao I'm almost done with M1, need your answers. Another question: what to do with existing users? I wouldn't ban or kick them out, but can annoy one a week until they add their wallet ID, how that sounds to you?

yangwao commented 2 years ago
  1. Discords API doesn't allow to save custom info into user's profile. That means we need to save it to external DB.

If possible, want to make it storage less. Just fetch your balance and then give you attributes, i.e. let you inside

  1. We won't be able to kick user immediately if they sell their's KSM. I can setup scheduler that will check balance every X minutes/hours.

I guess one way would be listening for events but that would be costly, other way around would be yes, having sort of schedule to check every once per hour/day (to save some costs when userbase might grow)

yangwao commented 2 years ago

What should we do when someone sold his KSM? Ban or kick off?

Kick off-channel, that's purpose, ban would be way too strict :)

What min amount of KSM customers should hold on the wallet?

I guess starting with 10KSM would be for now default? Oh wait, I would also account if that KSM is staked, that brings bit complication into game I guess 😄

Another question: what to do with existing users?

What is scenario?

I wouldn't ban or kick them out, but can annoy one a week until they add their wallet ID, how that sounds to you?

I would not spam users bc they might can report your bot without no reason:)

yangwao commented 2 years ago

We've chatted with @AndreyGrin that later would be nice to change firebase to something decentralized/distributed, maybe Textile/ThreadDb would be nice to check, maybe https://orbitdb.org/ but seems the recent release wasn't quite along.

M3

AndreyGrin commented 1 year ago

hey, is it still valid? I think, last time I've worked on this, M1 points already completed in that MVP

vikiival commented 1 year ago

I think yes