Skip to content

Commit bbf12ad

Browse files
authored
Merge pull request #1 from rarimo/feature/proofs
Add: airdrop functionality
2 parents a3e11be + 4b8f0db commit bbf12ad

34 files changed

+1153
-136
lines changed

.DS_Store

-6 KB
Binary file not shown.

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,5 @@ docker-compose.yaml
55
docs/node_modules
66
docs/web_deploy
77
vendor/
8+
airdrop-svc
9+
.DS_Store

config.yaml

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,15 @@ listener:
99
addr: localhost:8000
1010

1111
broadcaster:
12-
addr: broadcaster
13-
sender_account: "rarimo15hcd6tv7pe8hk2re7hu0zg0aphqdm2dtjrs0ds"
12+
airdrop_amount: 100stake
13+
cosmos_rpc: rpc_url
14+
chain_id: chain_id
15+
sender_private_key: priv_key
16+
query_limit: 10
1417

15-
airdrop:
16-
amount: 100000 # urmo
18+
verifier:
19+
verification_keys_paths:
20+
sha1: "./verification_key.json"
21+
sha256: "./verification_key.json"
22+
allowed_age: 18
23+
allowed_citizenships: ["UKR"]

docs/spec/components/responses/invalidAuth.yaml

Lines changed: 0 additions & 5 deletions
This file was deleted.
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
allOf:
2+
- $ref: '#/components/schemas/AirdropKey'
3+
- type: object
4+
required:
5+
- attributes
6+
properties:
7+
attributes:
8+
type: object
9+
required:
10+
- address
11+
- status
12+
- amount
13+
- tx_hash
14+
- created_at
15+
- updated_at
16+
properties:
17+
address:
18+
type: string
19+
description: Destination address for the airdrop
20+
example: "rarimo1qlyq3ej7j7rrkw6sluz658pzne88ymf66vjcap"
21+
status:
22+
type: string
23+
description: Status of the airdrop transaction
24+
enum: [ pending, completed ]
25+
created_at:
26+
type: string
27+
format: time.Time
28+
description: RFC3339 UTC timestamp of the airdrop creation
29+
example: "2021-09-01T00:00:00Z"
30+
updated_at:
31+
type: string
32+
format: time.Time
33+
description: RFC3339 UTC timestamp of the airdrop successful tx
34+
example: "2021-09-01T00:00:00Z"
35+
amount:
36+
type: string
37+
description: Amount of airdropped coins
38+
example: "100stake"
39+
tx_hash:
40+
type: string
41+
description: Hash of the airdrop transaction
42+
example: "F1CC0E80E151A67F75E41F2CDBF07920C29C9A3CDB6131B2A23A7C9D1964AD0B"
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
type: object
2+
required:
3+
- id
4+
- type
5+
properties:
6+
id:
7+
type: string
8+
description: User nullifier
9+
example: "0x04a32216f2425dc7343031352de3d62a7b0d3b4bf7a66d6c8c2aa8c9f4f2632b"
10+
type:
11+
type: string
12+
enum: [ airdrop ]

docs/spec/components/schemas/CreateAirdrop.yaml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,19 @@ allOf:
99
type: object
1010
required:
1111
- address
12-
- proof
12+
- algorithm
13+
- zk_proof
1314
properties:
1415
address:
1516
type: string
1617
description: Destination address for the airdrop
1718
example: "rarimo1qlyq3ej7j7rrkw6sluz658pzne88ymf66vjcap"
18-
proof:
19+
algorithm:
1920
type: string
20-
description: Placeholder for the proof
21+
description: Signing algorithm used in proof. The value from passport document SOD is assumed.
22+
example: "sha256_ecdsa"
23+
zk_proof:
24+
type: string
25+
format: types.ZKProof
26+
description: ZK-proof of the passport data
2127
example: "{}"
Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,7 @@
11
type: object
22
required:
3-
- id
43
- type
54
properties:
6-
id:
7-
type: string
8-
description: Nullifier
9-
example: "0x04a32216f2425dc7343031352de3d62a7b0d3b4bf7a66d6c8c2aa8c9f4f2632b"
105
type:
116
type: string
127
enum: [ create_airdrop ]

