ton-society / grants-and-bounties

TON Foundation invites talent to imagine and realize projects that have the potential to integrate with the daily lives of users.
https://ton.org/grants
314 stars 138 forks source link

Massive sender bot & contract #165

Closed PolyProgrammist closed 1 year ago

PolyProgrammist commented 1 year ago

Summary

Bot that sends toncoins to several addresses using smart contract

Context

The bot and smart contract is needed to simplify massive sending. Usages are:

Goals

The bot should accept json file that contains a dictionary from address to number of toncoins to send to this address

JSON example

{
    "EQDk0rRqwtKw34r0fecUO6YotwKfMPU9XIxwrfjOfX9BIUx_": "52",
    "EQBnk2PqeZZjIya2zvPlH2pnSQYYPjNReMntiOyWYt9au_fc": "34",
    "EQCafuKP6EVcOo_ZifdIBfE1EwM1QPFj_-ryaT0IY6CNRVtV": "100"
}

CSV example:

"EQDk0rRqwtKw34r0fecUO6YotwKfMPU9XIxwrfjOfX9BIUx_",52
"EQBnk2PqeZZjIya2zvPlH2pnSQYYPjNReMntiOyWYt9au_fc",34
"EQCafuKP6EVcOo_ZifdIBfE1EwM1QPFj_-ryaT0IY6CNRVtV",100

TG message example:

EQDk0rRqwtKw34r0fecUO6YotwKfMPU9XIxwrfjOfX9BIUx_: 52
EQBnk2PqeZZjIya2zvPlH2pnSQYYPjNReMntiOyWYt9au_fc: 34
EQCafuKP6EVcOo_ZifdIBfE1EwM1QPFj_-ryaT0IY6CNRVtV: 100

User needs to connect to the bot via ton connect 2.0 with tonkeeper. Then they need to provide the file with description of addresses and number of tons to send for each address. After that they should approve transaction to send toncoins from their wallet to smart contract. Smart contract will send the coins to addresses from file.

Other details:

Smart contract language: Func Tests will be on: blueprint & sandbox

Deliverables

Definition of Done

Reward

Gusarich commented 1 year ago

Isn't it just a highload wallet with telegram bot linking?

Naltox commented 1 year ago

Isn't it just a highload wallet with telegram bot linking?

Not quite, main goal is to create bullet-proof solution. In case of using highload wallet bot backend should track each message to highload wallet and check if transaction is complete. It's quite a problem if server goes down or there is a bug in backed code.

@PolyProgrammist suggest's solution that will take only one transaction from user wallet that will initiate recursive process of sending coins which will not depend on any backend or offchain infrastructure.

@PolyProgrammist btw: i think coin's amount in JSON should be string since we can face some problems with float's in JS.

Smart contract should be deployed with addresses in data cell. Initial cell should contain three addresses along with a link to next cell

I guess you should just have Address -> coins map in contract data, you just delete ones that are send per each transaction

Gusarich commented 1 year ago

Why do we even need external messages for this contract? Deployment will be done through ton connect 2.0 via internal message. And then contract will start the payment process immediately with the data from stateinit.

Gusarich commented 1 year ago

In general this footstep looks useful. Are you sure about using Tact language for this contract?

Naltox commented 1 year ago

Why do we even need external messages for this contract? Deployment will be done through ton connect 2.0 via internal message. And then contract will start the payment process immediately with the data from stateinit.

we dont

Naltox commented 1 year ago

In general this footstep looks useful. Are you sure about using Tact language for this contract?

Yeah, this will be one of first production ready product's done using Tact

Gusarich commented 1 year ago

@PolyProgrammist Were you going to take up this footstep, or did you just come up with an idea?

PolyProgrammist commented 1 year ago

@PolyProgrammist Were you going to take up this footstep, or did you just come up with an idea?

I can do it most likely. Discussing it with @Naltox Naltox

PolyProgrammist commented 1 year ago

@Naltox @Gusarich could you please approve or comment? Ready to do this

PolyProgrammist commented 1 year ago

@PolyProgrammist Were you going to take up this footstep, or did you just come up with an idea?

Smart contract language changed to func. What do you think?

Naltox commented 1 year ago

Update: after some discussion with @PolyProgrammist we came up that it would be better to write this contract on FunC, since gas usage is important and Tact has some overhead

Gusarich commented 1 year ago

@PolyProgrammist told us that he won't complete this Footstep.

Gusarich commented 1 year ago

I'd like to complete this Footstep.

PolyProgrammist commented 1 year ago

Hi guys! Sorry, I can't take this footstep. Please feel free to take it

Gusarich commented 1 year ago

Completed the smart contract & script & tests in repository:

I'll implement the Telegram bot soon.

Gusarich commented 1 year ago

I've also edited the description of this Footstep a little bit.

Gusarich commented 1 year ago

Telegram bot is done.

Gusarich commented 1 year ago

@Naltox can you please review it?

Gusarich commented 1 year ago

There were many adjustments, improvements and fixes to the bot and the contract. It's currently on the final stage of the review. 👀

Naltox commented 1 year ago

LGTM!

delovoyhomie commented 1 year ago

Thank you for the contribution!

A reform of the TON Footsteps collection mint is currently underway, which may result in increased SBT receipt times. Please accept our apologies.

However, the cash equivalent reward has already been received by the performer.

delovoyhomie commented 1 year ago

TON Footstep SBT was minted!

delovoyhomie commented 1 year ago

Feel free to utilize the @ton_mass_payments_bot.

mbaneshi commented 1 year ago

Thank you all. 💯

delovoyhomie commented 10 months ago

@Gusarich, I've encountered an issue where I can't re-link my wallet. Let's add the option to connect a new wallet.