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

Bounty: Delegatable Integration & Subscription Enforcer - 325 OP Reward #56

Open
9 tasks
kamescg opened this issue Apr 27, 2023 · 2 comments
Open
9 tasks
Labels

Comments

@kamescg
Copy link
Member

kamescg commented Apr 27, 2023

πŸ‘¨β€πŸ’» User Story

As a Web3 experience architect I want to create streamlined and user experience optimized transaction flows.

More specifically I want to integrate the Delegatable framework and gas-less subscription services into my Web3 application.

πŸ“œ Disclaimer

To be eligible for the payout you must first get approval to work on the bounty.

It's recommended to share a link to your personal Github account.

🧱 Project

Integrate the delegatable smart contract framework into a TurboETH template.

Integrate the DistrictERC20PermitSubscriptionsEnforcer enforcer smart contract.

Delegatable using rather complex EIP712 signatures to embed transaction execution conditionals directly into a transaction signature.

It's recommended to review the DistrictERC20PermitSubscriptionsEnforcer unit tests to see how implement the terms bytecode packing.

Options
You can fork the Gifte Cards template and add the integration in the template.

This will require removing the existing functionality or adding the subscription functionality to the existing user interface.

Or...

Create an integration/streaming-delegatable integration in the TurboETH integrations branch and expose the funcionality in the integrations section.

Either way it's recommended to review the Giftee Cards application to see how delegatable is integrated. The EIP712 signatures can be tricky.

Required Functionality:

  • Start gas-less subscription and save transaction in a database.
  • Revoke subscription delegation.
  • Vercel cron job function every 30 minutes to execute valid transactions.

Developer Tasks:

  • Add essential Delegatable V0 smart contract artifacts
    • delegatable-abi.json and delegatable-bytecode.json
    • district-erc20-permit-subscriptions-enforcer-abi.json and district-erc20-permit-subscriptions-enforcer-bytecode.json
  • Create wagmi.config.js - Configure to use essential smart contract artifacts
  • Create Component - form-subscription-start.tsx
  • Create Component - form-subscription-end.tsx

Potential File Structure

Integration

The core delegatable-subscription integration should be added to the integrations/delegatable-subscription folder.

integrations/delegatable-subscription
β”œβ”€ components/
β”‚  β”œβ”€ form-delegatable-subscription-start.tsx
β”‚  β”œβ”€ form-delegatable-subscription-revoke.tsx
β”œβ”€ hooks/
β”‚  β”œβ”€ **/*.ts
β”œβ”€ utils/
β”‚  β”œβ”€ **/*.ts
β”œβ”€ delegatable-wagmi.ts
β”œβ”€ delegatable-enforcers-wagmi.ts
β”œβ”€ wagmi.config.ts
β”œβ”€ README.md
Application

The subscription pages should be added to the app/delegatable folder.

app/delegatable
β”œβ”€ subscription
β”‚  β”œβ”€ page.tsx

Resources

Delegatable is a complex smart contract solidity framework. It handles transaction formatting and execution differently, compared to a standard transaction or meta-transaction.

Below is an example of delegatable transaction object.

const INVOCATION_MESSAGE = {
      replayProtection: {
        nonce: '0x01',
        queue: '0x00',
      },
      batch: [
        {
          authority: [],
          transaction: {
            to: verifyingContract.address,
            gasLimit: '210000000000000000',
            data: (
              await verifyingContract.populateTransaction.approveSubscription(
                wallet0.address,
                totalSubscriptionAmount,
                deadline,
                v,
                r,
                s,
              )
            ).data,
          },
        },
        {
          authority: [_delegation],
          transaction: {
            to: verifyingContract.address,
            gasLimit: '210000000000000000',
            data: (await verifyingContract.populateTransaction.paySubscription()).data,
          },
        },
      ],
    };

πŸ’° Bounty Reward

The bounty reward is 325 OP tokens and TurboETH DevPass digital collectible.

TurboETH is the recipient of 18,271.88 OP Tokens from Optimism Retroactive Public Goods Funding. The OP tokens earned from the PGF program are the primary funding source for TurboETH bounties.

Notice

The final integration may not resemble the proposed integration - that's O.K - a natural part of software development.

During development you might discover an original hypothesis doesn't make sense. No problem. Make a comment and clearly explain why a new approach is better than old one. Get rewarded for thinking out of the box.

The final bounty reward can be increased to match new bounty tasks.

Resources

@kamescg kamescg added the bounty label Apr 27, 2023
@kamescg kamescg assigned kamescg and marthendalnunes and unassigned kamescg May 15, 2023
@marthendalnunes marthendalnunes removed their assignment Jun 26, 2023
@0xJoichiro
Copy link

Interested

@ManyRios
Copy link

ManyRios commented Jun 3, 2024

Hey @kamescg is this available?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
No open projects
Status: Todo
Development

No branches or pull requests

4 participants