docs/spec/paths/integrations@airdrop-svc@airdrops.yaml

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,19 @@ post:
1515
data:
1616
$ref: '#/components/schemas/CreateAirdrop'
1717
responses:
18-
204:
19-
description: No content
20-
401:
21-
$ref: '#/components/responses/invalidAuth'
22-
404:
23-
$ref: '#/components/responses/notFound'
18+
201:
19+
description: Airdrop was created, transaction was queued
20+
content:
21+
application/vnd.api+json:
22+
schema:
23+
type: object
24+
required:
25+
- data
26+
properties:
27+
data:
28+
$ref: '#/components/schemas/Airdrop'
29+
400:
30+
$ref: '#/components/responses/invalidParameter'
2431
409:
2532
description: Airdrop was already done
2633
content:
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
get:
2+
tags:
3+
- Airdrop
4+
summary: Get an airdrop
5+
description: Get an airdrop for unique user.
6+
operationId: createAirdrop
7+
parameters:
8+
- in: path
9+
name: id
10+
description: User nullifier
11+
required: true
12+
schema:
13+
type: string
14+
example: "0x04a32216f2425dc7343031352de3d62a7b0d3b4bf7a66d6c8c2aa8c9f4f2632b"
15+
responses:
16+
200:
17+
content:
18+
application/vnd.api+json:
19+
schema:
20+
type: object
21+
required:
22+
- data
23+
properties:
24+
data:
25+
$ref: '#/components/schemas/Airdrop'
26+
400:
27+
$ref: '#/components/responses/invalidParameter'
28+
404:
29+
$ref: '#/components/responses/notFound'
30+
409:
31+
description: Airdrop was already done
32+
content:
33+
application/vnd.api+json:
34+
schema:
35+
$ref: '#/components/schemas/Errors'
36+
500:
37+
$ref: '#/components/responses/internalError'

go.mod

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,20 @@ require (
66
github.com/Masterminds/squirrel v1.4.0
77
github.com/alecthomas/kingpin v2.2.6+incompatible
88
github.com/cosmos/cosmos-sdk v0.46.12
9+
github.com/decred/dcrd/bech32 v1.1.3
910
github.com/ethereum/go-ethereum v1.13.11
1011
github.com/go-chi/chi v4.1.2+incompatible
11-
github.com/go-co-op/gocron/v2 v2.2.2
1212
github.com/go-ozzo/ozzo-validation/v4 v4.3.0
13-
github.com/google/jsonapi v1.0.0
14-
github.com/iden3/go-iden3-core/v2 v2.0.4
15-
github.com/rarimo/auth-svc v1.0.0-rc2.0.20240311143312-de1e2258f175
16-
github.com/rarimo/saver-grpc-lib v1.0.0
13+
github.com/iden3/go-rapidsnark/types v0.0.3
14+
github.com/iden3/go-rapidsnark/verifier v0.0.5
15+
github.com/rarimo/rarimo-core v0.0.0-20231004143803-6b209428ecbf
1716
github.com/rubenv/sql-migrate v1.6.1
1817
gitlab.com/distributed_lab/ape v1.7.1
1918
gitlab.com/distributed_lab/figure/v3 v3.1.3
20-
gitlab.com/distributed_lab/json-api-connector v0.2.7
2119
gitlab.com/distributed_lab/kit v1.11.2
2220
gitlab.com/distributed_lab/logan v3.8.1+incompatible
2321
gitlab.com/distributed_lab/running v0.0.0-20200706131153-4af0e83eb96c
24-
gitlab.com/distributed_lab/urlval/v4 v4.0.3
22+
google.golang.org/grpc v1.59.0
2523
)
2624

