[#23] *: Support NEP-17 in native asset transfers

Now `transfer()` requires 4 arguments.

Signed-off-by: Alex Vanin <alexey@nspcc.ru>
This commit is contained in:
Alex Vanin 2020-12-10 18:45:01 +03:00 committed by Alex Vanin
parent 806dbbb487
commit 29f2f0ef17
9 changed files with 19 additions and 19 deletions

View file

@ -125,7 +125,7 @@ func Emit() bool {
contractHash := runtime.GetExecutingScriptHash()
neo := balance(neoHash, contractHash)
_ = contract.Call([]byte(neoHash), "transfer", contractHash, contractHash, neo)
_ = contract.Call([]byte(neoHash), "transfer", contractHash, contractHash, neo, nil)
gas := balance(gasHash, contractHash)
gasPerNode := gas * 7 / 8 / len(innerRingKeys)
@ -139,7 +139,7 @@ func Emit() bool {
node := innerRingKeys[i]
address := contract.CreateStandardAccount(node.key)
_ = contract.Call([]byte(gasHash), "transfer", contractHash, address, gasPerNode)
_ = contract.Call([]byte(gasHash), "transfer", contractHash, address, gasPerNode, nil)
}
runtime.Log("utility token has been emitted to inner ring nodes")

View file

@ -125,7 +125,7 @@ func Emit() bool {
contractHash := runtime.GetExecutingScriptHash()
neo := balance(neoHash, contractHash)
_ = contract.Call([]byte(neoHash), "transfer", contractHash, contractHash, neo)
_ = contract.Call([]byte(neoHash), "transfer", contractHash, contractHash, neo, nil)
gas := balance(gasHash, contractHash)
gasPerNode := gas * 7 / 8 / len(innerRingKeys)
@ -139,7 +139,7 @@ func Emit() bool {
node := innerRingKeys[i]
address := contract.CreateStandardAccount(node.key)
_ = contract.Call([]byte(gasHash), "transfer", contractHash, address, gasPerNode)
_ = contract.Call([]byte(gasHash), "transfer", contractHash, address, gasPerNode, nil)
}
runtime.Log("utility token has been emitted to inner ring nodes")

View file

@ -125,7 +125,7 @@ func Emit() bool {
contractHash := runtime.GetExecutingScriptHash()
neo := balance(neoHash, contractHash)
_ = contract.Call([]byte(neoHash), "transfer", contractHash, contractHash, neo)
_ = contract.Call([]byte(neoHash), "transfer", contractHash, contractHash, neo, nil)
gas := balance(gasHash, contractHash)
gasPerNode := gas * 7 / 8 / len(innerRingKeys)
@ -139,7 +139,7 @@ func Emit() bool {
node := innerRingKeys[i]
address := contract.CreateStandardAccount(node.key)
_ = contract.Call([]byte(gasHash), "transfer", contractHash, address, gasPerNode)
_ = contract.Call([]byte(gasHash), "transfer", contractHash, address, gasPerNode, nil)
}
runtime.Log("utility token has been emitted to inner ring nodes")

View file

@ -125,7 +125,7 @@ func Emit() bool {
contractHash := runtime.GetExecutingScriptHash()
neo := balance(neoHash, contractHash)
_ = contract.Call([]byte(neoHash), "transfer", contractHash, contractHash, neo)
_ = contract.Call([]byte(neoHash), "transfer", contractHash, contractHash, neo, nil)
gas := balance(gasHash, contractHash)
gasPerNode := gas * 7 / 8 / len(innerRingKeys)
@ -139,7 +139,7 @@ func Emit() bool {
node := innerRingKeys[i]
address := contract.CreateStandardAccount(node.key)
_ = contract.Call([]byte(gasHash), "transfer", contractHash, address, gasPerNode)
_ = contract.Call([]byte(gasHash), "transfer", contractHash, address, gasPerNode, nil)
}
runtime.Log("utility token has been emitted to inner ring nodes")

View file

@ -125,7 +125,7 @@ func Emit() bool {
contractHash := runtime.GetExecutingScriptHash()
neo := balance(neoHash, contractHash)
_ = contract.Call([]byte(neoHash), "transfer", contractHash, contractHash, neo)
_ = contract.Call([]byte(neoHash), "transfer", contractHash, contractHash, neo, nil)
gas := balance(gasHash, contractHash)
gasPerNode := gas * 7 / 8 / len(innerRingKeys)
@ -139,7 +139,7 @@ func Emit() bool {
node := innerRingKeys[i]
address := contract.CreateStandardAccount(node.key)
_ = contract.Call([]byte(gasHash), "transfer", contractHash, address, gasPerNode)
_ = contract.Call([]byte(gasHash), "transfer", contractHash, address, gasPerNode, nil)
}
runtime.Log("utility token has been emitted to inner ring nodes")

View file

@ -125,7 +125,7 @@ func Emit() bool {
contractHash := runtime.GetExecutingScriptHash()
neo := balance(neoHash, contractHash)
_ = contract.Call([]byte(neoHash), "transfer", contractHash, contractHash, neo)
_ = contract.Call([]byte(neoHash), "transfer", contractHash, contractHash, neo, nil)
gas := balance(gasHash, contractHash)
gasPerNode := gas * 7 / 8 / len(innerRingKeys)
@ -139,7 +139,7 @@ func Emit() bool {
node := innerRingKeys[i]
address := contract.CreateStandardAccount(node.key)
_ = contract.Call([]byte(gasHash), "transfer", contractHash, address, gasPerNode)
_ = contract.Call([]byte(gasHash), "transfer", contractHash, address, gasPerNode, nil)
}
runtime.Log("utility token has been emitted to inner ring nodes")

View file

@ -125,7 +125,7 @@ func Emit() bool {
contractHash := runtime.GetExecutingScriptHash()
neo := balance(neoHash, contractHash)
_ = contract.Call([]byte(neoHash), "transfer", contractHash, contractHash, neo)
_ = contract.Call([]byte(neoHash), "transfer", contractHash, contractHash, neo, nil)
gas := balance(gasHash, contractHash)
gasPerNode := gas * 7 / 8 / len(innerRingKeys)
@ -139,7 +139,7 @@ func Emit() bool {
node := innerRingKeys[i]
address := contract.CreateStandardAccount(node.key)
_ = contract.Call([]byte(gasHash), "transfer", contractHash, address, gasPerNode)
_ = contract.Call([]byte(gasHash), "transfer", contractHash, address, gasPerNode, nil)
}
runtime.Log("utility token has been emitted to inner ring nodes")

View file

@ -125,7 +125,7 @@ func Emit() bool {
contractHash := runtime.GetExecutingScriptHash()
neo := balance(neoHash, contractHash)
_ = contract.Call([]byte(neoHash), "transfer", contractHash, contractHash, neo)
_ = contract.Call([]byte(neoHash), "transfer", contractHash, contractHash, neo, nil)
gas := balance(gasHash, contractHash)
gasPerNode := gas * 7 / 8 / len(innerRingKeys)
@ -139,7 +139,7 @@ func Emit() bool {
node := innerRingKeys[i]
address := contract.CreateStandardAccount(node.key)
_ = contract.Call([]byte(gasHash), "transfer", contractHash, address, gasPerNode)
_ = contract.Call([]byte(gasHash), "transfer", contractHash, address, gasPerNode, nil)
}
runtime.Log("utility token has been emitted to inner ring nodes")

View file

@ -183,7 +183,7 @@ func InnerRingCandidateAdd(key []byte) bool {
to := runtime.GetExecutingScriptHash()
fee := getConfig(ctx, candidateFeeConfigKey).(int)
transferred := contract.Call([]byte(tokenHash), "transfer", from, to, fee).(bool)
transferred := contract.Call([]byte(tokenHash), "transfer", from, to, fee, nil).(bool)
if !transferred {
panic("irCandidateAdd: failed to transfer funds, aborting")
}
@ -211,7 +211,7 @@ func Deposit(from []byte, amount int, rcv []byte) bool {
to := runtime.GetExecutingScriptHash()
transferred := contract.Call([]byte(tokenHash), "transfer", from, to, amount).(bool)
transferred := contract.Call([]byte(tokenHash), "transfer", from, to, amount, nil).(bool)
if !transferred {
panic("deposit: failed to transfer funds, aborting")
}
@ -277,7 +277,7 @@ func Cheque(id, user []byte, amount int, lockAcc []byte) bool {
from := runtime.GetExecutingScriptHash()
transferred := contract.Call([]byte(tokenHash), "transfer", from, user, amount).(bool)
transferred := contract.Call([]byte(tokenHash), "transfer", from, user, amount, nil).(bool)
if !transferred {
panic("cheque: failed to transfer funds, aborting")
}