Skip to content

Commit

Permalink
Merge pull request #1 from rarimo/feature/proofs
Browse files Browse the repository at this point in the history
Add: airdrop functionality
  • Loading branch information
mhrynenko authored May 13, 2024
2 parents a3e11be + 4b8f0db commit bbf12ad
Show file tree
Hide file tree
Showing 34 changed files with 1,153 additions and 136 deletions.
Binary file removed .DS_Store
Binary file not shown.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@ docker-compose.yaml
docs/node_modules
docs/web_deploy
vendor/
airdrop-svc
.DS_Store
15 changes: 11 additions & 4 deletions config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,15 @@ listener:
addr: localhost:8000

broadcaster:
addr: broadcaster
sender_account: "rarimo15hcd6tv7pe8hk2re7hu0zg0aphqdm2dtjrs0ds"
airdrop_amount: 100stake
cosmos_rpc: rpc_url
chain_id: chain_id
sender_private_key: priv_key
query_limit: 10

airdrop:
amount: 100000 # urmo
verifier:
verification_keys_paths:
sha1: "./verification_key.json"
sha256: "./verification_key.json"
allowed_age: 18
allowed_citizenships: ["UKR"]
5 changes: 0 additions & 5 deletions docs/spec/components/responses/invalidAuth.yaml

This file was deleted.

42 changes: 42 additions & 0 deletions docs/spec/components/schemas/Airdrop.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
allOf:
- $ref: '#/components/schemas/AirdropKey'
- type: object
required:
- attributes
properties:
attributes:
type: object
required:
- address
- status
- amount
- tx_hash
- created_at
- updated_at
properties:
address:
type: string
description: Destination address for the airdrop
example: "rarimo1qlyq3ej7j7rrkw6sluz658pzne88ymf66vjcap"
status:
type: string
description: Status of the airdrop transaction
enum: [ pending, completed ]
created_at:
type: string
format: time.Time
description: RFC3339 UTC timestamp of the airdrop creation
example: "2021-09-01T00:00:00Z"
updated_at:
type: string
format: time.Time
description: RFC3339 UTC timestamp of the airdrop successful tx
example: "2021-09-01T00:00:00Z"
amount:
type: string
description: Amount of airdropped coins
example: "100stake"
tx_hash:
type: string
description: Hash of the airdrop transaction
example: "F1CC0E80E151A67F75E41F2CDBF07920C29C9A3CDB6131B2A23A7C9D1964AD0B"
12 changes: 12 additions & 0 deletions docs/spec/components/schemas/AirdropKey.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
type: object
required:
- id
- type
properties:
id:
type: string
description: User nullifier
example: "0x04a32216f2425dc7343031352de3d62a7b0d3b4bf7a66d6c8c2aa8c9f4f2632b"
type:
type: string
enum: [ airdrop ]
12 changes: 9 additions & 3 deletions docs/spec/components/schemas/CreateAirdrop.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,19 @@ allOf:
type: object
required:
- address
- proof
- algorithm
- zk_proof
properties:
address:
type: string
description: Destination address for the airdrop
example: "rarimo1qlyq3ej7j7rrkw6sluz658pzne88ymf66vjcap"
proof:
algorithm:
type: string
description: Placeholder for the proof
description: Signing algorithm used in proof. The value from passport document SOD is assumed.
example: "sha256_ecdsa"
zk_proof:
type: string
format: types.ZKProof
description: ZK-proof of the passport data
example: "{}"
5 changes: 0 additions & 5 deletions docs/spec/components/schemas/CreateAirdropKey.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
type: object
required:
- id
- type
properties:
id:
type: string
description: Nullifier
example: "0x04a32216f2425dc7343031352de3d62a7b0d3b4bf7a66d6c8c2aa8c9f4f2632b"
type:
type: string
enum: [ create_airdrop ]
19 changes: 13 additions & 6 deletions docs/spec/paths/integrations@[email protected]
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,19 @@ post:
data:
$ref: '#/components/schemas/CreateAirdrop'
responses:
204:
description: No content
401:
$ref: '#/components/responses/invalidAuth'
404:
$ref: '#/components/responses/notFound'
201:
description: Airdrop was created, transaction was queued
content:
application/vnd.api+json:
schema:
type: object
required:
- data
properties:
data:
$ref: '#/components/schemas/Airdrop'
400:
$ref: '#/components/responses/invalidParameter'
409:
description: Airdrop was already done
content:
Expand Down
37 changes: 37 additions & 0 deletions docs/spec/paths/integrations@airdrop-svc@airdrops@{id}.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
get:
tags:
- Airdrop
summary: Get an airdrop
description: Get an airdrop for unique user.
operationId: createAirdrop
parameters:
- in: path
name: id
description: User nullifier
required: true
schema:
type: string
example: "0x04a32216f2425dc7343031352de3d62a7b0d3b4bf7a66d6c8c2aa8c9f4f2632b"
responses:
200:
content:
application/vnd.api+json:
schema:
type: object
required:
- data
properties:
data:
$ref: '#/components/schemas/Airdrop'
400:
$ref: '#/components/responses/invalidParameter'
404:
$ref: '#/components/responses/notFound'
409:
description: Airdrop was already done
content:
application/vnd.api+json:
schema:
$ref: '#/components/schemas/Errors'
500:
$ref: '#/components/responses/internalError'
21 changes: 7 additions & 14 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,20 @@ require (
github.com/Masterminds/squirrel v1.4.0
github.com/alecthomas/kingpin v2.2.6+incompatible
github.com/cosmos/cosmos-sdk v0.46.12
github.com/decred/dcrd/bech32 v1.1.3
github.com/ethereum/go-ethereum v1.13.11
github.com/go-chi/chi v4.1.2+incompatible
github.com/go-co-op/gocron/v2 v2.2.2
github.com/go-ozzo/ozzo-validation/v4 v4.3.0
github.com/google/jsonapi v1.0.0
github.com/iden3/go-iden3-core/v2 v2.0.4
github.com/rarimo/auth-svc v1.0.0-rc2.0.20240311143312-de1e2258f175
github.com/rarimo/saver-grpc-lib v1.0.0
github.com/iden3/go-rapidsnark/types v0.0.3
github.com/iden3/go-rapidsnark/verifier v0.0.5
github.com/rarimo/rarimo-core v0.0.0-20231004143803-6b209428ecbf
github.com/rubenv/sql-migrate v1.6.1
gitlab.com/distributed_lab/ape v1.7.1
gitlab.com/distributed_lab/figure/v3 v3.1.3
gitlab.com/distributed_lab/json-api-connector v0.2.7
gitlab.com/distributed_lab/kit v1.11.2
gitlab.com/distributed_lab/logan v3.8.1+incompatible
gitlab.com/distributed_lab/running v0.0.0-20200706131153-4af0e83eb96c
gitlab.com/distributed_lab/urlval/v4 v4.0.3
google.golang.org/grpc v1.59.0
)

