2021-02-08 08:06:28 +00:00
|
|
|
package oracle
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/nspcc-dev/neo-go/pkg/interop"
|
|
|
|
"github.com/nspcc-dev/neo-go/pkg/interop/contract"
|
|
|
|
)
|
|
|
|
|
|
|
|
// Hash represents Oracle contract hash.
|
2021-02-15 13:40:44 +00:00
|
|
|
const Hash = "\x58\x87\x17\x11\x7e\x0a\xa8\x10\x72\xaf\xab\x71\xd2\xdd\x89\xfe\x7c\x4b\x92\xfe"
|
2021-02-08 08:06:28 +00:00
|
|
|
|
|
|
|
// Request represents `request` method of Oracle native contract.
|
|
|
|
func Request(url string, filter []byte, cb string, userData interface{}, gasForResponse int) {
|
|
|
|
contract.Call(interop.Hash160(Hash), "request",
|
2021-02-25 15:04:46 +00:00
|
|
|
contract.States|contract.AllowNotify,
|
2021-02-08 08:06:28 +00:00
|
|
|
url, filter, cb, userData, gasForResponse)
|
|
|
|
}
|
2021-03-05 11:38:16 +00:00
|
|
|
|
|
|
|
// GetPrice represents `getPrice` method of Oracle native contract.
|
|
|
|
func GetPrice() int {
|
|
|
|
return contract.Call(interop.Hash160(Hash), "getPrice", contract.ReadStates).(int)
|
|
|
|
}
|
|
|
|
|
|
|
|
// SetPrice represents `setPrice` method of Oracle native contract.
|
|
|
|
func SetPrice(amount int) {
|
|
|
|
contract.Call(interop.Hash160(Hash), "setPrice", contract.States, amount)
|
|
|
|
}
|