forked from TrueCloudLab/frostfs-node
43 lines
825 B
Go
43 lines
825 B
Go
package balance
|
|
|
|
import (
|
|
"context"
|
|
|
|
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/morph/client"
|
|
"github.com/nspcc-dev/neo-go/pkg/util"
|
|
)
|
|
|
|
// BurnPrm groups parameters of Burn operation.
|
|
type BurnPrm struct {
|
|
to util.Uint160
|
|
amount int64
|
|
id []byte
|
|
|
|
client.InvokePrmOptional
|
|
}
|
|
|
|
// SetTo sets receiver.
|
|
func (b *BurnPrm) SetTo(to util.Uint160) {
|
|
b.to = to
|
|
}
|
|
|
|
// SetAmount sets amount.
|
|
func (b *BurnPrm) SetAmount(amount int64) {
|
|
b.amount = amount
|
|
}
|
|
|
|
// SetID sets ID.
|
|
func (b *BurnPrm) SetID(id []byte) {
|
|
b.id = id
|
|
}
|
|
|
|
// Burn destroys funds from the account.
|
|
func (c *Client) Burn(ctx context.Context, p BurnPrm) error {
|
|
prm := client.InvokePrm{}
|
|
prm.SetMethod(burnMethod)
|
|
prm.SetArgs(p.to, p.amount, p.id)
|
|
prm.InvokePrmOptional = p.InvokePrmOptional
|
|
|
|
_, err := c.client.Invoke(ctx, prm)
|
|
return err
|
|
}
|