[#68] policy: Add Version() method
DCO action / DCO (pull_request) Successful in 1m3s Details
Tests / Tests (1.20) (pull_request) Successful in 1m26s Details
Tests / Tests (1.19) (pull_request) Successful in 1m31s Details

Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
pull/68/head
Evgenii Stratonikov 2024-01-11 15:36:55 +03:00
parent 5363aaf16a
commit a7c45fdd0d
3 changed files with 11 additions and 0 deletions

View File

@ -4,3 +4,4 @@ safemethods:
- "listChains"
- "getChain"
- "listChainsByPrefix"
- "version"

View File

@ -58,6 +58,11 @@ func checkAuthorization(ctx storage.Context) {
panic(ErrNotAuthorized)
}
// Version returns the version of the contract.
func Version() int {
return common.Version
}
func SetAdmin(addr interop.Hash160) {
common.CheckAlphabetWitness()

View File

@ -72,6 +72,11 @@ func (c *ContractReader) ListChainsByPrefix(entity *big.Int, entityName string,
return unwrap.Array(c.invoker.Call(c.hash, "listChainsByPrefix", entity, entityName, prefix))
}
// Version invokes `version` method of contract.
func (c *ContractReader) Version() (*big.Int, error) {
return unwrap.BigInt(c.invoker.Call(c.hash, "version"))
}
// AddChain creates a transaction invoking `addChain` method of the contract.
// This transaction is signed and immediately sent to the network.
// The values returned are its hash, ValidUntilBlock value and error if any.