frostfs-node/pkg/innerring/invoke/netmap.go
Alex Vanin 3d0064cb4c [#14] Use lower case in first letter of contract methods
Signed-off-by: Alex Vanin <alexey@nspcc.ru>
2020-10-02 11:25:35 +03:00

39 lines
782 B
Go

package invoke
import (
"github.com/nspcc-dev/neo-go/pkg/util"
"github.com/nspcc-dev/neofs-node/pkg/morph/client"
)
const (
getEpochMethod = "epoch"
setNewEpochMethod = "newEpoch"
)
// Epoch return epoch value from contract.
func Epoch(cli *client.Client, con util.Uint160) (int64, error) {
if cli == nil {
return 0, client.ErrNilClient
}
val, err := cli.TestInvoke(con, getEpochMethod)
if err != nil {
return 0, err
}
epoch, err := client.IntFromStackItem(val[0])
if err != nil {
return 0, err
}
return epoch, nil
}
// SetNewEpoch invokes NewEpoch method.
func SetNewEpoch(cli *client.Client, con util.Uint160, epoch uint64) error {
if cli == nil {
return client.ErrNilClient
}
return cli.Invoke(con, extraFee, setNewEpochMethod, int64(epoch))
}