2021-03-19 09:11:48 +00:00
|
|
|
/*
|
2022-04-20 18:30:09 +00:00
|
|
|
Package policy provides an interface to PolicyContract native contract.
|
2021-03-19 09:11:48 +00:00
|
|
|
This contract holds various network-wide settings.
|
|
|
|
*/
|
2021-02-08 08:07:06 +00:00
|
|
|
package policy
|
|
|
|
|
|
|
|
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:07:06 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
// Hash represents Policy contract hash.
|
2021-02-15 13:40:44 +00:00
|
|
|
const Hash = "\x7b\xc6\x81\xc0\xa1\xf7\x1d\x54\x34\x57\xb6\x8b\xba\x8d\x5f\x9f\xdd\x4e\x5e\xcc"
|
2021-02-08 08:07:06 +00:00
|
|
|
|
|
|
|
// GetFeePerByte represents `getFeePerByte` method of Policy native contract.
|
|
|
|
func GetFeePerByte() int {
|
2021-12-08 19:33:03 +00:00
|
|
|
return neogointernal.CallWithToken(Hash, "getFeePerByte", int(contract.ReadStates)).(int)
|
2021-02-08 08:07:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// SetFeePerByte represents `setFeePerByte` method of Policy native contract.
|
|
|
|
func SetFeePerByte(value int) {
|
2021-12-08 19:33:03 +00:00
|
|
|
neogointernal.CallWithTokenNoRet(Hash, "setFeePerByte", int(contract.States), value)
|
2021-02-08 08:07:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// GetExecFeeFactor represents `getExecFeeFactor` method of Policy native contract.
|
|
|
|
func GetExecFeeFactor() int {
|
2021-12-08 19:33:03 +00:00
|
|
|
return neogointernal.CallWithToken(Hash, "getExecFeeFactor", int(contract.ReadStates)).(int)
|
2021-02-08 08:07:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// SetExecFeeFactor represents `setExecFeeFactor` method of Policy native contract.
|
|
|
|
func SetExecFeeFactor(value int) {
|
2021-12-08 19:33:03 +00:00
|
|
|
neogointernal.CallWithTokenNoRet(Hash, "setExecFeeFactor", int(contract.States), value)
|
2021-02-08 08:07:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// GetStoragePrice represents `getStoragePrice` method of Policy native contract.
|
|
|
|
func GetStoragePrice() int {
|
2021-12-08 19:33:03 +00:00
|
|
|
return neogointernal.CallWithToken(Hash, "getStoragePrice", int(contract.ReadStates)).(int)
|
2021-02-08 08:07:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// SetStoragePrice represents `setStoragePrice` method of Policy native contract.
|
|
|
|
func SetStoragePrice(value int) {
|
2021-12-08 19:33:03 +00:00
|
|
|
neogointernal.CallWithTokenNoRet(Hash, "setStoragePrice", int(contract.States), value)
|
2021-02-08 08:07:06 +00:00
|
|
|
}
|
|
|
|
|
2023-09-20 13:33:04 +00:00
|
|
|
// GetAttributeFee represents `getAttributeFee` method of Policy native contract.
|
|
|
|
func GetAttributeFee(t AttributeType) int {
|
|
|
|
return neogointernal.CallWithToken(Hash, "getAttributeFee", int(contract.ReadStates), t).(int)
|
|
|
|
}
|
|
|
|
|
|
|
|
// SetAttributeFee represents `setAttributeFee` method of Policy native contract.
|
|
|
|
func SetAttributeFee(t AttributeType, value int) {
|
|
|
|
neogointernal.CallWithTokenNoRet(Hash, "setAttributeFee", int(contract.States), t, value)
|
|
|
|
}
|
|
|
|
|
2021-02-08 08:07:06 +00:00
|
|
|
// IsBlocked represents `isBlocked` method of Policy native contract.
|
|
|
|
func IsBlocked(addr interop.Hash160) bool {
|
2021-12-08 19:33:03 +00:00
|
|
|
return neogointernal.CallWithToken(Hash, "isBlocked", int(contract.ReadStates), addr).(bool)
|
2021-02-08 08:07:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// BlockAccount represents `blockAccount` method of Policy native contract.
|
|
|
|
func BlockAccount(addr interop.Hash160) bool {
|
2021-12-08 19:33:03 +00:00
|
|
|
return neogointernal.CallWithToken(Hash, "blockAccount", int(contract.States), addr).(bool)
|
2021-02-08 08:07:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// UnblockAccount represents `unblockAccount` method of Policy native contract.
|
|
|
|
func UnblockAccount(addr interop.Hash160) bool {
|
2021-12-08 19:33:03 +00:00
|
|
|
return neogointernal.CallWithToken(Hash, "unblockAccount", int(contract.States), addr).(bool)
|
2021-02-08 08:07:06 +00:00
|
|
|
}
|