frostfs-node/pkg/innerring/processors/balance/process_assets.go
Alex Vanin 90984ee219 [#122] Add converter interface in balance and neofs processors
Signed-off-by: Alex Vanin <alexey@nspcc.ru>
2020-10-28 13:36:59 +03:00

27 lines
761 B
Go

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(),
Amount: bp.converter.ToFixed8(lock.Amount()),
User: lock.User(),
LockAccount: lock.LockAccount(),
})
if err != nil {
bp.log.Error("can't send lock asset tx", zap.Error(err))
}
}