2020-07-24 13:54:03 +00:00
|
|
|
package balance
|
|
|
|
|
|
|
|
import (
|
|
|
|
balanceEvent "github.com/nspcc-dev/neofs-node/pkg/morph/event/balance"
|
|
|
|
"go.uber.org/zap"
|
|
|
|
)
|
|
|
|
|
2021-05-21 07:45:15 +00:00
|
|
|
const chequeMethod = "cheque"
|
|
|
|
|
2020-07-24 13:54:03 +00:00
|
|
|
// 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) {
|
2021-03-23 15:20:44 +00:00
|
|
|
if !bp.alphabetState.IsAlphabet() {
|
|
|
|
bp.log.Info("non alphabet mode, ignore balance lock")
|
2020-07-24 13:54:03 +00:00
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2021-05-21 07:45:15 +00:00
|
|
|
err := bp.mainnetClient.NotaryInvoke(bp.neofsContract, bp.feeProvider.MainChainFee(), chequeMethod,
|
|
|
|
lock.ID(),
|
|
|
|
lock.User(),
|
|
|
|
bp.converter.ToFixed8(lock.Amount()),
|
|
|
|
lock.LockAccount())
|
2020-07-24 13:54:03 +00:00
|
|
|
if err != nil {
|
|
|
|
bp.log.Error("can't send lock asset tx", zap.Error(err))
|
|
|
|
}
|
|
|
|
}
|