Skip to content

Commit

Permalink
adjusted kyc handling logic take the kyc enabled flag into account wh…
Browse files Browse the repository at this point in the history
…en verifying if users are blocked on kyc step 1; adjusted kyc handling logic to allow max X time for users to not be required kyc step 1;
  • Loading branch information
ice-ares committed Nov 20, 2023
1 parent ff6470b commit f15c51d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ require (
github.com/cenkalti/backoff/v4 v4.2.1
github.com/goccy/go-json v0.10.2
github.com/hashicorp/go-multierror v1.1.1
github.com/ice-blockchain/eskimo v1.180.0
github.com/ice-blockchain/eskimo v1.181.0
github.com/ice-blockchain/go-tarantool-client v0.0.0-20230327200757-4fc71fa3f7bb
github.com/ice-blockchain/wintr v1.125.0
github.com/imroc/req/v3 v3.42.1
github.com/imroc/req/v3 v3.42.2
github.com/pkg/errors v0.9.1
github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475
github.com/redis/go-redis/v9 v9.3.0
Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -301,14 +301,14 @@ github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4=
github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ=
github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
github.com/ice-blockchain/eskimo v1.180.0 h1:fhg0elXwuhJq1jYyFkTbGZeO/OhtU9rS2+oPtUJLe9o=
github.com/ice-blockchain/eskimo v1.180.0/go.mod h1:oXuuEPPEB4UMqyACv8LnTogIn4uU0tFCd2Y6ci7T+g4=
github.com/ice-blockchain/eskimo v1.181.0 h1:qqZgvfHBWGzaHXhIshrqLBkp76wjRgdE307gocWpdDI=
github.com/ice-blockchain/eskimo v1.181.0/go.mod h1:oXuuEPPEB4UMqyACv8LnTogIn4uU0tFCd2Y6ci7T+g4=
github.com/ice-blockchain/go-tarantool-client v0.0.0-20230327200757-4fc71fa3f7bb h1:8TnFP3mc7O+tc44kv2e0/TpZKnEVUaKH+UstwfBwRkk=
github.com/ice-blockchain/go-tarantool-client v0.0.0-20230327200757-4fc71fa3f7bb/go.mod h1:ZsQU7i3mxhgBBu43Oev7WPFbIjP4TniN/b1UPNGbrq8=
github.com/ice-blockchain/wintr v1.125.0 h1:pk/SVyztstUF19+JDCufJRMXJeNpchVA4O26xp47l3Y=
github.com/ice-blockchain/wintr v1.125.0/go.mod h1:Wq/uG3vDL/Na9lhpOo9NI7y3gLNZn2u/oa6+t85GT9c=
github.com/imroc/req/v3 v3.42.1 h1:g82SouLvX7pqwqJjpQJYrVvuI+LOycWhyuwxtLlyQJk=
github.com/imroc/req/v3 v3.42.1/go.mod h1:W7dOrfQORA9nFoj+CafIZ6P5iyk+rWdbp2sffOAvABU=
github.com/imroc/req/v3 v3.42.2 h1:/BwrKXGR7X1/ptccaQAiziDCeZ7T6ye55g3ZhiLy1fc=
github.com/imroc/req/v3 v3.42.2/go.mod h1:W7dOrfQORA9nFoj+CafIZ6P5iyk+rWdbp2sffOAvABU=
github.com/ip2location/ip2location-go/v9 v9.6.1 h1:4tYtSoRNpUwbbgf3NUmF7c5vV0QVCKEeRPSbMCXiQfE=
github.com/ip2location/ip2location-go/v9 v9.6.1/go.mod h1:MPLnsKxwQlvd2lBNcQCsLoyzJLDBFizuO67wXXdzoyI=
github.com/jackc/pgpassfile v1.0.0 h1:/6Hmqy13Ss2zCq62VdNG8tM1wchn8zjSGOBJ6icpsIM=
Expand Down
5 changes: 3 additions & 2 deletions tokenomics/kyc.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ func (r *repository) validateKYC(ctx context.Context, state *getCurrentMiningSes
if err := r.overrideKYCStateWithEskimoKYCState(ctx, state.UserID, &state.KYCState); err != nil {
return errors.Wrapf(err, "failed to overrideKYCStateWithEskimoKYCState for %#v", state)
}
if state.KYCStepBlocked > 0 {
if state.KYCStepBlocked > 0 && r.isKYCEnabled(ctx, users.FacialRecognitionKYCStep) {
return terror.New(ErrMiningDisabled, map[string]any{
"kycStepBlocked": state.KYCStepBlocked,
})
Expand All @@ -112,7 +112,8 @@ func (r *repository) validateKYC(ctx context.Context, state *getCurrentMiningSes
case users.NoneKYCStep:
var (
atLeastOneMiningStarted = !state.MiningSessionSoloLastStartedAt.IsNil()
isReservedForToday = r.cfg.KYC.LivenessDelay <= r.cfg.MiningSessionDuration.Max || int64((time.Now().Sub(*r.livenessLoadDistributionStartDate.Time)%r.cfg.KYC.LivenessDelay)/r.cfg.MiningSessionDuration.Max) == state.ID%int64(r.cfg.KYC.LivenessDelay/r.cfg.MiningSessionDuration.Max) //nolint:lll // .
isAfterFirstWindow = time.Now().Sub(*r.livenessLoadDistributionStartDate.Time) > r.cfg.KYC.LivenessDelay
isReservedForToday = r.cfg.KYC.LivenessDelay <= r.cfg.MiningSessionDuration.Max || isAfterFirstWindow || int64((time.Now().Sub(*r.livenessLoadDistributionStartDate.Time)%r.cfg.KYC.LivenessDelay)/r.cfg.MiningSessionDuration.Max) == state.ID%int64(r.cfg.KYC.LivenessDelay/r.cfg.MiningSessionDuration.Max) //nolint:lll // .
)
if atLeastOneMiningStarted && isReservedForToday && r.isKYCEnabled(ctx, users.FacialRecognitionKYCStep) {
return terror.New(ErrKYCRequired, map[string]any{
Expand Down

0 comments on commit f15c51d

Please sign in to comment.