From 4239f1e81771affc467ff93376f5d94cf85512be Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Tue, 24 Oct 2023 15:20:38 +0300 Subject: [PATCH] [#750] adm: Drop deprecated rpcclient.TransferTarget We do not use `nep17` wrapper, because transfers of different tokens are possible in a single transaction. Signed-off-by: Evgenii Stratonikov --- .../modules/morph/initialize_transfer.go | 22 ++++++++++++------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/cmd/frostfs-adm/internal/modules/morph/initialize_transfer.go b/cmd/frostfs-adm/internal/modules/morph/initialize_transfer.go index 3d214d0cf..12b94a2ed 100644 --- a/cmd/frostfs-adm/internal/modules/morph/initialize_transfer.go +++ b/cmd/frostfs-adm/internal/modules/morph/initialize_transfer.go @@ -7,13 +7,13 @@ import ( "github.com/nspcc-dev/neo-go/pkg/core/native" "github.com/nspcc-dev/neo-go/pkg/core/transaction" "github.com/nspcc-dev/neo-go/pkg/io" - "github.com/nspcc-dev/neo-go/pkg/rpcclient" "github.com/nspcc-dev/neo-go/pkg/rpcclient/actor" "github.com/nspcc-dev/neo-go/pkg/rpcclient/gas" "github.com/nspcc-dev/neo-go/pkg/rpcclient/neo" "github.com/nspcc-dev/neo-go/pkg/rpcclient/nep17" "github.com/nspcc-dev/neo-go/pkg/smartcontract/callflag" scContext "github.com/nspcc-dev/neo-go/pkg/smartcontract/context" + "github.com/nspcc-dev/neo-go/pkg/util" "github.com/nspcc-dev/neo-go/pkg/vm/emit" "github.com/nspcc-dev/neo-go/pkg/vm/opcode" "github.com/nspcc-dev/neo-go/pkg/wallet" @@ -36,11 +36,11 @@ func (c *initializeContext) transferFunds() error { return err } - var transfers []rpcclient.TransferTarget + var transfers []transferTarget for _, acc := range c.Accounts { to := acc.Contract.ScriptHash() transfers = append(transfers, - rpcclient.TransferTarget{ + transferTarget{ Token: gas.Hash, Address: to, Amount: initialAlphabetGASAmount, @@ -50,12 +50,12 @@ func (c *initializeContext) transferFunds() error { // It is convenient to have all funds at the committee account. transfers = append(transfers, - rpcclient.TransferTarget{ + transferTarget{ Token: gas.Hash, Address: c.CommitteeAcc.Contract.ScriptHash(), Amount: (gasInitialTotalSupply - initialAlphabetGASAmount*int64(len(c.Wallets))) / 2, }, - rpcclient.TransferTarget{ + transferTarget{ Token: neo.Hash, Address: c.CommitteeAcc.Contract.ScriptHash(), Amount: native.NEOTotalSupply, @@ -151,7 +151,7 @@ func (c *initializeContext) transferGASToProxy() error { return err } - tx, err := createNEP17MultiTransferTx(c.Client, c.CommitteeAcc, []rpcclient.TransferTarget{{ + tx, err := createNEP17MultiTransferTx(c.Client, c.CommitteeAcc, []transferTarget{{ Token: gas.Hash, Address: proxyCs.Hash, Amount: initialProxyGASAmount, @@ -167,8 +167,14 @@ func (c *initializeContext) transferGASToProxy() error { return c.awaitTx() } -func createNEP17MultiTransferTx(c Client, acc *wallet.Account, - recipients []rpcclient.TransferTarget) (*transaction.Transaction, error) { +type transferTarget struct { + Token util.Uint160 + Address util.Uint160 + Amount int64 + Data any +} + +func createNEP17MultiTransferTx(c Client, acc *wallet.Account, recipients []transferTarget) (*transaction.Transaction, error) { from := acc.Contract.ScriptHash() w := io.NewBufBinWriter()