41 lines
1.4 KiB
Go
41 lines
1.4 KiB
Go
/*
|
|
Package lub provides interface to LubToken native contract.
|
|
It implements regular NEP-17 functions for Lub token.
|
|
*/
|
|
package lub
|
|
|
|
import (
|
|
"github.com/tutus-one/tutus-chain/pkg/interop"
|
|
"github.com/tutus-one/tutus-chain/pkg/interop/contract"
|
|
"github.com/tutus-one/tutus-chain/pkg/interop/neogointernal"
|
|
)
|
|
|
|
// Hash represents Lub contract hash.
|
|
const Hash = "\x69\xe8\x15\x86\x5e\xaa\x14\x6f\xdd\x64\x79\xd4\xa3\x57\xf0\x70\x93\xbb\x95\xe8"
|
|
|
|
// Symbol represents `symbol` method of Lub native contract.
|
|
func Symbol() string {
|
|
return neogointernal.CallWithToken(Hash, "symbol", int(contract.NoneFlag)).(string)
|
|
}
|
|
|
|
// Decimals represents `decimals` method of Lub native contract.
|
|
func Decimals() int {
|
|
return neogointernal.CallWithToken(Hash, "decimals", int(contract.NoneFlag)).(int)
|
|
}
|
|
|
|
// TotalSupply represents `totalSupply` method of Lub native contract.
|
|
func TotalSupply() int {
|
|
return neogointernal.CallWithToken(Hash, "totalSupply", int(contract.ReadStates)).(int)
|
|
}
|
|
|
|
// BalanceOf represents `balanceOf` method of Lub native contract.
|
|
func BalanceOf(addr interop.Hash160) int {
|
|
return neogointernal.CallWithToken(Hash, "balanceOf", int(contract.ReadStates), addr).(int)
|
|
}
|
|
|
|
// Transfer represents `transfer` method of Lub native contract.
|
|
func Transfer(from, to interop.Hash160, amount int, data any) bool {
|
|
return neogointernal.CallWithToken(Hash, "transfer",
|
|
int(contract.All), from, to, amount, data).(bool)
|
|
}
|