2725
require (
@@ -64,7 +62,6 @@ require (
6462
github.com/dustin/go-humanize v1.0.1-0.20200219035652-afde56e7acac // indirect
6563
github.com/dvsekhvalnov/jose2go v1.5.0 // indirect
6664
github.com/ethereum/c-kzg-4844 v0.4.0 // indirect
67-
github.com/fatih/structs v1.1.0 // indirect
6865
github.com/fsnotify/fsnotify v1.7.0 // indirect
6966
github.com/getsentry/raven-go v0.2.0 // indirect
7067
github.com/getsentry/sentry-go v0.26.0 // indirect
@@ -75,11 +72,11 @@ require (
7572
github.com/go-ole/go-ole v1.3.0 // indirect
7673
github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2 // indirect
7774
github.com/gogo/protobuf v1.3.3 // indirect
78-
github.com/golang-jwt/jwt/v5 v5.2.0 // indirect
7975
github.com/golang/glog v1.1.2 // indirect
8076
github.com/golang/protobuf v1.5.3 // indirect
8177
github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb // indirect
8278
github.com/google/btree v1.1.2 // indirect
79+
github.com/google/jsonapi v1.0.0 // indirect
8380
github.com/google/uuid v1.6.0 // indirect
8481
github.com/gorilla/websocket v1.5.0 // indirect
8582
github.com/grpc-ecosystem/go-grpc-middleware v1.3.0 // indirect
@@ -96,7 +93,6 @@ require (
9693
github.com/inconshreveable/mousetrap v1.1.0 // indirect
9794
github.com/jmhodges/levigo v1.0.0 // indirect
9895
github.com/jmoiron/sqlx v1.2.0 // indirect
99-
github.com/jonboulle/clockwork v0.4.0 // indirect
10096
github.com/klauspost/compress v1.17.0 // indirect
10197
github.com/lann/builder v0.0.0-20180802200727-47ae307949d0 // indirect
10298
github.com/lann/ps v0.0.0-20150810152359-62de8c46ede0 // indirect
@@ -106,9 +102,9 @@ require (
106102
github.com/mattn/go-isatty v0.0.17 // indirect
107103
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
108104
github.com/mimoo/StrobeGo v0.0.0-20210601165009-122bf33a46e0 // indirect
105+
github.com/mitchellh/go-testing-interface v1.14.1 // indirect
109106
github.com/mitchellh/mapstructure v1.5.0 // indirect
110107
github.com/mmcloughlin/addchain v0.4.0 // indirect
111-
github.com/mr-tron/base58 v1.2.0 // indirect
112108
github.com/mtibben/percent v0.2.1 // indirect
113109
github.com/oklog/ulid v1.3.1 // indirect
114110
github.com/pelletier/go-toml/v2 v2.1.1 // indirect
@@ -119,9 +115,7 @@ require (
119115
github.com/prometheus/client_model v0.3.0 // indirect
120116
github.com/prometheus/common v0.39.0 // indirect
121117
github.com/prometheus/procfs v0.9.0 // indirect
122-
github.com/rarimo/broadcaster-svc v1.0.2 // indirect
123118
github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect
124-
github.com/robfig/cron/v3 v3.0.1 // indirect
125119
github.com/sagikazarmark/locafero v0.4.0 // indirect
126120
github.com/sagikazarmark/slog-shim v0.1.0 // indirect
127121
github.com/sasha-s/go-deadlock v0.3.1 // indirect
@@ -162,7 +156,6 @@ require (
162156
google.golang.org/genproto v0.0.0-20231106174013-bbf56f31fb17 // indirect
163157
google.golang.org/genproto/googleapis/api v0.0.0-20231106174013-bbf56f31fb17 // indirect
164158
google.golang.org/genproto/googleapis/rpc v0.0.0-20231120223509-83a465c0220f // indirect
165-
google.golang.org/grpc v1.59.0 // indirect
166159
google.golang.org/protobuf v1.31.0 // indirect
167160
gopkg.in/ini.v1 v1.67.0 // indirect
168161
gopkg.in/yaml.v2 v2.4.0 // indirect

0 commit comments

Comments
 (0)