forked from TrueCloudLab/frostfs-node
[#128] innerring: Add GAS pouring mechanism for a configurable list of wallets
Signed-off-by: Artem Tataurov <a.tataurov@yadro.com>
This commit is contained in:
parent
abd21f8099
commit
db3ccd2762
7 changed files with 83 additions and 1 deletions
|
@ -244,6 +244,40 @@ func (c *Client) TransferGas(receiver util.Uint160, amount fixedn.Fixed8) error
|
|||
return nil
|
||||
}
|
||||
|
||||
func (c *Client) BatchTransferGas(receivers []util.Uint160, amount fixedn.Fixed8) error {
|
||||
c.switchLock.RLock()
|
||||
defer c.switchLock.RUnlock()
|
||||
|
||||
if c.inactive {
|
||||
return ErrConnectionLost
|
||||
}
|
||||
|
||||
transferParams := make([]nep17.TransferParameters, len(receivers))
|
||||
receiversLog := make([]string, len(receivers))
|
||||
|
||||
for i, receiver := range receivers {
|
||||
transferParams[i] = nep17.TransferParameters{
|
||||
From: c.accAddr,
|
||||
To: receiver,
|
||||
Amount: big.NewInt(int64(amount)),
|
||||
Data: nil,
|
||||
}
|
||||
receiversLog[i] = receiver.StringLE()
|
||||
}
|
||||
|
||||
txHash, vub, err := c.gasToken.MultiTransfer(transferParams)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
c.logger.Debug("batch gas transfer invoke",
|
||||
zap.Strings("to", receiversLog),
|
||||
zap.Stringer("tx_hash", txHash.Reverse()),
|
||||
zap.Uint32("vub", vub))
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// Wait function blocks routing execution until there
|
||||
// are `n` new blocks in the chain.
|
||||
//
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue