Giter Site home page Giter Site logo

deposit-backend's Introduction

Deposit Backend

This is a "temporary" solution for a backend for the deposit app. Eventually, this will be implemented on the EmpowerChain, but we want to test the Deposit App in different scenarios before we get that far. So we are starting with Plastic Credits on the EmpowerChain, and nailing down the specifics of the Deposit Schemes through this repo.

Take a look at the White Paper for more details: https://github.com/empowerchain/empowerchain

Development

Set up Encore: https://encore.dev/docs/install

Test: encore test ./... -p 1 -count=1

Run locally: encore run

Generate new client code: encore gen client deposit-pqu2 --env=staging --lang typescript --output client.ts

Auth

Auth is documented under commons/auth.md.

Logical flow

The following illustration documents the logical flow of data in the application:

Logical flow

Data model

The following illustration documents the current data model and how the relations are built

Data model

Usage documentation

1. SETUP: Admin

Many of the setup functions are currently admin-only. This means you need to either seed the admin database with an admin public key or manually add it:

$ encore db shell admin --env staging # Example env
admin=> insert into admin VALUES('YOURPUBKEYGOESHERE');

2. SETUP: Organization

Schemes needs an organization, so create one using the organization.CreateOrganization API.

3. Voucher Definition / Token Definition

Schemes also need a reward definition id, so use for instance deposit.CreateVoucherDefinition API.

4. SETUP: Scheme

Create scheme with scheme.CreateScheme

5. SETUP: Add collection point

Add collection point(s) to the scheme with scheme.AddCollectionPoint

6. Make deposit

As the collection point, make a new deposit with deposit.MakeDeposit

7. Optional: Claim

If user pub key is not added in the initial deposit, the user needs to claim the deposit reward with: deposit.Claim

deposit-backend's People

Contributors

gjermundgaraba avatar iam-agf avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.