forked from TrueCloudLab/frostfs-node
[#1400] owner: Upgrade SDK package
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
parent
f8ac4632f8
commit
bb25ecbd15
60 changed files with 379 additions and 327 deletions
|
@ -65,7 +65,7 @@ func (inc *IncomeSettlementContext) Collect() {
|
|||
|
||||
txTable.Transfer(&common.TransferTx{
|
||||
From: owner.Owner(),
|
||||
To: inc.bankOwner,
|
||||
To: &inc.bankOwner,
|
||||
Amount: total,
|
||||
})
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@ import (
|
|||
"github.com/nspcc-dev/neo-go/pkg/util"
|
||||
"github.com/nspcc-dev/neofs-node/pkg/innerring/processors/settlement/common"
|
||||
"github.com/nspcc-dev/neofs-node/pkg/morph/client/container"
|
||||
"github.com/nspcc-dev/neofs-sdk-go/owner"
|
||||
"github.com/nspcc-dev/neofs-sdk-go/user"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
|
@ -22,7 +22,7 @@ type (
|
|||
|
||||
// BalanceFetcher uses NEP-17 compatible balance contract
|
||||
BalanceFetcher interface {
|
||||
Balance(id *owner.ID) (*big.Int, error)
|
||||
Balance(id *user.ID) (*big.Int, error)
|
||||
}
|
||||
|
||||
IncomeSettlementContext struct {
|
||||
|
@ -39,7 +39,7 @@ type (
|
|||
exchange common.Exchanger
|
||||
accounts common.AccountStorage
|
||||
|
||||
bankOwner *owner.ID
|
||||
bankOwner user.ID
|
||||
|
||||
// this table is not thread safe, make sure you use it with mu.Lock()
|
||||
distributeTable *NodeSizeTable
|
||||
|
@ -58,11 +58,8 @@ type (
|
|||
}
|
||||
)
|
||||
|
||||
func NewIncomeSettlementContext(p *IncomeSettlementContextPrms) (*IncomeSettlementContext, error) {
|
||||
bankingAccount := owner.NewID()
|
||||
bankingAccount.SetScriptHash(util.Uint160{1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1})
|
||||
|
||||
return &IncomeSettlementContext{
|
||||
func NewIncomeSettlementContext(p *IncomeSettlementContextPrms) *IncomeSettlementContext {
|
||||
res := &IncomeSettlementContext{
|
||||
log: p.Log,
|
||||
epoch: p.Epoch,
|
||||
rate: p.Rate,
|
||||
|
@ -72,7 +69,10 @@ func NewIncomeSettlementContext(p *IncomeSettlementContextPrms) (*IncomeSettleme
|
|||
placement: p.Placement,
|
||||
exchange: p.Exchange,
|
||||
accounts: p.Accounts,
|
||||
bankOwner: bankingAccount,
|
||||
distributeTable: NewNodeSizeTable(),
|
||||
}, nil
|
||||
}
|
||||
|
||||
res.bankOwner.SetScriptHash(util.Uint160{1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1})
|
||||
|
||||
return res
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ func (inc *IncomeSettlementContext) Distribute() {
|
|||
|
||||
txTable := common.NewTransferTable()
|
||||
|
||||
bankBalance, err := inc.balances.Balance(inc.bankOwner)
|
||||
bankBalance, err := inc.balances.Balance(&inc.bankOwner)
|
||||
if err != nil {
|
||||
inc.log.Error("can't fetch balance of banking account",
|
||||
zap.String("error", err.Error()))
|
||||
|
@ -35,7 +35,7 @@ func (inc *IncomeSettlementContext) Distribute() {
|
|||
}
|
||||
|
||||
txTable.Transfer(&common.TransferTx{
|
||||
From: inc.bankOwner,
|
||||
From: &inc.bankOwner,
|
||||
To: nodeOwner,
|
||||
Amount: normalizedValue(n, total, bankBalance),
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue