2020-07-24 13:54:03 +00:00
|
|
|
package balance
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/nspcc-dev/neofs-node/pkg/innerring/invoke"
|
|
|
|
balanceEvent "github.com/nspcc-dev/neofs-node/pkg/morph/event/balance"
|
|
|
|
"go.uber.org/zap"
|
|
|
|
)
|
|
|
|
|
|
|
|
// Process lock event by invoking Cheque method in main net to send assets
|
|
|
|
// back to the withdraw issuer.
|
|
|
|
func (bp *Processor) processLock(lock *balanceEvent.Lock) {
|
|
|
|
if !bp.activeState.IsActive() {
|
|
|
|
bp.log.Info("passive mode, ignore balance lock")
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
err := invoke.CashOutCheque(bp.mainnetClient, bp.neofsContract,
|
|
|
|
&invoke.ChequeParams{
|
|
|
|
ID: lock.ID(),
|
2020-09-08 09:09:08 +00:00
|
|
|
Amount: lock.Amount() / 1_0000_0000, // Fixed16 to Fixed8
|
2020-07-24 13:54:03 +00:00
|
|
|
User: lock.User(),
|
|
|
|
LockAccount: lock.LockAccount(),
|
|
|
|
})
|
|
|
|
if err != nil {
|
|
|
|
bp.log.Error("can't send lock asset tx", zap.Error(err))
|
|
|
|
}
|
|
|
|
}
|