mirror of
https://github.com/0xbow-io/privacy-pools-core.git
synced 2026-01-09 01:17:58 -05:00
The core functionality of the feature takes place at `packages/relayer/src/services/privacyPoolRelayer.service.ts` in the `validateWithdrawal` function. There we check in order: 1. Decode Withdrawal.data and check feeReceiver == CONFIGURED_FEE_RECEIVER && feeBPS == CONFIGURED_FEE_BPS 2. Hash (Withdrawal || Scope) and check hash == Proof.context 3. Verify proof with SDK.verifyProof(Proof) 4. Call Entrypoint.scopeToPool() to get asset pool 5. Call Pool.ASSET() to get withdrawn asset 6. Check proof.withdrawnAmount() >= CONFIGURED_MINIMUM_AMOUNT[withdrawn_asset] If everything is ok, we call the Entrypoint.relay() with the user's proof. I've added examples for the config files `env.example`, `withdraw_amount.example.json`. The first one are environment variables to be defined in the server's environment. The second one contains a mapping of the mimimum withdraw limits for the different supported assets. There's an env var that should contain a path to this file. Added a `Dockerfile` and a `docker-compose.yml` to the relayer to test it or use it in dev flows. The circuit artifacts are loaded as volumes, so before starting the docker-compose, you should run `yarn present` from the circuits package dir to group all the artifacts and make them easily accesible. Additionally added a small package in `/packages/relayer/test/integration/relay` that can be built and run to test the relayer.
32 lines
857 B
JSON
32 lines
857 B
JSON
{
|
|
"name": "privacy-pool-core",
|
|
"version": "0.1.0",
|
|
"description": "Core repository for the Privacy Pool protocol",
|
|
"repository": "https://github.com/defi-wonderland/privacy-pool-core",
|
|
"license": "MIT",
|
|
"author": "Wonderland",
|
|
"private": true,
|
|
"workspaces": [
|
|
"packages/circuits",
|
|
"packages/contracts",
|
|
"packages/sdk",
|
|
"packages/relayer"
|
|
],
|
|
"scripts": {
|
|
"docker:build:relayer": "docker build -f packages/relayer/Dockerfile -t privacy-pool/relayer ."
|
|
},
|
|
"devDependencies": {
|
|
"@typescript-eslint/eslint-plugin": "7.18.0",
|
|
"@typescript-eslint/parser": "7.18.0",
|
|
"eslint": "9.18.0",
|
|
"eslint-config-prettier": "9.1.0",
|
|
"eslint-plugin-prettier": "5.2.1",
|
|
"prettier": "3.3.3",
|
|
"typescript": "5.5.4",
|
|
"typescript-eslint": "8.20.0"
|
|
},
|
|
"dependencies": {
|
|
"ts-node": "^10.9.2"
|
|
}
|
|
}
|