require (
Expand Down Expand Up @@ -64,7 +62,6 @@ require (
github.com/dustin/go-humanize v1.0.1-0.20200219035652-afde56e7acac // indirect
github.com/dvsekhvalnov/jose2go v1.5.0 // indirect
github.com/ethereum/c-kzg-4844 v0.4.0 // indirect
github.com/fatih/structs v1.1.0 // indirect
github.com/fsnotify/fsnotify v1.7.0 // indirect
github.com/getsentry/raven-go v0.2.0 // indirect
github.com/getsentry/sentry-go v0.26.0 // indirect
Expand All @@ -75,11 +72,11 @@ require (
github.com/go-ole/go-ole v1.3.0 // indirect
github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2 // indirect
github.com/gogo/protobuf v1.3.3 // indirect
github.com/golang-jwt/jwt/v5 v5.2.0 // indirect
github.com/golang/glog v1.1.2 // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb // indirect
github.com/google/btree v1.1.2 // indirect
github.com/google/jsonapi v1.0.0 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/gorilla/websocket v1.5.0 // indirect
github.com/grpc-ecosystem/go-grpc-middleware v1.3.0 // indirect
Expand All @@ -96,7 +93,6 @@ require (
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/jmhodges/levigo v1.0.0 // indirect
github.com/jmoiron/sqlx v1.2.0 // indirect
github.com/jonboulle/clockwork v0.4.0 // indirect
github.com/klauspost/compress v1.17.0 // indirect
github.com/lann/builder v0.0.0-20180802200727-47ae307949d0 // indirect
github.com/lann/ps v0.0.0-20150810152359-62de8c46ede0 // indirect
Expand All @@ -106,9 +102,9 @@ require (
github.com/mattn/go-isatty v0.0.17 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
github.com/mimoo/StrobeGo v0.0.0-20210601165009-122bf33a46e0 // indirect
github.com/mitchellh/go-testing-interface v1.14.1 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/mmcloughlin/addchain v0.4.0 // indirect
github.com/mr-tron/base58 v1.2.0 // indirect
github.com/mtibben/percent v0.2.1 // indirect
github.com/oklog/ulid v1.3.1 // indirect
github.com/pelletier/go-toml/v2 v2.1.1 // indirect
Expand All @@ -119,9 +115,7 @@ require (
github.com/prometheus/client_model v0.3.0 // indirect
github.com/prometheus/common v0.39.0 // indirect
github.com/prometheus/procfs v0.9.0 // indirect
github.com/rarimo/broadcaster-svc v1.0.2 // indirect
github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect
github.com/robfig/cron/v3 v3.0.1 // indirect
github.com/sagikazarmark/locafero v0.4.0 // indirect
github.com/sagikazarmark/slog-shim v0.1.0 // indirect
github.com/sasha-s/go-deadlock v0.3.1 // indirect
Expand Down Expand Up @@ -162,7 +156,6 @@ require (
google.golang.org/genproto v0.0.0-20231106174013-bbf56f31fb17 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20231106174013-bbf56f31fb17 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20231120223509-83a465c0220f // indirect
google.golang.org/grpc v1.59.0 // indirect
google.golang.org/protobuf v1.31.0 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
Expand Down
Loading

0 comments on commit bbf12ad

Please sign in to comment.