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

feat: ref should be an array #26

Open
bonustrack opened this issue Feb 18, 2023 · 6 comments
Open

feat: ref should be an array #26

bonustrack opened this issue Feb 18, 2023 · 6 comments

Comments

@bonustrack
Copy link
Member

We should change ref to be an array, currently if we want define within a Boost strategy multiple requirement like doing a vote on Snapshot and do a retweet, we wouldn't be able to mark both the address and the Twitter username as id that have already claimed.

@Orland0x
Copy link
Contributor

Orland0x commented Feb 21, 2023

could we instead create a combined single ref by hashing the individual ones?

like:

ref = keccak256(abi.encode(voteID, tweetID));

@bonustrack
Copy link
Member Author

No because we need to check each of the ref, not all at once. Otherwise if someone have multiple tweetId but a single voteId, he will be able to claim multiple time.

@Orland0x
Copy link
Contributor

okay, well we will need to redesign some part as you cannot use an array as a key for a mapping, so we will not be able to store who has claimed so far here

ill have a think

@bonustrack
Copy link
Member Author

@Orland0x Can't you just store each of the ref in the same variable claimed? And when someone claim you check all the refs against claimed?

@Orland0x
Copy link
Contributor

@Orland0x Can't you just store each of the ref in the same variable claimed? And when someone claim you check all the refs against claimed?

yeah we could do that, it adds 20k gas for each ref used though.

No because we need to check each of the ref, not all at once. Otherwise if someone have multiple tweetId but a single voteId, he will be able to claim multiple time.

The guard has to sign each claim so why cant they just check that refs have not been reused?

@bonustrack
Copy link
Member Author

The guard has to sign each claim so why cant they just check that refs have not been reused?

I'll need to think about it. If it's not enforced at the contract level the guard would need to assume everytime it issue a coupon that it can be claimed, but we may have user who request a coupon and not claim it directly then ask a coupon again. On solution could be to store the issued coupons so we can send it again

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

No branches or pull requests

2 participants