forked from TrueCloudLab/neoneo-go
rpc: use Notify with varargs in the test contract
This commit is contained in:
parent
efad66aee1
commit
004023920e
2 changed files with 4 additions and 4 deletions
BIN
pkg/rpc/server/testdata/test_contract.avm
vendored
BIN
pkg/rpc/server/testdata/test_contract.avm
vendored
Binary file not shown.
8
pkg/rpc/server/testdata/test_contract.go
vendored
8
pkg/rpc/server/testdata/test_contract.go
vendored
|
@ -12,7 +12,7 @@ const (
|
||||||
)
|
)
|
||||||
|
|
||||||
func Main(operation string, args []interface{}) interface{} {
|
func Main(operation string, args []interface{}) interface{} {
|
||||||
runtime.Notify([]interface{}{"contract call", operation, args})
|
runtime.Notify("contract call", operation, args)
|
||||||
switch operation {
|
switch operation {
|
||||||
case "Put":
|
case "Put":
|
||||||
ctx := storage.GetContext()
|
ctx := storage.GetContext()
|
||||||
|
@ -34,7 +34,7 @@ func Main(operation string, args []interface{}) interface{} {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
amount := storage.Get(ctx, addr).(int)
|
amount := storage.Get(ctx, addr).(int)
|
||||||
runtime.Notify([]interface{}{"balanceOf", addr, amount})
|
runtime.Notify("balanceOf", addr, amount)
|
||||||
return amount
|
return amount
|
||||||
case "transfer":
|
case "transfer":
|
||||||
ctx := storage.GetContext()
|
ctx := storage.GetContext()
|
||||||
|
@ -66,7 +66,7 @@ func Main(operation string, args []interface{}) interface{} {
|
||||||
toBalance += amount
|
toBalance += amount
|
||||||
storage.Put(ctx, to, toBalance)
|
storage.Put(ctx, to, toBalance)
|
||||||
|
|
||||||
runtime.Notify([]interface{}{"transfer", from, to, amount})
|
runtime.Notify("transfer", from, to, amount)
|
||||||
|
|
||||||
return true
|
return true
|
||||||
case "init":
|
case "init":
|
||||||
|
@ -74,7 +74,7 @@ func Main(operation string, args []interface{}) interface{} {
|
||||||
h := engine.GetExecutingScriptHash()
|
h := engine.GetExecutingScriptHash()
|
||||||
amount := totalSupply
|
amount := totalSupply
|
||||||
storage.Put(ctx, h, amount)
|
storage.Put(ctx, h, amount)
|
||||||
runtime.Notify([]interface{}{"transfer", []byte{}, h, amount})
|
runtime.Notify("transfer", []byte{}, h, amount)
|
||||||
return true
|
return true
|
||||||
default:
|
default:
|
||||||
panic("invalid operation")
|
panic("invalid operation")
|
||||||
|
|
Loading…
Reference in a new issue