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

Mint card for Ubiquity Dollars #267

Closed
rndquu opened this issue Jul 24, 2024 · 26 comments · Fixed by #313
Closed

Mint card for Ubiquity Dollars #267

rndquu opened this issue Jul 24, 2024 · 26 comments · Fixed by #313

Comments

@rndquu
Copy link
Member

rndquu commented Jul 24, 2024

This PR introduced a feature of card minting.

How it works:

  1. Contributor opens pay.ubq.fi to redeem our "standard" permit reward
  2. Contributor sends permit reward to the treasury address
  3. Contributor sends transaction hash to the pay.ubq.fi backend
  4. A new reloadly gift card is minted to the contributor

Any user with Ubiquity Dollars should be able to mint a gift card (not only the ones with ready to use permits).

What should be done:

  • create a new page (for example pay.ubq.fi/cards) where users will be able to send Ubiquity Dollars to the treasury address and get reloadly gift cards in return

Notice:

  1. Gift cards feature is located in a separate branch so it makes sense to open a PR towards that branch
  2. Try to minimize backend code changes in order not to complicate it further
@pbkompasz
Copy link
Contributor

/start

Copy link

ubiquibot-dev bot commented Aug 1, 2024

DeadlineThu, Aug 8, 4:03 PM UTC
Registered Wallet 0x26BfbD8ED2B302ec2c2B6f063C4caF7abcB062e0
Tips:
  • Use /wallet 0x0000...0000 if you want to update your registered payment wallet address.
  • Be sure to open a draft pull request as soon as possible to communicate updates on your progress.
  • Be sure to provide timely updates to us when requested, or you will be automatically unassigned from the task.

1 similar comment
Copy link

DeadlineThu, Aug 8, 4:03 PM UTC
Registered Wallet 0x26BfbD8ED2B302ec2c2B6f063C4caF7abcB062e0
Tips:
  • Use /wallet 0x0000...0000 if you want to update your registered payment wallet address.
  • Be sure to open a draft pull request as soon as possible to communicate updates on your progress.
  • Be sure to provide timely updates to us when requested, or you will be automatically unassigned from the task.

Copy link

ubiquibot bot commented Aug 1, 2024

DeadlineThu, Aug 8, 4:03 PM UTC
Registered Wallet 0x26BfbD8ED2B302ec2c2B6f063C4caF7abcB062e0
Tips:
  • Use /wallet 0x0000...0000 if you want to update your registered payment wallet address.
  • Be sure to open a draft pull request as soon as possible to communicate updates on your progress.
  • Be sure to provide timely updates to us when requested, or you will be automatically unassigned from the task.

@pbkompasz
Copy link
Contributor

@rndquu I have an MVP that is ready (~80%) and works locally on fixed and custom priced gift cards.
In this MVP the "standard" permit is built by a script and is passed as a query parameter to the frontend. In production how will this happen? Will a permit be generated on the spot for each page visit in permit-generation that can be fetched from the Supabase database?

@0x4007
Copy link
Member

0x4007 commented Aug 15, 2024

@rndquu I have an MVP that is ready (~80%) and works locally on fixed and custom priced gift cards. In this MVP the "standard" permit is built by a script and is passed as a query parameter to the frontend. In production how will this happen? Will a permit be generated on the spot for each page visit in permit-generation that can be fetched from the Supabase database?

@EresDev rfc

@EresDev
Copy link
Contributor

EresDev commented Aug 15, 2024

@rndquu I have an MVP that is ready (~80%) and works locally on fixed and custom priced gift cards.
In this MVP the "standard" permit is built by a script and is passed as a query parameter to the frontend. In production how will this happen? Will a permit be generated on the spot for each page visit in permit-generation that can be fetched from the Supabase database?

There are tools included with this repository to generate a permit for testing. yarn start from beta branch generates a permit but it needs some setup. In production, we don't care about how permit is generated. For us, user visits the page with permit in query parameter https://pay.ubq.fi/?claim=[permit base64 encoded]. We can just use it here or if needed it can be passed to /cards page as query parameter.

But just for info, permit is generated by ubiquibot in its permit-generation plugin on a specific github event, which is when an issue is closed on a successful merge of a PR that solves that issue.

@rndquu
Copy link
Member Author

rndquu commented Aug 19, 2024

@pbkompasz

Will a permit be generated on the spot for each page visit in permit-generation that can be fetched from the Supabase database?

How permit generation works:

  1. Github issue is closed
  2. The bot generates a permit (example). Permit is simply a json data with signature. The bot owns an ethereum wallet from which the bot signs uniswap permits which can be redeemed by contributors at pay.ubq.fi.

As EresDev already stated simply run yarn start and you'll get an example ERC20 permit URL ready to use at pay.ubq.fi with the local anvil instance.

In this MVP the "standard" permit is built by a script and is passed as a query parameter to the frontend. In production how will this happen?

In the context of the "Mint card for Ubiquity Dollars" feature you don't need permits at all unless I'm missing smth. In the pay.ubq.fi/cards page user pastes in some text input how much of available Ubiquity Dollars he want to exchange for a gift card and all of it is then handled on the backend. Our standard permits don't seem to be used anywhere here.

Copy link
Contributor

ubiquity-os bot commented Sep 14, 2024

@whilefoo the deadline is at Sat, Sep 21, 4:18 PM UTC

@whilefoo
Copy link
Contributor

@rndquu do ubiquity dollars need to be sent to the treasury wallet?

@0x4007
Copy link
Member

0x4007 commented Sep 14, 2024

@EresDev requested I make a brand new wallet for it- something about a clean transaction history.

I would guess that a smart contract would be considered more professional but I think for now there are no functional differences.

Unfortunately I can't find the wallet I made for it yet. I suppose we can always make a new one.

@EresDev
Copy link
Contributor

EresDev commented Sep 14, 2024

@rndquu do ubiquity dollars need to be sent to the treasury wallet?

There is a treasury wallet used only to receive payments for minting card. It is not used for any other purpose.

Unfortunately I can't find the wallet I made for it yet. I suppose we can always make a new one.

The one you gave me as the treasury wallet for cards was
https://github.com/ubiquity/pay.ubq.fi/blob/bb5ec42adb3b9947cd49c8f815d528d12b431a4e/shared/constants.ts#L7C41-L7C83

@whilefoo
Copy link
Contributor

Where do I get reloadly sandbox api keys?

@rndquu
Copy link
Member Author

rndquu commented Sep 16, 2024

Where do I get reloadly sandbox api keys?

DMed you in telegram

Copy link
Contributor

ubiquity-os bot commented Sep 18, 2024

@whilefoo, this task has been idle for a while. Please provide an update.

@whilefoo
Copy link
Contributor

The plan is:

  • User enters the amount in Ubiquity dollars in the input field
  • User clicks 'Check gift card'
  • The best available card is presented and user can click 'Mint card'
  • The frontend initiates a ERC20 transfer to a special address owned by Ubiquity (or it can be a smart contract later)
  • User accepts the transaction and the tx hash is written to the local storage
  • User signs a message with the tx hash confirming it is the owner of the wallet
  • Frontend sends the tx hash and signed message to the backend
  • Backend orders a card and transaction id of the order is added to the tx hash in the local storage
  • The frontend keeps checking if the card is ready to redeem
  • When the card is ready to redeem, the user must sign a message again to claim the card
  • Backend checks the signed message and returns the redeem code

All the steps write in the local storage because the user can refresh the page or something goes wrong in the process. At the bottom of the page the history will be displayed with all cards ordered or claimed

@0x4007
Copy link
Member

0x4007 commented Sep 20, 2024

At the bottom of the page the history will be displayed with all cards ordered or claimed

Need to reduce clutter in UI. Should focus on instantly removing the cards from UI once they are imported to Apple Pay etc

@whilefoo
Copy link
Contributor

Need to reduce clutter in UI. Should focus on instantly removing the cards from UI once they are imported to Apple Pay etc

We can remove the cards from the history if the redeem code was revealed but that doesn't guarantee that they already imported it to Apple Pay

@0x4007
Copy link
Member

0x4007 commented Sep 20, 2024

That AND a seven day timeout should guarantee no problems

Copy link
Contributor

ubiquity-os bot commented Sep 21, 2024

@whilefoo, this task has been idle for a while. Please provide an update.

@whilefoo
Copy link
Contributor

whilefoo commented Oct 7, 2024

Ah it looks like I was unassigned. Maybe we could add a feature if the issue has a linked PR that has been merged, it should assign the user to the issue and close it?

What's also interesting that even though I specified Resolves # it didn't mark it as a linked PR
image

Copy link
Contributor

ubiquity-os bot commented Oct 8, 2024

@whilefoo the deadline is at Tue, Oct 15, 7:56 AM UTC

@0x4007
Copy link
Member

0x4007 commented Oct 8, 2024

