mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2024-11-26 09:42:22 +00:00
examples: fix method names
Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
This commit is contained in:
parent
a781d299e0
commit
d1ef9e67be
2 changed files with 9 additions and 10 deletions
|
@ -38,14 +38,13 @@ func (t Token) GetSupply(ctx storage.Context) interface{} {
|
||||||
return getIntFromDB(ctx, []byte(t.CirculationKey))
|
return getIntFromDB(ctx, []byte(t.CirculationKey))
|
||||||
}
|
}
|
||||||
|
|
||||||
// TBalanceOf gets the token balance of a specific address
|
// BalanceOf gets the token balance of a specific address
|
||||||
// TODO: https://github.com/nspcc-dev/neo-go/issues/1150
|
func (t Token) BalanceOf(ctx storage.Context, holder []byte) interface{} {
|
||||||
func (t Token) TBalanceOf(ctx storage.Context, holder []byte) interface{} {
|
|
||||||
return getIntFromDB(ctx, holder)
|
return getIntFromDB(ctx, holder)
|
||||||
}
|
}
|
||||||
|
|
||||||
// TTransfer token from one user to another
|
// Transfer token from one user to another
|
||||||
func (t Token) TTransfer(ctx storage.Context, from []byte, to []byte, amount int) bool {
|
func (t Token) Transfer(ctx storage.Context, from []byte, to []byte, amount int) bool {
|
||||||
amountFrom := t.CanTransfer(ctx, from, to, amount)
|
amountFrom := t.CanTransfer(ctx, from, to, amount)
|
||||||
if amountFrom == -1 {
|
if amountFrom == -1 {
|
||||||
return false
|
return false
|
||||||
|
@ -105,8 +104,8 @@ func IsUsableAddress(addr []byte) bool {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
// TMint initial supply of tokens.
|
// Mint initial supply of tokens.
|
||||||
func (t Token) TMint(ctx storage.Context, to []byte) bool {
|
func (t Token) Mint(ctx storage.Context, to []byte) bool {
|
||||||
if !IsUsableAddress(t.Owner) {
|
if !IsUsableAddress(t.Owner) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
|
@ -99,19 +99,19 @@ func TotalSupply() interface{} {
|
||||||
func BalanceOf(holder []byte) interface{} {
|
func BalanceOf(holder []byte) interface{} {
|
||||||
t := createToken()
|
t := createToken()
|
||||||
ctx := storage.GetContext()
|
ctx := storage.GetContext()
|
||||||
return t.TBalanceOf(ctx, holder)
|
return t.BalanceOf(ctx, holder)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Transfer token from one user to another
|
// Transfer token from one user to another
|
||||||
func Transfer(from []byte, to []byte, amount int) bool {
|
func Transfer(from []byte, to []byte, amount int) bool {
|
||||||
t := createToken()
|
t := createToken()
|
||||||
ctx := storage.GetContext()
|
ctx := storage.GetContext()
|
||||||
return t.TTransfer(ctx, from, to, amount)
|
return t.Transfer(ctx, from, to, amount)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Mint initial supply of tokens
|
// Mint initial supply of tokens
|
||||||
func Mint(to []byte) bool {
|
func Mint(to []byte) bool {
|
||||||
t := createToken()
|
t := createToken()
|
||||||
ctx := storage.GetContext()
|
ctx := storage.GetContext()
|
||||||
return t.TMint(ctx, to)
|
return t.Mint(ctx, to)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue