/*
Package lub provides interface to Lub native contract.
It implements regular NEP-17 functions for Lub token.
*/
package lub

import (
	"git.marketally.com/tutus-one/tutus-chain/pkg/interop"
	"git.marketally.com/tutus-one/tutus-chain/pkg/interop/contract"
	"git.marketally.com/tutus-one/tutus-chain/pkg/interop/tutusinternal"
)

// Hash represents Lub contract hash.
const Hash = "\x38\x72\xea\xf3\x9d\x7f\x9b\x39\xe5\xbe\x30\xaf\x3e\xbe\xd8\x00\x6f\xfe\xb3\x8a"

// Symbol represents `symbol` method of Lub native contract.
func Symbol() string {
	return tutusinternal.CallWithToken(Hash, "symbol", int(contract.NoneFlag)).(string)
}

// Decimals represents `decimals` method of Lub native contract.
func Decimals() int {
	return tutusinternal.CallWithToken(Hash, "decimals", int(contract.NoneFlag)).(int)
}

// TotalSupply represents `totalSupply` method of Lub native contract.
func TotalSupply() int {
	return tutusinternal.CallWithToken(Hash, "totalSupply", int(contract.ReadStates)).(int)
}

// BalanceOf represents `balanceOf` method of Lub native contract.
func BalanceOf(addr interop.Hash160) int {
	return tutusinternal.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 tutusinternal.CallWithToken(Hash, "transfer",
		int(contract.All), from, to, amount, data).(bool)
}
