forked from TrueCloudLab/frostfs-node
Alex Vanin
20de74a505
Due to source code relocation from GitHub. Signed-off-by: Alex Vanin <a.vanin@yadro.com>
52 lines
1 KiB
Go
52 lines
1 KiB
Go
package balance
|
|
|
|
import (
|
|
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/morph/client"
|
|
"github.com/nspcc-dev/neo-go/pkg/util"
|
|
)
|
|
|
|
// LockPrm groups parameters of Lock operation.
|
|
type LockPrm struct {
|
|
id []byte
|
|
user util.Uint160
|
|
lock util.Uint160
|
|
amount int64
|
|
dueEpoch int64
|
|
|
|
client.InvokePrmOptional
|
|
}
|
|
|
|
// SetID sets ID.
|
|
func (l *LockPrm) SetID(id []byte) {
|
|
l.id = id
|
|
}
|
|
|
|
// SetUser set user.
|
|
func (l *LockPrm) SetUser(user util.Uint160) {
|
|
l.user = user
|
|
}
|
|
|
|
// SetLock sets lock.
|
|
func (l *LockPrm) SetLock(lock util.Uint160) {
|
|
l.lock = lock
|
|
}
|
|
|
|
// SetAmount sets amount.
|
|
func (l *LockPrm) SetAmount(amount int64) {
|
|
l.amount = amount
|
|
}
|
|
|
|
// SetDueEpoch sets end of the lock.
|
|
func (l *LockPrm) SetDueEpoch(dueEpoch int64) {
|
|
l.dueEpoch = dueEpoch
|
|
}
|
|
|
|
// Lock locks fund on the user account.
|
|
func (c *Client) Lock(p LockPrm) error {
|
|
prm := client.InvokePrm{}
|
|
prm.SetMethod(lockMethod)
|
|
prm.SetArgs(p.id, p.user, p.lock, p.amount, p.dueEpoch)
|
|
prm.InvokePrmOptional = p.InvokePrmOptional
|
|
|
|
return c.client.Invoke(prm)
|
|
}
|