Merge pull request #1729 from c9s/c9s/max/fix-v3-deposit-state-conversion

FIX: [max] fix v3 deposit state conversion
This commit is contained in:
c9s 2024-09-04 11:41:22 +08:00 committed by GitHub
commit 699164484b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 13 additions and 2 deletions

View File

@ -284,11 +284,18 @@ func toGlobalDepositStatus(a max.DepositState) types.DepositStatus {
case max.DepositStateAccepted: case max.DepositStateAccepted:
return types.DepositSuccess return types.DepositSuccess
case max.DepositStateProcessing: // v3 states
return types.DepositPending
case max.DepositStateDone: // v3 states
return types.DepositSuccess
} }
// other states goes to this // other states goes to this
// max.DepositStateSuspect, max.DepositStateSuspended // max.DepositStateSuspect, max.DepositStateSuspended
log.Warnf("unsupported deposit state %q from max exchange", a) log.Errorf("unsupported deposit state %q from max exchange", a)
return types.DepositStatus(a) return types.DepositStatus(a)
} }

View File

@ -116,6 +116,10 @@ const (
DepositStateSuspended DepositState = "suspended" DepositStateSuspended DepositState = "suspended"
DepositStateAccepted DepositState = "accepted" DepositStateAccepted DepositState = "accepted"
DepositStateChecking DepositState = "checking" DepositStateChecking DepositState = "checking"
// v3 states
DepositStateProcessing DepositState = "processing"
DepositStateDone DepositState = "done"
) )
type Deposit struct { type Deposit struct {

View File

@ -236,7 +236,7 @@ func (s *Strategy) scanDepositHistory(ctx context.Context, asset string, duratio
s.watchingDeposits[deposit.TransactionID] = deposit s.watchingDeposits[deposit.TransactionID] = deposit
} }
} else { } else {
// ignore all initial deposit history that are already success // ignore all initial deposits that are already in success status
logger.Infof("ignored succeess deposit: %s %+v", deposit.TransactionID, deposit) logger.Infof("ignored succeess deposit: %s %+v", deposit.TransactionID, deposit)
} }