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

Add reward decisions from connected web-applications #1

Open
ifavo opened this issue Sep 12, 2024 · 0 comments
Open

Add reward decisions from connected web-applications #1

ifavo opened this issue Sep 12, 2024 · 0 comments

Comments

@ifavo
Copy link

ifavo commented Sep 12, 2024

Actions that are tracked in established services like Withings, Strava, GoogleFit, etc. can be a good source of information and good behaviour like a healthy lifestyle can be rewarded too.

The need for such data can be turned into a generic feature that:

  • allows users to connect to Web-Applications
  • run metrics / information through a validation process
  • send rewards to users with sustainability proofs

To make it technologically as simple as possible, the following principles will lead the solution:

  • use contracts as data storage
  • prefer scaleability with slow but stable solutions
  • service-neutrality

Initial idea/draft:

sequenceDiagram
participant User
participant X2App
participant Web-App
participant Service-Contract

Note over User, Service-Contract: Connect Apps
User->>X2App: "Connect Web-App"
X2App-->>User: Send redirect for User to authenticate on Web-App
User->>Web-App: Sign In
Web-App-->>X2App: Redirect with auth tokens
X2App->>Web-App: Verify authorization
opt valid authorization
    Web-App-->>X2App: Return user information
    X2App->>Service-Contract: Store wallet address + webAppId + webAppUserId
    X2App-->>User: Confirm connection
end

Note over User, Service-Contract: Disconnect Apps
User->>X2App: Disconnect Web-App
X2App->>Service-Contract: Remove information
X2App-->>User: Confirm disconnection

Note over User, Service-Contract: Reward Distribution
loop Interval or Webhook from Web-App
    X2App->>Service-Contract: Load user to update
    Service-Contract-->>X2App: Return user information
    X2App->>Web-App: Request data
    Web-App-->>X2App: Return metrics/information
    X2App->>X2App: Process information
    opt if eligible for rewards
        X2App->>Service-Contract: Document metrics and reward
        Service-Contract-->>User: Send reward
    end
end
Loading
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

1 participant