crypto-bug-hunters / bug-buster

🪲 Bug Buster, a bug bounty platform powered by Cartesi Rollups
https://x.com/BugBusterApp
Apache License 2.0
10 stars 10 forks source link

Support ERC-20 tokens #85

Closed guidanoli closed 3 months ago

guidanoli commented 5 months ago

We could either:

The difficulty part there is encoding value in the application state. We could add an optional token field to the AppBounty struct. If not provided, it's assumed the bounty only accepts sponsorships in ETH. Otherwise, it only accepts sponsorships in the provided ERC-20 token. The type of currency would be determined by whoever creates the bounty.

In the back-end, we'd have to:

In the web front-end, we'd have to tweak:

It would also be good to test these new cases in Lua.

guidanoli commented 5 months ago

For optional fields, we can use the omitempty JSON option. Source: https://pkg.go.dev/encoding/json

guidanoli commented 5 months ago

I'll go with the easiest route, which is to accept only ERC-20 tokens, and not support native ETH anymore. ETH can be wrapped in ERC-20 tokens and 1-to-1 equivalence can be enforced by contract logic.