Ah it looks like I was unassigned. Maybe we could a feature if the issue has a linked PR that has been merged, it should assign the user to the issue and close it?

That probably makes sense!

What's also interesting that even though I specified Resolves # it didn't mark it as a linked PR

I'm not sure why but I have seen this rarely.

@rndquu
Copy link
Member Author

rndquu commented Oct 9, 2024

What's also interesting that even though I specified Resolves # it didn't mark it as a linked PR

I suppose that's because #313 targets a none default branch of the https://github.com/ubiquity/pay.ubq.fi repo

@rndquu
Copy link
Member Author

rndquu commented Oct 9, 2024

This issue should be closed as completed in #313, correct?

Copy link
Contributor

ubiquity-os bot commented Oct 26, 2024

 [ 1200 UUSD ] 

@whilefoo
Contributions Overview
ViewContributionCountReward
IssueTask11200
IssueComment50
ReviewComment130
Conversation Incentives
CommentFormattingRelevanceReward
@rndquu do ubiquity dollars need to be sent to the treasury wall…
0
content:
  content:
    p:
      score: 0
      elementCount: 1
  result: 0
regex:
  wordCount: 12
  wordValue: 0
  result: 0
0.80
Where do I get reloadly sandbox api keys?
0
content:
  content:
    p:
      score: 0
      elementCount: 1
  result: 0
regex:
  wordCount: 8
  wordValue: 0
  result: 0
0.70
The plan is:- User enters the amount in Ubiquity dollars in th…
6.5
content:
  content:
    p:
      score: 0
      elementCount: 13
    ul:
      score: 1
      elementCount: 1
    li:
      score: 0.5
      elementCount: 11
  result: 6.5
regex:
  wordCount: 191
  wordValue: 0
  result: 0
10
We can remove the cards from the history if the redeem code was …
0
content:
  content:
    p:
      score: 0
      elementCount: 1
  result: 0
regex:
  wordCount: 27
  wordValue: 0
  result: 0
0.60
Ah it looks like I was unassigned. Maybe we could add a feature …
5
content:
  content:
    p:
      score: 0
      elementCount: 3
    img:
      score: 5
      elementCount: 1
  result: 5
regex:
  wordCount: 53
  wordValue: 0
  result: 0
0.40
Resolves #267 ![image](https://github.com/user-attachments/ass…
15
content:
  content:
    p:
      score: 0
      elementCount: 4
    img:
      score: 5
      elementCount: 3
  result: 15
regex:
  wordCount: 2
  wordValue: 0
  result: 0
0.20
`txParsed.args.signature` is the signature of the permit…
0
content:
  content:
    p:
      score: 0
      elementCount: 2
  result: 0
regex:
  wordCount: 34
  wordValue: 0
  result: 0
0.80
I wasn't sure how to name it, since the main page also has card …
0
content:
  content:
    p:
      score: 0
      elementCount: 1
  result: 0
regex:
  wordCount: 16
  wordValue: 0
  result: 0
0.30
It's a separate page
0
content:
  content:
    p:
      score: 0
      elementCount: 1
  result: 0
regex:
  wordCount: 5
  wordValue: 0
  result: 0
0.30
it's set by the frontend
0
content:
  content:
    p:
      score: 0
      elementCount: 1
  result: 0
regex:
  wordCount: 6
  wordValue: 0
  result: 0
0.50
it's just returning response, not mocking
0
content:
  content:
    p:
      score: 0
      elementCount: 1
  result: 0
regex:
  wordCount: 7
  wordValue: 0
  result: 0
0.40
it is traveling over the network. The `functions` folder…
0
content:
  content:
    p:
      score: 0
      elementCount: 1
  result: 0
regex:
  wordCount: 22
  wordValue: 0
  result: 0
0.50
that's interesting because when I tried to access it by property…
0
content:
  content:
    p:
      score: 0
      elementCount: 1
  result: 0
regex:
  wordCount: 16
  wordValue: 0
  result: 0
0.60
We can add all but it doesn't make sense to do it because we onl…
0
content:
  content:
    p:
      score: 0
      elementCount: 1
  result: 0
regex:
  wordCount: 20
  wordValue: 0
  result: 0
0.40
Yes we can generate permits on any network that has permit2 cont…
0
content:
  content:
    p:
      score: 0
      elementCount: 1
  result: 0
regex:
  wordCount: 13
  wordValue: 0
  result: 0
