From a60069c7fbc0b22762f0eb30dc14c1fdb78aba58 Mon Sep 17 00:00:00 2001 From: Zaptoss Date: Tue, 17 Sep 2024 16:18:14 +0300 Subject: [PATCH] Add withdrawals --- docs/spec/components/schemas/Withdraw.yaml | 22 + docs/spec/components/schemas/WithdrawKey.yaml | 13 + ...blic@balances@{nullifier}@withdrawals.yaml | 39 + go.mod | 25 +- go.sum | 31 + internal/assets/migrations/005_withdraw.sql | 13 + internal/config/levels.go | 18 +- internal/config/main.go | 3 + internal/config/poll_verifier.go | 3 +- internal/config/rarimarket.go | 218 ++ internal/contracts/points/Points.go | 2766 +++++++++++++++++ .../RarimarketAccountFactory.go | 1523 +++++++++ internal/data/pg/withdrawals.go | 61 + internal/data/withdrawals.go | 24 + internal/service/event/main.go | 1 - internal/service/handlers/ctx.go | 22 + internal/service/handlers/middleware.go | 1 + internal/service/handlers/withdraw.go | 161 + internal/service/requests/withdraw.go | 30 + internal/service/router.go | 2 + resources/model_resource_type.go | 1 + resources/model_withdraw.go | 43 + resources/model_withdraw_attributes.go | 14 + 23 files changed, 5023 insertions(+), 11 deletions(-) create mode 100644 docs/spec/components/schemas/Withdraw.yaml create mode 100644 docs/spec/components/schemas/WithdrawKey.yaml create mode 100644 docs/spec/paths/integrations@geo-points-svc@v1@public@balances@{nullifier}@withdrawals.yaml create mode 100644 internal/assets/migrations/005_withdraw.sql create mode 100644 internal/config/rarimarket.go create mode 100644 internal/contracts/points/Points.go create mode 100644 internal/contracts/rarimarketaccountfactory/RarimarketAccountFactory.go create mode 100644 internal/data/pg/withdrawals.go create mode 100644 internal/data/withdrawals.go create mode 100644 internal/service/handlers/withdraw.go create mode 100644 internal/service/requests/withdraw.go create mode 100644 resources/model_withdraw.go create mode 100644 resources/model_withdraw_attributes.go diff --git a/docs/spec/components/schemas/Withdraw.yaml b/docs/spec/components/schemas/Withdraw.yaml new file mode 100644 index 0000000..e6a7443 --- /dev/null +++ b/docs/spec/components/schemas/Withdraw.yaml @@ -0,0 +1,22 @@ +allOf: + - $ref: '#/components/schemas/WithdrawKey' + - type: object + x-go-is-request: true + required: + - attributes + properties: + attributes: + type: object + required: + - amount + - proof + properties: + amount: + type: integer + format: int64 + description: Amount of points to withdraw + example: 580 + proof: + type: object + format: types.ZKProof + description: Query ZK passport verification proof. diff --git a/docs/spec/components/schemas/WithdrawKey.yaml b/docs/spec/components/schemas/WithdrawKey.yaml new file mode 100644 index 0000000..a2ef907 --- /dev/null +++ b/docs/spec/components/schemas/WithdrawKey.yaml @@ -0,0 +1,13 @@ +type: object +required: + - id + - type +properties: + id: + type: string + description: Nullifier of the points owner + example: "0x123...abc" + pattern: '^0x[0-9a-fA-F]{64}$' + type: + type: string + enum: [ withdraw ] diff --git a/docs/spec/paths/integrations@geo-points-svc@v1@public@balances@{nullifier}@withdrawals.yaml b/docs/spec/paths/integrations@geo-points-svc@v1@public@balances@{nullifier}@withdrawals.yaml new file mode 100644 index 0000000..7b49dde --- /dev/null +++ b/docs/spec/paths/integrations@geo-points-svc@v1@public@balances@{nullifier}@withdrawals.yaml @@ -0,0 +1,39 @@ +post: + tags: + - Points balance + summary: Withdraw points + description: | + Convert points to RariMarket points by exchange rate and withdraw to user wallet. + Updated balance with new rank is returned. + operationId: withdrawPoints + parameters: + - $ref: '#/components/parameters/pathNullifier' + requestBody: + required: true + content: + application/vnd.api+json: + schema: + type: object + required: + - data + properties: + data: + $ref: '#/components/schemas/Withdraw' + responses: + 200: + description: Success + content: + application/vnd.api+json: + schema: + type: object + required: + - data + properties: + data: + $ref: '#/components/schemas/Balance' + 400: + $ref: '#/components/responses/invalidParameter' + 401: + $ref: '#/components/responses/invalidAuth' + 500: + $ref: '#/components/responses/internalError' diff --git a/go.mod b/go.mod index 1e7dcf0..55d0bd6 100644 --- a/go.mod +++ b/go.mod @@ -11,6 +11,7 @@ require ( 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/hashicorp/vault/api v1.15.0 github.com/iden3/go-rapidsnark/types v0.0.3 github.com/iden3/go-rapidsnark/verifier v0.0.5 github.com/rarimo/geo-auth-svc v1.1.0 @@ -18,6 +19,7 @@ require ( github.com/rarimo/zkverifier-kit v1.2.2 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 gitlab.com/distributed_lab/figure/v3 v3.1.4 gitlab.com/distributed_lab/kit v1.11.3 gitlab.com/distributed_lab/logan v3.8.1+incompatible @@ -43,6 +45,7 @@ require ( github.com/bits-and-blooms/bitset v1.10.0 // indirect github.com/btcsuite/btcd v0.23.0 // indirect github.com/btcsuite/btcd/btcec/v2 v2.3.2 // indirect + github.com/cenkalti/backoff/v4 v4.3.0 // indirect github.com/certifi/gocertifi v0.0.0-20210507211836-431795d63e8d // indirect github.com/cespare/xxhash v1.1.0 // indirect github.com/cespare/xxhash/v2 v2.3.0 // indirect @@ -70,6 +73,7 @@ require ( github.com/getsentry/raven-go v0.2.0 // indirect github.com/getsentry/sentry-go v0.27.0 // indirect github.com/go-gorp/gorp/v3 v3.1.0 // indirect + github.com/go-jose/go-jose/v4 v4.0.1 // indirect github.com/go-kit/kit v0.12.0 // indirect github.com/go-kit/log v0.2.1 // indirect github.com/go-logfmt/logfmt v0.6.0 // indirect @@ -88,7 +92,15 @@ require ( github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c // indirect github.com/gtank/merlin v0.1.1 // indirect github.com/gtank/ristretto255 v0.1.2 // indirect + github.com/hashicorp/errwrap v1.1.0 // indirect + github.com/hashicorp/go-cleanhttp v0.5.2 // indirect github.com/hashicorp/go-immutable-radix v1.3.1 // indirect + github.com/hashicorp/go-multierror v1.1.1 // indirect + github.com/hashicorp/go-retryablehttp v0.7.7 // indirect + github.com/hashicorp/go-rootcerts v1.0.2 // indirect + github.com/hashicorp/go-secure-stdlib/parseutil v0.1.6 // indirect + github.com/hashicorp/go-secure-stdlib/strutil v0.1.2 // indirect + github.com/hashicorp/go-sockaddr v1.0.2 // indirect github.com/hashicorp/golang-lru v1.0.2 // indirect github.com/hashicorp/hcl v1.0.0 // indirect github.com/hdevalence/ed25519consensus v0.0.0-20220222234857-c00d1f31bab3 // indirect @@ -107,6 +119,7 @@ require ( github.com/mattn/go-isatty v0.0.20 // 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-homedir v1.1.0 // indirect github.com/mitchellh/mapstructure v1.5.0 // indirect github.com/mmcloughlin/addchain v0.4.0 // indirect github.com/mtibben/percent v0.2.1 // indirect @@ -122,6 +135,7 @@ require ( 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/ryanuber/go-glob v1.0.0 // 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 @@ -150,14 +164,15 @@ require ( gitlab.com/distributed_lab/lorem v0.2.1 // indirect go.etcd.io/bbolt v1.3.7 // indirect go.uber.org/multierr v1.11.0 // indirect - golang.org/x/crypto v0.22.0 // indirect + golang.org/x/crypto v0.23.0 // indirect golang.org/x/exp v0.0.0-20240404231335-c0f41cb1a7a0 // indirect golang.org/x/mod v0.17.0 // indirect - golang.org/x/net v0.24.0 // indirect + golang.org/x/net v0.25.0 // indirect golang.org/x/sync v0.7.0 // indirect - golang.org/x/sys v0.19.0 // indirect - golang.org/x/term v0.19.0 // indirect - golang.org/x/text v0.14.0 // indirect + golang.org/x/sys v0.20.0 // indirect + golang.org/x/term v0.20.0 // indirect + golang.org/x/text v0.15.0 // indirect + golang.org/x/time v0.5.0 // indirect golang.org/x/tools v0.20.0 // indirect google.golang.org/genproto v0.0.0-20231106174013-bbf56f31fb17 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20231106174013-bbf56f31fb17 // indirect diff --git a/go.sum b/go.sum index 761f336..fe0053d 100644 --- a/go.sum +++ b/go.sum @@ -1267,6 +1267,8 @@ github.com/c-bata/go-prompt v0.2.2/go.mod h1:VzqtzE2ksDBcdln8G7mk2RX9QyGjH+OVqOC github.com/cenkalti/backoff v2.2.1+incompatible h1:tNowT99t7UNflLxfYYSlKYsBpXdEet03Pg2g16Swow4= github.com/cenkalti/backoff/v4 v4.1.3 h1:cFAlzYUlVYDysBEH2T5hyJZMh3+5+WCBvSnK6Q8UtC4= github.com/cenkalti/backoff/v4 v4.1.3/go.mod h1:scbssz8iZGpm3xbr14ovlUdkxfGXNInqkPWOWmG2CLw= +github.com/cenkalti/backoff/v4 v4.3.0 h1:MyRJ/UdXutAwSAT+s3wNd7MfTIcy71VQueUuFK343L8= +github.com/cenkalti/backoff/v4 v4.3.0/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/census-instrumentation/opencensus-proto v0.3.0/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/census-instrumentation/opencensus-proto v0.4.1/go.mod h1:4T9NM4+4Vw91VeyqjLS6ao50K5bOcLKN6Q42XnYaRYw= @@ -1483,6 +1485,8 @@ github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2 github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-gorp/gorp/v3 v3.1.0 h1:ItKF/Vbuj31dmV4jxA1qblpSwkl9g1typ24xoe70IGs= github.com/go-gorp/gorp/v3 v3.1.0/go.mod h1:dLEjIyyRNiXvNZ8PSmzpt1GsWAUK8kjVhEpjH8TixEw= +github.com/go-jose/go-jose/v4 v4.0.1 h1:QVEPDE3OluqXBQZDcnNvQrInro2h0e4eqNbnZSWqS6U= +github.com/go-jose/go-jose/v4 v4.0.1/go.mod h1:WVf9LFMHh/QVrmqrOfqun0C45tMe3RoiKJMPvgWwLfY= github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-kit/kit v0.12.0 h1:e4o3o3IsBfAKQh5Qbbiqyfu97Ku7jrO/JbohvztANh4= @@ -1718,6 +1722,7 @@ github.com/gtank/ristretto255 v0.1.2/go.mod h1:Ph5OpO6c7xKUGROZfWVLiJf9icMDwUeIv github.com/hashicorp/consul/api v1.25.1/go.mod h1:iiLVwR/htV7mas/sy0O+XSuEnrdBUUydemjxcUrAt4g= github.com/hashicorp/consul/sdk v0.14.1/go.mod h1:vFt03juSzocLRFo59NkeQHHmQa6+g7oU0pfzdI1mUhg= github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= +github.com/hashicorp/errwrap v1.1.0 h1:OxrOeh75EUXMY8TBjag2fzXGZ40LB6IKw45YeGUDY2I= github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= github.com/hashicorp/go-bexpr v0.1.10 h1:9kuI5PFotCboP3dkDYFr/wi0gg0QVbSNz5oFRpxn4uE= github.com/hashicorp/go-bexpr v0.1.10/go.mod h1:oxlubA2vC/gFVfX1A6JGp7ls7uCDlfJn732ehYYg+g0= @@ -1734,12 +1739,22 @@ github.com/hashicorp/go-msgpack v0.5.3/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iP github.com/hashicorp/go-msgpack v0.5.5/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM= github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk= github.com/hashicorp/go-multierror v1.1.0/go.mod h1:spPvp8C1qA32ftKqdAHm4hHTbPw+vmowP0z+KUhOZdA= +github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo= github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM= github.com/hashicorp/go-retryablehttp v0.5.3/go.mod h1:9B5zBasrRhHXnJnui7y6sL7es7NDiJgTc6Er0maI1Xs= +github.com/hashicorp/go-retryablehttp v0.7.7 h1:C8hUCYzor8PIfXHa4UrZkU4VvK8o9ISHxT2Q8+VepXU= +github.com/hashicorp/go-retryablehttp v0.7.7/go.mod h1:pkQpWZeYWskR+D1tR2O5OcBFOxfA7DoAO6xtkuQnHTk= +github.com/hashicorp/go-rootcerts v1.0.2 h1:jzhAVGtqPKbwpyCPELlgNWhE1znq+qwJtW5Oi2viEzc= github.com/hashicorp/go-rootcerts v1.0.2/go.mod h1:pqUvnprVnM5bf7AOirdbb01K4ccR319Vf4pU3K5EGc8= github.com/hashicorp/go-safetemp v1.0.0 h1:2HR189eFNrjHQyENnQMMpCiBAsRxzbTMIgBhEyExpmo= github.com/hashicorp/go-safetemp v1.0.0/go.mod h1:oaerMy3BhqiTbVye6QuFhFtIceqFoDHxNAB65b+Rj1I= +github.com/hashicorp/go-secure-stdlib/parseutil v0.1.6 h1:om4Al8Oy7kCm/B86rLCLah4Dt5Aa0Fr5rYBG60OzwHQ= +github.com/hashicorp/go-secure-stdlib/parseutil v0.1.6/go.mod h1:QmrqtbKuxxSWTN3ETMPuB+VtEiBJ/A9XhoYGv8E1uD8= +github.com/hashicorp/go-secure-stdlib/strutil v0.1.1/go.mod h1:gKOamz3EwoIoJq7mlMIRBpVTAUn8qPCrEclOKKWhD3U= +github.com/hashicorp/go-secure-stdlib/strutil v0.1.2 h1:kes8mmyCpxJsI7FTwtzRqEy9CdjCtrXrXGuOpxEA7Ts= +github.com/hashicorp/go-secure-stdlib/strutil v0.1.2/go.mod h1:Gou2R9+il93BqX25LAKCLuM+y9U2T4hlwvT1yprcna4= github.com/hashicorp/go-sockaddr v1.0.0/go.mod h1:7Xibr9yA9JjQq1JpNB2Vw7kxv8xerXegt+ozgdvDeDU= +github.com/hashicorp/go-sockaddr v1.0.2 h1:ztczhD1jLxIRjVejw8gFomI1BQZOe2WoVOu0SyteCQc= github.com/hashicorp/go-sockaddr v1.0.2/go.mod h1:rB4wwRAUzs07qva3c5SdrY/NEtAUjGlgmH/UkBUC97A= github.com/hashicorp/go-syslog v1.0.0/go.mod h1:qPfqrKkXGihmCqbJM2mZgkZGvKG1dFdvsLplgctolz4= github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= @@ -1761,6 +1776,8 @@ github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO github.com/hashicorp/mdns v1.0.4/go.mod h1:mtBihi+LeNXGtG8L9dX59gAEa12BDtBQSp4v/YAJqrc= github.com/hashicorp/memberlist v0.5.0/go.mod h1:yvyXLpo0QaGE59Y7hDTsTzDD25JYBZ4mHgHUZ8lrOI0= github.com/hashicorp/serf v0.10.1/go.mod h1:yL2t6BqATOLGc5HF7qbFkTfXoPIY0WZdWHfEvMqbG+4= +github.com/hashicorp/vault/api v1.15.0 h1:O24FYQCWwhwKnF7CuSqP30S51rTV7vz1iACXE/pj5DA= +github.com/hashicorp/vault/api v1.15.0/go.mod h1:+5YTO09JGn0u+b6ySD/LLVf8WkJCPLAL2Vkmrn2+CM8= github.com/hdevalence/ed25519consensus v0.0.0-20220222234857-c00d1f31bab3 h1:aSVUgRRRtOrZOC1fYmY9gV0e9z/Iu+xNVSASWjsuyGU= github.com/hdevalence/ed25519consensus v0.0.0-20220222234857-c00d1f31bab3/go.mod h1:5PC6ZNPde8bBqU/ewGZig35+UIZtw9Ytxez8/q5ZyFE= github.com/holiman/billy v0.0.0-20230718173358-1c7e68d277a7 h1:3JQNjnMRil1yD0IfZKHF9GxxWKDJGj8I0IqOUol//sw= @@ -2157,6 +2174,8 @@ github.com/ruudk/golang-pdf417 v0.0.0-20181029194003-1af4ab5afa58/go.mod h1:6lfF github.com/ruudk/golang-pdf417 v0.0.0-20201230142125-a7e3863a1245/go.mod h1:pQAZKsJ8yyVxGRWYNEm9oFB8ieLgKFnamEyDmSA0BRk= github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= github.com/ryanuber/columnize v2.1.0+incompatible/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= +github.com/ryanuber/go-glob v1.0.0 h1:iQh3xXAumdQ+4Ufa5b25cRpC5TYKlno6hsv6Cb3pkBk= +github.com/ryanuber/go-glob v1.0.0/go.mod h1:807d1WSdnB0XRJzKNil9Om6lcp/3a0v4qIHxIXzX/Yc= github.com/sagikazarmark/crypt v0.17.0/go.mod h1:SMtHTvdmsZMuY/bpZoqokSoChIrcJ/epOxZN58PbZDg= github.com/sagikazarmark/locafero v0.4.0 h1:HApY1R9zGo4DBgr7dqsTH/JJxLTTsOt7u6keLGt6kNQ= github.com/sagikazarmark/locafero v0.4.0/go.mod h1:Pe1W6UlPYUk/+wc/6KFhbORCfqzgYEpgQ3O5fPuL3H4= @@ -2320,6 +2339,8 @@ github.com/zondax/ledger-go v0.14.1/go.mod h1:fZ3Dqg6qcdXWSOJFKMG8GCTnD7slO/RL2f gitlab.com/distributed_lab/ape v1.6.1/go.mod h1:Qy9Y2arL0hmZIpVpctGEFhdrVsjWtyVJ5G+bZWcFT4s= gitlab.com/distributed_lab/ape v1.7.1 h1:LpTmZgG7Lvx6ulopQbH2aWI3s8ey9FsKVjbic3ZQIy4= gitlab.com/distributed_lab/ape v1.7.1/go.mod h1:Qy9Y2arL0hmZIpVpctGEFhdrVsjWtyVJ5G+bZWcFT4s= +gitlab.com/distributed_lab/dig v0.0.0-20230207152643-c44f80a4294c h1:cqPwdAw7oJpNeN0F80bg5vNI5t3oJoSCPSnC6oj+Zyw= +gitlab.com/distributed_lab/dig v0.0.0-20230207152643-c44f80a4294c/go.mod h1:NT4H8lLoIqJxFa9AM88+6uUZ38BmxnFU8VOm/LJYUF4= gitlab.com/distributed_lab/figure v2.1.2+incompatible h1:xO1KCYPK9KFx6OUBOaJ62d8vYd1R3aNgidHlC/ZtVBA= gitlab.com/distributed_lab/figure v2.1.2+incompatible/go.mod h1:tk+aPBohT49MGPLy5+eVbE1HpD/CaC5drBHfVpRI8eE= gitlab.com/distributed_lab/figure/v3 v3.1.4 h1:Wa9FtWkDcgzL53JmiZl3j17L2ugJ4o1u/5C2wiXCJgw= @@ -2416,6 +2437,8 @@ golang.org/x/crypto v0.15.0/go.mod h1:4ChreQoLWfG3xLDer1WdlH5NdlQ3+mwnQq1YTKY+72 golang.org/x/crypto v0.16.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4= golang.org/x/crypto v0.22.0 h1:g1v0xeRhjcugydODzvb3mEM9SQ0HGp9s/nh3COQ/C30= golang.org/x/crypto v0.22.0/go.mod h1:vr6Su+7cTlO45qkww3VDJlzDn0ctJvRgYbC2NvXHt+M= +golang.org/x/crypto v0.23.0 h1:dIJU/v2J8Mdglj/8rJ6UUOM3Zc9zLZxVZwwxMooUSAI= +golang.org/x/crypto v0.23.0/go.mod h1:CKFgDieR+mRhux2Lsu27y0fO304Db0wZe70UKqHu0v8= golang.org/x/exp v0.0.0-20180321215751-8460e604b9de/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20180807140117-3d87b88a115f/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= @@ -2569,6 +2592,8 @@ golang.org/x/net v0.18.0/go.mod h1:/czyP5RqHAH4odGYxBJ1qz0+CE5WZ+2j1YgoEo8F2jQ= golang.org/x/net v0.19.0/go.mod h1:CfAk/cbD4CthTvqiEl8NpboMuiuOYsAr/7NOjZJtv1U= golang.org/x/net v0.24.0 h1:1PcaxkF854Fu3+lvBIx5SYn9wRlBzzcnHZSiaFFAb0w= golang.org/x/net v0.24.0/go.mod h1:2Q7sJY5mzlzWjKtYUEXSlBWCdyaioyXzRB2RtU8KVE8= +golang.org/x/net v0.25.0 h1:d/OCCoBEUq33pjydKrGQhw7IlUPI2Oylr+8qLx49kac= +golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -2754,6 +2779,8 @@ golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/sys v0.19.0 h1:q5f1RH2jigJ1MoAWp2KTp3gm5zAGFUTarQZ5U386+4o= golang.org/x/sys v0.19.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.20.0 h1:Od9JTbYCk261bKm4M/mw7AklTlFYIa0bIp9BgSm1S8Y= +golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= @@ -2774,6 +2801,8 @@ golang.org/x/term v0.14.0/go.mod h1:TySc+nGkYR6qt8km8wUhuFRTVSMIX3XPR58y2lC8vww= golang.org/x/term v0.15.0/go.mod h1:BDl952bC7+uMoWR75FIrCDx79TPU9oHkTZ9yRbYOrX0= golang.org/x/term v0.19.0 h1:+ThwsDv+tYfnJFhF4L8jITxu1tdTWRTZpdsWgEgjL6Q= golang.org/x/term v0.19.0/go.mod h1:2CuTdWZ7KHSQwUzKva0cbMg6q2DMI3Mmxp+gKJbskEk= +golang.org/x/term v0.20.0 h1:VnkxpohqXaOBYJtBmEppKUG6mXpi+4O6purfc2+sMhw= +golang.org/x/term v0.20.0/go.mod h1:8UkIAJTvZgivsXaD6/pH6U9ecQzZ45awqEOzuCvwpFY= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -2796,6 +2825,8 @@ golang.org/x/text v0.12.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= +golang.org/x/text v0.15.0 h1:h1V/4gjBv8v9cjcR6+AR5+/cIYK5N/WAgiv4xlsEtAk= +golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= diff --git a/internal/assets/migrations/005_withdraw.sql b/internal/assets/migrations/005_withdraw.sql new file mode 100644 index 0000000..6049879 --- /dev/null +++ b/internal/assets/migrations/005_withdraw.sql @@ -0,0 +1,13 @@ +-- +migrate Up +CREATE TABLE IF NOT EXISTS withdrawals +( + id uuid PRIMARY KEY default gen_random_uuid(), + nullifier TEXT NOT NULL REFERENCES balances (nullifier), + amount integer NOT NULL, + created_at TIMESTAMP NOT NULL DEFAULT NOW() +); + +CREATE INDEX IF NOT EXISTS withdrawals_page_index ON withdrawals (nullifier, created_at); + +-- +migrate Down +DROP TABLE IF EXISTS withdrawals; \ No newline at end of file diff --git a/internal/config/levels.go b/internal/config/levels.go index 49bbba4..40179e3 100644 --- a/internal/config/levels.go +++ b/internal/config/levels.go @@ -10,10 +10,11 @@ import ( ) type Level struct { - Level int `fig:"lvl,required"` - Threshold int `fig:"threshold,required"` - Referrals int `fig:"referrals"` - Infinity bool `fig:"infinity"` + Level int `fig:"lvl,required"` + Threshold int `fig:"threshold,required"` + Referrals int `fig:"referrals"` + Infinity bool `fig:"infinity"` + WithdrawalAllowed bool `fig:"withdrawal_allowed"` } type Levels struct { @@ -51,6 +52,15 @@ func (c *config) Levels() *Levels { }).(*Levels) } +func (l *Levels) WithdrawalAllowed(level int) bool { + levelConfig, ok := l.levels[level] + if !ok { + return false + } + + return levelConfig.WithdrawalAllowed +} + // LvlUp Calculates new lvl. New lvl always greater then current level func (l *Levels) LvlChange(currentLevel int, totalAmount int64) (refCoundToAdd *int, newLevel int) { var downgrade bool diff --git a/internal/config/main.go b/internal/config/main.go index 70ca566..fc5e16c 100644 --- a/internal/config/main.go +++ b/internal/config/main.go @@ -20,6 +20,7 @@ type Config interface { evtypes.EventTypeser hmacsig.SigCalculatorProvider PollVerifierer + Rarimarket Levels() *Levels Verifiers() Verifiers @@ -35,6 +36,7 @@ type config struct { evtypes.EventTypeser hmacsig.SigCalculatorProvider PollVerifierer + Rarimarket passport root.VerifierProvider @@ -56,5 +58,6 @@ func New(getter kv.Getter) Config { passport: root.NewVerifierProvider(getter, root.PoseidonSMT), EventTypeser: evtypes.NewConfig(getter), SigCalculatorProvider: hmacsig.NewCalculatorProvider(getter), + Rarimarket: NewRarimarketConfig(getter), } } diff --git a/internal/config/poll_verifier.go b/internal/config/poll_verifier.go index 28a6833..4d398d6 100644 --- a/internal/config/poll_verifier.go +++ b/internal/config/poll_verifier.go @@ -4,10 +4,11 @@ import ( "context" "errors" "fmt" - "github.com/ethereum/go-ethereum/accounts/abi/bind" "math/big" "os" + "github.com/ethereum/go-ethereum/accounts/abi/bind" + "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/ethclient" zkptypes "github.com/iden3/go-rapidsnark/types" diff --git a/internal/config/rarimarket.go b/internal/config/rarimarket.go new file mode 100644 index 0000000..e6b6321 --- /dev/null +++ b/internal/config/rarimarket.go @@ -0,0 +1,218 @@ +package config + +import ( + "bytes" + "context" + "crypto/ecdsa" + "fmt" + "math/big" + "time" + + "github.com/ethereum/go-ethereum/accounts/abi/bind" + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/ethclient" + vaultapi "github.com/hashicorp/vault/api" + pointTokens "github.com/rarimo/geo-points-svc/internal/contracts/points" + accountFactory "github.com/rarimo/geo-points-svc/internal/contracts/rarimarketaccountfactory" + + "gitlab.com/distributed_lab/dig" + "gitlab.com/distributed_lab/figure/v3" + "gitlab.com/distributed_lab/kit/comfig" + "gitlab.com/distributed_lab/kit/kv" +) + +var ZeroAddress = common.HexToAddress("0x0000000000000000000000000000000000000000") + +type Rarimarket interface { + RarimarketConfig() *RarimarketConfig +} + +func NewRarimarketConfig(getter kv.Getter) Rarimarket { + return &rarimarketConfig{ + getter: getter, + } +} + +type rarimarketConfig struct { + once comfig.Once + getter kv.Getter +} + +type RarimarketConfig struct { + RPC *ethclient.Client + AccountFactory common.Address + ChainID *big.Int + PointPrice int64 + + privateKey *ecdsa.PrivateKey +} + +func (c *rarimarketConfig) RarimarketConfig() *RarimarketConfig { + return c.once.Do(func() interface{} { + var cfg struct { + RPC *ethclient.Client `fig:"rpc,required"` + AccountFactory common.Address `fig:"account_factory,required"` + PointTokens common.Address `fig:"point_tokens,required"` + PointPrice int64 `fig:"point_price,required"` + + VaultAddress string `fig:"vault_address"` + VaultMountPath string `fig:"vault_mount_path"` + PrivateKey *ecdsa.PrivateKey `fig:"private_key"` + } + + err := figure.Out(&cfg). + From(kv.MustGetStringMap(c.getter, "rarimarket")). + With(figure.EthereumHooks, figure.BaseHooks). + Please() + if err != nil { + panic(fmt.Errorf("failed to figure out rarimarket config: %w", err)) + } + + privateKey := cfg.PrivateKey + if privateKey == nil { + privateKey = extractPrivateKey(cfg.VaultAddress, cfg.VaultMountPath) + } + + chainID, err := cfg.RPC.ChainID(context.TODO()) + if err != nil { + panic(fmt.Errorf("failed to get chain id: %w", err)) + } + + return &RarimarketConfig{ + RPC: cfg.RPC, + AccountFactory: cfg.AccountFactory, + ChainID: chainID, + PointPrice: cfg.PointPrice, + + privateKey: privateKey, + } + }).(*RarimarketConfig) +} + +func (r *RarimarketConfig) CreateAccount(ctx context.Context, nullifier [32]byte) (common.Address, error) { + signerOpts, err := bind.NewKeyedTransactorWithChainID(r.privateKey, r.ChainID) + if err != nil { + return common.Address{}, fmt.Errorf("failed to get keyed transactor: %w", err) + } + + accountFactoryInstance, err := accountFactory.NewRarimarketAccountFactory(r.AccountFactory, r.RPC) + if err != nil { + return common.Address{}, fmt.Errorf("failed to get account factory: %w", err) + } + + tx, err := accountFactoryInstance.DeployRarimarketAccount(signerOpts, nullifier) + if err != nil { + return common.Address{}, fmt.Errorf("failed to deploy rarimarket account: %w", err) + } + + ctx, cancel := context.WithTimeout(ctx, 5*time.Minute) + defer cancel() + + rec, err := bind.WaitMined(ctx, r.RPC, tx) + if err != nil { + return common.Address{}, fmt.Errorf("failed to wait mined transaction: %w", err) + } + + abi, err := accountFactory.RarimarketAccountFactoryMetaData.GetAbi() + if err != nil { + return common.Address{}, fmt.Errorf("failed to get contract abi: %w", err) + } + + rarimarketAccountDeployedTopic := abi.Events["RarimarketAccountDeployed"].ID + + var event *accountFactory.RarimarketAccountFactoryRarimarketAccountDeployed + for _, log := range rec.Logs { + if !bytes.Equal(log.Topics[0][:], rarimarketAccountDeployedTopic[:]) { + continue + } + + event, err = accountFactoryInstance.ParseRarimarketAccountDeployed(*log) + if err != nil { + return common.Address{}, fmt.Errorf("failed to unpack log: %w", err) + } + break + } + + return event.Account, nil +} + +func (r *RarimarketConfig) GetAccount(nullifier [32]byte) (common.Address, error) { + accountFactoryInstance, err := accountFactory.NewRarimarketAccountFactory(r.AccountFactory, r.RPC) + if err != nil { + return common.Address{}, fmt.Errorf("failed to get account factory: %w", err) + } + + accountAddress, err := accountFactoryInstance.GetRarimarketAccount(nil, nullifier) + if err != nil { + return common.Address{}, fmt.Errorf("failed to get rarimarket account: %w", err) + } + + return accountAddress, nil +} + +func (r *RarimarketConfig) Mint(ctx context.Context, account common.Address, amount *big.Int) error { + signerOpts, err := bind.NewKeyedTransactorWithChainID(r.privateKey, r.ChainID) + if err != nil { + return fmt.Errorf("failed to get keyed transactor: %w", err) + } + + pointTokensInstance, err := pointTokens.NewPoints(r.AccountFactory, r.RPC) + if err != nil { + return fmt.Errorf("failed to get account factory: %w", err) + } + + tx, err := pointTokensInstance.Mint(signerOpts, account, amount) + if err != nil { + return fmt.Errorf("failed to deploy rarimarket account: %w", err) + } + + ctx, cancel := context.WithTimeout(ctx, 5*time.Minute) + defer cancel() + + _, err = bind.WaitMined(ctx, r.RPC, tx) + if err != nil { + return fmt.Errorf("failed to wait mined transaction: %w", err) + } + + return nil +} + +func extractPrivateKey(vaultAddress, vaultMountPath string) *ecdsa.PrivateKey { + conf := vaultapi.DefaultConfig() + conf.Address = vaultAddress + + vaultClient, err := vaultapi.NewClient(conf) + if err != nil { + panic(fmt.Errorf("failed to initialize new client: %w", err)) + } + + token := struct { + Token string `dig:"VAULT_TOKEN,clear"` + }{} + + err = dig.Out(&token).Now() + if err != nil { + panic(fmt.Errorf("failed to dig out token: %w", err)) + } + + vaultClient.SetToken(token.Token) + + secret, err := vaultClient.KVv2(vaultMountPath).Get(context.Background(), "geo-points") + if err != nil { + panic(fmt.Errorf("failed to get secret: %w", err)) + } + + vaultRelayerConf := struct { + PrivateKey *ecdsa.PrivateKey `fig:"private_key,required"` + }{} + + if err := figure. + Out(&vaultRelayerConf). + With(figure.EthereumHooks). + From(secret.Data). + Please(); err != nil { + panic(fmt.Errorf("failed to figure out private_key: %w", err)) + } + + return vaultRelayerConf.PrivateKey +} diff --git a/internal/contracts/points/Points.go b/internal/contracts/points/Points.go new file mode 100644 index 0000000..42122f1 --- /dev/null +++ b/internal/contracts/points/Points.go @@ -0,0 +1,2766 @@ +// Code generated - DO NOT EDIT. +// This file is a generated binding and any manual changes will be lost. + +package points + +import ( + "errors" + "math/big" + "strings" + + ethereum "github.com/ethereum/go-ethereum" + "github.com/ethereum/go-ethereum/accounts/abi" + "github.com/ethereum/go-ethereum/accounts/abi/bind" + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/core/types" + "github.com/ethereum/go-ethereum/event" +) + +// Reference imports to suppress errors if they are not otherwise used. +var ( + _ = errors.New + _ = big.NewInt + _ = strings.NewReader + _ = ethereum.NotFound + _ = bind.Bind + _ = common.Big1 + _ = types.BloomLookup + _ = event.NewSubscription + _ = abi.ConvertType +) + +// DiamondFacet is an auto generated low-level Go binding around an user-defined struct. +type DiamondFacet struct { + FacetAddress common.Address + Action uint8 + FunctionSelectors [][4]byte +} + +// DiamondStorageFacetInfo is an auto generated low-level Go binding around an user-defined struct. +type DiamondStorageFacetInfo struct { + FacetAddress common.Address + FunctionSelectors [][4]byte +} + +// PointsMetaData contains all meta data concerning the Points contract. +var PointsMetaData = &bind.MetaData{ + ABI: "[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"Approval\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"facetAddress\",\"type\":\"address\"},{\"internalType\":\"enumDiamond.FacetAction\",\"name\":\"action\",\"type\":\"uint8\"},{\"internalType\":\"bytes4[]\",\"name\":\"functionSelectors\",\"type\":\"bytes4[]\"}],\"indexed\":false,\"internalType\":\"structDiamond.Facet[]\",\"name\":\"facets\",\"type\":\"tuple[]\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"initFacet\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"initData\",\"type\":\"bytes\"}],\"name\":\"DiamondCut\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[],\"name\":\"EIP712DomainChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"storageSlot\",\"type\":\"bytes32\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"previousAdminRole\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"newAdminRole\",\"type\":\"bytes32\"}],\"name\":\"RoleAdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"RoleGranted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"RoleRevoked\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"Transfer\",\"type\":\"event\"},{\"stateMutability\":\"payable\",\"type\":\"fallback\"},{\"inputs\":[],\"name\":\"AGENT_ROLE\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"BURN_SELECTOR\",\"outputs\":[{\"internalType\":\"bytes4\",\"name\":\"\",\"type\":\"bytes4\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"DEFAULT_ADMIN_ROLE\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"DIAMOND_ACCESS_CONTROL_STORAGE_SLOT\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"DIAMOND_ERC20_STORAGE_SLOT\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"DIAMOND_STORAGE_SLOT\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"DOMAIN_SEPARATOR\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"EIP712_DIAMOND_STORAGE_SLOT\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"FORCED_TRANSFER_SELECTOR\",\"outputs\":[{\"internalType\":\"bytes4\",\"name\":\"\",\"type\":\"bytes4\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"MINTER_ROLE\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"MINT_SELECTOR\",\"outputs\":[{\"internalType\":\"bytes4\",\"name\":\"\",\"type\":\"bytes4\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"PERMIT_TYPEHASH\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"POINTS_STORAGE_SLOT\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"RECOVERY_SELECTOR\",\"outputs\":[{\"internalType\":\"bytes4\",\"name\":\"\",\"type\":\"bytes4\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"TRANSFER_FROM_SELECTOR\",\"outputs\":[{\"internalType\":\"bytes4\",\"name\":\"\",\"type\":\"bytes4\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"TRANSFER_SELECTOR\",\"outputs\":[{\"internalType\":\"bytes4\",\"name\":\"\",\"type\":\"bytes4\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"TYPE_HASH\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"UPGRADER_ROLE\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"name_\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"symbol_\",\"type\":\"string\"},{\"internalType\":\"uint8\",\"name\":\"decimals_\",\"type\":\"uint8\"},{\"internalType\":\"address\",\"name\":\"regulatoryCompliance_\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"kycCompliance_\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"initRegulatory_\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"initKYC_\",\"type\":\"bytes\"}],\"name\":\"__Points_init\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner_\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"spender_\",\"type\":\"address\"}],\"name\":\"allowance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"spender_\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount_\",\"type\":\"uint256\"}],\"name\":\"approve\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account_\",\"type\":\"address\"}],\"name\":\"balanceOf\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account_\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount_\",\"type\":\"uint256\"}],\"name\":\"burn\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role_\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account_\",\"type\":\"address\"}],\"name\":\"checkRole\",\"outputs\":[],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"decimals\",\"outputs\":[{\"internalType\":\"uint8\",\"name\":\"\",\"type\":\"uint8\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"facetAddress\",\"type\":\"address\"},{\"internalType\":\"enumDiamond.FacetAction\",\"name\":\"action\",\"type\":\"uint8\"},{\"internalType\":\"bytes4[]\",\"name\":\"functionSelectors\",\"type\":\"bytes4[]\"}],\"internalType\":\"structDiamond.Facet[]\",\"name\":\"modules_\",\"type\":\"tuple[]\"},{\"internalType\":\"address\",\"name\":\"initModule_\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"initData_\",\"type\":\"bytes\"}],\"name\":\"diamondCut\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"facetAddress\",\"type\":\"address\"},{\"internalType\":\"enumDiamond.FacetAction\",\"name\":\"action\",\"type\":\"uint8\"},{\"internalType\":\"bytes4[]\",\"name\":\"functionSelectors\",\"type\":\"bytes4[]\"}],\"internalType\":\"structDiamond.Facet[]\",\"name\":\"modules_\",\"type\":\"tuple[]\"}],\"name\":\"diamondCut\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"eip712Domain\",\"outputs\":[{\"internalType\":\"bytes1\",\"name\":\"fields\",\"type\":\"bytes1\"},{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"version\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"verifyingContract\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"salt\",\"type\":\"bytes32\"},{\"internalType\":\"uint256[]\",\"name\":\"extensions\",\"type\":\"uint256[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"selector_\",\"type\":\"bytes4\"}],\"name\":\"facetAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"facet_\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"facetAddresses\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"facets_\",\"type\":\"address[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"facet_\",\"type\":\"address\"}],\"name\":\"facetFunctionSelectors\",\"outputs\":[{\"internalType\":\"bytes4[]\",\"name\":\"selectors_\",\"type\":\"bytes4[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"facets\",\"outputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"facetAddress\",\"type\":\"address\"},{\"internalType\":\"bytes4[]\",\"name\":\"functionSelectors\",\"type\":\"bytes4[]\"}],\"internalType\":\"structDiamondStorage.FacetInfo[]\",\"name\":\"facets_\",\"type\":\"tuple[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"from_\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to_\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount_\",\"type\":\"uint256\"}],\"name\":\"forcedTransfer\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role_\",\"type\":\"bytes32\"}],\"name\":\"getRoleAdmin\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role_\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account_\",\"type\":\"address\"}],\"name\":\"grantRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role_\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account_\",\"type\":\"address\"}],\"name\":\"hasRole\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account_\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount_\",\"type\":\"uint256\"}],\"name\":\"mint\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"name\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"nonces\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"deadline\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"signature\",\"type\":\"bytes\"}],\"name\":\"permit\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"oldAccount_\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"newAccount_\",\"type\":\"address\"}],\"name\":\"recovery\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role_\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account_\",\"type\":\"address\"}],\"name\":\"renounceRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role_\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account_\",\"type\":\"address\"}],\"name\":\"revokeRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"symbol\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalSupply\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"to_\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount_\",\"type\":\"uint256\"}],\"name\":\"transfer\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"from_\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to_\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount_\",\"type\":\"uint256\"}],\"name\":\"transferFrom\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", +} + +// PointsABI is the input ABI used to generate the binding from. +// Deprecated: Use PointsMetaData.ABI instead. +var PointsABI = PointsMetaData.ABI + +// Points is an auto generated Go binding around an Ethereum contract. +type Points struct { + PointsCaller // Read-only binding to the contract + PointsTransactor // Write-only binding to the contract + PointsFilterer // Log filterer for contract events +} + +// PointsCaller is an auto generated read-only Go binding around an Ethereum contract. +type PointsCaller struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// PointsTransactor is an auto generated write-only Go binding around an Ethereum contract. +type PointsTransactor struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// PointsFilterer is an auto generated log filtering Go binding around an Ethereum contract events. +type PointsFilterer struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// PointsSession is an auto generated Go binding around an Ethereum contract, +// with pre-set call and transact options. +type PointsSession struct { + Contract *Points // Generic contract binding to set the session for + CallOpts bind.CallOpts // Call options to use throughout this session + TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session +} + +// PointsCallerSession is an auto generated read-only Go binding around an Ethereum contract, +// with pre-set call options. +type PointsCallerSession struct { + Contract *PointsCaller // Generic contract caller binding to set the session for + CallOpts bind.CallOpts // Call options to use throughout this session +} + +// PointsTransactorSession is an auto generated write-only Go binding around an Ethereum contract, +// with pre-set transact options. +type PointsTransactorSession struct { + Contract *PointsTransactor // Generic contract transactor binding to set the session for + TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session +} + +// PointsRaw is an auto generated low-level Go binding around an Ethereum contract. +type PointsRaw struct { + Contract *Points // Generic contract binding to access the raw methods on +} + +// PointsCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract. +type PointsCallerRaw struct { + Contract *PointsCaller // Generic read-only contract binding to access the raw methods on +} + +// PointsTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract. +type PointsTransactorRaw struct { + Contract *PointsTransactor // Generic write-only contract binding to access the raw methods on +} + +// NewPoints creates a new instance of Points, bound to a specific deployed contract. +func NewPoints(address common.Address, backend bind.ContractBackend) (*Points, error) { + contract, err := bindPoints(address, backend, backend, backend) + if err != nil { + return nil, err + } + return &Points{PointsCaller: PointsCaller{contract: contract}, PointsTransactor: PointsTransactor{contract: contract}, PointsFilterer: PointsFilterer{contract: contract}}, nil +} + +// NewPointsCaller creates a new read-only instance of Points, bound to a specific deployed contract. +func NewPointsCaller(address common.Address, caller bind.ContractCaller) (*PointsCaller, error) { + contract, err := bindPoints(address, caller, nil, nil) + if err != nil { + return nil, err + } + return &PointsCaller{contract: contract}, nil +} + +// NewPointsTransactor creates a new write-only instance of Points, bound to a specific deployed contract. +func NewPointsTransactor(address common.Address, transactor bind.ContractTransactor) (*PointsTransactor, error) { + contract, err := bindPoints(address, nil, transactor, nil) + if err != nil { + return nil, err + } + return &PointsTransactor{contract: contract}, nil +} + +// NewPointsFilterer creates a new log filterer instance of Points, bound to a specific deployed contract. +func NewPointsFilterer(address common.Address, filterer bind.ContractFilterer) (*PointsFilterer, error) { + contract, err := bindPoints(address, nil, nil, filterer) + if err != nil { + return nil, err + } + return &PointsFilterer{contract: contract}, nil +} + +// bindPoints binds a generic wrapper to an already deployed contract. +func bindPoints(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { + parsed, err := PointsMetaData.GetAbi() + if err != nil { + return nil, err + } + return bind.NewBoundContract(address, *parsed, caller, transactor, filterer), nil +} + +// Call invokes the (constant) contract method with params as input values and +// sets the output to result. The result type might be a single field for simple +// returns, a slice of interfaces for anonymous returns and a struct for named +// returns. +func (_Points *PointsRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _Points.Contract.PointsCaller.contract.Call(opts, result, method, params...) +} + +// Transfer initiates a plain transaction to move funds to the contract, calling +// its default method if one is available. +func (_Points *PointsRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _Points.Contract.PointsTransactor.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_Points *PointsRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _Points.Contract.PointsTransactor.contract.Transact(opts, method, params...) +} + +// Call invokes the (constant) contract method with params as input values and +// sets the output to result. The result type might be a single field for simple +// returns, a slice of interfaces for anonymous returns and a struct for named +// returns. +func (_Points *PointsCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _Points.Contract.contract.Call(opts, result, method, params...) +} + +// Transfer initiates a plain transaction to move funds to the contract, calling +// its default method if one is available. +func (_Points *PointsTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _Points.Contract.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_Points *PointsTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _Points.Contract.contract.Transact(opts, method, params...) +} + +// AGENTROLE is a free data retrieval call binding the contract method 0x22459e18. +// +// Solidity: function AGENT_ROLE() view returns(bytes32) +func (_Points *PointsCaller) AGENTROLE(opts *bind.CallOpts) ([32]byte, error) { + var out []interface{} + err := _Points.contract.Call(opts, &out, "AGENT_ROLE") + + if err != nil { + return *new([32]byte), err + } + + out0 := *abi.ConvertType(out[0], new([32]byte)).(*[32]byte) + + return out0, err + +} + +// AGENTROLE is a free data retrieval call binding the contract method 0x22459e18. +// +// Solidity: function AGENT_ROLE() view returns(bytes32) +func (_Points *PointsSession) AGENTROLE() ([32]byte, error) { + return _Points.Contract.AGENTROLE(&_Points.CallOpts) +} + +// AGENTROLE is a free data retrieval call binding the contract method 0x22459e18. +// +// Solidity: function AGENT_ROLE() view returns(bytes32) +func (_Points *PointsCallerSession) AGENTROLE() ([32]byte, error) { + return _Points.Contract.AGENTROLE(&_Points.CallOpts) +} + +// BURNSELECTOR is a free data retrieval call binding the contract method 0x87a131bb. +// +// Solidity: function BURN_SELECTOR() view returns(bytes4) +func (_Points *PointsCaller) BURNSELECTOR(opts *bind.CallOpts) ([4]byte, error) { + var out []interface{} + err := _Points.contract.Call(opts, &out, "BURN_SELECTOR") + + if err != nil { + return *new([4]byte), err + } + + out0 := *abi.ConvertType(out[0], new([4]byte)).(*[4]byte) + + return out0, err + +} + +// BURNSELECTOR is a free data retrieval call binding the contract method 0x87a131bb. +// +// Solidity: function BURN_SELECTOR() view returns(bytes4) +func (_Points *PointsSession) BURNSELECTOR() ([4]byte, error) { + return _Points.Contract.BURNSELECTOR(&_Points.CallOpts) +} + +// BURNSELECTOR is a free data retrieval call binding the contract method 0x87a131bb. +// +// Solidity: function BURN_SELECTOR() view returns(bytes4) +func (_Points *PointsCallerSession) BURNSELECTOR() ([4]byte, error) { + return _Points.Contract.BURNSELECTOR(&_Points.CallOpts) +} + +// DEFAULTADMINROLE is a free data retrieval call binding the contract method 0xa217fddf. +// +// Solidity: function DEFAULT_ADMIN_ROLE() view returns(bytes32) +func (_Points *PointsCaller) DEFAULTADMINROLE(opts *bind.CallOpts) ([32]byte, error) { + var out []interface{} + err := _Points.contract.Call(opts, &out, "DEFAULT_ADMIN_ROLE") + + if err != nil { + return *new([32]byte), err + } + + out0 := *abi.ConvertType(out[0], new([32]byte)).(*[32]byte) + + return out0, err + +} + +// DEFAULTADMINROLE is a free data retrieval call binding the contract method 0xa217fddf. +// +// Solidity: function DEFAULT_ADMIN_ROLE() view returns(bytes32) +func (_Points *PointsSession) DEFAULTADMINROLE() ([32]byte, error) { + return _Points.Contract.DEFAULTADMINROLE(&_Points.CallOpts) +} + +// DEFAULTADMINROLE is a free data retrieval call binding the contract method 0xa217fddf. +// +// Solidity: function DEFAULT_ADMIN_ROLE() view returns(bytes32) +func (_Points *PointsCallerSession) DEFAULTADMINROLE() ([32]byte, error) { + return _Points.Contract.DEFAULTADMINROLE(&_Points.CallOpts) +} + +// DIAMONDACCESSCONTROLSTORAGESLOT is a free data retrieval call binding the contract method 0xb29b3bc0. +// +// Solidity: function DIAMOND_ACCESS_CONTROL_STORAGE_SLOT() view returns(bytes32) +func (_Points *PointsCaller) DIAMONDACCESSCONTROLSTORAGESLOT(opts *bind.CallOpts) ([32]byte, error) { + var out []interface{} + err := _Points.contract.Call(opts, &out, "DIAMOND_ACCESS_CONTROL_STORAGE_SLOT") + + if err != nil { + return *new([32]byte), err + } + + out0 := *abi.ConvertType(out[0], new([32]byte)).(*[32]byte) + + return out0, err + +} + +// DIAMONDACCESSCONTROLSTORAGESLOT is a free data retrieval call binding the contract method 0xb29b3bc0. +// +// Solidity: function DIAMOND_ACCESS_CONTROL_STORAGE_SLOT() view returns(bytes32) +func (_Points *PointsSession) DIAMONDACCESSCONTROLSTORAGESLOT() ([32]byte, error) { + return _Points.Contract.DIAMONDACCESSCONTROLSTORAGESLOT(&_Points.CallOpts) +} + +// DIAMONDACCESSCONTROLSTORAGESLOT is a free data retrieval call binding the contract method 0xb29b3bc0. +// +// Solidity: function DIAMOND_ACCESS_CONTROL_STORAGE_SLOT() view returns(bytes32) +func (_Points *PointsCallerSession) DIAMONDACCESSCONTROLSTORAGESLOT() ([32]byte, error) { + return _Points.Contract.DIAMONDACCESSCONTROLSTORAGESLOT(&_Points.CallOpts) +} + +// DIAMONDERC20STORAGESLOT is a free data retrieval call binding the contract method 0x6812cb2a. +// +// Solidity: function DIAMOND_ERC20_STORAGE_SLOT() view returns(bytes32) +func (_Points *PointsCaller) DIAMONDERC20STORAGESLOT(opts *bind.CallOpts) ([32]byte, error) { + var out []interface{} + err := _Points.contract.Call(opts, &out, "DIAMOND_ERC20_STORAGE_SLOT") + + if err != nil { + return *new([32]byte), err + } + + out0 := *abi.ConvertType(out[0], new([32]byte)).(*[32]byte) + + return out0, err + +} + +// DIAMONDERC20STORAGESLOT is a free data retrieval call binding the contract method 0x6812cb2a. +// +// Solidity: function DIAMOND_ERC20_STORAGE_SLOT() view returns(bytes32) +func (_Points *PointsSession) DIAMONDERC20STORAGESLOT() ([32]byte, error) { + return _Points.Contract.DIAMONDERC20STORAGESLOT(&_Points.CallOpts) +} + +// DIAMONDERC20STORAGESLOT is a free data retrieval call binding the contract method 0x6812cb2a. +// +// Solidity: function DIAMOND_ERC20_STORAGE_SLOT() view returns(bytes32) +func (_Points *PointsCallerSession) DIAMONDERC20STORAGESLOT() ([32]byte, error) { + return _Points.Contract.DIAMONDERC20STORAGESLOT(&_Points.CallOpts) +} + +// DIAMONDSTORAGESLOT is a free data retrieval call binding the contract method 0xe828c51f. +// +// Solidity: function DIAMOND_STORAGE_SLOT() view returns(bytes32) +func (_Points *PointsCaller) DIAMONDSTORAGESLOT(opts *bind.CallOpts) ([32]byte, error) { + var out []interface{} + err := _Points.contract.Call(opts, &out, "DIAMOND_STORAGE_SLOT") + + if err != nil { + return *new([32]byte), err + } + + out0 := *abi.ConvertType(out[0], new([32]byte)).(*[32]byte) + + return out0, err + +} + +// DIAMONDSTORAGESLOT is a free data retrieval call binding the contract method 0xe828c51f. +// +// Solidity: function DIAMOND_STORAGE_SLOT() view returns(bytes32) +func (_Points *PointsSession) DIAMONDSTORAGESLOT() ([32]byte, error) { + return _Points.Contract.DIAMONDSTORAGESLOT(&_Points.CallOpts) +} + +// DIAMONDSTORAGESLOT is a free data retrieval call binding the contract method 0xe828c51f. +// +// Solidity: function DIAMOND_STORAGE_SLOT() view returns(bytes32) +func (_Points *PointsCallerSession) DIAMONDSTORAGESLOT() ([32]byte, error) { + return _Points.Contract.DIAMONDSTORAGESLOT(&_Points.CallOpts) +} + +// DOMAINSEPARATOR is a free data retrieval call binding the contract method 0x3644e515. +// +// Solidity: function DOMAIN_SEPARATOR() view returns(bytes32) +func (_Points *PointsCaller) DOMAINSEPARATOR(opts *bind.CallOpts) ([32]byte, error) { + var out []interface{} + err := _Points.contract.Call(opts, &out, "DOMAIN_SEPARATOR") + + if err != nil { + return *new([32]byte), err + } + + out0 := *abi.ConvertType(out[0], new([32]byte)).(*[32]byte) + + return out0, err + +} + +// DOMAINSEPARATOR is a free data retrieval call binding the contract method 0x3644e515. +// +// Solidity: function DOMAIN_SEPARATOR() view returns(bytes32) +func (_Points *PointsSession) DOMAINSEPARATOR() ([32]byte, error) { + return _Points.Contract.DOMAINSEPARATOR(&_Points.CallOpts) +} + +// DOMAINSEPARATOR is a free data retrieval call binding the contract method 0x3644e515. +// +// Solidity: function DOMAIN_SEPARATOR() view returns(bytes32) +func (_Points *PointsCallerSession) DOMAINSEPARATOR() ([32]byte, error) { + return _Points.Contract.DOMAINSEPARATOR(&_Points.CallOpts) +} + +// EIP712DIAMONDSTORAGESLOT is a free data retrieval call binding the contract method 0x20cb691b. +// +// Solidity: function EIP712_DIAMOND_STORAGE_SLOT() view returns(bytes32) +func (_Points *PointsCaller) EIP712DIAMONDSTORAGESLOT(opts *bind.CallOpts) ([32]byte, error) { + var out []interface{} + err := _Points.contract.Call(opts, &out, "EIP712_DIAMOND_STORAGE_SLOT") + + if err != nil { + return *new([32]byte), err + } + + out0 := *abi.ConvertType(out[0], new([32]byte)).(*[32]byte) + + return out0, err + +} + +// EIP712DIAMONDSTORAGESLOT is a free data retrieval call binding the contract method 0x20cb691b. +// +// Solidity: function EIP712_DIAMOND_STORAGE_SLOT() view returns(bytes32) +func (_Points *PointsSession) EIP712DIAMONDSTORAGESLOT() ([32]byte, error) { + return _Points.Contract.EIP712DIAMONDSTORAGESLOT(&_Points.CallOpts) +} + +// EIP712DIAMONDSTORAGESLOT is a free data retrieval call binding the contract method 0x20cb691b. +// +// Solidity: function EIP712_DIAMOND_STORAGE_SLOT() view returns(bytes32) +func (_Points *PointsCallerSession) EIP712DIAMONDSTORAGESLOT() ([32]byte, error) { + return _Points.Contract.EIP712DIAMONDSTORAGESLOT(&_Points.CallOpts) +} + +// FORCEDTRANSFERSELECTOR is a free data retrieval call binding the contract method 0xc7ff5a47. +// +// Solidity: function FORCED_TRANSFER_SELECTOR() view returns(bytes4) +func (_Points *PointsCaller) FORCEDTRANSFERSELECTOR(opts *bind.CallOpts) ([4]byte, error) { + var out []interface{} + err := _Points.contract.Call(opts, &out, "FORCED_TRANSFER_SELECTOR") + + if err != nil { + return *new([4]byte), err + } + + out0 := *abi.ConvertType(out[0], new([4]byte)).(*[4]byte) + + return out0, err + +} + +// FORCEDTRANSFERSELECTOR is a free data retrieval call binding the contract method 0xc7ff5a47. +// +// Solidity: function FORCED_TRANSFER_SELECTOR() view returns(bytes4) +func (_Points *PointsSession) FORCEDTRANSFERSELECTOR() ([4]byte, error) { + return _Points.Contract.FORCEDTRANSFERSELECTOR(&_Points.CallOpts) +} + +// FORCEDTRANSFERSELECTOR is a free data retrieval call binding the contract method 0xc7ff5a47. +// +// Solidity: function FORCED_TRANSFER_SELECTOR() view returns(bytes4) +func (_Points *PointsCallerSession) FORCEDTRANSFERSELECTOR() ([4]byte, error) { + return _Points.Contract.FORCEDTRANSFERSELECTOR(&_Points.CallOpts) +} + +// MINTERROLE is a free data retrieval call binding the contract method 0xd5391393. +// +// Solidity: function MINTER_ROLE() view returns(bytes32) +func (_Points *PointsCaller) MINTERROLE(opts *bind.CallOpts) ([32]byte, error) { + var out []interface{} + err := _Points.contract.Call(opts, &out, "MINTER_ROLE") + + if err != nil { + return *new([32]byte), err + } + + out0 := *abi.ConvertType(out[0], new([32]byte)).(*[32]byte) + + return out0, err + +} + +// MINTERROLE is a free data retrieval call binding the contract method 0xd5391393. +// +// Solidity: function MINTER_ROLE() view returns(bytes32) +func (_Points *PointsSession) MINTERROLE() ([32]byte, error) { + return _Points.Contract.MINTERROLE(&_Points.CallOpts) +} + +// MINTERROLE is a free data retrieval call binding the contract method 0xd5391393. +// +// Solidity: function MINTER_ROLE() view returns(bytes32) +func (_Points *PointsCallerSession) MINTERROLE() ([32]byte, error) { + return _Points.Contract.MINTERROLE(&_Points.CallOpts) +} + +// MINTSELECTOR is a free data retrieval call binding the contract method 0x544fe464. +// +// Solidity: function MINT_SELECTOR() view returns(bytes4) +func (_Points *PointsCaller) MINTSELECTOR(opts *bind.CallOpts) ([4]byte, error) { + var out []interface{} + err := _Points.contract.Call(opts, &out, "MINT_SELECTOR") + + if err != nil { + return *new([4]byte), err + } + + out0 := *abi.ConvertType(out[0], new([4]byte)).(*[4]byte) + + return out0, err + +} + +// MINTSELECTOR is a free data retrieval call binding the contract method 0x544fe464. +// +// Solidity: function MINT_SELECTOR() view returns(bytes4) +func (_Points *PointsSession) MINTSELECTOR() ([4]byte, error) { + return _Points.Contract.MINTSELECTOR(&_Points.CallOpts) +} + +// MINTSELECTOR is a free data retrieval call binding the contract method 0x544fe464. +// +// Solidity: function MINT_SELECTOR() view returns(bytes4) +func (_Points *PointsCallerSession) MINTSELECTOR() ([4]byte, error) { + return _Points.Contract.MINTSELECTOR(&_Points.CallOpts) +} + +// PERMITTYPEHASH is a free data retrieval call binding the contract method 0x30adf81f. +// +// Solidity: function PERMIT_TYPEHASH() view returns(bytes32) +func (_Points *PointsCaller) PERMITTYPEHASH(opts *bind.CallOpts) ([32]byte, error) { + var out []interface{} + err := _Points.contract.Call(opts, &out, "PERMIT_TYPEHASH") + + if err != nil { + return *new([32]byte), err + } + + out0 := *abi.ConvertType(out[0], new([32]byte)).(*[32]byte) + + return out0, err + +} + +// PERMITTYPEHASH is a free data retrieval call binding the contract method 0x30adf81f. +// +// Solidity: function PERMIT_TYPEHASH() view returns(bytes32) +func (_Points *PointsSession) PERMITTYPEHASH() ([32]byte, error) { + return _Points.Contract.PERMITTYPEHASH(&_Points.CallOpts) +} + +// PERMITTYPEHASH is a free data retrieval call binding the contract method 0x30adf81f. +// +// Solidity: function PERMIT_TYPEHASH() view returns(bytes32) +func (_Points *PointsCallerSession) PERMITTYPEHASH() ([32]byte, error) { + return _Points.Contract.PERMITTYPEHASH(&_Points.CallOpts) +} + +// POINTSSTORAGESLOT is a free data retrieval call binding the contract method 0x616e3487. +// +// Solidity: function POINTS_STORAGE_SLOT() view returns(bytes32) +func (_Points *PointsCaller) POINTSSTORAGESLOT(opts *bind.CallOpts) ([32]byte, error) { + var out []interface{} + err := _Points.contract.Call(opts, &out, "POINTS_STORAGE_SLOT") + + if err != nil { + return *new([32]byte), err + } + + out0 := *abi.ConvertType(out[0], new([32]byte)).(*[32]byte) + + return out0, err + +} + +// POINTSSTORAGESLOT is a free data retrieval call binding the contract method 0x616e3487. +// +// Solidity: function POINTS_STORAGE_SLOT() view returns(bytes32) +func (_Points *PointsSession) POINTSSTORAGESLOT() ([32]byte, error) { + return _Points.Contract.POINTSSTORAGESLOT(&_Points.CallOpts) +} + +// POINTSSTORAGESLOT is a free data retrieval call binding the contract method 0x616e3487. +// +// Solidity: function POINTS_STORAGE_SLOT() view returns(bytes32) +func (_Points *PointsCallerSession) POINTSSTORAGESLOT() ([32]byte, error) { + return _Points.Contract.POINTSSTORAGESLOT(&_Points.CallOpts) +} + +// RECOVERYSELECTOR is a free data retrieval call binding the contract method 0xe4c38584. +// +// Solidity: function RECOVERY_SELECTOR() view returns(bytes4) +func (_Points *PointsCaller) RECOVERYSELECTOR(opts *bind.CallOpts) ([4]byte, error) { + var out []interface{} + err := _Points.contract.Call(opts, &out, "RECOVERY_SELECTOR") + + if err != nil { + return *new([4]byte), err + } + + out0 := *abi.ConvertType(out[0], new([4]byte)).(*[4]byte) + + return out0, err + +} + +// RECOVERYSELECTOR is a free data retrieval call binding the contract method 0xe4c38584. +// +// Solidity: function RECOVERY_SELECTOR() view returns(bytes4) +func (_Points *PointsSession) RECOVERYSELECTOR() ([4]byte, error) { + return _Points.Contract.RECOVERYSELECTOR(&_Points.CallOpts) +} + +// RECOVERYSELECTOR is a free data retrieval call binding the contract method 0xe4c38584. +// +// Solidity: function RECOVERY_SELECTOR() view returns(bytes4) +func (_Points *PointsCallerSession) RECOVERYSELECTOR() ([4]byte, error) { + return _Points.Contract.RECOVERYSELECTOR(&_Points.CallOpts) +} + +// TRANSFERFROMSELECTOR is a free data retrieval call binding the contract method 0xa53016a3. +// +// Solidity: function TRANSFER_FROM_SELECTOR() view returns(bytes4) +func (_Points *PointsCaller) TRANSFERFROMSELECTOR(opts *bind.CallOpts) ([4]byte, error) { + var out []interface{} + err := _Points.contract.Call(opts, &out, "TRANSFER_FROM_SELECTOR") + + if err != nil { + return *new([4]byte), err + } + + out0 := *abi.ConvertType(out[0], new([4]byte)).(*[4]byte) + + return out0, err + +} + +// TRANSFERFROMSELECTOR is a free data retrieval call binding the contract method 0xa53016a3. +// +// Solidity: function TRANSFER_FROM_SELECTOR() view returns(bytes4) +func (_Points *PointsSession) TRANSFERFROMSELECTOR() ([4]byte, error) { + return _Points.Contract.TRANSFERFROMSELECTOR(&_Points.CallOpts) +} + +// TRANSFERFROMSELECTOR is a free data retrieval call binding the contract method 0xa53016a3. +// +// Solidity: function TRANSFER_FROM_SELECTOR() view returns(bytes4) +func (_Points *PointsCallerSession) TRANSFERFROMSELECTOR() ([4]byte, error) { + return _Points.Contract.TRANSFERFROMSELECTOR(&_Points.CallOpts) +} + +// TRANSFERSELECTOR is a free data retrieval call binding the contract method 0x72e93225. +// +// Solidity: function TRANSFER_SELECTOR() view returns(bytes4) +func (_Points *PointsCaller) TRANSFERSELECTOR(opts *bind.CallOpts) ([4]byte, error) { + var out []interface{} + err := _Points.contract.Call(opts, &out, "TRANSFER_SELECTOR") + + if err != nil { + return *new([4]byte), err + } + + out0 := *abi.ConvertType(out[0], new([4]byte)).(*[4]byte) + + return out0, err + +} + +// TRANSFERSELECTOR is a free data retrieval call binding the contract method 0x72e93225. +// +// Solidity: function TRANSFER_SELECTOR() view returns(bytes4) +func (_Points *PointsSession) TRANSFERSELECTOR() ([4]byte, error) { + return _Points.Contract.TRANSFERSELECTOR(&_Points.CallOpts) +} + +// TRANSFERSELECTOR is a free data retrieval call binding the contract method 0x72e93225. +// +// Solidity: function TRANSFER_SELECTOR() view returns(bytes4) +func (_Points *PointsCallerSession) TRANSFERSELECTOR() ([4]byte, error) { + return _Points.Contract.TRANSFERSELECTOR(&_Points.CallOpts) +} + +// TYPEHASH is a free data retrieval call binding the contract method 0x64d4c819. +// +// Solidity: function TYPE_HASH() view returns(bytes32) +func (_Points *PointsCaller) TYPEHASH(opts *bind.CallOpts) ([32]byte, error) { + var out []interface{} + err := _Points.contract.Call(opts, &out, "TYPE_HASH") + + if err != nil { + return *new([32]byte), err + } + + out0 := *abi.ConvertType(out[0], new([32]byte)).(*[32]byte) + + return out0, err + +} + +// TYPEHASH is a free data retrieval call binding the contract method 0x64d4c819. +// +// Solidity: function TYPE_HASH() view returns(bytes32) +func (_Points *PointsSession) TYPEHASH() ([32]byte, error) { + return _Points.Contract.TYPEHASH(&_Points.CallOpts) +} + +// TYPEHASH is a free data retrieval call binding the contract method 0x64d4c819. +// +// Solidity: function TYPE_HASH() view returns(bytes32) +func (_Points *PointsCallerSession) TYPEHASH() ([32]byte, error) { + return _Points.Contract.TYPEHASH(&_Points.CallOpts) +} + +// UPGRADERROLE is a free data retrieval call binding the contract method 0xf72c0d8b. +// +// Solidity: function UPGRADER_ROLE() view returns(bytes32) +func (_Points *PointsCaller) UPGRADERROLE(opts *bind.CallOpts) ([32]byte, error) { + var out []interface{} + err := _Points.contract.Call(opts, &out, "UPGRADER_ROLE") + + if err != nil { + return *new([32]byte), err + } + + out0 := *abi.ConvertType(out[0], new([32]byte)).(*[32]byte) + + return out0, err + +} + +// UPGRADERROLE is a free data retrieval call binding the contract method 0xf72c0d8b. +// +// Solidity: function UPGRADER_ROLE() view returns(bytes32) +func (_Points *PointsSession) UPGRADERROLE() ([32]byte, error) { + return _Points.Contract.UPGRADERROLE(&_Points.CallOpts) +} + +// UPGRADERROLE is a free data retrieval call binding the contract method 0xf72c0d8b. +// +// Solidity: function UPGRADER_ROLE() view returns(bytes32) +func (_Points *PointsCallerSession) UPGRADERROLE() ([32]byte, error) { + return _Points.Contract.UPGRADERROLE(&_Points.CallOpts) +} + +// Allowance is a free data retrieval call binding the contract method 0xdd62ed3e. +// +// Solidity: function allowance(address owner_, address spender_) view returns(uint256) +func (_Points *PointsCaller) Allowance(opts *bind.CallOpts, owner_ common.Address, spender_ common.Address) (*big.Int, error) { + var out []interface{} + err := _Points.contract.Call(opts, &out, "allowance", owner_, spender_) + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// Allowance is a free data retrieval call binding the contract method 0xdd62ed3e. +// +// Solidity: function allowance(address owner_, address spender_) view returns(uint256) +func (_Points *PointsSession) Allowance(owner_ common.Address, spender_ common.Address) (*big.Int, error) { + return _Points.Contract.Allowance(&_Points.CallOpts, owner_, spender_) +} + +// Allowance is a free data retrieval call binding the contract method 0xdd62ed3e. +// +// Solidity: function allowance(address owner_, address spender_) view returns(uint256) +func (_Points *PointsCallerSession) Allowance(owner_ common.Address, spender_ common.Address) (*big.Int, error) { + return _Points.Contract.Allowance(&_Points.CallOpts, owner_, spender_) +} + +// BalanceOf is a free data retrieval call binding the contract method 0x70a08231. +// +// Solidity: function balanceOf(address account_) view returns(uint256) +func (_Points *PointsCaller) BalanceOf(opts *bind.CallOpts, account_ common.Address) (*big.Int, error) { + var out []interface{} + err := _Points.contract.Call(opts, &out, "balanceOf", account_) + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// BalanceOf is a free data retrieval call binding the contract method 0x70a08231. +// +// Solidity: function balanceOf(address account_) view returns(uint256) +func (_Points *PointsSession) BalanceOf(account_ common.Address) (*big.Int, error) { + return _Points.Contract.BalanceOf(&_Points.CallOpts, account_) +} + +// BalanceOf is a free data retrieval call binding the contract method 0x70a08231. +// +// Solidity: function balanceOf(address account_) view returns(uint256) +func (_Points *PointsCallerSession) BalanceOf(account_ common.Address) (*big.Int, error) { + return _Points.Contract.BalanceOf(&_Points.CallOpts, account_) +} + +// CheckRole is a free data retrieval call binding the contract method 0x12d9a6ad. +// +// Solidity: function checkRole(bytes32 role_, address account_) view returns() +func (_Points *PointsCaller) CheckRole(opts *bind.CallOpts, role_ [32]byte, account_ common.Address) error { + var out []interface{} + err := _Points.contract.Call(opts, &out, "checkRole", role_, account_) + + if err != nil { + return err + } + + return err + +} + +// CheckRole is a free data retrieval call binding the contract method 0x12d9a6ad. +// +// Solidity: function checkRole(bytes32 role_, address account_) view returns() +func (_Points *PointsSession) CheckRole(role_ [32]byte, account_ common.Address) error { + return _Points.Contract.CheckRole(&_Points.CallOpts, role_, account_) +} + +// CheckRole is a free data retrieval call binding the contract method 0x12d9a6ad. +// +// Solidity: function checkRole(bytes32 role_, address account_) view returns() +func (_Points *PointsCallerSession) CheckRole(role_ [32]byte, account_ common.Address) error { + return _Points.Contract.CheckRole(&_Points.CallOpts, role_, account_) +} + +// Decimals is a free data retrieval call binding the contract method 0x313ce567. +// +// Solidity: function decimals() view returns(uint8) +func (_Points *PointsCaller) Decimals(opts *bind.CallOpts) (uint8, error) { + var out []interface{} + err := _Points.contract.Call(opts, &out, "decimals") + + if err != nil { + return *new(uint8), err + } + + out0 := *abi.ConvertType(out[0], new(uint8)).(*uint8) + + return out0, err + +} + +// Decimals is a free data retrieval call binding the contract method 0x313ce567. +// +// Solidity: function decimals() view returns(uint8) +func (_Points *PointsSession) Decimals() (uint8, error) { + return _Points.Contract.Decimals(&_Points.CallOpts) +} + +// Decimals is a free data retrieval call binding the contract method 0x313ce567. +// +// Solidity: function decimals() view returns(uint8) +func (_Points *PointsCallerSession) Decimals() (uint8, error) { + return _Points.Contract.Decimals(&_Points.CallOpts) +} + +// Eip712Domain is a free data retrieval call binding the contract method 0x84b0196e. +// +// Solidity: function eip712Domain() view returns(bytes1 fields, string name, string version, uint256 chainId, address verifyingContract, bytes32 salt, uint256[] extensions) +func (_Points *PointsCaller) Eip712Domain(opts *bind.CallOpts) (struct { + Fields [1]byte + Name string + Version string + ChainId *big.Int + VerifyingContract common.Address + Salt [32]byte + Extensions []*big.Int +}, error) { + var out []interface{} + err := _Points.contract.Call(opts, &out, "eip712Domain") + + outstruct := new(struct { + Fields [1]byte + Name string + Version string + ChainId *big.Int + VerifyingContract common.Address + Salt [32]byte + Extensions []*big.Int + }) + if err != nil { + return *outstruct, err + } + + outstruct.Fields = *abi.ConvertType(out[0], new([1]byte)).(*[1]byte) + outstruct.Name = *abi.ConvertType(out[1], new(string)).(*string) + outstruct.Version = *abi.ConvertType(out[2], new(string)).(*string) + outstruct.ChainId = *abi.ConvertType(out[3], new(*big.Int)).(**big.Int) + outstruct.VerifyingContract = *abi.ConvertType(out[4], new(common.Address)).(*common.Address) + outstruct.Salt = *abi.ConvertType(out[5], new([32]byte)).(*[32]byte) + outstruct.Extensions = *abi.ConvertType(out[6], new([]*big.Int)).(*[]*big.Int) + + return *outstruct, err + +} + +// Eip712Domain is a free data retrieval call binding the contract method 0x84b0196e. +// +// Solidity: function eip712Domain() view returns(bytes1 fields, string name, string version, uint256 chainId, address verifyingContract, bytes32 salt, uint256[] extensions) +func (_Points *PointsSession) Eip712Domain() (struct { + Fields [1]byte + Name string + Version string + ChainId *big.Int + VerifyingContract common.Address + Salt [32]byte + Extensions []*big.Int +}, error) { + return _Points.Contract.Eip712Domain(&_Points.CallOpts) +} + +// Eip712Domain is a free data retrieval call binding the contract method 0x84b0196e. +// +// Solidity: function eip712Domain() view returns(bytes1 fields, string name, string version, uint256 chainId, address verifyingContract, bytes32 salt, uint256[] extensions) +func (_Points *PointsCallerSession) Eip712Domain() (struct { + Fields [1]byte + Name string + Version string + ChainId *big.Int + VerifyingContract common.Address + Salt [32]byte + Extensions []*big.Int +}, error) { + return _Points.Contract.Eip712Domain(&_Points.CallOpts) +} + +// FacetAddress is a free data retrieval call binding the contract method 0xcdffacc6. +// +// Solidity: function facetAddress(bytes4 selector_) view returns(address facet_) +func (_Points *PointsCaller) FacetAddress(opts *bind.CallOpts, selector_ [4]byte) (common.Address, error) { + var out []interface{} + err := _Points.contract.Call(opts, &out, "facetAddress", selector_) + + if err != nil { + return *new(common.Address), err + } + + out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) + + return out0, err + +} + +// FacetAddress is a free data retrieval call binding the contract method 0xcdffacc6. +// +// Solidity: function facetAddress(bytes4 selector_) view returns(address facet_) +func (_Points *PointsSession) FacetAddress(selector_ [4]byte) (common.Address, error) { + return _Points.Contract.FacetAddress(&_Points.CallOpts, selector_) +} + +// FacetAddress is a free data retrieval call binding the contract method 0xcdffacc6. +// +// Solidity: function facetAddress(bytes4 selector_) view returns(address facet_) +func (_Points *PointsCallerSession) FacetAddress(selector_ [4]byte) (common.Address, error) { + return _Points.Contract.FacetAddress(&_Points.CallOpts, selector_) +} + +// FacetAddresses is a free data retrieval call binding the contract method 0x52ef6b2c. +// +// Solidity: function facetAddresses() view returns(address[] facets_) +func (_Points *PointsCaller) FacetAddresses(opts *bind.CallOpts) ([]common.Address, error) { + var out []interface{} + err := _Points.contract.Call(opts, &out, "facetAddresses") + + if err != nil { + return *new([]common.Address), err + } + + out0 := *abi.ConvertType(out[0], new([]common.Address)).(*[]common.Address) + + return out0, err + +} + +// FacetAddresses is a free data retrieval call binding the contract method 0x52ef6b2c. +// +// Solidity: function facetAddresses() view returns(address[] facets_) +func (_Points *PointsSession) FacetAddresses() ([]common.Address, error) { + return _Points.Contract.FacetAddresses(&_Points.CallOpts) +} + +// FacetAddresses is a free data retrieval call binding the contract method 0x52ef6b2c. +// +// Solidity: function facetAddresses() view returns(address[] facets_) +func (_Points *PointsCallerSession) FacetAddresses() ([]common.Address, error) { + return _Points.Contract.FacetAddresses(&_Points.CallOpts) +} + +// FacetFunctionSelectors is a free data retrieval call binding the contract method 0xadfca15e. +// +// Solidity: function facetFunctionSelectors(address facet_) view returns(bytes4[] selectors_) +func (_Points *PointsCaller) FacetFunctionSelectors(opts *bind.CallOpts, facet_ common.Address) ([][4]byte, error) { + var out []interface{} + err := _Points.contract.Call(opts, &out, "facetFunctionSelectors", facet_) + + if err != nil { + return *new([][4]byte), err + } + + out0 := *abi.ConvertType(out[0], new([][4]byte)).(*[][4]byte) + + return out0, err + +} + +// FacetFunctionSelectors is a free data retrieval call binding the contract method 0xadfca15e. +// +// Solidity: function facetFunctionSelectors(address facet_) view returns(bytes4[] selectors_) +func (_Points *PointsSession) FacetFunctionSelectors(facet_ common.Address) ([][4]byte, error) { + return _Points.Contract.FacetFunctionSelectors(&_Points.CallOpts, facet_) +} + +// FacetFunctionSelectors is a free data retrieval call binding the contract method 0xadfca15e. +// +// Solidity: function facetFunctionSelectors(address facet_) view returns(bytes4[] selectors_) +func (_Points *PointsCallerSession) FacetFunctionSelectors(facet_ common.Address) ([][4]byte, error) { + return _Points.Contract.FacetFunctionSelectors(&_Points.CallOpts, facet_) +} + +// Facets is a free data retrieval call binding the contract method 0x7a0ed627. +// +// Solidity: function facets() view returns((address,bytes4[])[] facets_) +func (_Points *PointsCaller) Facets(opts *bind.CallOpts) ([]DiamondStorageFacetInfo, error) { + var out []interface{} + err := _Points.contract.Call(opts, &out, "facets") + + if err != nil { + return *new([]DiamondStorageFacetInfo), err + } + + out0 := *abi.ConvertType(out[0], new([]DiamondStorageFacetInfo)).(*[]DiamondStorageFacetInfo) + + return out0, err + +} + +// Facets is a free data retrieval call binding the contract method 0x7a0ed627. +// +// Solidity: function facets() view returns((address,bytes4[])[] facets_) +func (_Points *PointsSession) Facets() ([]DiamondStorageFacetInfo, error) { + return _Points.Contract.Facets(&_Points.CallOpts) +} + +// Facets is a free data retrieval call binding the contract method 0x7a0ed627. +// +// Solidity: function facets() view returns((address,bytes4[])[] facets_) +func (_Points *PointsCallerSession) Facets() ([]DiamondStorageFacetInfo, error) { + return _Points.Contract.Facets(&_Points.CallOpts) +} + +// GetRoleAdmin is a free data retrieval call binding the contract method 0x248a9ca3. +// +// Solidity: function getRoleAdmin(bytes32 role_) view returns(bytes32) +func (_Points *PointsCaller) GetRoleAdmin(opts *bind.CallOpts, role_ [32]byte) ([32]byte, error) { + var out []interface{} + err := _Points.contract.Call(opts, &out, "getRoleAdmin", role_) + + if err != nil { + return *new([32]byte), err + } + + out0 := *abi.ConvertType(out[0], new([32]byte)).(*[32]byte) + + return out0, err + +} + +// GetRoleAdmin is a free data retrieval call binding the contract method 0x248a9ca3. +// +// Solidity: function getRoleAdmin(bytes32 role_) view returns(bytes32) +func (_Points *PointsSession) GetRoleAdmin(role_ [32]byte) ([32]byte, error) { + return _Points.Contract.GetRoleAdmin(&_Points.CallOpts, role_) +} + +// GetRoleAdmin is a free data retrieval call binding the contract method 0x248a9ca3. +// +// Solidity: function getRoleAdmin(bytes32 role_) view returns(bytes32) +func (_Points *PointsCallerSession) GetRoleAdmin(role_ [32]byte) ([32]byte, error) { + return _Points.Contract.GetRoleAdmin(&_Points.CallOpts, role_) +} + +// HasRole is a free data retrieval call binding the contract method 0x91d14854. +// +// Solidity: function hasRole(bytes32 role_, address account_) view returns(bool) +func (_Points *PointsCaller) HasRole(opts *bind.CallOpts, role_ [32]byte, account_ common.Address) (bool, error) { + var out []interface{} + err := _Points.contract.Call(opts, &out, "hasRole", role_, account_) + + if err != nil { + return *new(bool), err + } + + out0 := *abi.ConvertType(out[0], new(bool)).(*bool) + + return out0, err + +} + +// HasRole is a free data retrieval call binding the contract method 0x91d14854. +// +// Solidity: function hasRole(bytes32 role_, address account_) view returns(bool) +func (_Points *PointsSession) HasRole(role_ [32]byte, account_ common.Address) (bool, error) { + return _Points.Contract.HasRole(&_Points.CallOpts, role_, account_) +} + +// HasRole is a free data retrieval call binding the contract method 0x91d14854. +// +// Solidity: function hasRole(bytes32 role_, address account_) view returns(bool) +func (_Points *PointsCallerSession) HasRole(role_ [32]byte, account_ common.Address) (bool, error) { + return _Points.Contract.HasRole(&_Points.CallOpts, role_, account_) +} + +// Name is a free data retrieval call binding the contract method 0x06fdde03. +// +// Solidity: function name() view returns(string) +func (_Points *PointsCaller) Name(opts *bind.CallOpts) (string, error) { + var out []interface{} + err := _Points.contract.Call(opts, &out, "name") + + if err != nil { + return *new(string), err + } + + out0 := *abi.ConvertType(out[0], new(string)).(*string) + + return out0, err + +} + +// Name is a free data retrieval call binding the contract method 0x06fdde03. +// +// Solidity: function name() view returns(string) +func (_Points *PointsSession) Name() (string, error) { + return _Points.Contract.Name(&_Points.CallOpts) +} + +// Name is a free data retrieval call binding the contract method 0x06fdde03. +// +// Solidity: function name() view returns(string) +func (_Points *PointsCallerSession) Name() (string, error) { + return _Points.Contract.Name(&_Points.CallOpts) +} + +// Nonces is a free data retrieval call binding the contract method 0x7ecebe00. +// +// Solidity: function nonces(address owner) view returns(uint256) +func (_Points *PointsCaller) Nonces(opts *bind.CallOpts, owner common.Address) (*big.Int, error) { + var out []interface{} + err := _Points.contract.Call(opts, &out, "nonces", owner) + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// Nonces is a free data retrieval call binding the contract method 0x7ecebe00. +// +// Solidity: function nonces(address owner) view returns(uint256) +func (_Points *PointsSession) Nonces(owner common.Address) (*big.Int, error) { + return _Points.Contract.Nonces(&_Points.CallOpts, owner) +} + +// Nonces is a free data retrieval call binding the contract method 0x7ecebe00. +// +// Solidity: function nonces(address owner) view returns(uint256) +func (_Points *PointsCallerSession) Nonces(owner common.Address) (*big.Int, error) { + return _Points.Contract.Nonces(&_Points.CallOpts, owner) +} + +// Symbol is a free data retrieval call binding the contract method 0x95d89b41. +// +// Solidity: function symbol() view returns(string) +func (_Points *PointsCaller) Symbol(opts *bind.CallOpts) (string, error) { + var out []interface{} + err := _Points.contract.Call(opts, &out, "symbol") + + if err != nil { + return *new(string), err + } + + out0 := *abi.ConvertType(out[0], new(string)).(*string) + + return out0, err + +} + +// Symbol is a free data retrieval call binding the contract method 0x95d89b41. +// +// Solidity: function symbol() view returns(string) +func (_Points *PointsSession) Symbol() (string, error) { + return _Points.Contract.Symbol(&_Points.CallOpts) +} + +// Symbol is a free data retrieval call binding the contract method 0x95d89b41. +// +// Solidity: function symbol() view returns(string) +func (_Points *PointsCallerSession) Symbol() (string, error) { + return _Points.Contract.Symbol(&_Points.CallOpts) +} + +// TotalSupply is a free data retrieval call binding the contract method 0x18160ddd. +// +// Solidity: function totalSupply() view returns(uint256) +func (_Points *PointsCaller) TotalSupply(opts *bind.CallOpts) (*big.Int, error) { + var out []interface{} + err := _Points.contract.Call(opts, &out, "totalSupply") + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// TotalSupply is a free data retrieval call binding the contract method 0x18160ddd. +// +// Solidity: function totalSupply() view returns(uint256) +func (_Points *PointsSession) TotalSupply() (*big.Int, error) { + return _Points.Contract.TotalSupply(&_Points.CallOpts) +} + +// TotalSupply is a free data retrieval call binding the contract method 0x18160ddd. +// +// Solidity: function totalSupply() view returns(uint256) +func (_Points *PointsCallerSession) TotalSupply() (*big.Int, error) { + return _Points.Contract.TotalSupply(&_Points.CallOpts) +} + +// PointsInit is a paid mutator transaction binding the contract method 0xa7fe5e30. +// +// Solidity: function __Points_init(string name_, string symbol_, uint8 decimals_, address regulatoryCompliance_, address kycCompliance_, bytes initRegulatory_, bytes initKYC_) returns() +func (_Points *PointsTransactor) PointsInit(opts *bind.TransactOpts, name_ string, symbol_ string, decimals_ uint8, regulatoryCompliance_ common.Address, kycCompliance_ common.Address, initRegulatory_ []byte, initKYC_ []byte) (*types.Transaction, error) { + return _Points.contract.Transact(opts, "__Points_init", name_, symbol_, decimals_, regulatoryCompliance_, kycCompliance_, initRegulatory_, initKYC_) +} + +// PointsInit is a paid mutator transaction binding the contract method 0xa7fe5e30. +// +// Solidity: function __Points_init(string name_, string symbol_, uint8 decimals_, address regulatoryCompliance_, address kycCompliance_, bytes initRegulatory_, bytes initKYC_) returns() +func (_Points *PointsSession) PointsInit(name_ string, symbol_ string, decimals_ uint8, regulatoryCompliance_ common.Address, kycCompliance_ common.Address, initRegulatory_ []byte, initKYC_ []byte) (*types.Transaction, error) { + return _Points.Contract.PointsInit(&_Points.TransactOpts, name_, symbol_, decimals_, regulatoryCompliance_, kycCompliance_, initRegulatory_, initKYC_) +} + +// PointsInit is a paid mutator transaction binding the contract method 0xa7fe5e30. +// +// Solidity: function __Points_init(string name_, string symbol_, uint8 decimals_, address regulatoryCompliance_, address kycCompliance_, bytes initRegulatory_, bytes initKYC_) returns() +func (_Points *PointsTransactorSession) PointsInit(name_ string, symbol_ string, decimals_ uint8, regulatoryCompliance_ common.Address, kycCompliance_ common.Address, initRegulatory_ []byte, initKYC_ []byte) (*types.Transaction, error) { + return _Points.Contract.PointsInit(&_Points.TransactOpts, name_, symbol_, decimals_, regulatoryCompliance_, kycCompliance_, initRegulatory_, initKYC_) +} + +// Approve is a paid mutator transaction binding the contract method 0x095ea7b3. +// +// Solidity: function approve(address spender_, uint256 amount_) returns(bool) +func (_Points *PointsTransactor) Approve(opts *bind.TransactOpts, spender_ common.Address, amount_ *big.Int) (*types.Transaction, error) { + return _Points.contract.Transact(opts, "approve", spender_, amount_) +} + +// Approve is a paid mutator transaction binding the contract method 0x095ea7b3. +// +// Solidity: function approve(address spender_, uint256 amount_) returns(bool) +func (_Points *PointsSession) Approve(spender_ common.Address, amount_ *big.Int) (*types.Transaction, error) { + return _Points.Contract.Approve(&_Points.TransactOpts, spender_, amount_) +} + +// Approve is a paid mutator transaction binding the contract method 0x095ea7b3. +// +// Solidity: function approve(address spender_, uint256 amount_) returns(bool) +func (_Points *PointsTransactorSession) Approve(spender_ common.Address, amount_ *big.Int) (*types.Transaction, error) { + return _Points.Contract.Approve(&_Points.TransactOpts, spender_, amount_) +} + +// Burn is a paid mutator transaction binding the contract method 0x9dc29fac. +// +// Solidity: function burn(address account_, uint256 amount_) returns(bool) +func (_Points *PointsTransactor) Burn(opts *bind.TransactOpts, account_ common.Address, amount_ *big.Int) (*types.Transaction, error) { + return _Points.contract.Transact(opts, "burn", account_, amount_) +} + +// Burn is a paid mutator transaction binding the contract method 0x9dc29fac. +// +// Solidity: function burn(address account_, uint256 amount_) returns(bool) +func (_Points *PointsSession) Burn(account_ common.Address, amount_ *big.Int) (*types.Transaction, error) { + return _Points.Contract.Burn(&_Points.TransactOpts, account_, amount_) +} + +// Burn is a paid mutator transaction binding the contract method 0x9dc29fac. +// +// Solidity: function burn(address account_, uint256 amount_) returns(bool) +func (_Points *PointsTransactorSession) Burn(account_ common.Address, amount_ *big.Int) (*types.Transaction, error) { + return _Points.Contract.Burn(&_Points.TransactOpts, account_, amount_) +} + +// DiamondCut is a paid mutator transaction binding the contract method 0x1f931c1c. +// +// Solidity: function diamondCut((address,uint8,bytes4[])[] modules_, address initModule_, bytes initData_) returns() +func (_Points *PointsTransactor) DiamondCut(opts *bind.TransactOpts, modules_ []DiamondFacet, initModule_ common.Address, initData_ []byte) (*types.Transaction, error) { + return _Points.contract.Transact(opts, "diamondCut", modules_, initModule_, initData_) +} + +// DiamondCut is a paid mutator transaction binding the contract method 0x1f931c1c. +// +// Solidity: function diamondCut((address,uint8,bytes4[])[] modules_, address initModule_, bytes initData_) returns() +func (_Points *PointsSession) DiamondCut(modules_ []DiamondFacet, initModule_ common.Address, initData_ []byte) (*types.Transaction, error) { + return _Points.Contract.DiamondCut(&_Points.TransactOpts, modules_, initModule_, initData_) +} + +// DiamondCut is a paid mutator transaction binding the contract method 0x1f931c1c. +// +// Solidity: function diamondCut((address,uint8,bytes4[])[] modules_, address initModule_, bytes initData_) returns() +func (_Points *PointsTransactorSession) DiamondCut(modules_ []DiamondFacet, initModule_ common.Address, initData_ []byte) (*types.Transaction, error) { + return _Points.Contract.DiamondCut(&_Points.TransactOpts, modules_, initModule_, initData_) +} + +// DiamondCut0 is a paid mutator transaction binding the contract method 0xe57e69c6. +// +// Solidity: function diamondCut((address,uint8,bytes4[])[] modules_) returns() +func (_Points *PointsTransactor) DiamondCut0(opts *bind.TransactOpts, modules_ []DiamondFacet) (*types.Transaction, error) { + return _Points.contract.Transact(opts, "diamondCut0", modules_) +} + +// DiamondCut0 is a paid mutator transaction binding the contract method 0xe57e69c6. +// +// Solidity: function diamondCut((address,uint8,bytes4[])[] modules_) returns() +func (_Points *PointsSession) DiamondCut0(modules_ []DiamondFacet) (*types.Transaction, error) { + return _Points.Contract.DiamondCut0(&_Points.TransactOpts, modules_) +} + +// DiamondCut0 is a paid mutator transaction binding the contract method 0xe57e69c6. +// +// Solidity: function diamondCut((address,uint8,bytes4[])[] modules_) returns() +func (_Points *PointsTransactorSession) DiamondCut0(modules_ []DiamondFacet) (*types.Transaction, error) { + return _Points.Contract.DiamondCut0(&_Points.TransactOpts, modules_) +} + +// ForcedTransfer is a paid mutator transaction binding the contract method 0x9fc1d0e7. +// +// Solidity: function forcedTransfer(address from_, address to_, uint256 amount_) returns(bool) +func (_Points *PointsTransactor) ForcedTransfer(opts *bind.TransactOpts, from_ common.Address, to_ common.Address, amount_ *big.Int) (*types.Transaction, error) { + return _Points.contract.Transact(opts, "forcedTransfer", from_, to_, amount_) +} + +// ForcedTransfer is a paid mutator transaction binding the contract method 0x9fc1d0e7. +// +// Solidity: function forcedTransfer(address from_, address to_, uint256 amount_) returns(bool) +func (_Points *PointsSession) ForcedTransfer(from_ common.Address, to_ common.Address, amount_ *big.Int) (*types.Transaction, error) { + return _Points.Contract.ForcedTransfer(&_Points.TransactOpts, from_, to_, amount_) +} + +// ForcedTransfer is a paid mutator transaction binding the contract method 0x9fc1d0e7. +// +// Solidity: function forcedTransfer(address from_, address to_, uint256 amount_) returns(bool) +func (_Points *PointsTransactorSession) ForcedTransfer(from_ common.Address, to_ common.Address, amount_ *big.Int) (*types.Transaction, error) { + return _Points.Contract.ForcedTransfer(&_Points.TransactOpts, from_, to_, amount_) +} + +// GrantRole is a paid mutator transaction binding the contract method 0x2f2ff15d. +// +// Solidity: function grantRole(bytes32 role_, address account_) returns() +func (_Points *PointsTransactor) GrantRole(opts *bind.TransactOpts, role_ [32]byte, account_ common.Address) (*types.Transaction, error) { + return _Points.contract.Transact(opts, "grantRole", role_, account_) +} + +// GrantRole is a paid mutator transaction binding the contract method 0x2f2ff15d. +// +// Solidity: function grantRole(bytes32 role_, address account_) returns() +func (_Points *PointsSession) GrantRole(role_ [32]byte, account_ common.Address) (*types.Transaction, error) { + return _Points.Contract.GrantRole(&_Points.TransactOpts, role_, account_) +} + +// GrantRole is a paid mutator transaction binding the contract method 0x2f2ff15d. +// +// Solidity: function grantRole(bytes32 role_, address account_) returns() +func (_Points *PointsTransactorSession) GrantRole(role_ [32]byte, account_ common.Address) (*types.Transaction, error) { + return _Points.Contract.GrantRole(&_Points.TransactOpts, role_, account_) +} + +// Mint is a paid mutator transaction binding the contract method 0x40c10f19. +// +// Solidity: function mint(address account_, uint256 amount_) returns(bool) +func (_Points *PointsTransactor) Mint(opts *bind.TransactOpts, account_ common.Address, amount_ *big.Int) (*types.Transaction, error) { + return _Points.contract.Transact(opts, "mint", account_, amount_) +} + +// Mint is a paid mutator transaction binding the contract method 0x40c10f19. +// +// Solidity: function mint(address account_, uint256 amount_) returns(bool) +func (_Points *PointsSession) Mint(account_ common.Address, amount_ *big.Int) (*types.Transaction, error) { + return _Points.Contract.Mint(&_Points.TransactOpts, account_, amount_) +} + +// Mint is a paid mutator transaction binding the contract method 0x40c10f19. +// +// Solidity: function mint(address account_, uint256 amount_) returns(bool) +func (_Points *PointsTransactorSession) Mint(account_ common.Address, amount_ *big.Int) (*types.Transaction, error) { + return _Points.Contract.Mint(&_Points.TransactOpts, account_, amount_) +} + +// Permit is a paid mutator transaction binding the contract method 0x9fd5a6cf. +// +// Solidity: function permit(address owner, address spender, uint256 value, uint256 deadline, bytes signature) returns() +func (_Points *PointsTransactor) Permit(opts *bind.TransactOpts, owner common.Address, spender common.Address, value *big.Int, deadline *big.Int, signature []byte) (*types.Transaction, error) { + return _Points.contract.Transact(opts, "permit", owner, spender, value, deadline, signature) +} + +// Permit is a paid mutator transaction binding the contract method 0x9fd5a6cf. +// +// Solidity: function permit(address owner, address spender, uint256 value, uint256 deadline, bytes signature) returns() +func (_Points *PointsSession) Permit(owner common.Address, spender common.Address, value *big.Int, deadline *big.Int, signature []byte) (*types.Transaction, error) { + return _Points.Contract.Permit(&_Points.TransactOpts, owner, spender, value, deadline, signature) +} + +// Permit is a paid mutator transaction binding the contract method 0x9fd5a6cf. +// +// Solidity: function permit(address owner, address spender, uint256 value, uint256 deadline, bytes signature) returns() +func (_Points *PointsTransactorSession) Permit(owner common.Address, spender common.Address, value *big.Int, deadline *big.Int, signature []byte) (*types.Transaction, error) { + return _Points.Contract.Permit(&_Points.TransactOpts, owner, spender, value, deadline, signature) +} + +// Recovery is a paid mutator transaction binding the contract method 0x8d785674. +// +// Solidity: function recovery(address oldAccount_, address newAccount_) returns(bool) +func (_Points *PointsTransactor) Recovery(opts *bind.TransactOpts, oldAccount_ common.Address, newAccount_ common.Address) (*types.Transaction, error) { + return _Points.contract.Transact(opts, "recovery", oldAccount_, newAccount_) +} + +// Recovery is a paid mutator transaction binding the contract method 0x8d785674. +// +// Solidity: function recovery(address oldAccount_, address newAccount_) returns(bool) +func (_Points *PointsSession) Recovery(oldAccount_ common.Address, newAccount_ common.Address) (*types.Transaction, error) { + return _Points.Contract.Recovery(&_Points.TransactOpts, oldAccount_, newAccount_) +} + +// Recovery is a paid mutator transaction binding the contract method 0x8d785674. +// +// Solidity: function recovery(address oldAccount_, address newAccount_) returns(bool) +func (_Points *PointsTransactorSession) Recovery(oldAccount_ common.Address, newAccount_ common.Address) (*types.Transaction, error) { + return _Points.Contract.Recovery(&_Points.TransactOpts, oldAccount_, newAccount_) +} + +// RenounceRole is a paid mutator transaction binding the contract method 0x36568abe. +// +// Solidity: function renounceRole(bytes32 role_, address account_) returns() +func (_Points *PointsTransactor) RenounceRole(opts *bind.TransactOpts, role_ [32]byte, account_ common.Address) (*types.Transaction, error) { + return _Points.contract.Transact(opts, "renounceRole", role_, account_) +} + +// RenounceRole is a paid mutator transaction binding the contract method 0x36568abe. +// +// Solidity: function renounceRole(bytes32 role_, address account_) returns() +func (_Points *PointsSession) RenounceRole(role_ [32]byte, account_ common.Address) (*types.Transaction, error) { + return _Points.Contract.RenounceRole(&_Points.TransactOpts, role_, account_) +} + +// RenounceRole is a paid mutator transaction binding the contract method 0x36568abe. +// +// Solidity: function renounceRole(bytes32 role_, address account_) returns() +func (_Points *PointsTransactorSession) RenounceRole(role_ [32]byte, account_ common.Address) (*types.Transaction, error) { + return _Points.Contract.RenounceRole(&_Points.TransactOpts, role_, account_) +} + +// RevokeRole is a paid mutator transaction binding the contract method 0xd547741f. +// +// Solidity: function revokeRole(bytes32 role_, address account_) returns() +func (_Points *PointsTransactor) RevokeRole(opts *bind.TransactOpts, role_ [32]byte, account_ common.Address) (*types.Transaction, error) { + return _Points.contract.Transact(opts, "revokeRole", role_, account_) +} + +// RevokeRole is a paid mutator transaction binding the contract method 0xd547741f. +// +// Solidity: function revokeRole(bytes32 role_, address account_) returns() +func (_Points *PointsSession) RevokeRole(role_ [32]byte, account_ common.Address) (*types.Transaction, error) { + return _Points.Contract.RevokeRole(&_Points.TransactOpts, role_, account_) +} + +// RevokeRole is a paid mutator transaction binding the contract method 0xd547741f. +// +// Solidity: function revokeRole(bytes32 role_, address account_) returns() +func (_Points *PointsTransactorSession) RevokeRole(role_ [32]byte, account_ common.Address) (*types.Transaction, error) { + return _Points.Contract.RevokeRole(&_Points.TransactOpts, role_, account_) +} + +// Transfer is a paid mutator transaction binding the contract method 0xa9059cbb. +// +// Solidity: function transfer(address to_, uint256 amount_) returns(bool) +func (_Points *PointsTransactor) Transfer(opts *bind.TransactOpts, to_ common.Address, amount_ *big.Int) (*types.Transaction, error) { + return _Points.contract.Transact(opts, "transfer", to_, amount_) +} + +// Transfer is a paid mutator transaction binding the contract method 0xa9059cbb. +// +// Solidity: function transfer(address to_, uint256 amount_) returns(bool) +func (_Points *PointsSession) Transfer(to_ common.Address, amount_ *big.Int) (*types.Transaction, error) { + return _Points.Contract.Transfer(&_Points.TransactOpts, to_, amount_) +} + +// Transfer is a paid mutator transaction binding the contract method 0xa9059cbb. +// +// Solidity: function transfer(address to_, uint256 amount_) returns(bool) +func (_Points *PointsTransactorSession) Transfer(to_ common.Address, amount_ *big.Int) (*types.Transaction, error) { + return _Points.Contract.Transfer(&_Points.TransactOpts, to_, amount_) +} + +// TransferFrom is a paid mutator transaction binding the contract method 0x23b872dd. +// +// Solidity: function transferFrom(address from_, address to_, uint256 amount_) returns(bool) +func (_Points *PointsTransactor) TransferFrom(opts *bind.TransactOpts, from_ common.Address, to_ common.Address, amount_ *big.Int) (*types.Transaction, error) { + return _Points.contract.Transact(opts, "transferFrom", from_, to_, amount_) +} + +// TransferFrom is a paid mutator transaction binding the contract method 0x23b872dd. +// +// Solidity: function transferFrom(address from_, address to_, uint256 amount_) returns(bool) +func (_Points *PointsSession) TransferFrom(from_ common.Address, to_ common.Address, amount_ *big.Int) (*types.Transaction, error) { + return _Points.Contract.TransferFrom(&_Points.TransactOpts, from_, to_, amount_) +} + +// TransferFrom is a paid mutator transaction binding the contract method 0x23b872dd. +// +// Solidity: function transferFrom(address from_, address to_, uint256 amount_) returns(bool) +func (_Points *PointsTransactorSession) TransferFrom(from_ common.Address, to_ common.Address, amount_ *big.Int) (*types.Transaction, error) { + return _Points.Contract.TransferFrom(&_Points.TransactOpts, from_, to_, amount_) +} + +// Fallback is a paid mutator transaction binding the contract fallback function. +// +// Solidity: fallback() payable returns() +func (_Points *PointsTransactor) Fallback(opts *bind.TransactOpts, calldata []byte) (*types.Transaction, error) { + return _Points.contract.RawTransact(opts, calldata) +} + +// Fallback is a paid mutator transaction binding the contract fallback function. +// +// Solidity: fallback() payable returns() +func (_Points *PointsSession) Fallback(calldata []byte) (*types.Transaction, error) { + return _Points.Contract.Fallback(&_Points.TransactOpts, calldata) +} + +// Fallback is a paid mutator transaction binding the contract fallback function. +// +// Solidity: fallback() payable returns() +func (_Points *PointsTransactorSession) Fallback(calldata []byte) (*types.Transaction, error) { + return _Points.Contract.Fallback(&_Points.TransactOpts, calldata) +} + +// PointsApprovalIterator is returned from FilterApproval and is used to iterate over the raw logs and unpacked data for Approval events raised by the Points contract. +type PointsApprovalIterator struct { + Event *PointsApproval // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *PointsApprovalIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(PointsApproval) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(PointsApproval) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *PointsApprovalIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *PointsApprovalIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// PointsApproval represents a Approval event raised by the Points contract. +type PointsApproval struct { + Owner common.Address + Spender common.Address + Value *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterApproval is a free log retrieval operation binding the contract event 0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925. +// +// Solidity: event Approval(address indexed owner, address indexed spender, uint256 value) +func (_Points *PointsFilterer) FilterApproval(opts *bind.FilterOpts, owner []common.Address, spender []common.Address) (*PointsApprovalIterator, error) { + + var ownerRule []interface{} + for _, ownerItem := range owner { + ownerRule = append(ownerRule, ownerItem) + } + var spenderRule []interface{} + for _, spenderItem := range spender { + spenderRule = append(spenderRule, spenderItem) + } + + logs, sub, err := _Points.contract.FilterLogs(opts, "Approval", ownerRule, spenderRule) + if err != nil { + return nil, err + } + return &PointsApprovalIterator{contract: _Points.contract, event: "Approval", logs: logs, sub: sub}, nil +} + +// WatchApproval is a free log subscription operation binding the contract event 0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925. +// +// Solidity: event Approval(address indexed owner, address indexed spender, uint256 value) +func (_Points *PointsFilterer) WatchApproval(opts *bind.WatchOpts, sink chan<- *PointsApproval, owner []common.Address, spender []common.Address) (event.Subscription, error) { + + var ownerRule []interface{} + for _, ownerItem := range owner { + ownerRule = append(ownerRule, ownerItem) + } + var spenderRule []interface{} + for _, spenderItem := range spender { + spenderRule = append(spenderRule, spenderItem) + } + + logs, sub, err := _Points.contract.WatchLogs(opts, "Approval", ownerRule, spenderRule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(PointsApproval) + if err := _Points.contract.UnpackLog(event, "Approval", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseApproval is a log parse operation binding the contract event 0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925. +// +// Solidity: event Approval(address indexed owner, address indexed spender, uint256 value) +func (_Points *PointsFilterer) ParseApproval(log types.Log) (*PointsApproval, error) { + event := new(PointsApproval) + if err := _Points.contract.UnpackLog(event, "Approval", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// PointsDiamondCutIterator is returned from FilterDiamondCut and is used to iterate over the raw logs and unpacked data for DiamondCut events raised by the Points contract. +type PointsDiamondCutIterator struct { + Event *PointsDiamondCut // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *PointsDiamondCutIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(PointsDiamondCut) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(PointsDiamondCut) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *PointsDiamondCutIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *PointsDiamondCutIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// PointsDiamondCut represents a DiamondCut event raised by the Points contract. +type PointsDiamondCut struct { + Facets []DiamondFacet + InitFacet common.Address + InitData []byte + Raw types.Log // Blockchain specific contextual infos +} + +// FilterDiamondCut is a free log retrieval operation binding the contract event 0x8faa70878671ccd212d20771b795c50af8fd3ff6cf27f4bde57e5d4de0aeb673. +// +// Solidity: event DiamondCut((address,uint8,bytes4[])[] facets, address initFacet, bytes initData) +func (_Points *PointsFilterer) FilterDiamondCut(opts *bind.FilterOpts) (*PointsDiamondCutIterator, error) { + + logs, sub, err := _Points.contract.FilterLogs(opts, "DiamondCut") + if err != nil { + return nil, err + } + return &PointsDiamondCutIterator{contract: _Points.contract, event: "DiamondCut", logs: logs, sub: sub}, nil +} + +// WatchDiamondCut is a free log subscription operation binding the contract event 0x8faa70878671ccd212d20771b795c50af8fd3ff6cf27f4bde57e5d4de0aeb673. +// +// Solidity: event DiamondCut((address,uint8,bytes4[])[] facets, address initFacet, bytes initData) +func (_Points *PointsFilterer) WatchDiamondCut(opts *bind.WatchOpts, sink chan<- *PointsDiamondCut) (event.Subscription, error) { + + logs, sub, err := _Points.contract.WatchLogs(opts, "DiamondCut") + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(PointsDiamondCut) + if err := _Points.contract.UnpackLog(event, "DiamondCut", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseDiamondCut is a log parse operation binding the contract event 0x8faa70878671ccd212d20771b795c50af8fd3ff6cf27f4bde57e5d4de0aeb673. +// +// Solidity: event DiamondCut((address,uint8,bytes4[])[] facets, address initFacet, bytes initData) +func (_Points *PointsFilterer) ParseDiamondCut(log types.Log) (*PointsDiamondCut, error) { + event := new(PointsDiamondCut) + if err := _Points.contract.UnpackLog(event, "DiamondCut", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// PointsEIP712DomainChangedIterator is returned from FilterEIP712DomainChanged and is used to iterate over the raw logs and unpacked data for EIP712DomainChanged events raised by the Points contract. +type PointsEIP712DomainChangedIterator struct { + Event *PointsEIP712DomainChanged // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *PointsEIP712DomainChangedIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(PointsEIP712DomainChanged) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(PointsEIP712DomainChanged) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *PointsEIP712DomainChangedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *PointsEIP712DomainChangedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// PointsEIP712DomainChanged represents a EIP712DomainChanged event raised by the Points contract. +type PointsEIP712DomainChanged struct { + Raw types.Log // Blockchain specific contextual infos +} + +// FilterEIP712DomainChanged is a free log retrieval operation binding the contract event 0x0a6387c9ea3628b88a633bb4f3b151770f70085117a15f9bf3787cda53f13d31. +// +// Solidity: event EIP712DomainChanged() +func (_Points *PointsFilterer) FilterEIP712DomainChanged(opts *bind.FilterOpts) (*PointsEIP712DomainChangedIterator, error) { + + logs, sub, err := _Points.contract.FilterLogs(opts, "EIP712DomainChanged") + if err != nil { + return nil, err + } + return &PointsEIP712DomainChangedIterator{contract: _Points.contract, event: "EIP712DomainChanged", logs: logs, sub: sub}, nil +} + +// WatchEIP712DomainChanged is a free log subscription operation binding the contract event 0x0a6387c9ea3628b88a633bb4f3b151770f70085117a15f9bf3787cda53f13d31. +// +// Solidity: event EIP712DomainChanged() +func (_Points *PointsFilterer) WatchEIP712DomainChanged(opts *bind.WatchOpts, sink chan<- *PointsEIP712DomainChanged) (event.Subscription, error) { + + logs, sub, err := _Points.contract.WatchLogs(opts, "EIP712DomainChanged") + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(PointsEIP712DomainChanged) + if err := _Points.contract.UnpackLog(event, "EIP712DomainChanged", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseEIP712DomainChanged is a log parse operation binding the contract event 0x0a6387c9ea3628b88a633bb4f3b151770f70085117a15f9bf3787cda53f13d31. +// +// Solidity: event EIP712DomainChanged() +func (_Points *PointsFilterer) ParseEIP712DomainChanged(log types.Log) (*PointsEIP712DomainChanged, error) { + event := new(PointsEIP712DomainChanged) + if err := _Points.contract.UnpackLog(event, "EIP712DomainChanged", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// PointsInitializedIterator is returned from FilterInitialized and is used to iterate over the raw logs and unpacked data for Initialized events raised by the Points contract. +type PointsInitializedIterator struct { + Event *PointsInitialized // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *PointsInitializedIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(PointsInitialized) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(PointsInitialized) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *PointsInitializedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *PointsInitializedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// PointsInitialized represents a Initialized event raised by the Points contract. +type PointsInitialized struct { + StorageSlot [32]byte + Raw types.Log // Blockchain specific contextual infos +} + +// FilterInitialized is a free log retrieval operation binding the contract event 0xdc73717d728bcfa015e8117438a65319aa06e979ca324afa6e1ea645c28ea15d. +// +// Solidity: event Initialized(bytes32 storageSlot) +func (_Points *PointsFilterer) FilterInitialized(opts *bind.FilterOpts) (*PointsInitializedIterator, error) { + + logs, sub, err := _Points.contract.FilterLogs(opts, "Initialized") + if err != nil { + return nil, err + } + return &PointsInitializedIterator{contract: _Points.contract, event: "Initialized", logs: logs, sub: sub}, nil +} + +// WatchInitialized is a free log subscription operation binding the contract event 0xdc73717d728bcfa015e8117438a65319aa06e979ca324afa6e1ea645c28ea15d. +// +// Solidity: event Initialized(bytes32 storageSlot) +func (_Points *PointsFilterer) WatchInitialized(opts *bind.WatchOpts, sink chan<- *PointsInitialized) (event.Subscription, error) { + + logs, sub, err := _Points.contract.WatchLogs(opts, "Initialized") + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(PointsInitialized) + if err := _Points.contract.UnpackLog(event, "Initialized", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseInitialized is a log parse operation binding the contract event 0xdc73717d728bcfa015e8117438a65319aa06e979ca324afa6e1ea645c28ea15d. +// +// Solidity: event Initialized(bytes32 storageSlot) +func (_Points *PointsFilterer) ParseInitialized(log types.Log) (*PointsInitialized, error) { + event := new(PointsInitialized) + if err := _Points.contract.UnpackLog(event, "Initialized", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// PointsRoleAdminChangedIterator is returned from FilterRoleAdminChanged and is used to iterate over the raw logs and unpacked data for RoleAdminChanged events raised by the Points contract. +type PointsRoleAdminChangedIterator struct { + Event *PointsRoleAdminChanged // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *PointsRoleAdminChangedIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(PointsRoleAdminChanged) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(PointsRoleAdminChanged) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *PointsRoleAdminChangedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *PointsRoleAdminChangedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// PointsRoleAdminChanged represents a RoleAdminChanged event raised by the Points contract. +type PointsRoleAdminChanged struct { + Role [32]byte + PreviousAdminRole [32]byte + NewAdminRole [32]byte + Raw types.Log // Blockchain specific contextual infos +} + +// FilterRoleAdminChanged is a free log retrieval operation binding the contract event 0xbd79b86ffe0ab8e8776151514217cd7cacd52c909f66475c3af44e129f0b00ff. +// +// Solidity: event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole) +func (_Points *PointsFilterer) FilterRoleAdminChanged(opts *bind.FilterOpts, role [][32]byte, previousAdminRole [][32]byte, newAdminRole [][32]byte) (*PointsRoleAdminChangedIterator, error) { + + var roleRule []interface{} + for _, roleItem := range role { + roleRule = append(roleRule, roleItem) + } + var previousAdminRoleRule []interface{} + for _, previousAdminRoleItem := range previousAdminRole { + previousAdminRoleRule = append(previousAdminRoleRule, previousAdminRoleItem) + } + var newAdminRoleRule []interface{} + for _, newAdminRoleItem := range newAdminRole { + newAdminRoleRule = append(newAdminRoleRule, newAdminRoleItem) + } + + logs, sub, err := _Points.contract.FilterLogs(opts, "RoleAdminChanged", roleRule, previousAdminRoleRule, newAdminRoleRule) + if err != nil { + return nil, err + } + return &PointsRoleAdminChangedIterator{contract: _Points.contract, event: "RoleAdminChanged", logs: logs, sub: sub}, nil +} + +// WatchRoleAdminChanged is a free log subscription operation binding the contract event 0xbd79b86ffe0ab8e8776151514217cd7cacd52c909f66475c3af44e129f0b00ff. +// +// Solidity: event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole) +func (_Points *PointsFilterer) WatchRoleAdminChanged(opts *bind.WatchOpts, sink chan<- *PointsRoleAdminChanged, role [][32]byte, previousAdminRole [][32]byte, newAdminRole [][32]byte) (event.Subscription, error) { + + var roleRule []interface{} + for _, roleItem := range role { + roleRule = append(roleRule, roleItem) + } + var previousAdminRoleRule []interface{} + for _, previousAdminRoleItem := range previousAdminRole { + previousAdminRoleRule = append(previousAdminRoleRule, previousAdminRoleItem) + } + var newAdminRoleRule []interface{} + for _, newAdminRoleItem := range newAdminRole { + newAdminRoleRule = append(newAdminRoleRule, newAdminRoleItem) + } + + logs, sub, err := _Points.contract.WatchLogs(opts, "RoleAdminChanged", roleRule, previousAdminRoleRule, newAdminRoleRule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(PointsRoleAdminChanged) + if err := _Points.contract.UnpackLog(event, "RoleAdminChanged", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseRoleAdminChanged is a log parse operation binding the contract event 0xbd79b86ffe0ab8e8776151514217cd7cacd52c909f66475c3af44e129f0b00ff. +// +// Solidity: event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole) +func (_Points *PointsFilterer) ParseRoleAdminChanged(log types.Log) (*PointsRoleAdminChanged, error) { + event := new(PointsRoleAdminChanged) + if err := _Points.contract.UnpackLog(event, "RoleAdminChanged", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// PointsRoleGrantedIterator is returned from FilterRoleGranted and is used to iterate over the raw logs and unpacked data for RoleGranted events raised by the Points contract. +type PointsRoleGrantedIterator struct { + Event *PointsRoleGranted // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *PointsRoleGrantedIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(PointsRoleGranted) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(PointsRoleGranted) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *PointsRoleGrantedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *PointsRoleGrantedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// PointsRoleGranted represents a RoleGranted event raised by the Points contract. +type PointsRoleGranted struct { + Role [32]byte + Account common.Address + Sender common.Address + Raw types.Log // Blockchain specific contextual infos +} + +// FilterRoleGranted is a free log retrieval operation binding the contract event 0x2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d. +// +// Solidity: event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender) +func (_Points *PointsFilterer) FilterRoleGranted(opts *bind.FilterOpts, role [][32]byte, account []common.Address, sender []common.Address) (*PointsRoleGrantedIterator, error) { + + var roleRule []interface{} + for _, roleItem := range role { + roleRule = append(roleRule, roleItem) + } + var accountRule []interface{} + for _, accountItem := range account { + accountRule = append(accountRule, accountItem) + } + var senderRule []interface{} + for _, senderItem := range sender { + senderRule = append(senderRule, senderItem) + } + + logs, sub, err := _Points.contract.FilterLogs(opts, "RoleGranted", roleRule, accountRule, senderRule) + if err != nil { + return nil, err + } + return &PointsRoleGrantedIterator{contract: _Points.contract, event: "RoleGranted", logs: logs, sub: sub}, nil +} + +// WatchRoleGranted is a free log subscription operation binding the contract event 0x2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d. +// +// Solidity: event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender) +func (_Points *PointsFilterer) WatchRoleGranted(opts *bind.WatchOpts, sink chan<- *PointsRoleGranted, role [][32]byte, account []common.Address, sender []common.Address) (event.Subscription, error) { + + var roleRule []interface{} + for _, roleItem := range role { + roleRule = append(roleRule, roleItem) + } + var accountRule []interface{} + for _, accountItem := range account { + accountRule = append(accountRule, accountItem) + } + var senderRule []interface{} + for _, senderItem := range sender { + senderRule = append(senderRule, senderItem) + } + + logs, sub, err := _Points.contract.WatchLogs(opts, "RoleGranted", roleRule, accountRule, senderRule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(PointsRoleGranted) + if err := _Points.contract.UnpackLog(event, "RoleGranted", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseRoleGranted is a log parse operation binding the contract event 0x2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d. +// +// Solidity: event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender) +func (_Points *PointsFilterer) ParseRoleGranted(log types.Log) (*PointsRoleGranted, error) { + event := new(PointsRoleGranted) + if err := _Points.contract.UnpackLog(event, "RoleGranted", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// PointsRoleRevokedIterator is returned from FilterRoleRevoked and is used to iterate over the raw logs and unpacked data for RoleRevoked events raised by the Points contract. +type PointsRoleRevokedIterator struct { + Event *PointsRoleRevoked // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *PointsRoleRevokedIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(PointsRoleRevoked) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(PointsRoleRevoked) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *PointsRoleRevokedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *PointsRoleRevokedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// PointsRoleRevoked represents a RoleRevoked event raised by the Points contract. +type PointsRoleRevoked struct { + Role [32]byte + Account common.Address + Sender common.Address + Raw types.Log // Blockchain specific contextual infos +} + +// FilterRoleRevoked is a free log retrieval operation binding the contract event 0xf6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b. +// +// Solidity: event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender) +func (_Points *PointsFilterer) FilterRoleRevoked(opts *bind.FilterOpts, role [][32]byte, account []common.Address, sender []common.Address) (*PointsRoleRevokedIterator, error) { + + var roleRule []interface{} + for _, roleItem := range role { + roleRule = append(roleRule, roleItem) + } + var accountRule []interface{} + for _, accountItem := range account { + accountRule = append(accountRule, accountItem) + } + var senderRule []interface{} + for _, senderItem := range sender { + senderRule = append(senderRule, senderItem) + } + + logs, sub, err := _Points.contract.FilterLogs(opts, "RoleRevoked", roleRule, accountRule, senderRule) + if err != nil { + return nil, err + } + return &PointsRoleRevokedIterator{contract: _Points.contract, event: "RoleRevoked", logs: logs, sub: sub}, nil +} + +// WatchRoleRevoked is a free log subscription operation binding the contract event 0xf6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b. +// +// Solidity: event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender) +func (_Points *PointsFilterer) WatchRoleRevoked(opts *bind.WatchOpts, sink chan<- *PointsRoleRevoked, role [][32]byte, account []common.Address, sender []common.Address) (event.Subscription, error) { + + var roleRule []interface{} + for _, roleItem := range role { + roleRule = append(roleRule, roleItem) + } + var accountRule []interface{} + for _, accountItem := range account { + accountRule = append(accountRule, accountItem) + } + var senderRule []interface{} + for _, senderItem := range sender { + senderRule = append(senderRule, senderItem) + } + + logs, sub, err := _Points.contract.WatchLogs(opts, "RoleRevoked", roleRule, accountRule, senderRule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(PointsRoleRevoked) + if err := _Points.contract.UnpackLog(event, "RoleRevoked", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseRoleRevoked is a log parse operation binding the contract event 0xf6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b. +// +// Solidity: event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender) +func (_Points *PointsFilterer) ParseRoleRevoked(log types.Log) (*PointsRoleRevoked, error) { + event := new(PointsRoleRevoked) + if err := _Points.contract.UnpackLog(event, "RoleRevoked", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// PointsTransferIterator is returned from FilterTransfer and is used to iterate over the raw logs and unpacked data for Transfer events raised by the Points contract. +type PointsTransferIterator struct { + Event *PointsTransfer // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *PointsTransferIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(PointsTransfer) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(PointsTransfer) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *PointsTransferIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *PointsTransferIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// PointsTransfer represents a Transfer event raised by the Points contract. +type PointsTransfer struct { + From common.Address + To common.Address + Value *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterTransfer is a free log retrieval operation binding the contract event 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef. +// +// Solidity: event Transfer(address indexed from, address indexed to, uint256 value) +func (_Points *PointsFilterer) FilterTransfer(opts *bind.FilterOpts, from []common.Address, to []common.Address) (*PointsTransferIterator, error) { + + var fromRule []interface{} + for _, fromItem := range from { + fromRule = append(fromRule, fromItem) + } + var toRule []interface{} + for _, toItem := range to { + toRule = append(toRule, toItem) + } + + logs, sub, err := _Points.contract.FilterLogs(opts, "Transfer", fromRule, toRule) + if err != nil { + return nil, err + } + return &PointsTransferIterator{contract: _Points.contract, event: "Transfer", logs: logs, sub: sub}, nil +} + +// WatchTransfer is a free log subscription operation binding the contract event 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef. +// +// Solidity: event Transfer(address indexed from, address indexed to, uint256 value) +func (_Points *PointsFilterer) WatchTransfer(opts *bind.WatchOpts, sink chan<- *PointsTransfer, from []common.Address, to []common.Address) (event.Subscription, error) { + + var fromRule []interface{} + for _, fromItem := range from { + fromRule = append(fromRule, fromItem) + } + var toRule []interface{} + for _, toItem := range to { + toRule = append(toRule, toItem) + } + + logs, sub, err := _Points.contract.WatchLogs(opts, "Transfer", fromRule, toRule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(PointsTransfer) + if err := _Points.contract.UnpackLog(event, "Transfer", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseTransfer is a log parse operation binding the contract event 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef. +// +// Solidity: event Transfer(address indexed from, address indexed to, uint256 value) +func (_Points *PointsFilterer) ParseTransfer(log types.Log) (*PointsTransfer, error) { + event := new(PointsTransfer) + if err := _Points.contract.UnpackLog(event, "Transfer", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} diff --git a/internal/contracts/rarimarketaccountfactory/RarimarketAccountFactory.go b/internal/contracts/rarimarketaccountfactory/RarimarketAccountFactory.go new file mode 100644 index 0000000..40d0e5b --- /dev/null +++ b/internal/contracts/rarimarketaccountfactory/RarimarketAccountFactory.go @@ -0,0 +1,1523 @@ +// Code generated - DO NOT EDIT. +// This file is a generated binding and any manual changes will be lost. + +package rarimarketaccountfactory + +import ( + "errors" + "math/big" + "strings" + + ethereum "github.com/ethereum/go-ethereum" + "github.com/ethereum/go-ethereum/accounts/abi" + "github.com/ethereum/go-ethereum/accounts/abi/bind" + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/core/types" + "github.com/ethereum/go-ethereum/event" +) + +// Reference imports to suppress errors if they are not otherwise used. +var ( + _ = errors.New + _ = big.NewInt + _ = strings.NewReader + _ = ethereum.NotFound + _ = bind.Bind + _ = common.Big1 + _ = types.BloomLookup + _ = event.NewSubscription + _ = abi.ConvertType +) + +// RarimarketAccountFactoryMetaData contains all meta data concerning the RarimarketAccountFactory contract. +var RarimarketAccountFactoryMetaData = &bind.MetaData{ + ABI: "[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"previousAdmin\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"AdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"beacon\",\"type\":\"address\"}],\"name\":\"BeaconUpgraded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"RarimarketAccountDeployed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"implementation\",\"type\":\"address\"}],\"name\":\"Upgraded\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"rarimarketAccountImplementation_\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"negRiskAdapter_\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"ctfExchange_\",\"type\":\"address\"},{\"internalType\":\"contractIERC20\",\"name\":\"points_\",\"type\":\"address\"},{\"internalType\":\"contractIERC1155\",\"name\":\"ctf_\",\"type\":\"address\"}],\"name\":\"__RarimarketAccountFactory_init\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"ctf\",\"outputs\":[{\"internalType\":\"contractIERC1155\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"ctfExchange\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"nullifier_\",\"type\":\"bytes32\"}],\"name\":\"deployRarimarketAccount\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"nullifier_\",\"type\":\"bytes32\"}],\"name\":\"getRarimarketAccount\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getRarimarketAccountImplementation\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"implementation\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"negRiskAdapter\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"points\",\"outputs\":[{\"internalType\":\"contractIERC20\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"nullifier_\",\"type\":\"bytes32\"}],\"name\":\"predictRarimarketAccountAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"proxiableUUID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"name\":\"rarimarketAccounts\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"}],\"name\":\"setRarimarketAccountImplementation\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"}],\"name\":\"upgradeTo\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"upgradeToAndCall\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"}]", +} + +// RarimarketAccountFactoryABI is the input ABI used to generate the binding from. +// Deprecated: Use RarimarketAccountFactoryMetaData.ABI instead. +var RarimarketAccountFactoryABI = RarimarketAccountFactoryMetaData.ABI + +// RarimarketAccountFactory is an auto generated Go binding around an Ethereum contract. +type RarimarketAccountFactory struct { + RarimarketAccountFactoryCaller // Read-only binding to the contract + RarimarketAccountFactoryTransactor // Write-only binding to the contract + RarimarketAccountFactoryFilterer // Log filterer for contract events +} + +// RarimarketAccountFactoryCaller is an auto generated read-only Go binding around an Ethereum contract. +type RarimarketAccountFactoryCaller struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// RarimarketAccountFactoryTransactor is an auto generated write-only Go binding around an Ethereum contract. +type RarimarketAccountFactoryTransactor struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// RarimarketAccountFactoryFilterer is an auto generated log filtering Go binding around an Ethereum contract events. +type RarimarketAccountFactoryFilterer struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// RarimarketAccountFactorySession is an auto generated Go binding around an Ethereum contract, +// with pre-set call and transact options. +type RarimarketAccountFactorySession struct { + Contract *RarimarketAccountFactory // Generic contract binding to set the session for + CallOpts bind.CallOpts // Call options to use throughout this session + TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session +} + +// RarimarketAccountFactoryCallerSession is an auto generated read-only Go binding around an Ethereum contract, +// with pre-set call options. +type RarimarketAccountFactoryCallerSession struct { + Contract *RarimarketAccountFactoryCaller // Generic contract caller binding to set the session for + CallOpts bind.CallOpts // Call options to use throughout this session +} + +// RarimarketAccountFactoryTransactorSession is an auto generated write-only Go binding around an Ethereum contract, +// with pre-set transact options. +type RarimarketAccountFactoryTransactorSession struct { + Contract *RarimarketAccountFactoryTransactor // Generic contract transactor binding to set the session for + TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session +} + +// RarimarketAccountFactoryRaw is an auto generated low-level Go binding around an Ethereum contract. +type RarimarketAccountFactoryRaw struct { + Contract *RarimarketAccountFactory // Generic contract binding to access the raw methods on +} + +// RarimarketAccountFactoryCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract. +type RarimarketAccountFactoryCallerRaw struct { + Contract *RarimarketAccountFactoryCaller // Generic read-only contract binding to access the raw methods on +} + +// RarimarketAccountFactoryTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract. +type RarimarketAccountFactoryTransactorRaw struct { + Contract *RarimarketAccountFactoryTransactor // Generic write-only contract binding to access the raw methods on +} + +// NewRarimarketAccountFactory creates a new instance of RarimarketAccountFactory, bound to a specific deployed contract. +func NewRarimarketAccountFactory(address common.Address, backend bind.ContractBackend) (*RarimarketAccountFactory, error) { + contract, err := bindRarimarketAccountFactory(address, backend, backend, backend) + if err != nil { + return nil, err + } + return &RarimarketAccountFactory{RarimarketAccountFactoryCaller: RarimarketAccountFactoryCaller{contract: contract}, RarimarketAccountFactoryTransactor: RarimarketAccountFactoryTransactor{contract: contract}, RarimarketAccountFactoryFilterer: RarimarketAccountFactoryFilterer{contract: contract}}, nil +} + +// NewRarimarketAccountFactoryCaller creates a new read-only instance of RarimarketAccountFactory, bound to a specific deployed contract. +func NewRarimarketAccountFactoryCaller(address common.Address, caller bind.ContractCaller) (*RarimarketAccountFactoryCaller, error) { + contract, err := bindRarimarketAccountFactory(address, caller, nil, nil) + if err != nil { + return nil, err + } + return &RarimarketAccountFactoryCaller{contract: contract}, nil +} + +// NewRarimarketAccountFactoryTransactor creates a new write-only instance of RarimarketAccountFactory, bound to a specific deployed contract. +func NewRarimarketAccountFactoryTransactor(address common.Address, transactor bind.ContractTransactor) (*RarimarketAccountFactoryTransactor, error) { + contract, err := bindRarimarketAccountFactory(address, nil, transactor, nil) + if err != nil { + return nil, err + } + return &RarimarketAccountFactoryTransactor{contract: contract}, nil +} + +// NewRarimarketAccountFactoryFilterer creates a new log filterer instance of RarimarketAccountFactory, bound to a specific deployed contract. +func NewRarimarketAccountFactoryFilterer(address common.Address, filterer bind.ContractFilterer) (*RarimarketAccountFactoryFilterer, error) { + contract, err := bindRarimarketAccountFactory(address, nil, nil, filterer) + if err != nil { + return nil, err + } + return &RarimarketAccountFactoryFilterer{contract: contract}, nil +} + +// bindRarimarketAccountFactory binds a generic wrapper to an already deployed contract. +func bindRarimarketAccountFactory(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { + parsed, err := RarimarketAccountFactoryMetaData.GetAbi() + if err != nil { + return nil, err + } + return bind.NewBoundContract(address, *parsed, caller, transactor, filterer), nil +} + +// Call invokes the (constant) contract method with params as input values and +// sets the output to result. The result type might be a single field for simple +// returns, a slice of interfaces for anonymous returns and a struct for named +// returns. +func (_RarimarketAccountFactory *RarimarketAccountFactoryRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _RarimarketAccountFactory.Contract.RarimarketAccountFactoryCaller.contract.Call(opts, result, method, params...) +} + +// Transfer initiates a plain transaction to move funds to the contract, calling +// its default method if one is available. +func (_RarimarketAccountFactory *RarimarketAccountFactoryRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _RarimarketAccountFactory.Contract.RarimarketAccountFactoryTransactor.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_RarimarketAccountFactory *RarimarketAccountFactoryRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _RarimarketAccountFactory.Contract.RarimarketAccountFactoryTransactor.contract.Transact(opts, method, params...) +} + +// Call invokes the (constant) contract method with params as input values and +// sets the output to result. The result type might be a single field for simple +// returns, a slice of interfaces for anonymous returns and a struct for named +// returns. +func (_RarimarketAccountFactory *RarimarketAccountFactoryCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _RarimarketAccountFactory.Contract.contract.Call(opts, result, method, params...) +} + +// Transfer initiates a plain transaction to move funds to the contract, calling +// its default method if one is available. +func (_RarimarketAccountFactory *RarimarketAccountFactoryTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _RarimarketAccountFactory.Contract.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_RarimarketAccountFactory *RarimarketAccountFactoryTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _RarimarketAccountFactory.Contract.contract.Transact(opts, method, params...) +} + +// Ctf is a free data retrieval call binding the contract method 0x22a9339f. +// +// Solidity: function ctf() view returns(address) +func (_RarimarketAccountFactory *RarimarketAccountFactoryCaller) Ctf(opts *bind.CallOpts) (common.Address, error) { + var out []interface{} + err := _RarimarketAccountFactory.contract.Call(opts, &out, "ctf") + + if err != nil { + return *new(common.Address), err + } + + out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) + + return out0, err + +} + +// Ctf is a free data retrieval call binding the contract method 0x22a9339f. +// +// Solidity: function ctf() view returns(address) +func (_RarimarketAccountFactory *RarimarketAccountFactorySession) Ctf() (common.Address, error) { + return _RarimarketAccountFactory.Contract.Ctf(&_RarimarketAccountFactory.CallOpts) +} + +// Ctf is a free data retrieval call binding the contract method 0x22a9339f. +// +// Solidity: function ctf() view returns(address) +func (_RarimarketAccountFactory *RarimarketAccountFactoryCallerSession) Ctf() (common.Address, error) { + return _RarimarketAccountFactory.Contract.Ctf(&_RarimarketAccountFactory.CallOpts) +} + +// CtfExchange is a free data retrieval call binding the contract method 0x4b8295e7. +// +// Solidity: function ctfExchange() view returns(address) +func (_RarimarketAccountFactory *RarimarketAccountFactoryCaller) CtfExchange(opts *bind.CallOpts) (common.Address, error) { + var out []interface{} + err := _RarimarketAccountFactory.contract.Call(opts, &out, "ctfExchange") + + if err != nil { + return *new(common.Address), err + } + + out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) + + return out0, err + +} + +// CtfExchange is a free data retrieval call binding the contract method 0x4b8295e7. +// +// Solidity: function ctfExchange() view returns(address) +func (_RarimarketAccountFactory *RarimarketAccountFactorySession) CtfExchange() (common.Address, error) { + return _RarimarketAccountFactory.Contract.CtfExchange(&_RarimarketAccountFactory.CallOpts) +} + +// CtfExchange is a free data retrieval call binding the contract method 0x4b8295e7. +// +// Solidity: function ctfExchange() view returns(address) +func (_RarimarketAccountFactory *RarimarketAccountFactoryCallerSession) CtfExchange() (common.Address, error) { + return _RarimarketAccountFactory.Contract.CtfExchange(&_RarimarketAccountFactory.CallOpts) +} + +// GetRarimarketAccount is a free data retrieval call binding the contract method 0x2d1ac65a. +// +// Solidity: function getRarimarketAccount(bytes32 nullifier_) view returns(address) +func (_RarimarketAccountFactory *RarimarketAccountFactoryCaller) GetRarimarketAccount(opts *bind.CallOpts, nullifier_ [32]byte) (common.Address, error) { + var out []interface{} + err := _RarimarketAccountFactory.contract.Call(opts, &out, "getRarimarketAccount", nullifier_) + + if err != nil { + return *new(common.Address), err + } + + out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) + + return out0, err + +} + +// GetRarimarketAccount is a free data retrieval call binding the contract method 0x2d1ac65a. +// +// Solidity: function getRarimarketAccount(bytes32 nullifier_) view returns(address) +func (_RarimarketAccountFactory *RarimarketAccountFactorySession) GetRarimarketAccount(nullifier_ [32]byte) (common.Address, error) { + return _RarimarketAccountFactory.Contract.GetRarimarketAccount(&_RarimarketAccountFactory.CallOpts, nullifier_) +} + +// GetRarimarketAccount is a free data retrieval call binding the contract method 0x2d1ac65a. +// +// Solidity: function getRarimarketAccount(bytes32 nullifier_) view returns(address) +func (_RarimarketAccountFactory *RarimarketAccountFactoryCallerSession) GetRarimarketAccount(nullifier_ [32]byte) (common.Address, error) { + return _RarimarketAccountFactory.Contract.GetRarimarketAccount(&_RarimarketAccountFactory.CallOpts, nullifier_) +} + +// GetRarimarketAccountImplementation is a free data retrieval call binding the contract method 0xad04299b. +// +// Solidity: function getRarimarketAccountImplementation() view returns(address) +func (_RarimarketAccountFactory *RarimarketAccountFactoryCaller) GetRarimarketAccountImplementation(opts *bind.CallOpts) (common.Address, error) { + var out []interface{} + err := _RarimarketAccountFactory.contract.Call(opts, &out, "getRarimarketAccountImplementation") + + if err != nil { + return *new(common.Address), err + } + + out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) + + return out0, err + +} + +// GetRarimarketAccountImplementation is a free data retrieval call binding the contract method 0xad04299b. +// +// Solidity: function getRarimarketAccountImplementation() view returns(address) +func (_RarimarketAccountFactory *RarimarketAccountFactorySession) GetRarimarketAccountImplementation() (common.Address, error) { + return _RarimarketAccountFactory.Contract.GetRarimarketAccountImplementation(&_RarimarketAccountFactory.CallOpts) +} + +// GetRarimarketAccountImplementation is a free data retrieval call binding the contract method 0xad04299b. +// +// Solidity: function getRarimarketAccountImplementation() view returns(address) +func (_RarimarketAccountFactory *RarimarketAccountFactoryCallerSession) GetRarimarketAccountImplementation() (common.Address, error) { + return _RarimarketAccountFactory.Contract.GetRarimarketAccountImplementation(&_RarimarketAccountFactory.CallOpts) +} + +// Implementation is a free data retrieval call binding the contract method 0x5c60da1b. +// +// Solidity: function implementation() view returns(address) +func (_RarimarketAccountFactory *RarimarketAccountFactoryCaller) Implementation(opts *bind.CallOpts) (common.Address, error) { + var out []interface{} + err := _RarimarketAccountFactory.contract.Call(opts, &out, "implementation") + + if err != nil { + return *new(common.Address), err + } + + out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) + + return out0, err + +} + +// Implementation is a free data retrieval call binding the contract method 0x5c60da1b. +// +// Solidity: function implementation() view returns(address) +func (_RarimarketAccountFactory *RarimarketAccountFactorySession) Implementation() (common.Address, error) { + return _RarimarketAccountFactory.Contract.Implementation(&_RarimarketAccountFactory.CallOpts) +} + +// Implementation is a free data retrieval call binding the contract method 0x5c60da1b. +// +// Solidity: function implementation() view returns(address) +func (_RarimarketAccountFactory *RarimarketAccountFactoryCallerSession) Implementation() (common.Address, error) { + return _RarimarketAccountFactory.Contract.Implementation(&_RarimarketAccountFactory.CallOpts) +} + +// NegRiskAdapter is a free data retrieval call binding the contract method 0xf6ef95a1. +// +// Solidity: function negRiskAdapter() view returns(address) +func (_RarimarketAccountFactory *RarimarketAccountFactoryCaller) NegRiskAdapter(opts *bind.CallOpts) (common.Address, error) { + var out []interface{} + err := _RarimarketAccountFactory.contract.Call(opts, &out, "negRiskAdapter") + + if err != nil { + return *new(common.Address), err + } + + out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) + + return out0, err + +} + +// NegRiskAdapter is a free data retrieval call binding the contract method 0xf6ef95a1. +// +// Solidity: function negRiskAdapter() view returns(address) +func (_RarimarketAccountFactory *RarimarketAccountFactorySession) NegRiskAdapter() (common.Address, error) { + return _RarimarketAccountFactory.Contract.NegRiskAdapter(&_RarimarketAccountFactory.CallOpts) +} + +// NegRiskAdapter is a free data retrieval call binding the contract method 0xf6ef95a1. +// +// Solidity: function negRiskAdapter() view returns(address) +func (_RarimarketAccountFactory *RarimarketAccountFactoryCallerSession) NegRiskAdapter() (common.Address, error) { + return _RarimarketAccountFactory.Contract.NegRiskAdapter(&_RarimarketAccountFactory.CallOpts) +} + +// Owner is a free data retrieval call binding the contract method 0x8da5cb5b. +// +// Solidity: function owner() view returns(address) +func (_RarimarketAccountFactory *RarimarketAccountFactoryCaller) Owner(opts *bind.CallOpts) (common.Address, error) { + var out []interface{} + err := _RarimarketAccountFactory.contract.Call(opts, &out, "owner") + + if err != nil { + return *new(common.Address), err + } + + out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) + + return out0, err + +} + +// Owner is a free data retrieval call binding the contract method 0x8da5cb5b. +// +// Solidity: function owner() view returns(address) +func (_RarimarketAccountFactory *RarimarketAccountFactorySession) Owner() (common.Address, error) { + return _RarimarketAccountFactory.Contract.Owner(&_RarimarketAccountFactory.CallOpts) +} + +// Owner is a free data retrieval call binding the contract method 0x8da5cb5b. +// +// Solidity: function owner() view returns(address) +func (_RarimarketAccountFactory *RarimarketAccountFactoryCallerSession) Owner() (common.Address, error) { + return _RarimarketAccountFactory.Contract.Owner(&_RarimarketAccountFactory.CallOpts) +} + +// Points is a free data retrieval call binding the contract method 0x1be6dd64. +// +// Solidity: function points() view returns(address) +func (_RarimarketAccountFactory *RarimarketAccountFactoryCaller) Points(opts *bind.CallOpts) (common.Address, error) { + var out []interface{} + err := _RarimarketAccountFactory.contract.Call(opts, &out, "points") + + if err != nil { + return *new(common.Address), err + } + + out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) + + return out0, err + +} + +// Points is a free data retrieval call binding the contract method 0x1be6dd64. +// +// Solidity: function points() view returns(address) +func (_RarimarketAccountFactory *RarimarketAccountFactorySession) Points() (common.Address, error) { + return _RarimarketAccountFactory.Contract.Points(&_RarimarketAccountFactory.CallOpts) +} + +// Points is a free data retrieval call binding the contract method 0x1be6dd64. +// +// Solidity: function points() view returns(address) +func (_RarimarketAccountFactory *RarimarketAccountFactoryCallerSession) Points() (common.Address, error) { + return _RarimarketAccountFactory.Contract.Points(&_RarimarketAccountFactory.CallOpts) +} + +// PredictRarimarketAccountAddress is a free data retrieval call binding the contract method 0xaedbd803. +// +// Solidity: function predictRarimarketAccountAddress(bytes32 nullifier_) view returns(address) +func (_RarimarketAccountFactory *RarimarketAccountFactoryCaller) PredictRarimarketAccountAddress(opts *bind.CallOpts, nullifier_ [32]byte) (common.Address, error) { + var out []interface{} + err := _RarimarketAccountFactory.contract.Call(opts, &out, "predictRarimarketAccountAddress", nullifier_) + + if err != nil { + return *new(common.Address), err + } + + out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) + + return out0, err + +} + +// PredictRarimarketAccountAddress is a free data retrieval call binding the contract method 0xaedbd803. +// +// Solidity: function predictRarimarketAccountAddress(bytes32 nullifier_) view returns(address) +func (_RarimarketAccountFactory *RarimarketAccountFactorySession) PredictRarimarketAccountAddress(nullifier_ [32]byte) (common.Address, error) { + return _RarimarketAccountFactory.Contract.PredictRarimarketAccountAddress(&_RarimarketAccountFactory.CallOpts, nullifier_) +} + +// PredictRarimarketAccountAddress is a free data retrieval call binding the contract method 0xaedbd803. +// +// Solidity: function predictRarimarketAccountAddress(bytes32 nullifier_) view returns(address) +func (_RarimarketAccountFactory *RarimarketAccountFactoryCallerSession) PredictRarimarketAccountAddress(nullifier_ [32]byte) (common.Address, error) { + return _RarimarketAccountFactory.Contract.PredictRarimarketAccountAddress(&_RarimarketAccountFactory.CallOpts, nullifier_) +} + +// ProxiableUUID is a free data retrieval call binding the contract method 0x52d1902d. +// +// Solidity: function proxiableUUID() view returns(bytes32) +func (_RarimarketAccountFactory *RarimarketAccountFactoryCaller) ProxiableUUID(opts *bind.CallOpts) ([32]byte, error) { + var out []interface{} + err := _RarimarketAccountFactory.contract.Call(opts, &out, "proxiableUUID") + + if err != nil { + return *new([32]byte), err + } + + out0 := *abi.ConvertType(out[0], new([32]byte)).(*[32]byte) + + return out0, err + +} + +// ProxiableUUID is a free data retrieval call binding the contract method 0x52d1902d. +// +// Solidity: function proxiableUUID() view returns(bytes32) +func (_RarimarketAccountFactory *RarimarketAccountFactorySession) ProxiableUUID() ([32]byte, error) { + return _RarimarketAccountFactory.Contract.ProxiableUUID(&_RarimarketAccountFactory.CallOpts) +} + +// ProxiableUUID is a free data retrieval call binding the contract method 0x52d1902d. +// +// Solidity: function proxiableUUID() view returns(bytes32) +func (_RarimarketAccountFactory *RarimarketAccountFactoryCallerSession) ProxiableUUID() ([32]byte, error) { + return _RarimarketAccountFactory.Contract.ProxiableUUID(&_RarimarketAccountFactory.CallOpts) +} + +// RarimarketAccounts is a free data retrieval call binding the contract method 0x60b7ddc0. +// +// Solidity: function rarimarketAccounts(bytes32 ) view returns(address) +func (_RarimarketAccountFactory *RarimarketAccountFactoryCaller) RarimarketAccounts(opts *bind.CallOpts, arg0 [32]byte) (common.Address, error) { + var out []interface{} + err := _RarimarketAccountFactory.contract.Call(opts, &out, "rarimarketAccounts", arg0) + + if err != nil { + return *new(common.Address), err + } + + out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) + + return out0, err + +} + +// RarimarketAccounts is a free data retrieval call binding the contract method 0x60b7ddc0. +// +// Solidity: function rarimarketAccounts(bytes32 ) view returns(address) +func (_RarimarketAccountFactory *RarimarketAccountFactorySession) RarimarketAccounts(arg0 [32]byte) (common.Address, error) { + return _RarimarketAccountFactory.Contract.RarimarketAccounts(&_RarimarketAccountFactory.CallOpts, arg0) +} + +// RarimarketAccounts is a free data retrieval call binding the contract method 0x60b7ddc0. +// +// Solidity: function rarimarketAccounts(bytes32 ) view returns(address) +func (_RarimarketAccountFactory *RarimarketAccountFactoryCallerSession) RarimarketAccounts(arg0 [32]byte) (common.Address, error) { + return _RarimarketAccountFactory.Contract.RarimarketAccounts(&_RarimarketAccountFactory.CallOpts, arg0) +} + +// RarimarketAccountFactoryInit is a paid mutator transaction binding the contract method 0xa3a4aa4f. +// +// Solidity: function __RarimarketAccountFactory_init(address rarimarketAccountImplementation_, address negRiskAdapter_, address ctfExchange_, address points_, address ctf_) returns() +func (_RarimarketAccountFactory *RarimarketAccountFactoryTransactor) RarimarketAccountFactoryInit(opts *bind.TransactOpts, rarimarketAccountImplementation_ common.Address, negRiskAdapter_ common.Address, ctfExchange_ common.Address, points_ common.Address, ctf_ common.Address) (*types.Transaction, error) { + return _RarimarketAccountFactory.contract.Transact(opts, "__RarimarketAccountFactory_init", rarimarketAccountImplementation_, negRiskAdapter_, ctfExchange_, points_, ctf_) +} + +// RarimarketAccountFactoryInit is a paid mutator transaction binding the contract method 0xa3a4aa4f. +// +// Solidity: function __RarimarketAccountFactory_init(address rarimarketAccountImplementation_, address negRiskAdapter_, address ctfExchange_, address points_, address ctf_) returns() +func (_RarimarketAccountFactory *RarimarketAccountFactorySession) RarimarketAccountFactoryInit(rarimarketAccountImplementation_ common.Address, negRiskAdapter_ common.Address, ctfExchange_ common.Address, points_ common.Address, ctf_ common.Address) (*types.Transaction, error) { + return _RarimarketAccountFactory.Contract.RarimarketAccountFactoryInit(&_RarimarketAccountFactory.TransactOpts, rarimarketAccountImplementation_, negRiskAdapter_, ctfExchange_, points_, ctf_) +} + +// RarimarketAccountFactoryInit is a paid mutator transaction binding the contract method 0xa3a4aa4f. +// +// Solidity: function __RarimarketAccountFactory_init(address rarimarketAccountImplementation_, address negRiskAdapter_, address ctfExchange_, address points_, address ctf_) returns() +func (_RarimarketAccountFactory *RarimarketAccountFactoryTransactorSession) RarimarketAccountFactoryInit(rarimarketAccountImplementation_ common.Address, negRiskAdapter_ common.Address, ctfExchange_ common.Address, points_ common.Address, ctf_ common.Address) (*types.Transaction, error) { + return _RarimarketAccountFactory.Contract.RarimarketAccountFactoryInit(&_RarimarketAccountFactory.TransactOpts, rarimarketAccountImplementation_, negRiskAdapter_, ctfExchange_, points_, ctf_) +} + +// DeployRarimarketAccount is a paid mutator transaction binding the contract method 0xcd95b7b0. +// +// Solidity: function deployRarimarketAccount(bytes32 nullifier_) returns() +func (_RarimarketAccountFactory *RarimarketAccountFactoryTransactor) DeployRarimarketAccount(opts *bind.TransactOpts, nullifier_ [32]byte) (*types.Transaction, error) { + return _RarimarketAccountFactory.contract.Transact(opts, "deployRarimarketAccount", nullifier_) +} + +// DeployRarimarketAccount is a paid mutator transaction binding the contract method 0xcd95b7b0. +// +// Solidity: function deployRarimarketAccount(bytes32 nullifier_) returns() +func (_RarimarketAccountFactory *RarimarketAccountFactorySession) DeployRarimarketAccount(nullifier_ [32]byte) (*types.Transaction, error) { + return _RarimarketAccountFactory.Contract.DeployRarimarketAccount(&_RarimarketAccountFactory.TransactOpts, nullifier_) +} + +// DeployRarimarketAccount is a paid mutator transaction binding the contract method 0xcd95b7b0. +// +// Solidity: function deployRarimarketAccount(bytes32 nullifier_) returns() +func (_RarimarketAccountFactory *RarimarketAccountFactoryTransactorSession) DeployRarimarketAccount(nullifier_ [32]byte) (*types.Transaction, error) { + return _RarimarketAccountFactory.Contract.DeployRarimarketAccount(&_RarimarketAccountFactory.TransactOpts, nullifier_) +} + +// RenounceOwnership is a paid mutator transaction binding the contract method 0x715018a6. +// +// Solidity: function renounceOwnership() returns() +func (_RarimarketAccountFactory *RarimarketAccountFactoryTransactor) RenounceOwnership(opts *bind.TransactOpts) (*types.Transaction, error) { + return _RarimarketAccountFactory.contract.Transact(opts, "renounceOwnership") +} + +// RenounceOwnership is a paid mutator transaction binding the contract method 0x715018a6. +// +// Solidity: function renounceOwnership() returns() +func (_RarimarketAccountFactory *RarimarketAccountFactorySession) RenounceOwnership() (*types.Transaction, error) { + return _RarimarketAccountFactory.Contract.RenounceOwnership(&_RarimarketAccountFactory.TransactOpts) +} + +// RenounceOwnership is a paid mutator transaction binding the contract method 0x715018a6. +// +// Solidity: function renounceOwnership() returns() +func (_RarimarketAccountFactory *RarimarketAccountFactoryTransactorSession) RenounceOwnership() (*types.Transaction, error) { + return _RarimarketAccountFactory.Contract.RenounceOwnership(&_RarimarketAccountFactory.TransactOpts) +} + +// SetRarimarketAccountImplementation is a paid mutator transaction binding the contract method 0x85a3cbd9. +// +// Solidity: function setRarimarketAccountImplementation(address newImplementation) returns() +func (_RarimarketAccountFactory *RarimarketAccountFactoryTransactor) SetRarimarketAccountImplementation(opts *bind.TransactOpts, newImplementation common.Address) (*types.Transaction, error) { + return _RarimarketAccountFactory.contract.Transact(opts, "setRarimarketAccountImplementation", newImplementation) +} + +// SetRarimarketAccountImplementation is a paid mutator transaction binding the contract method 0x85a3cbd9. +// +// Solidity: function setRarimarketAccountImplementation(address newImplementation) returns() +func (_RarimarketAccountFactory *RarimarketAccountFactorySession) SetRarimarketAccountImplementation(newImplementation common.Address) (*types.Transaction, error) { + return _RarimarketAccountFactory.Contract.SetRarimarketAccountImplementation(&_RarimarketAccountFactory.TransactOpts, newImplementation) +} + +// SetRarimarketAccountImplementation is a paid mutator transaction binding the contract method 0x85a3cbd9. +// +// Solidity: function setRarimarketAccountImplementation(address newImplementation) returns() +func (_RarimarketAccountFactory *RarimarketAccountFactoryTransactorSession) SetRarimarketAccountImplementation(newImplementation common.Address) (*types.Transaction, error) { + return _RarimarketAccountFactory.Contract.SetRarimarketAccountImplementation(&_RarimarketAccountFactory.TransactOpts, newImplementation) +} + +// TransferOwnership is a paid mutator transaction binding the contract method 0xf2fde38b. +// +// Solidity: function transferOwnership(address newOwner) returns() +func (_RarimarketAccountFactory *RarimarketAccountFactoryTransactor) TransferOwnership(opts *bind.TransactOpts, newOwner common.Address) (*types.Transaction, error) { + return _RarimarketAccountFactory.contract.Transact(opts, "transferOwnership", newOwner) +} + +// TransferOwnership is a paid mutator transaction binding the contract method 0xf2fde38b. +// +// Solidity: function transferOwnership(address newOwner) returns() +func (_RarimarketAccountFactory *RarimarketAccountFactorySession) TransferOwnership(newOwner common.Address) (*types.Transaction, error) { + return _RarimarketAccountFactory.Contract.TransferOwnership(&_RarimarketAccountFactory.TransactOpts, newOwner) +} + +// TransferOwnership is a paid mutator transaction binding the contract method 0xf2fde38b. +// +// Solidity: function transferOwnership(address newOwner) returns() +func (_RarimarketAccountFactory *RarimarketAccountFactoryTransactorSession) TransferOwnership(newOwner common.Address) (*types.Transaction, error) { + return _RarimarketAccountFactory.Contract.TransferOwnership(&_RarimarketAccountFactory.TransactOpts, newOwner) +} + +// UpgradeTo is a paid mutator transaction binding the contract method 0x3659cfe6. +// +// Solidity: function upgradeTo(address newImplementation) returns() +func (_RarimarketAccountFactory *RarimarketAccountFactoryTransactor) UpgradeTo(opts *bind.TransactOpts, newImplementation common.Address) (*types.Transaction, error) { + return _RarimarketAccountFactory.contract.Transact(opts, "upgradeTo", newImplementation) +} + +// UpgradeTo is a paid mutator transaction binding the contract method 0x3659cfe6. +// +// Solidity: function upgradeTo(address newImplementation) returns() +func (_RarimarketAccountFactory *RarimarketAccountFactorySession) UpgradeTo(newImplementation common.Address) (*types.Transaction, error) { + return _RarimarketAccountFactory.Contract.UpgradeTo(&_RarimarketAccountFactory.TransactOpts, newImplementation) +} + +// UpgradeTo is a paid mutator transaction binding the contract method 0x3659cfe6. +// +// Solidity: function upgradeTo(address newImplementation) returns() +func (_RarimarketAccountFactory *RarimarketAccountFactoryTransactorSession) UpgradeTo(newImplementation common.Address) (*types.Transaction, error) { + return _RarimarketAccountFactory.Contract.UpgradeTo(&_RarimarketAccountFactory.TransactOpts, newImplementation) +} + +// UpgradeToAndCall is a paid mutator transaction binding the contract method 0x4f1ef286. +// +// Solidity: function upgradeToAndCall(address newImplementation, bytes data) payable returns() +func (_RarimarketAccountFactory *RarimarketAccountFactoryTransactor) UpgradeToAndCall(opts *bind.TransactOpts, newImplementation common.Address, data []byte) (*types.Transaction, error) { + return _RarimarketAccountFactory.contract.Transact(opts, "upgradeToAndCall", newImplementation, data) +} + +// UpgradeToAndCall is a paid mutator transaction binding the contract method 0x4f1ef286. +// +// Solidity: function upgradeToAndCall(address newImplementation, bytes data) payable returns() +func (_RarimarketAccountFactory *RarimarketAccountFactorySession) UpgradeToAndCall(newImplementation common.Address, data []byte) (*types.Transaction, error) { + return _RarimarketAccountFactory.Contract.UpgradeToAndCall(&_RarimarketAccountFactory.TransactOpts, newImplementation, data) +} + +// UpgradeToAndCall is a paid mutator transaction binding the contract method 0x4f1ef286. +// +// Solidity: function upgradeToAndCall(address newImplementation, bytes data) payable returns() +func (_RarimarketAccountFactory *RarimarketAccountFactoryTransactorSession) UpgradeToAndCall(newImplementation common.Address, data []byte) (*types.Transaction, error) { + return _RarimarketAccountFactory.Contract.UpgradeToAndCall(&_RarimarketAccountFactory.TransactOpts, newImplementation, data) +} + +// RarimarketAccountFactoryAdminChangedIterator is returned from FilterAdminChanged and is used to iterate over the raw logs and unpacked data for AdminChanged events raised by the RarimarketAccountFactory contract. +type RarimarketAccountFactoryAdminChangedIterator struct { + Event *RarimarketAccountFactoryAdminChanged // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *RarimarketAccountFactoryAdminChangedIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(RarimarketAccountFactoryAdminChanged) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(RarimarketAccountFactoryAdminChanged) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *RarimarketAccountFactoryAdminChangedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *RarimarketAccountFactoryAdminChangedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// RarimarketAccountFactoryAdminChanged represents a AdminChanged event raised by the RarimarketAccountFactory contract. +type RarimarketAccountFactoryAdminChanged struct { + PreviousAdmin common.Address + NewAdmin common.Address + Raw types.Log // Blockchain specific contextual infos +} + +// FilterAdminChanged is a free log retrieval operation binding the contract event 0x7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f. +// +// Solidity: event AdminChanged(address previousAdmin, address newAdmin) +func (_RarimarketAccountFactory *RarimarketAccountFactoryFilterer) FilterAdminChanged(opts *bind.FilterOpts) (*RarimarketAccountFactoryAdminChangedIterator, error) { + + logs, sub, err := _RarimarketAccountFactory.contract.FilterLogs(opts, "AdminChanged") + if err != nil { + return nil, err + } + return &RarimarketAccountFactoryAdminChangedIterator{contract: _RarimarketAccountFactory.contract, event: "AdminChanged", logs: logs, sub: sub}, nil +} + +// WatchAdminChanged is a free log subscription operation binding the contract event 0x7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f. +// +// Solidity: event AdminChanged(address previousAdmin, address newAdmin) +func (_RarimarketAccountFactory *RarimarketAccountFactoryFilterer) WatchAdminChanged(opts *bind.WatchOpts, sink chan<- *RarimarketAccountFactoryAdminChanged) (event.Subscription, error) { + + logs, sub, err := _RarimarketAccountFactory.contract.WatchLogs(opts, "AdminChanged") + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(RarimarketAccountFactoryAdminChanged) + if err := _RarimarketAccountFactory.contract.UnpackLog(event, "AdminChanged", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseAdminChanged is a log parse operation binding the contract event 0x7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f. +// +// Solidity: event AdminChanged(address previousAdmin, address newAdmin) +func (_RarimarketAccountFactory *RarimarketAccountFactoryFilterer) ParseAdminChanged(log types.Log) (*RarimarketAccountFactoryAdminChanged, error) { + event := new(RarimarketAccountFactoryAdminChanged) + if err := _RarimarketAccountFactory.contract.UnpackLog(event, "AdminChanged", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// RarimarketAccountFactoryBeaconUpgradedIterator is returned from FilterBeaconUpgraded and is used to iterate over the raw logs and unpacked data for BeaconUpgraded events raised by the RarimarketAccountFactory contract. +type RarimarketAccountFactoryBeaconUpgradedIterator struct { + Event *RarimarketAccountFactoryBeaconUpgraded // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *RarimarketAccountFactoryBeaconUpgradedIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(RarimarketAccountFactoryBeaconUpgraded) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(RarimarketAccountFactoryBeaconUpgraded) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *RarimarketAccountFactoryBeaconUpgradedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *RarimarketAccountFactoryBeaconUpgradedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// RarimarketAccountFactoryBeaconUpgraded represents a BeaconUpgraded event raised by the RarimarketAccountFactory contract. +type RarimarketAccountFactoryBeaconUpgraded struct { + Beacon common.Address + Raw types.Log // Blockchain specific contextual infos +} + +// FilterBeaconUpgraded is a free log retrieval operation binding the contract event 0x1cf3b03a6cf19fa2baba4df148e9dcabedea7f8a5c07840e207e5c089be95d3e. +// +// Solidity: event BeaconUpgraded(address indexed beacon) +func (_RarimarketAccountFactory *RarimarketAccountFactoryFilterer) FilterBeaconUpgraded(opts *bind.FilterOpts, beacon []common.Address) (*RarimarketAccountFactoryBeaconUpgradedIterator, error) { + + var beaconRule []interface{} + for _, beaconItem := range beacon { + beaconRule = append(beaconRule, beaconItem) + } + + logs, sub, err := _RarimarketAccountFactory.contract.FilterLogs(opts, "BeaconUpgraded", beaconRule) + if err != nil { + return nil, err + } + return &RarimarketAccountFactoryBeaconUpgradedIterator{contract: _RarimarketAccountFactory.contract, event: "BeaconUpgraded", logs: logs, sub: sub}, nil +} + +// WatchBeaconUpgraded is a free log subscription operation binding the contract event 0x1cf3b03a6cf19fa2baba4df148e9dcabedea7f8a5c07840e207e5c089be95d3e. +// +// Solidity: event BeaconUpgraded(address indexed beacon) +func (_RarimarketAccountFactory *RarimarketAccountFactoryFilterer) WatchBeaconUpgraded(opts *bind.WatchOpts, sink chan<- *RarimarketAccountFactoryBeaconUpgraded, beacon []common.Address) (event.Subscription, error) { + + var beaconRule []interface{} + for _, beaconItem := range beacon { + beaconRule = append(beaconRule, beaconItem) + } + + logs, sub, err := _RarimarketAccountFactory.contract.WatchLogs(opts, "BeaconUpgraded", beaconRule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(RarimarketAccountFactoryBeaconUpgraded) + if err := _RarimarketAccountFactory.contract.UnpackLog(event, "BeaconUpgraded", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseBeaconUpgraded is a log parse operation binding the contract event 0x1cf3b03a6cf19fa2baba4df148e9dcabedea7f8a5c07840e207e5c089be95d3e. +// +// Solidity: event BeaconUpgraded(address indexed beacon) +func (_RarimarketAccountFactory *RarimarketAccountFactoryFilterer) ParseBeaconUpgraded(log types.Log) (*RarimarketAccountFactoryBeaconUpgraded, error) { + event := new(RarimarketAccountFactoryBeaconUpgraded) + if err := _RarimarketAccountFactory.contract.UnpackLog(event, "BeaconUpgraded", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// RarimarketAccountFactoryInitializedIterator is returned from FilterInitialized and is used to iterate over the raw logs and unpacked data for Initialized events raised by the RarimarketAccountFactory contract. +type RarimarketAccountFactoryInitializedIterator struct { + Event *RarimarketAccountFactoryInitialized // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *RarimarketAccountFactoryInitializedIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(RarimarketAccountFactoryInitialized) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(RarimarketAccountFactoryInitialized) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *RarimarketAccountFactoryInitializedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *RarimarketAccountFactoryInitializedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// RarimarketAccountFactoryInitialized represents a Initialized event raised by the RarimarketAccountFactory contract. +type RarimarketAccountFactoryInitialized struct { + Version uint8 + Raw types.Log // Blockchain specific contextual infos +} + +// FilterInitialized is a free log retrieval operation binding the contract event 0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498. +// +// Solidity: event Initialized(uint8 version) +func (_RarimarketAccountFactory *RarimarketAccountFactoryFilterer) FilterInitialized(opts *bind.FilterOpts) (*RarimarketAccountFactoryInitializedIterator, error) { + + logs, sub, err := _RarimarketAccountFactory.contract.FilterLogs(opts, "Initialized") + if err != nil { + return nil, err + } + return &RarimarketAccountFactoryInitializedIterator{contract: _RarimarketAccountFactory.contract, event: "Initialized", logs: logs, sub: sub}, nil +} + +// WatchInitialized is a free log subscription operation binding the contract event 0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498. +// +// Solidity: event Initialized(uint8 version) +func (_RarimarketAccountFactory *RarimarketAccountFactoryFilterer) WatchInitialized(opts *bind.WatchOpts, sink chan<- *RarimarketAccountFactoryInitialized) (event.Subscription, error) { + + logs, sub, err := _RarimarketAccountFactory.contract.WatchLogs(opts, "Initialized") + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(RarimarketAccountFactoryInitialized) + if err := _RarimarketAccountFactory.contract.UnpackLog(event, "Initialized", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseInitialized is a log parse operation binding the contract event 0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498. +// +// Solidity: event Initialized(uint8 version) +func (_RarimarketAccountFactory *RarimarketAccountFactoryFilterer) ParseInitialized(log types.Log) (*RarimarketAccountFactoryInitialized, error) { + event := new(RarimarketAccountFactoryInitialized) + if err := _RarimarketAccountFactory.contract.UnpackLog(event, "Initialized", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// RarimarketAccountFactoryOwnershipTransferredIterator is returned from FilterOwnershipTransferred and is used to iterate over the raw logs and unpacked data for OwnershipTransferred events raised by the RarimarketAccountFactory contract. +type RarimarketAccountFactoryOwnershipTransferredIterator struct { + Event *RarimarketAccountFactoryOwnershipTransferred // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *RarimarketAccountFactoryOwnershipTransferredIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(RarimarketAccountFactoryOwnershipTransferred) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(RarimarketAccountFactoryOwnershipTransferred) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *RarimarketAccountFactoryOwnershipTransferredIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *RarimarketAccountFactoryOwnershipTransferredIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// RarimarketAccountFactoryOwnershipTransferred represents a OwnershipTransferred event raised by the RarimarketAccountFactory contract. +type RarimarketAccountFactoryOwnershipTransferred struct { + PreviousOwner common.Address + NewOwner common.Address + Raw types.Log // Blockchain specific contextual infos +} + +// FilterOwnershipTransferred is a free log retrieval operation binding the contract event 0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0. +// +// Solidity: event OwnershipTransferred(address indexed previousOwner, address indexed newOwner) +func (_RarimarketAccountFactory *RarimarketAccountFactoryFilterer) FilterOwnershipTransferred(opts *bind.FilterOpts, previousOwner []common.Address, newOwner []common.Address) (*RarimarketAccountFactoryOwnershipTransferredIterator, error) { + + var previousOwnerRule []interface{} + for _, previousOwnerItem := range previousOwner { + previousOwnerRule = append(previousOwnerRule, previousOwnerItem) + } + var newOwnerRule []interface{} + for _, newOwnerItem := range newOwner { + newOwnerRule = append(newOwnerRule, newOwnerItem) + } + + logs, sub, err := _RarimarketAccountFactory.contract.FilterLogs(opts, "OwnershipTransferred", previousOwnerRule, newOwnerRule) + if err != nil { + return nil, err + } + return &RarimarketAccountFactoryOwnershipTransferredIterator{contract: _RarimarketAccountFactory.contract, event: "OwnershipTransferred", logs: logs, sub: sub}, nil +} + +// WatchOwnershipTransferred is a free log subscription operation binding the contract event 0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0. +// +// Solidity: event OwnershipTransferred(address indexed previousOwner, address indexed newOwner) +func (_RarimarketAccountFactory *RarimarketAccountFactoryFilterer) WatchOwnershipTransferred(opts *bind.WatchOpts, sink chan<- *RarimarketAccountFactoryOwnershipTransferred, previousOwner []common.Address, newOwner []common.Address) (event.Subscription, error) { + + var previousOwnerRule []interface{} + for _, previousOwnerItem := range previousOwner { + previousOwnerRule = append(previousOwnerRule, previousOwnerItem) + } + var newOwnerRule []interface{} + for _, newOwnerItem := range newOwner { + newOwnerRule = append(newOwnerRule, newOwnerItem) + } + + logs, sub, err := _RarimarketAccountFactory.contract.WatchLogs(opts, "OwnershipTransferred", previousOwnerRule, newOwnerRule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(RarimarketAccountFactoryOwnershipTransferred) + if err := _RarimarketAccountFactory.contract.UnpackLog(event, "OwnershipTransferred", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseOwnershipTransferred is a log parse operation binding the contract event 0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0. +// +// Solidity: event OwnershipTransferred(address indexed previousOwner, address indexed newOwner) +func (_RarimarketAccountFactory *RarimarketAccountFactoryFilterer) ParseOwnershipTransferred(log types.Log) (*RarimarketAccountFactoryOwnershipTransferred, error) { + event := new(RarimarketAccountFactoryOwnershipTransferred) + if err := _RarimarketAccountFactory.contract.UnpackLog(event, "OwnershipTransferred", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// RarimarketAccountFactoryRarimarketAccountDeployedIterator is returned from FilterRarimarketAccountDeployed and is used to iterate over the raw logs and unpacked data for RarimarketAccountDeployed events raised by the RarimarketAccountFactory contract. +type RarimarketAccountFactoryRarimarketAccountDeployedIterator struct { + Event *RarimarketAccountFactoryRarimarketAccountDeployed // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *RarimarketAccountFactoryRarimarketAccountDeployedIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(RarimarketAccountFactoryRarimarketAccountDeployed) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(RarimarketAccountFactoryRarimarketAccountDeployed) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *RarimarketAccountFactoryRarimarketAccountDeployedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *RarimarketAccountFactoryRarimarketAccountDeployedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// RarimarketAccountFactoryRarimarketAccountDeployed represents a RarimarketAccountDeployed event raised by the RarimarketAccountFactory contract. +type RarimarketAccountFactoryRarimarketAccountDeployed struct { + Account common.Address + Raw types.Log // Blockchain specific contextual infos +} + +// FilterRarimarketAccountDeployed is a free log retrieval operation binding the contract event 0xf8078a05821fe3a0f57304f01a507627f803be4212ef8a593a28a395b43763de. +// +// Solidity: event RarimarketAccountDeployed(address indexed account) +func (_RarimarketAccountFactory *RarimarketAccountFactoryFilterer) FilterRarimarketAccountDeployed(opts *bind.FilterOpts, account []common.Address) (*RarimarketAccountFactoryRarimarketAccountDeployedIterator, error) { + + var accountRule []interface{} + for _, accountItem := range account { + accountRule = append(accountRule, accountItem) + } + + logs, sub, err := _RarimarketAccountFactory.contract.FilterLogs(opts, "RarimarketAccountDeployed", accountRule) + if err != nil { + return nil, err + } + return &RarimarketAccountFactoryRarimarketAccountDeployedIterator{contract: _RarimarketAccountFactory.contract, event: "RarimarketAccountDeployed", logs: logs, sub: sub}, nil +} + +// WatchRarimarketAccountDeployed is a free log subscription operation binding the contract event 0xf8078a05821fe3a0f57304f01a507627f803be4212ef8a593a28a395b43763de. +// +// Solidity: event RarimarketAccountDeployed(address indexed account) +func (_RarimarketAccountFactory *RarimarketAccountFactoryFilterer) WatchRarimarketAccountDeployed(opts *bind.WatchOpts, sink chan<- *RarimarketAccountFactoryRarimarketAccountDeployed, account []common.Address) (event.Subscription, error) { + + var accountRule []interface{} + for _, accountItem := range account { + accountRule = append(accountRule, accountItem) + } + + logs, sub, err := _RarimarketAccountFactory.contract.WatchLogs(opts, "RarimarketAccountDeployed", accountRule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(RarimarketAccountFactoryRarimarketAccountDeployed) + if err := _RarimarketAccountFactory.contract.UnpackLog(event, "RarimarketAccountDeployed", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseRarimarketAccountDeployed is a log parse operation binding the contract event 0xf8078a05821fe3a0f57304f01a507627f803be4212ef8a593a28a395b43763de. +// +// Solidity: event RarimarketAccountDeployed(address indexed account) +func (_RarimarketAccountFactory *RarimarketAccountFactoryFilterer) ParseRarimarketAccountDeployed(log types.Log) (*RarimarketAccountFactoryRarimarketAccountDeployed, error) { + event := new(RarimarketAccountFactoryRarimarketAccountDeployed) + if err := _RarimarketAccountFactory.contract.UnpackLog(event, "RarimarketAccountDeployed", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// RarimarketAccountFactoryUpgradedIterator is returned from FilterUpgraded and is used to iterate over the raw logs and unpacked data for Upgraded events raised by the RarimarketAccountFactory contract. +type RarimarketAccountFactoryUpgradedIterator struct { + Event *RarimarketAccountFactoryUpgraded // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *RarimarketAccountFactoryUpgradedIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(RarimarketAccountFactoryUpgraded) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(RarimarketAccountFactoryUpgraded) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *RarimarketAccountFactoryUpgradedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *RarimarketAccountFactoryUpgradedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// RarimarketAccountFactoryUpgraded represents a Upgraded event raised by the RarimarketAccountFactory contract. +type RarimarketAccountFactoryUpgraded struct { + Implementation common.Address + Raw types.Log // Blockchain specific contextual infos +} + +// FilterUpgraded is a free log retrieval operation binding the contract event 0xbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b. +// +// Solidity: event Upgraded(address indexed implementation) +func (_RarimarketAccountFactory *RarimarketAccountFactoryFilterer) FilterUpgraded(opts *bind.FilterOpts, implementation []common.Address) (*RarimarketAccountFactoryUpgradedIterator, error) { + + var implementationRule []interface{} + for _, implementationItem := range implementation { + implementationRule = append(implementationRule, implementationItem) + } + + logs, sub, err := _RarimarketAccountFactory.contract.FilterLogs(opts, "Upgraded", implementationRule) + if err != nil { + return nil, err + } + return &RarimarketAccountFactoryUpgradedIterator{contract: _RarimarketAccountFactory.contract, event: "Upgraded", logs: logs, sub: sub}, nil +} + +// WatchUpgraded is a free log subscription operation binding the contract event 0xbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b. +// +// Solidity: event Upgraded(address indexed implementation) +func (_RarimarketAccountFactory *RarimarketAccountFactoryFilterer) WatchUpgraded(opts *bind.WatchOpts, sink chan<- *RarimarketAccountFactoryUpgraded, implementation []common.Address) (event.Subscription, error) { + + var implementationRule []interface{} + for _, implementationItem := range implementation { + implementationRule = append(implementationRule, implementationItem) + } + + logs, sub, err := _RarimarketAccountFactory.contract.WatchLogs(opts, "Upgraded", implementationRule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(RarimarketAccountFactoryUpgraded) + if err := _RarimarketAccountFactory.contract.UnpackLog(event, "Upgraded", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseUpgraded is a log parse operation binding the contract event 0xbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b. +// +// Solidity: event Upgraded(address indexed implementation) +func (_RarimarketAccountFactory *RarimarketAccountFactoryFilterer) ParseUpgraded(log types.Log) (*RarimarketAccountFactoryUpgraded, error) { + event := new(RarimarketAccountFactoryUpgraded) + if err := _RarimarketAccountFactory.contract.UnpackLog(event, "Upgraded", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} diff --git a/internal/data/pg/withdrawals.go b/internal/data/pg/withdrawals.go new file mode 100644 index 0000000..1e1e8e3 --- /dev/null +++ b/internal/data/pg/withdrawals.go @@ -0,0 +1,61 @@ +package pg + +import ( + "fmt" + + "github.com/Masterminds/squirrel" + "github.com/rarimo/geo-points-svc/internal/data" + "gitlab.com/distributed_lab/kit/pgdb" +) + +const withdrawalsTable = "withdrawals" + +type withdrawals struct { + db *pgdb.DB + selector squirrel.SelectBuilder +} + +func NewWithdrawals(db *pgdb.DB) data.WithdrawalsQ { + return &withdrawals{ + db: db, + selector: squirrel.Select("*").From(withdrawalsTable), + } +} + +func (q *withdrawals) New() data.WithdrawalsQ { + return NewWithdrawals(q.db) +} + +func (q *withdrawals) Insert(w data.Withdrawal) (*data.Withdrawal, error) { + var res data.Withdrawal + stmt := squirrel.Insert(withdrawalsTable).SetMap(map[string]interface{}{ + "nullifier": w.Nullifier, + "amount": w.Amount, + }).Suffix("RETURNING *") + + if err := q.db.Get(&res, stmt); err != nil { + return nil, fmt.Errorf("insert withdrawal [%+v]: %w", w, err) + } + + return &res, nil +} + +func (q *withdrawals) Page(page *pgdb.CursorPageParams) data.WithdrawalsQ { + q.selector = page.ApplyTo(q.selector, "created_at") + return q +} + +func (q *withdrawals) Select() ([]data.Withdrawal, error) { + var res []data.Withdrawal + + if err := q.db.Select(&res, q.selector); err != nil { + return nil, fmt.Errorf("select withdrawals: %w", err) + } + + return res, nil +} + +func (q *withdrawals) FilterByNullifier(nullifier string) data.WithdrawalsQ { + q.selector = q.selector.Where(squirrel.Eq{"nullifier": nullifier}) + return q +} diff --git a/internal/data/withdrawals.go b/internal/data/withdrawals.go new file mode 100644 index 0000000..75b0f93 --- /dev/null +++ b/internal/data/withdrawals.go @@ -0,0 +1,24 @@ +package data + +import ( + "time" + + "gitlab.com/distributed_lab/kit/pgdb" +) + +type Withdrawal struct { + ID string `db:"id"` + Nullifier string `db:"nullifier"` + Amount int64 `db:"amount"` + CreatedAt time.Time `db:"created_at"` +} + +type WithdrawalsQ interface { + New() WithdrawalsQ + Insert(Withdrawal) (*Withdrawal, error) + + Page(*pgdb.CursorPageParams) WithdrawalsQ + Select() ([]Withdrawal, error) + + FilterByNullifier(string) WithdrawalsQ +} diff --git a/internal/service/event/main.go b/internal/service/event/main.go index 7c99739..a61259b 100644 --- a/internal/service/event/main.go +++ b/internal/service/event/main.go @@ -22,7 +22,6 @@ func Run(cfg config.Config, date int) error { referralsQ := pg.NewReferrals(db) evType := evTypes.Get(models.TypeEarlyTest, evtypes.FilterInactive) - if evType == nil { log.Infof("Event type %s is inactive", models.TypeEarlyTest) return nil diff --git a/internal/service/handlers/ctx.go b/internal/service/handlers/ctx.go index 55323ae..8984cc7 100644 --- a/internal/service/handlers/ctx.go +++ b/internal/service/handlers/ctx.go @@ -21,6 +21,7 @@ const ( referralsQCtxKey eventTypesCtxKey eventTypesQCtxKey + withdrawalsQCtxKey userClaimsCtxKey levelsCtxKey verifiersCtxKey @@ -28,6 +29,7 @@ const ( voteVerifierCtxKey dailyQuestionsCtxKey dailyQuestionsCfgCtxKey + rarimarketCtxKey ) func CtxLog(entry *logan.Entry) func(context.Context) context.Context { @@ -100,6 +102,16 @@ func EventTypesQ(r *http.Request) data.EventTypesQ { return r.Context().Value(eventTypesQCtxKey).(data.EventTypesQ).New() } +func CtxWithdrawalsQ(q data.WithdrawalsQ) func(context.Context) context.Context { + return func(ctx context.Context) context.Context { + return context.WithValue(ctx, withdrawalsQCtxKey, q) + } +} + +func WithdrawalsQ(r *http.Request) data.WithdrawalsQ { + return r.Context().Value(withdrawalsQCtxKey).(data.WithdrawalsQ).New() +} + func CtxUserClaims(claim []resources.Claim) func(context.Context) context.Context { return func(ctx context.Context) context.Context { return context.WithValue(ctx, userClaimsCtxKey, claim) @@ -159,3 +171,13 @@ func CtxLevels(levels *config.Levels) func(context.Context) context.Context { func Levels(r *http.Request) *config.Levels { return r.Context().Value(levelsCtxKey).(*config.Levels) } + +func CtxRarimarket(rarimarket *config.RarimarketConfig) func(context.Context) context.Context { + return func(ctx context.Context) context.Context { + return context.WithValue(ctx, rarimarketCtxKey, rarimarket) + } +} + +func Rarimarket(r *http.Request) *config.RarimarketConfig { + return r.Context().Value(rarimarketCtxKey).(*config.RarimarketConfig) +} diff --git a/internal/service/handlers/middleware.go b/internal/service/handlers/middleware.go index 76f9590..ffd4646 100644 --- a/internal/service/handlers/middleware.go +++ b/internal/service/handlers/middleware.go @@ -51,6 +51,7 @@ func DBCloneMiddleware(db *pgdb.DB) func(http.Handler) http.Handler { CtxReferralsQ(pg.NewReferrals(clone)), CtxEventTypesQ(pg.NewEventTypes(clone)), CtxDailyQuestionsQ(pg.NewDailyQuestionsQ(clone)), + CtxWithdrawalsQ(pg.NewWithdrawals(clone)), } for _, extender := range extenders { diff --git a/internal/service/handlers/withdraw.go b/internal/service/handlers/withdraw.go new file mode 100644 index 0000000..f6842ac --- /dev/null +++ b/internal/service/handlers/withdraw.go @@ -0,0 +1,161 @@ +package handlers + +import ( + "bytes" + "errors" + "fmt" + "math" + "math/big" + "net/http" + + "github.com/ethereum/go-ethereum/common/hexutil" + validation "github.com/go-ozzo/ozzo-validation/v4" + "github.com/google/jsonapi" + "github.com/rarimo/geo-auth-svc/pkg/auth" + "github.com/rarimo/geo-points-svc/internal/config" + "github.com/rarimo/geo-points-svc/internal/data" + "github.com/rarimo/geo-points-svc/internal/data/pg" + "github.com/rarimo/geo-points-svc/internal/service/requests" + + zk "github.com/rarimo/zkverifier-kit" + "gitlab.com/distributed_lab/ape" + "gitlab.com/distributed_lab/ape/problems" +) + +func Withdraw(w http.ResponseWriter, r *http.Request) { + req, err := requests.NewWithdraw(r) + if err != nil { + ape.RenderErr(w, problems.BadRequest(err)...) + return + } + log := Log(r).WithFields(map[string]any{ + "nullifier": req.Data.ID, + "points_amount": req.Data.Attributes.Amount, + }) + + var ( + nullifier = req.Data.ID + proof = req.Data.Attributes.Proof + ) + + if !auth.Authenticates(UserClaims(r), auth.UserGrant(nullifier)) { + ape.RenderErr(w, problems.Unauthorized()) + return + } + + balance, errs := getAndVerifyBalanceEligibility(r, nullifier, nil) + if len(errs) > 0 { + ape.RenderErr(w, errs...) + return + } + + var nullifierBytes [32]byte + // never panic because of request validation + new(big.Int).SetBytes(hexutil.MustDecode(nullifier)).FillBytes(nullifierBytes[:]) + + addr, err := Rarimarket(r).GetAccount(nullifierBytes) + if err != nil { + log.WithError(err).Error("Failed to get account") + ape.RenderErr(w, problems.InternalError()) + return + } + if bytes.Equal(addr[:], config.ZeroAddress[:]) { + log.Info("Rarimarket account absent. Creating new!") + addr, err = Rarimarket(r).CreateAccount(r.Context(), nullifierBytes) + if err != nil { + log.WithError(err).Error("Failed to create account") + ape.RenderErr(w, problems.InternalError()) + return + } + } + + // never panics because of request validation + proof.PubSignals[zk.Nullifier] = mustHexToInt(nullifier) + + err = Verifiers(r).Passport.VerifyProof(proof) + if err != nil { + var vErr validation.Errors + if errors.As(err, &vErr) { + ape.RenderErr(w, problems.BadRequest(err)...) + return + } + + Log(r).WithError(err).Error("Failed to verify proof") + ape.RenderErr(w, problems.InternalError()) + return + } + + errs = isEligibleToWithdraw(r, balance, req.Data.Attributes.Amount) + if len(errs) > 0 { + ape.RenderErr(w, errs...) + return + } + + err = EventsQ(r).Transaction(func() error { + err = BalancesQ(r).FilterByNullifier(nullifier).Update(map[string]any{ + data.ColAmount: pg.AddToValue(data.ColAmount, -req.Data.Attributes.Amount), + }) + if err != nil { + return fmt.Errorf("decrease points amount: %w", err) + } + + _, err = WithdrawalsQ(r).Insert(data.Withdrawal{ + Nullifier: nullifier, + Amount: req.Data.Attributes.Amount, + }) + if err != nil { + return fmt.Errorf("add withdrawal entry: %w", err) + } + + err = Rarimarket(r).Mint(r.Context(), addr, + new(big.Int).Mul( + new(big.Int).Mul( + big.NewInt(int64(math.Pow10(9))), + big.NewInt(Rarimarket(r).PointPrice)), + big.NewInt(req.Data.Attributes.Amount))) + + if err != nil { + return fmt.Errorf("failed to mint points: %w", err) + } + return nil + }) + if err != nil { + log.WithError(err).Error("Failed to perform withdrawal") + ape.RenderErr(w, problems.InternalError()) + return + } + + // balance should exist cause of previous logic + balance, err = BalancesQ(r).GetWithRank(nullifier) + if err != nil { + log.WithError(err).Error("Failed to get balance by nullifier with rank") + ape.RenderErr(w, problems.InternalError()) + return + } + + ape.Render(w, newBalanceModel(*balance)) +} + +func isEligibleToWithdraw( + r *http.Request, + balance *data.Balance, + amount int64, +) []*jsonapi.ErrorObject { + + mapValidationErr := func(field, format string, a ...any) []*jsonapi.ErrorObject { + return problems.BadRequest(validation.Errors{ + field: fmt.Errorf(format, a...), + }) + } + + switch { + case !balance.IsVerified(): + return mapValidationErr("data/attributes/proof", "passport must be proven beforehand") + case balance.Amount < amount: + return mapValidationErr("data/attributes/amount", "insufficient balance: %d", balance.Amount) + case !Levels(r).WithdrawalAllowed(balance.Level): + return mapValidationErr("level", "must up level to have withdraw ability") + } + + return nil +} diff --git a/internal/service/requests/withdraw.go b/internal/service/requests/withdraw.go new file mode 100644 index 0000000..95c59ed --- /dev/null +++ b/internal/service/requests/withdraw.go @@ -0,0 +1,30 @@ +package requests + +import ( + "encoding/json" + "net/http" + "strings" + + "github.com/go-chi/chi" + validation "github.com/go-ozzo/ozzo-validation/v4" + "github.com/rarimo/geo-points-svc/resources" +) + +func NewWithdraw(r *http.Request) (req resources.WithdrawRequest, err error) { + if err = json.NewDecoder(r.Body).Decode(&req); err != nil { + err = newDecodeError("body", err) + return + } + + req.Data.ID = strings.ToLower(req.Data.ID) + + return req, validation.Errors{ + "data/id": validation.Validate(req.Data.ID, + validation.Required, + validation.In(strings.ToLower(chi.URLParam(r, "nullifier"))), + validation.Match(nullifierRegexp)), + "data/type": validation.Validate(req.Data.Type, validation.Required, validation.In(resources.WITHDRAW)), + "data/attributes/amount": validation.Validate(req.Data.Attributes.Amount, validation.Required, validation.Min(1)), + "data/attributes/proof": validation.Validate(req.Data.Attributes.Proof, validation.Required), + }.Filter() +} diff --git a/internal/service/router.go b/internal/service/router.go index 302a1a6..e91f820 100644 --- a/internal/service/router.go +++ b/internal/service/router.go @@ -25,6 +25,7 @@ func Run(ctx context.Context, cfg config.Config) { handlers.CtxSigCalculator(cfg.SigCalculator()), handlers.CtxPollVerifier(cfg.PollVerifier()), handlers.CtxDailyQuestion(cfg.DailyQuestions()), + handlers.CtxRarimarket(cfg.RarimarketConfig()), ), handlers.DBCloneMiddleware(cfg.DB()), ) @@ -43,6 +44,7 @@ func Run(ctx context.Context, cfg config.Config) { r.Route("/verify", func(r chi.Router) { r.Post("/external", handlers.VerifyExternalPassport) }) + r.Post("/withdrawals", nil) }) }) diff --git a/resources/model_resource_type.go b/resources/model_resource_type.go index 339c618..03dff13 100644 --- a/resources/model_resource_type.go +++ b/resources/model_resource_type.go @@ -20,4 +20,5 @@ const ( FULFILL_POLL_EVENT ResourceType = "fulfill_poll_event" FULFILL_QR_EVENT ResourceType = "fulfill_qr_event" VERIFY_PASSPORT ResourceType = "verify_passport" + WITHDRAW ResourceType = "withdraw" ) diff --git a/resources/model_withdraw.go b/resources/model_withdraw.go new file mode 100644 index 0000000..4cbc57a --- /dev/null +++ b/resources/model_withdraw.go @@ -0,0 +1,43 @@ +/* + * GENERATED. Do not modify. Your changes might be overwritten! + */ + +package resources + +import "encoding/json" + +type Withdraw struct { + Key + Attributes WithdrawAttributes `json:"attributes"` +} +type WithdrawRequest struct { + Data Withdraw `json:"data"` + Included Included `json:"included"` +} + +type WithdrawListRequest struct { + Data []Withdraw `json:"data"` + Included Included `json:"included"` + Links *Links `json:"links"` + Meta json.RawMessage `json:"meta,omitempty"` +} + +func (r *WithdrawListRequest) PutMeta(v interface{}) (err error) { + r.Meta, err = json.Marshal(v) + return err +} + +func (r *WithdrawListRequest) GetMeta(out interface{}) error { + return json.Unmarshal(r.Meta, out) +} + +// MustWithdraw - returns Withdraw from include collection. +// if entry with specified key does not exist - returns nil +// if entry with specified key exists but type or ID mismatches - panics +func (c *Included) MustWithdraw(key Key) *Withdraw { + var withdraw Withdraw + if c.tryFindEntry(key, &withdraw) { + return &withdraw + } + return nil +} diff --git a/resources/model_withdraw_attributes.go b/resources/model_withdraw_attributes.go new file mode 100644 index 0000000..0aa6d02 --- /dev/null +++ b/resources/model_withdraw_attributes.go @@ -0,0 +1,14 @@ +/* + * GENERATED. Do not modify. Your changes might be overwritten! + */ + +package resources + +import "github.com/iden3/go-rapidsnark/types" + +type WithdrawAttributes struct { + // Amount of points to withdraw + Amount int64 `json:"amount"` + // Query ZK passport verification proof. + Proof types.ZKProof `json:"proof"` +}