Skip to content

Commit

Permalink
update: merge feature/migrate-to-evm
Browse files Browse the repository at this point in the history
  • Loading branch information
mhrynenko committed Jun 6, 2024
2 parents 9641ac2 + 100937d commit 194bc83
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ require (
github.com/go-chi/chi v4.1.2+incompatible
github.com/go-ozzo/ozzo-validation/v4 v4.3.0
github.com/iden3/go-rapidsnark/types v0.0.3
github.com/rarimo/zkverifier-kit v0.2.2-rc.2
github.com/rarimo/zkverifier-kit v0.2.2-rc.3
github.com/rubenv/sql-migrate v1.6.1
gitlab.com/distributed_lab/ape v1.7.1
gitlab.com/distributed_lab/dig v0.0.0-20230207152643-c44f80a4294c
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -2088,6 +2088,8 @@ github.com/rarimo/zkverifier-kit v0.2.2-rc.1 h1:IHf+Ctl/ilHxK37r6oJmhxNUz/tTWB6i
github.com/rarimo/zkverifier-kit v0.2.2-rc.1/go.mod h1:3YDg5dTkDRr4IdfaDHGYetopd6gS/2SuwSeseYTWwNw=
github.com/rarimo/zkverifier-kit v0.2.2-rc.2 h1:jjdbYH33yzsb0NHGm9TXkG9yKVBYX3GrX8XIc/Z2rAk=
github.com/rarimo/zkverifier-kit v0.2.2-rc.2/go.mod h1:3YDg5dTkDRr4IdfaDHGYetopd6gS/2SuwSeseYTWwNw=
github.com/rarimo/zkverifier-kit v0.2.2-rc.3 h1:QarWLZxDpng8FeNZ6LxO+0RBEB88N9fqnCFpC0MgQBE=
github.com/rarimo/zkverifier-kit v0.2.2-rc.3/go.mod h1:3YDg5dTkDRr4IdfaDHGYetopd6gS/2SuwSeseYTWwNw=
github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 h1:N/ElC8H3+5XpJzTSTfLsJV/mx9Q9g7kxmchpfZyxgzM=
github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4=
github.com/regen-network/protobuf v1.3.3-alpha.regen.1 h1:OHEc+q5iIAXpqiqFKeLpu5NwTIkVXUs48vFMwzqpqY4=
Expand Down
12 changes: 11 additions & 1 deletion internal/service/api/handlers/create_airdrop.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"net/http"

"github.com/ethereum/go-ethereum/accounts/abi/bind"
"github.com/ethereum/go-ethereum/common/hexutil"
"github.com/ethereum/go-ethereum/common/math"
"github.com/rarimo/evm-airdrop-svc/internal/data"
"github.com/rarimo/evm-airdrop-svc/internal/service/api"
Expand Down Expand Up @@ -44,7 +45,16 @@ func CreateAirdrop(w http.ResponseWriter, r *http.Request) {
return
}

err = api.Verifier(r).VerifyProof(req.Data.Attributes.ZkProof, zk.WithEthereumAddress(req.Data.Attributes.Address))
decodedAddress, err := hexutil.Decode(req.Data.Attributes.Address)
if err != nil {
api.Log(r).WithError(err).WithFields(logan.F{
"address": req.Data.Attributes.Address,
}).Error("Failed to decode hex ethereum address")
ape.RenderErr(w, problems.InternalError())
return
}

err = api.Verifier(r).VerifyProof(req.Data.Attributes.ZkProof, zk.WithEventData(decodedAddress))
if err != nil {
if stdErrors.Is(err, identity.ErrContractCall) {
api.Log(r).WithError(err).Error("Failed to verify proof")
Expand Down

0 comments on commit 194bc83

Please sign in to comment.