0.70
I only found this in their blog: Permit2 is deployed to the [s…
5
content:
  content:
    p:
      score: 0
      elementCount: 3
    a:
      score: 5
      elementCount: 1
  result: 5
regex:
  wordCount: 33
  wordValue: 0
  result: 0
0.50
Are we fine with merging this?
0
content:
  content:
    p:
      score: 0
      elementCount: 1
  result: 0
regex:
  wordCount: 6
  wordValue: 0
  result: 0
0.10
Actually I'm not sure why it's marked as unused dependency becau…
0
content:
  content:
    p:
      score: 0
      elementCount: 1
  result: 0
regex:
  wordCount: 16
  wordValue: 0
  result: 0
0.40

 [ 2.03275 UUSD ] 

@pbkompasz
Contributions Overview
ViewContributionCountReward
IssueComment12.03275
Conversation Incentives
CommentFormattingRelevanceReward
@rndquu I have an MVP that is ready (~80%) and works locally on …
8.66
content:
  content:
    p:
      score: 0
      elementCount: 2
    a:
      score: 5
      elementCount: 1
  result: 5
regex:
  wordCount: 69
  wordValue: 0.1
  result: 3.66
0.852.03275

 [ 11.23 UUSD ] 

@0x4007
Contributions Overview
ViewContributionCountReward
IssueComment54.495
ReviewComment146.735
Conversation Incentives
CommentFormattingRelevanceReward
@EresDev rfc
0.18
content:
  content:
    p:
      score: 0
      elementCount: 1
  result: 0
regex:
  wordCount: 2
  wordValue: 0.1
  result: 0.18
0.650.117
@EresDev requested I make a brand new wallet for it- something a…
3.2
content:
  content:
    p:
      score: 0
      elementCount: 1
    br:
      score: 0
      elementCount: 1
  result: 0
regex:
  wordCount: 59
  wordValue: 0.1
  result: 3.2
0.752.4
Need to reduce clutter in UI. Should focus on instantly removing…
1.44
content:
  content:
    p:
      score: 0
      elementCount: 1
  result: 0
regex:
  wordCount: 23
  wordValue: 0.1
  result: 1.44
0.81.152
That AND a seven day timeout should guarantee no problems
0.71
content:
  content:
    p:
      score: 0
      elementCount: 1
  result: 0
regex:
  wordCount: 10
  wordValue: 0.1
  result: 0.71
0.60.426
That probably makes sense!I'm not sure why but I have seen thi…
1
content:
  content:
    p:
      score: 0
      elementCount: 2
  result: 0
regex:
  wordCount: 15
  wordValue: 0.1
  result: 1
0.40.4
We bridged it to gnosis chain but it has a different address ht…
1.11
content:
  content:
    p:
      score: 0
      elementCount: 1
  result: 0
regex:
  wordCount: 17
  wordValue: 0.1
  result: 1.11
0.70.777
There's I think 12 networks permit2 is deployed on. Might want t…
1.17
content:
  content:
    p:
      score: 0
      elementCount: 1
  result: 0
regex:
  wordCount: 18
  wordValue: 0.1
  result: 1.17
0.60.702
What exactly is type derived from?
0.46
content:
  content:
    p:
      score: 0
      elementCount: 1
  result: 0
regex:
  wordCount: 6
  wordValue: 0.1
  result: 0.46
0.50.23
It seems like you're mocking network responses here locally?
0.71
content:
  content:
    p:
      score: 0
      elementCount: 1
  result: 0
regex:
  wordCount: 10
  wordValue: 0.1
  result: 0.71
0.80.568
Can be a problem if we are bridging to other chains as we did
0.94
content:
  content:
    p:
      score: 0
      elementCount: 1
  result: 0
regex:
  wordCount: 14
  wordValue: 0.1
  result: 0.94
0.40.376
Why did you sort under ubiquity dollar directory?
0.59
content:
  content:
    p:
      score: 0
      elementCount: 1
  result: 0
regex:
  wordCount: 8
  wordValue: 0.1
  result: 0.59
0.30.177
Shouldn't this be named something like card minting instead of u…
0.88
content:
  content:
    p:
      score: 0
      elementCount: 1
  result: 0
regex:
  wordCount: 13
  wordValue: 0.1
  result: 0.88
0.40.352
My point is I'm confused why you're setting an HTTP status code …
1.75
content:
  content:
    p:
      score: 0
      elementCount: 1
  result: 0
regex:
  wordCount: 29
  wordValue: 0.1
  result: 1.75
0.50.875
I guess if it's a big project we can handle in another pull but …
1.75
content:
  content:
    p:
      score: 0
      elementCount: 1
  result: 0
regex:
  wordCount: 29
  wordValue: 0.1
  result: 1.75
0.61.05
We should at least support optimism (10) as well then.
0.71
content:
  content:
    p:
      score: 0
      elementCount: 1
  result: 0
regex:
  wordCount: 10
  wordValue: 0.1
  result: 0.71
0.70.497
Why not throw an error?
0.39
content:
  content:
    p:
      score: 0
      elementCount: 1
  result: 0
regex:
  wordCount: 5
  wordValue: 0.1
  result: 0.39
0.60.234
I will need to adjust these numbers later. Given that they aren'…
1.9
content:
  content:
    p:
      score: 0
      elementCount: 1
  result: 0
regex:
  wordCount: 32
  wordValue: 0.1
  result: 1.9
0.30.57
Can you fix zod knip
0.39
content:
  content:
    p:
      score: 0
      elementCount: 1
  result: 0
regex:
  wordCount: 5
  wordValue: 0.1
  result: 0.39
0.20.078
You can ignore the warning by tweaking the config worst case sce…
0.83
content:
  content:
    p:
      score: 0
      elementCount: 1
  result: 0
regex:
  wordCount: 12
  wordValue: 0.1
  result: 0.83
0.30.249

 [ 6.0755 UUSD ] 

@EresDev
Contributions Overview
ViewContributionCountReward
IssueComment24.3125
ReviewComment11.763
Conversation Incentives
CommentFormattingRelevanceReward
In this MVP the "standard" permit is built by a script and is pa…
17.07
content:
  content:
    p:
      score: 0
      elementCount: 3
    a:
      score: 5
      elementCount: 2
  result: 10
regex:
  wordCount: 150
  wordValue: 0.1
  result: 7.07
0.83.9165
There is a treasury wallet used only to receive payments for min…
2.64
content:
  content:
    p:
      score: 0
      elementCount: 3
  result: 0
regex:
  wordCount: 47
  wordValue: 0.1
  result: 2.64
0.60.396
This is correct. It is [Result](https://docs.ethers.org/v5/api…
7.54
content:
  content:
    p:
      score: 0
      elementCount: 3
    a:
      score: 5
      elementCount: 1
  result: 5
regex:
  wordCount: 45
  wordValue: 0.1
  result: 2.54
0.81.763

 [ 124.712 UUSD ] 

@rndquu
Contributions Overview
ViewContributionCountReward
IssueSpecification183.28
IssueComment429.452
ReviewComment111.98
Conversation Incentives
CommentFormattingRelevanceReward
[This](https://github.com/ubiquity/pay.ubq.fi/pull/226) PR intro…
27.76
content:
  content:
    p:
      score: 0
      elementCount: 11
    a:
      score: 5
      elementCount: 3
    ol:
      score: 1
      elementCount: 2
    li:
      score: 0.5
      elementCount: 7
    ul:
      score: 1
      elementCount: 1
  result: 21.5
regex:
  wordCount: 130
  wordValue: 0.1
  result: 6.26
183.28
@pbkompasz How permit generation works:1. Github issue is cl…
28.39
content:
  content:
    p:
      score: 0
      elementCount: 6
    ol:
      score: 1
      elementCount: 1
    li:
      score: 0.5
      elementCount: 2
    a:
      score: 5
      elementCount: 4
  result: 22
regex:
  wordCount: 133
  wordValue: 0.1
  result: 6.39
0.8527.4315
DMed you in telegram
0.32
content:
  content:
    p:
      score: 0
      elementCount: 1
  result: 0
regex:
  wordCount: 4
  wordValue: 0.1
  result: 0.32
0.20.064
I suppose that's because https://github.com/ubiquity/pay.ubq.fi/…
1.75
content:
  content:
    p:
      score: 0
      elementCount: 1
  result: 0
regex:
  wordCount: 29
  wordValue: 0.1
  result: 1.75
0.651.1375
This issue should be closed as completed in https://github.com/u…
1.17
content:
  content:
    p:
      score: 0
      elementCount: 1
  result: 0
regex:
  wordCount: 18
  wordValue: 0.1
  result: 1.17
0.70.819
Here `txParsed.args.signature` refers to [method signatu…
12.2
content:
  content:
    p:
      score: 0
      elementCount: 1
    a:
      score: 5
      elementCount: 2
  result: 10
regex:
  wordCount: 38
  wordValue: 0.1
  result: 2.2
0.911.98

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