From 2a509ebbee2f0eaff7de5f96d7648e35b9cd47ef Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Thu, 12 Nov 2020 17:20:49 +0300 Subject: [PATCH] [#19] alphabet: Add log on voting Signed-off-by: Alex Vanin --- alphabet/alphabet.tpl | 8 +++++++- alphabet/az/az_contract.go | 7 ++++++- alphabet/buky/buky_contract.go | 7 ++++++- alphabet/dobro/dobro_contract.go | 7 ++++++- alphabet/glagoli/glagoli_contract.go | 7 ++++++- alphabet/jest/jest_contract.go | 7 ++++++- alphabet/vedi/vedi_contract.go | 7 ++++++- alphabet/zhivete/zhivete_contract.go | 7 ++++++- 8 files changed, 49 insertions(+), 8 deletions(-) diff --git a/alphabet/alphabet.tpl b/alphabet/alphabet.tpl index 3ababbc..ffce5e2 100644 --- a/alphabet/alphabet.tpl +++ b/alphabet/alphabet.tpl @@ -119,7 +119,13 @@ func Vote(candidate []byte) { address := runtime.GetExecutingScriptHash() - _ = engine.AppCall([]byte(neoHash), "vote", address, candidate) + ok := engine.AppCall([]byte(neoHash), "vote", address, candidate).(bool) + if ok { + runtime.Log("successfully voted for validator") + } else { + runtime.Log("vote has been failed") + } + return } diff --git a/alphabet/az/az_contract.go b/alphabet/az/az_contract.go index 34bf7e2..8528be9 100644 --- a/alphabet/az/az_contract.go +++ b/alphabet/az/az_contract.go @@ -119,7 +119,12 @@ func Vote(candidate []byte) { address := runtime.GetExecutingScriptHash() - _ = engine.AppCall([]byte(neoHash), "vote", address, candidate) + ok := engine.AppCall([]byte(neoHash), "vote", address, candidate).(bool) + if ok { + runtime.Log("successfully voted for validator") + } else { + runtime.Log("vote has been failed") + } return } diff --git a/alphabet/buky/buky_contract.go b/alphabet/buky/buky_contract.go index a4d549c..7cf223c 100644 --- a/alphabet/buky/buky_contract.go +++ b/alphabet/buky/buky_contract.go @@ -119,7 +119,12 @@ func Vote(candidate []byte) { address := runtime.GetExecutingScriptHash() - _ = engine.AppCall([]byte(neoHash), "vote", address, candidate) + ok := engine.AppCall([]byte(neoHash), "vote", address, candidate).(bool) + if ok { + runtime.Log("successfully voted for validator") + } else { + runtime.Log("vote has been failed") + } return } diff --git a/alphabet/dobro/dobro_contract.go b/alphabet/dobro/dobro_contract.go index 537b5fd..b804fc7 100644 --- a/alphabet/dobro/dobro_contract.go +++ b/alphabet/dobro/dobro_contract.go @@ -119,7 +119,12 @@ func Vote(candidate []byte) { address := runtime.GetExecutingScriptHash() - _ = engine.AppCall([]byte(neoHash), "vote", address, candidate) + ok := engine.AppCall([]byte(neoHash), "vote", address, candidate).(bool) + if ok { + runtime.Log("successfully voted for validator") + } else { + runtime.Log("vote has been failed") + } return } diff --git a/alphabet/glagoli/glagoli_contract.go b/alphabet/glagoli/glagoli_contract.go index 4c57cf2..5905322 100644 --- a/alphabet/glagoli/glagoli_contract.go +++ b/alphabet/glagoli/glagoli_contract.go @@ -119,7 +119,12 @@ func Vote(candidate []byte) { address := runtime.GetExecutingScriptHash() - _ = engine.AppCall([]byte(neoHash), "vote", address, candidate) + ok := engine.AppCall([]byte(neoHash), "vote", address, candidate).(bool) + if ok { + runtime.Log("successfully voted for validator") + } else { + runtime.Log("vote has been failed") + } return } diff --git a/alphabet/jest/jest_contract.go b/alphabet/jest/jest_contract.go index e0cf34b..36b87d3 100644 --- a/alphabet/jest/jest_contract.go +++ b/alphabet/jest/jest_contract.go @@ -119,7 +119,12 @@ func Vote(candidate []byte) { address := runtime.GetExecutingScriptHash() - _ = engine.AppCall([]byte(neoHash), "vote", address, candidate) + ok := engine.AppCall([]byte(neoHash), "vote", address, candidate).(bool) + if ok { + runtime.Log("successfully voted for validator") + } else { + runtime.Log("vote has been failed") + } return } diff --git a/alphabet/vedi/vedi_contract.go b/alphabet/vedi/vedi_contract.go index 286534c..090e15f 100644 --- a/alphabet/vedi/vedi_contract.go +++ b/alphabet/vedi/vedi_contract.go @@ -119,7 +119,12 @@ func Vote(candidate []byte) { address := runtime.GetExecutingScriptHash() - _ = engine.AppCall([]byte(neoHash), "vote", address, candidate) + ok := engine.AppCall([]byte(neoHash), "vote", address, candidate).(bool) + if ok { + runtime.Log("successfully voted for validator") + } else { + runtime.Log("vote has been failed") + } return } diff --git a/alphabet/zhivete/zhivete_contract.go b/alphabet/zhivete/zhivete_contract.go index 2a53709..8aa2824 100644 --- a/alphabet/zhivete/zhivete_contract.go +++ b/alphabet/zhivete/zhivete_contract.go @@ -119,7 +119,12 @@ func Vote(candidate []byte) { address := runtime.GetExecutingScriptHash() - _ = engine.AppCall([]byte(neoHash), "vote", address, candidate) + ok := engine.AppCall([]byte(neoHash), "vote", address, candidate).(bool) + if ok { + runtime.Log("successfully voted for validator") + } else { + runtime.Log("vote has been failed") + } return }