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
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 is documented under commons/auth.md.
The following illustration documents the logical flow of data in the application:
The following illustration documents the current data model and how the relations are built
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');
Schemes needs an organization, so create one using the organization.CreateOrganization
API.
Schemes also need a reward definition id, so use for instance deposit.CreateVoucherDefinition
API.
Create scheme with scheme.CreateScheme
Add collection point(s) to the scheme with scheme.AddCollectionPoint
As the collection point, make a new deposit with deposit.MakeDeposit
If user pub key is not added in the initial deposit, the user needs to claim the deposit reward with: deposit.Claim