Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
7 tasks
yangwao opened this issue Sep 15, 2021 · 21 comments
Open
7 tasks

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

yangwao opened this issue Sep 15, 2021 · 21 comments
Assignees
Labels

Comments

@yangwao
Copy link
Member

yangwao commented Sep 15, 2021

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

  • check if they are holders of a particular address they claim (hint, use signer or toolbox tools from dotapps)
  • check if they are holding an upfront defined amount of KSM (people with existential deposit aren't that valuable)
  • if they sold KSM, kick them out of room

M2

Check if an address is

  • holding a particular NFT from KodaDot, i.e. collection
  • owning % amount of collection
  • holding NFTs in a defined amount in KSM from a particular collection (this could be wash traded)
  • holding NFT from specific artists

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

@yangwao yangwao added the $$$ label Sep 15, 2021
@yangwao
Copy link
Member Author

yangwao commented Sep 15, 2021

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

@AndreyGrin
Copy link
Member

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

@yangwao
Copy link
Member Author

yangwao commented Sep 16, 2021

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
Copy link

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

@yangwao
Copy link
Member Author

yangwao commented Sep 16, 2021

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
Copy link

Ok, I will request API key from them

@AndriiHrynchuk
Copy link

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
Copy link

I got my API key, continue setting up.

@AndriiHrynchuk
Copy link

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
Copy link

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

@vikiival
Copy link
Member

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
Copy link

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

@AndriiHrynchuk
Copy link

We could ban until they have some money again

@AndriiHrynchuk
Copy link

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

@AndriiHrynchuk
Copy link

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

@AndriiHrynchuk
Copy link

@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
Copy link
Member Author

yangwao commented Sep 24, 2021

  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
Copy link
Member Author

yangwao commented Sep 24, 2021

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
Copy link
Member Author

yangwao commented Oct 11, 2021

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

  • Later could be added a notification that notifies creators when their KodaDot NFTs sell as a message.

@yangwao yangwao transferred this issue from kodadot/nft-gallery Feb 6, 2023
@AndreyGrin
Copy link
Member

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

@vikiival
Copy link
Member

vikiival commented Feb 6, 2023

I think yes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants