Add Version() method to the policy contract #68

Merged
fyrchik merged 1 commit from fyrchik/frostfs-contract:fix-policy-version into master 2024-09-04 19:51:17 +00:00
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.