2021-03-19 09:11:48 +00:00
|
|
|
/*
|
2022-04-20 18:30:09 +00:00
|
|
|
Package notary provides an interface to Notary native contract.
|
2021-03-19 09:11:48 +00:00
|
|
|
This contract is a NeoGo extension and is not available on regular Neo
|
2022-04-20 18:30:09 +00:00
|
|
|
networks. To use it, you need to have this extension enabled on the network.
|
2021-03-19 09:11:48 +00:00
|
|
|
*/
|
2021-02-08 08:10:01 +00:00
|
|
|
package notary
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/nspcc-dev/neo-go/pkg/interop"
|
|
|
|
"github.com/nspcc-dev/neo-go/pkg/interop/contract"
|
2021-12-08 19:33:03 +00:00
|
|
|
"github.com/nspcc-dev/neo-go/pkg/interop/neogointernal"
|
2021-02-08 08:10:01 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
// Hash represents Notary contract hash.
|
2021-02-15 13:40:44 +00:00
|
|
|
const Hash = "\x3b\xec\x35\x31\x11\x9b\xba\xd7\x6d\xd0\x44\x92\x0b\x0d\xe6\xc3\x19\x4f\xe1\xc1"
|
2021-02-08 08:10:01 +00:00
|
|
|
|
|
|
|
// LockDepositUntil represents `lockDepositUntil` method of Notary native contract.
|
|
|
|
func LockDepositUntil(addr interop.Hash160, till int) bool {
|
2021-12-08 19:33:03 +00:00
|
|
|
return neogointernal.CallWithToken(Hash, "lockDepositUntil", int(contract.States),
|
2021-02-08 08:10:01 +00:00
|
|
|
addr, till).(bool)
|
|
|
|
}
|
|
|
|
|
|
|
|
// Withdraw represents `withdraw` method of Notary native contract.
|
|
|
|
func Withdraw(from, to interop.Hash160) bool {
|
2022-01-19 08:33:33 +00:00
|
|
|
return neogointernal.CallWithToken(Hash, "withdraw", int(contract.All),
|
2021-02-08 08:10:01 +00:00
|
|
|
from, to).(bool)
|
|
|
|
}
|
|
|
|
|
|
|
|
// BalanceOf represents `balanceOf` method of Notary native contract.
|
|
|
|
func BalanceOf(addr interop.Hash160) int {
|
2021-12-08 19:33:03 +00:00
|
|
|
return neogointernal.CallWithToken(Hash, "balanceOf", int(contract.ReadStates), addr).(int)
|
2021-02-08 08:10:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// ExpirationOf represents `expirationOf` method of Notary native contract.
|
|
|
|
func ExpirationOf(addr interop.Hash160) int {
|
2021-12-08 19:33:03 +00:00
|
|
|
return neogointernal.CallWithToken(Hash, "expirationOf", int(contract.ReadStates), addr).(int)
|
2021-02-08 08:10:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// GetMaxNotValidBeforeDelta represents `getMaxNotValidBeforeDelta` method of Notary native contract.
|
|
|
|
func GetMaxNotValidBeforeDelta() int {
|
2021-12-08 19:33:03 +00:00
|
|
|
return neogointernal.CallWithToken(Hash, "getMaxNotValidBeforeDelta", int(contract.ReadStates)).(int)
|
2021-02-08 08:10:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// SetMaxNotValidBeforeDelta represents `setMaxNotValidBeforeDelta` method of Notary native contract.
|
|
|
|
func SetMaxNotValidBeforeDelta(value int) {
|
2021-12-08 19:33:03 +00:00
|
|
|
neogointernal.CallWithTokenNoRet(Hash, "setMaxNotValidBeforeDelta", int(contract.States), value)
|
2021-02-08 08:10:01 +00:00
|
|
|
}
|
2022-03-01 10:38:25 +00:00
|
|
|
|
|
|
|
// GetNotaryServiceFeePerKey represents `getNotaryServiceFeePerKey` method of Notary native contract.
|
|
|
|
func GetNotaryServiceFeePerKey() int {
|
|
|
|
return neogointernal.CallWithToken(Hash, "getNotaryServiceFeePerKey", int(contract.ReadStates)).(int)
|
|
|
|
}
|
|
|
|
|
|
|
|
// SetNotaryServiceFeePerKey represents `setNotaryServiceFeePerKey` method of Notary native contract.
|
|
|
|
func SetNotaryServiceFeePerKey(value int) {
|
|
|
|
neogointernal.CallWithTokenNoRet(Hash, "setNotaryServiceFeePerKey", int(contract.States), value)
|
|
|
|
}
|