Documentation ¶
Index ¶
- Constants
- Variables
- func AbortWithMessage(msg string)
- func AlphabetAddress() []byte
- func AlphabetNodes() []interop.PublicKey
- func AppendVersion(data any) []any
- func BurnTransferDetails(txDetails []byte) []byte
- func BytesEqual(a []byte, b []byte) bool
- func CheckAlphabetWitness(caller []byte)
- func CheckOwnerWitness(caller []byte)
- func CheckVersion(from int)
- func CheckWitness(caller []byte)
- func CommitteeAddress() []byte
- func ContainerFeeTransferDetails(cid []byte) []byte
- func FromKnownContract(ctx storage.Context, caller interop.Hash160, key string) bool
- func GetList(ctx storage.Context, key any) [][]byte
- func HasUpdateAccess() bool
- func InferNNSHash() interop.Hash160
- func InitVote(ctx storage.Context)
- func InnerRingInvoker(ir []interop.PublicKey) interop.PublicKey
- func InnerRingNodes() []interop.PublicKey
- func InnerRingNodesFromNetmap(sc interop.Hash160) []interop.PublicKey
- func InvokeID(args []any, prefix []byte) []byte
- func LockTransferDetails(txDetails []byte) []byte
- func MintTransferDetails(txDetails []byte) []byte
- func Multiaddress(n []interop.PublicKey, committee bool) []byte
- func RemoveVotes(ctx storage.Context, id []byte)
- func ResolveFSContract(name string) interop.Hash160
- func ResolveFSContractWithNNS(nns interop.Hash160, contractName string) interop.Hash160
- func SetSerialized(ctx storage.Context, key any, value any)
- func SubscribeForNewEpoch()
- func TryPurgeVotes(ctx storage.Context) bool
- func UnlockTransferDetails(epoch int) []byte
- func Vote(ctx storage.Context, id, from []byte) int
- func WalletToScriptHash(wallet []byte) []byte
- type Ballot
- type IRNode
Constants ¶
const ( Version = major*1_000_000 + minor*1_000 + patch PrevVersion = prevMajor*1_000_000 + prevMinor*1_000 + prevPatch // ErrVersionMismatch is thrown by CheckVersion in case of error. ErrVersionMismatch = "previous version mismatch" // ErrAlreadyUpdated is thrown by CheckVersion if current version equals to version contract // is being updated from. ErrAlreadyUpdated = "contract is already of the latest version" )
const ContractTLD = "neofs"
ContractTLD is the default domain used by NeoFS contracts.
const LegacyOwnerKey = "contractOwner"
LegacyOwnerKey is storage key used to store contract owner.
const NNSID = 1
NNSID is the ID of the NNS contract in NeoFS networks. It's always deployed first.
Variables ¶
var ( // ErrAlphabetWitnessFailed appears when the method must be // called by the Alphabet but was not. ErrAlphabetWitnessFailed = "alphabet witness check failed" // ErrOwnerWitnessFailed appears when the method must be called // by an owner of some assets but was not. ErrOwnerWitnessFailed = "owner witness check failed" // ErrWitnessFailed appears when the method must be called // using certain public key but was not. ErrWitnessFailed = "witness check failed" )
Functions ¶
func AbortWithMessage ¶ added in v0.13.0
func AbortWithMessage(msg string)
AbortWithMessage calls `runtime.Log` with the passed message and calls `ABORT` opcode.
func AlphabetAddress ¶ added in v0.6.0
func AlphabetAddress() []byte
AlphabetAddress returns multi address of alphabet public keys.
func AlphabetNodes ¶ added in v0.6.0
AlphabetNodes returns a list of alphabet nodes from committee in the sidechain.
func AppendVersion ¶ added in v0.12.2
AppendVersion appends current contract version to the list of deploy arguments.
func BurnTransferDetails ¶ added in v0.7.0
func BytesEqual ¶
BytesEqual compares two slices of bytes by wrapping them into strings, which is necessary with new util.Equals interop behaviour, see neo-go#1176.
func CheckAlphabetWitness ¶ added in v0.13.0
func CheckAlphabetWitness(caller []byte)
CheckAlphabetWitness checks witness of the passed caller. It panics with ErrAlphabetWitnessFailed message on fail.
func CheckOwnerWitness ¶ added in v0.13.0
func CheckOwnerWitness(caller []byte)
CheckOwnerWitness checks witness of the passed caller. It panics with ErrOwnerWitnessFailed message on fail.
func CheckVersion ¶ added in v0.12.2
func CheckVersion(from int)
CheckVersion checks that contract can be updated from given original version to the current one correctly. Original version should not be less than PrevVersion to prevent updates from no longer supported old versions (otherwise CheckVersion throws ErrVersionMismatch fault exception) and should be less than the current one to prevent rollbacks (ErrAlreadyUpdated in this case).
func CheckWitness ¶ added in v0.13.0
func CheckWitness(caller []byte)
CheckWitness checks witness of the passed caller. It panics with ErrWitnessFailed message on fail.
func CommitteeAddress ¶ added in v0.11.0
func CommitteeAddress() []byte
CommitteeAddress returns multi address of committee.
func ContainerFeeTransferDetails ¶ added in v0.7.0
func FromKnownContract ¶ added in v0.7.0
func HasUpdateAccess ¶
func HasUpdateAccess() bool
HasUpdateAccess returns true if contract can be updated.
func InferNNSHash ¶ added in v0.19.0
InferNNSHash returns NNS contract hash by NNSID or panics if it can't be resolved.
func InnerRingInvoker ¶
InnerRingInvoker returns the public key of the inner ring node that has invoked the contract. Work around for environments without notary support.
func InnerRingNodes ¶ added in v0.6.0
InnerRingNodes return a list of inner ring nodes from state validator role in the sidechain.
func InnerRingNodesFromNetmap ¶ added in v0.7.0
InnerRingNodesFromNetmap gets a list of inner ring nodes through calling "innerRingList" method of smart contract. Work around for environments without notary support.
func InvokeID ¶
InvokeID returns hashed value of prefix and args concatenation. Iy is used to identify different ballots.
func LockTransferDetails ¶ added in v0.7.0
func MintTransferDetails ¶ added in v0.7.0
func Multiaddress ¶ added in v0.6.0
Multiaddress returns default multisignature account address for N keys. If committee set to true, it is `M = N/2+1` committee account.
func RemoveVotes ¶
RemoveVotes clears ballots of the decision that has been accepted by inner ring nodes.
func ResolveFSContract ¶ added in v0.19.0
ResolveFSContract returns contract hash by name as registered in NNS or panics if it can't be resolved. It's similar to ResolveFSContractWithNNS, but retrieves NNS hash automatically (see InferNNSHash).
func ResolveFSContractWithNNS ¶ added in v0.19.0
ResolveFSContractWithNNS uses given NNS contract and returns target contract hash by name as registered in NNS (assuming NeoFS-specific NNS setup, see NNSID) or panics if it can't be resolved. Contract name should be lowercased and should not include ContractTLD. Example values: "netmap", "container", etc.
func SetSerialized ¶
SetSerialized serializes data and puts it into contract storage.
func SubscribeForNewEpoch ¶ added in v0.19.0
func SubscribeForNewEpoch()
SubscribeForNewEpoch registers calling contract as a NewEpoch callback requester. Netmap contract's address is taken from the NNS contract, therefore, it must be presented and filled with netmap information for a correct SubscribeForNewEpoch call; otherwise a successive call is not guaranteed. Caller must have `NewEpoch` method with a single numeric argument.
func TryPurgeVotes ¶ added in v0.17.0
TryPurgeVotes removes storage item by 'ballots' key if it doesn't contain any in-progress vote. Otherwise, TryPurgeVotes returns false.
func UnlockTransferDetails ¶ added in v0.7.0
func Vote ¶
Vote adds ballot for the decision with a specific 'id' and returns the amount of unique voters for that decision.