core: implement System.Contract.Call interop

This commit is contained in:
Evgenii Stratonikov 2020-05-07 14:11:59 +03:00
parent 301c1b7601
commit ec900c7ff7
4 changed files with 51 additions and 14 deletions

View file

@ -84,6 +84,16 @@ type ContractMD struct {
Methods map[string]MethodAndPrice
}
// GetContract returns script of the contract with the specified hash.
func (ic *Context) GetContract(h util.Uint160) ([]byte, bool) {
cs, err := ic.DAO.GetContractState(h)
if err != nil {
return nil, false
}
hasDynamicInvoke := (cs.Properties & smartcontract.HasDynamicInvoke) != 0
return cs.Script, hasDynamicInvoke
}
// NewContractMD returns Contract with the specified list of methods.
func NewContractMD(name string) *ContractMD {
c := &ContractMD{