fix: roulette fixed checks
This commit is contained in:
parent
8bca309836
commit
52f40c6b72
6 changed files with 5 additions and 4 deletions
|
@ -1 +1 @@
|
|||
{"name":"Craps","abi":{"methods":[{"name":"_deploy","offset":0,"parameters":[{"name":"data","type":"Any"},{"name":"isUpdate","type":"Boolean"}],"returntype":"Void","safe":false},{"name":"onNEP17Payment","offset":313,"parameters":[{"name":"from","type":"Hash160"},{"name":"amount","type":"Integer"},{"name":"data","type":"Any"}],"returntype":"Void","safe":false},{"name":"playCraps","offset":95,"parameters":[{"name":"bet","type":"Integer"},{"name":"firstSum","type":"Integer"},{"name":"secondSum","type":"Integer"}],"returntype":"Void","safe":false}],"events":[{"name":"Crup number","parameters":[{"name":"int","type":"Integer"}]},{"name":"Random number","parameters":[{"name":"int","type":"Integer"}]}]},"features":{},"groups":[],"permissions":[{"contract":"*","methods":"*"}],"supportedstandards":[],"trusts":[],"extra":null}
|
||||
{"name":"Craps","abi":{"methods":[{"name":"_deploy","offset":0,"parameters":[{"name":"data","type":"Any"},{"name":"isUpdate","type":"Boolean"}],"returntype":"Void","safe":false},{"name":"onNEP17Payment","offset":311,"parameters":[{"name":"from","type":"Hash160"},{"name":"amount","type":"Integer"},{"name":"data","type":"Any"}],"returntype":"Void","safe":false},{"name":"playCraps","offset":95,"parameters":[{"name":"bet","type":"Integer"},{"name":"firstSum","type":"Integer"},{"name":"secondSum","type":"Integer"}],"returntype":"Void","safe":false}],"events":[{"name":"Crup number","parameters":[{"name":"int","type":"Integer"}]},{"name":"Random number","parameters":[{"name":"int","type":"Integer"}]}]},"features":{},"groups":[],"permissions":[{"contract":"*","methods":"*"}],"supportedstandards":[],"trusts":[],"extra":null}
|
|
@ -1,7 +1,6 @@
|
|||
package Craps
|
||||
|
||||
import (
|
||||
|
||||
"github.com/nspcc-dev/neo-go/pkg/interop"
|
||||
"github.com/nspcc-dev/neo-go/pkg/interop/contract"
|
||||
"github.com/nspcc-dev/neo-go/pkg/interop/runtime"
|
||||
|
|
BIN
Craps/craps.nef
BIN
Craps/craps.nef
Binary file not shown.
|
@ -35,7 +35,7 @@ func PlayRoulette(bet int, selectedNumber int) {
|
|||
if bet <= 0 {
|
||||
panic("Invalid bet amount")
|
||||
}
|
||||
|
||||
zaCoinHash := storage.Get(ctx, zaCoinHashKey).(interop.Hash160)
|
||||
playerBalance := contract.Call(zaCoinHash, "balanceOf", contract.ReadStates, playerOwner).(int)
|
||||
if playerBalance < bet {
|
||||
panic("Insufficient funds")
|
||||
|
@ -56,6 +56,8 @@ func PlayRoulette(bet int, selectedNumber int) {
|
|||
|
||||
func isWinner(selectedNumber int) bool {
|
||||
rouletteNumber := (runtime.GetRandom() % 36) + 1
|
||||
runtime.Notify("rouletteNumber", rouletteNumber)
|
||||
runtime.Log("rouletteNumber " + string(rouletteNumber))
|
||||
return rouletteNumber == selectedNumber
|
||||
}
|
||||
|
||||
|
|
|
@ -1 +1 @@
|
|||
{"name":"Roulette","abi":{"methods":[{"name":"_deploy","offset":0,"parameters":[{"name":"data","type":"Any"},{"name":"isUpdate","type":"Boolean"}],"returntype":"Void","safe":false},{"name":"onNEP17Payment","offset":220,"parameters":[{"name":"from","type":"Hash160"},{"name":"amount","type":"Integer"},{"name":"data","type":"Any"}],"returntype":"Void","safe":false},{"name":"playRoulette","offset":95,"parameters":[{"name":"bet","type":"Integer"},{"name":"selectedNumber","type":"Integer"}],"returntype":"Void","safe":false}],"events":[{"name":"rouletteNumber","parameters":[{"name":"int","type":"Integer"}]}]},"features":{},"groups":[],"permissions":[{"contract":"*","methods":"*"}],"supportedstandards":[],"trusts":[],"extra":null}
|
||||
{"name":"Roulette","abi":{"methods":[{"name":"_deploy","offset":0,"parameters":[{"name":"data","type":"Any"},{"name":"isUpdate","type":"Boolean"}],"returntype":"Void","safe":false},{"name":"onNEP17Payment","offset":408,"parameters":[{"name":"from","type":"Hash160"},{"name":"amount","type":"Integer"},{"name":"data","type":"Any"}],"returntype":"Void","safe":false},{"name":"playRoulette","offset":95,"parameters":[{"name":"bet","type":"Integer"},{"name":"selectedNumber","type":"Integer"}],"returntype":"Void","safe":false}],"events":[{"name":"rouletteNumber","parameters":[{"name":"int","type":"Integer"}]}]},"features":{},"groups":[{"pubkey":"027171df30177d401c638fb2ddc14f9dbda323291e363ba4f7c3b19a8b44c8ba0a","signature":"xSD7RzJHXAPvoQfwznNSFOu0E8CWbNrWLnLNInig/J66uBky9YZlj4h1wvC0VWQFtAnTLxmuo1UVRh2NGRhAww=="}],"permissions":[{"contract":"*","methods":"*"}],"supportedstandards":[],"trusts":[],"extra":null}
|
Binary file not shown.
Loading…
Reference in a new issue