forked from TrueCloudLab/frostfs-contract
[#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:
parent
806dbbb487
commit
29f2f0ef17
9 changed files with 19 additions and 19 deletions
|
@ -125,7 +125,7 @@ func Emit() bool {
|
||||||
contractHash := runtime.GetExecutingScriptHash()
|
contractHash := runtime.GetExecutingScriptHash()
|
||||||
neo := balance(neoHash, contractHash)
|
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)
|
gas := balance(gasHash, contractHash)
|
||||||
gasPerNode := gas * 7 / 8 / len(innerRingKeys)
|
gasPerNode := gas * 7 / 8 / len(innerRingKeys)
|
||||||
|
@ -139,7 +139,7 @@ func Emit() bool {
|
||||||
node := innerRingKeys[i]
|
node := innerRingKeys[i]
|
||||||
address := contract.CreateStandardAccount(node.key)
|
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")
|
runtime.Log("utility token has been emitted to inner ring nodes")
|
||||||
|
|
|
@ -125,7 +125,7 @@ func Emit() bool {
|
||||||
contractHash := runtime.GetExecutingScriptHash()
|
contractHash := runtime.GetExecutingScriptHash()
|
||||||
neo := balance(neoHash, contractHash)
|
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)
|
gas := balance(gasHash, contractHash)
|
||||||
gasPerNode := gas * 7 / 8 / len(innerRingKeys)
|
gasPerNode := gas * 7 / 8 / len(innerRingKeys)
|
||||||
|
@ -139,7 +139,7 @@ func Emit() bool {
|
||||||
node := innerRingKeys[i]
|
node := innerRingKeys[i]
|
||||||
address := contract.CreateStandardAccount(node.key)
|
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")
|
runtime.Log("utility token has been emitted to inner ring nodes")
|
||||||
|
|
|
@ -125,7 +125,7 @@ func Emit() bool {
|
||||||
contractHash := runtime.GetExecutingScriptHash()
|
contractHash := runtime.GetExecutingScriptHash()
|
||||||
neo := balance(neoHash, contractHash)
|
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)
|
gas := balance(gasHash, contractHash)
|
||||||
gasPerNode := gas * 7 / 8 / len(innerRingKeys)
|
gasPerNode := gas * 7 / 8 / len(innerRingKeys)
|
||||||
|
@ -139,7 +139,7 @@ func Emit() bool {
|
||||||
node := innerRingKeys[i]
|
node := innerRingKeys[i]
|
||||||
address := contract.CreateStandardAccount(node.key)
|
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")
|
runtime.Log("utility token has been emitted to inner ring nodes")
|
||||||
|
|
|
@ -125,7 +125,7 @@ func Emit() bool {
|
||||||
contractHash := runtime.GetExecutingScriptHash()
|
contractHash := runtime.GetExecutingScriptHash()
|
||||||
neo := balance(neoHash, contractHash)
|
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)
|
gas := balance(gasHash, contractHash)
|
||||||
gasPerNode := gas * 7 / 8 / len(innerRingKeys)
|
gasPerNode := gas * 7 / 8 / len(innerRingKeys)
|
||||||
|
@ -139,7 +139,7 @@ func Emit() bool {
|
||||||
node := innerRingKeys[i]
|
node := innerRingKeys[i]
|
||||||
address := contract.CreateStandardAccount(node.key)
|
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")
|
runtime.Log("utility token has been emitted to inner ring nodes")
|
||||||
|
|
|
@ -125,7 +125,7 @@ func Emit() bool {
|
||||||
contractHash := runtime.GetExecutingScriptHash()
|
contractHash := runtime.GetExecutingScriptHash()
|
||||||
neo := balance(neoHash, contractHash)
|
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)
|
gas := balance(gasHash, contractHash)
|
||||||
gasPerNode := gas * 7 / 8 / len(innerRingKeys)
|
gasPerNode := gas * 7 / 8 / len(innerRingKeys)
|
||||||
|
@ -139,7 +139,7 @@ func Emit() bool {
|
||||||
node := innerRingKeys[i]
|
node := innerRingKeys[i]
|
||||||
address := contract.CreateStandardAccount(node.key)
|
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")
|
runtime.Log("utility token has been emitted to inner ring nodes")
|
||||||
|
|
|
@ -125,7 +125,7 @@ func Emit() bool {
|
||||||
contractHash := runtime.GetExecutingScriptHash()
|
contractHash := runtime.GetExecutingScriptHash()
|
||||||
neo := balance(neoHash, contractHash)
|
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)
|
gas := balance(gasHash, contractHash)
|
||||||
gasPerNode := gas * 7 / 8 / len(innerRingKeys)
|
gasPerNode := gas * 7 / 8 / len(innerRingKeys)
|
||||||
|
@ -139,7 +139,7 @@ func Emit() bool {
|
||||||
node := innerRingKeys[i]
|
node := innerRingKeys[i]
|
||||||
address := contract.CreateStandardAccount(node.key)
|
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")
|
runtime.Log("utility token has been emitted to inner ring nodes")
|
||||||
|
|
|
@ -125,7 +125,7 @@ func Emit() bool {
|
||||||
contractHash := runtime.GetExecutingScriptHash()
|
contractHash := runtime.GetExecutingScriptHash()
|
||||||
neo := balance(neoHash, contractHash)
|
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)
|
gas := balance(gasHash, contractHash)
|
||||||
gasPerNode := gas * 7 / 8 / len(innerRingKeys)
|
gasPerNode := gas * 7 / 8 / len(innerRingKeys)
|
||||||
|
@ -139,7 +139,7 @@ func Emit() bool {
|
||||||
node := innerRingKeys[i]
|
node := innerRingKeys[i]
|
||||||
address := contract.CreateStandardAccount(node.key)
|
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")
|
runtime.Log("utility token has been emitted to inner ring nodes")
|
||||||
|
|
|
@ -125,7 +125,7 @@ func Emit() bool {
|
||||||
contractHash := runtime.GetExecutingScriptHash()
|
contractHash := runtime.GetExecutingScriptHash()
|
||||||
neo := balance(neoHash, contractHash)
|
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)
|
gas := balance(gasHash, contractHash)
|
||||||
gasPerNode := gas * 7 / 8 / len(innerRingKeys)
|
gasPerNode := gas * 7 / 8 / len(innerRingKeys)
|
||||||
|
@ -139,7 +139,7 @@ func Emit() bool {
|
||||||
node := innerRingKeys[i]
|
node := innerRingKeys[i]
|
||||||
address := contract.CreateStandardAccount(node.key)
|
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")
|
runtime.Log("utility token has been emitted to inner ring nodes")
|
||||||
|
|
|
@ -183,7 +183,7 @@ func InnerRingCandidateAdd(key []byte) bool {
|
||||||
to := runtime.GetExecutingScriptHash()
|
to := runtime.GetExecutingScriptHash()
|
||||||
fee := getConfig(ctx, candidateFeeConfigKey).(int)
|
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 {
|
if !transferred {
|
||||||
panic("irCandidateAdd: failed to transfer funds, aborting")
|
panic("irCandidateAdd: failed to transfer funds, aborting")
|
||||||
}
|
}
|
||||||
|
@ -211,7 +211,7 @@ func Deposit(from []byte, amount int, rcv []byte) bool {
|
||||||
|
|
||||||
to := runtime.GetExecutingScriptHash()
|
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 {
|
if !transferred {
|
||||||
panic("deposit: failed to transfer funds, aborting")
|
panic("deposit: failed to transfer funds, aborting")
|
||||||
}
|
}
|
||||||
|
@ -277,7 +277,7 @@ func Cheque(id, user []byte, amount int, lockAcc []byte) bool {
|
||||||
|
|
||||||
from := runtime.GetExecutingScriptHash()
|
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 {
|
if !transferred {
|
||||||
panic("cheque: failed to transfer funds, aborting")
|
panic("cheque: failed to transfer funds, aborting")
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue