native: fix contract hashes

This commit is contained in:
Evgenii Stratonikov 2020-12-14 14:11:24 +03:00
parent 42be00b5bc
commit 1ffa1f9ade
7 changed files with 24 additions and 29 deletions

View file

@ -48,19 +48,11 @@ const (
oracleRequestPrice = 5000_0000
)
var (
oracleInvokeScript []byte
oracleScript []byte
)
var oracleScript []byte
func init() {
_, h := state.CreateNativeContractHash(nativenames.Oracle)
w := io.NewBufBinWriter()
emit.String(w.BinWriter, nativenames.Oracle)
emit.Syscall(w.BinWriter, interopnames.SystemContractCallNative)
oracleInvokeScript = w.Bytes()
h := hash.Hash160(oracleInvokeScript)
w = io.NewBufBinWriter()
emit.Int(w.BinWriter, 0)
emit.Opcodes(w.BinWriter, opcode.NEWARRAY)
emit.String(w.BinWriter, "finish")
@ -84,13 +76,6 @@ var (
ErrResponseNotFound = errors.New("oracle response not found")
)
// GetOracleInvokeScript returns oracle contract script.
func GetOracleInvokeScript() []byte {
b := make([]byte, len(oracleInvokeScript))
copy(b, oracleInvokeScript)
return b
}
// GetOracleResponseScript returns script for transaction with oracle response.
func GetOracleResponseScript() []byte {
b := make([]byte, len(oracleScript))