distributor

package
v1.5.2-rc-3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 21, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const TotalPositiveTransfersPerTransaction = 9

Variables

This section is empty.

Functions

func SplitAccountAmounts

func SplitAccountAmounts(positiveAccountAmounts []transfer.Hedera, negativeAccountAmount transfer.Hedera) [][]transfer.Hedera

SplitAccountAmounts splits account amounts to a chunks of TotalPositiveTransfersPerTransaction + 1 (1 comes from the negative account amount, opposite to the sum of the positive account amounts) It is necessary, because at this given moment, Hedera does not support a transfer transaction with a transfer list exceeding (TotalPositiveTransfersPerTransaction + 1)

Types

type Service

type Service struct {
	// contains filtered or unexported fields
}

func New

func New(members []string) *Service

func (Service) CalculateMemberDistribution

func (s Service) CalculateMemberDistribution(amount int64) ([]transfer.Hedera, error)

CalculateMemberDistribution Returns an equally divided to each member

func (Service) PrepareTransfers

func (s Service) PrepareTransfers(amount int64, token string) ([]transaction.Transfer, error)

func (Service) ValidAmount

func (s Service) ValidAmount(amount int64) int64

ValidAmount Returns the closest amount, which can be equally divided to members

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL