[#365] settlement/basic: Implement asset distribution

Signed-off-by: Alex Vanin <alexey@nspcc.ru>
This commit is contained in:
Alex Vanin 2021-02-02 20:23:01 +03:00 committed by Alex Vanin
parent 4433448645
commit 8e741a277d
5 changed files with 155 additions and 11 deletions

View file

@ -39,9 +39,13 @@ type (
container common.ContainerStorage
placement common.PlacementCalculator
exchange common.Exchanger
accounts common.AccountStorage
txTable *common.TransferTable
bankOwner *owner.ID
// this table is not thread safe, make sure you use it with mu.Lock()
distributeTable *NodeSizeTable
}
IncomeSettlementContextPrms struct {
@ -53,6 +57,7 @@ type (
Container common.ContainerStorage
Placement common.PlacementCalculator
Exchange common.Exchanger
Accounts common.AccountStorage
}
)
@ -63,16 +68,18 @@ func NewIncomeSettlementContext(p *IncomeSettlementContextPrms) (*IncomeSettleme
}
return &IncomeSettlementContext{
log: p.Log,
epoch: p.Epoch,
rate: p.Rate,
estimations: p.Estimations,
balances: p.Balances,
container: p.Container,
placement: p.Placement,
exchange: p.Exchange,
txTable: common.NewTransferTable(),
bankOwner: bankingAccount,
log: p.Log,
epoch: p.Epoch,
rate: p.Rate,
estimations: p.Estimations,
balances: p.Balances,
container: p.Container,
placement: p.Placement,
exchange: p.Exchange,
accounts: p.Accounts,
txTable: common.NewTransferTable(),
bankOwner: bankingAccount,
distributeTable: NewNodeSizeTable(),
}, nil
}