fix: slot notification

This commit is contained in:
shashkevichfrida 2024-01-09 14:11:13 +03:00
parent 021c155273
commit e79b82a831
5 changed files with 13 additions and 11 deletions

View file

@ -68,6 +68,8 @@ func OnNEP17Payment(from interop.Hash160, amount int, data any) {
func gasTransfer(playerOwner interop.Hash160, gasCount int) {
contractHash := runtime.GetExecutingScriptHash()
transferredGas := gas.Transfer(playerOwner, contractHash, gasCount, nil)
if !transferredGas {

View file

@ -1 +1 @@
{"name":"SlotMashine","abi":{"methods":[{"name":"_deploy","offset":0,"parameters":[{"name":"data","type":"Any"},{"name":"isUpdate","type":"Boolean"}],"returntype":"Void","safe":false},{"name":"onNEP17Payment","offset":458,"parameters":[{"name":"from","type":"Hash160"},{"name":"amount","type":"Integer"},{"name":"data","type":"Any"}],"returntype":"Void","safe":false},{"name":"rollSlot","offset":95,"parameters":[{"name":"bet","type":"Integer"}],"returntype":"Void","safe":false}],"events":[{"name":"SlotResult","parameters":[{"name":"array","type":"Array"}]},{"name":"playerBalance","parameters":[{"name":"int","type":"Integer"}]}]},"features":{},"groups":[],"permissions":[{"contract":"*","methods":"*"}],"supportedstandards":[],"trusts":[],"extra":null}
{"name":"SlotMashine","abi":{"methods":[{"name":"_deploy","offset":0,"parameters":[{"name":"data","type":"Any"},{"name":"isUpdate","type":"Boolean"}],"returntype":"Void","safe":false},{"name":"onNEP17Payment","offset":457,"parameters":[{"name":"from","type":"Hash160"},{"name":"amount","type":"Integer"},{"name":"data","type":"Any"}],"returntype":"Void","safe":false},{"name":"rollSlot","offset":95,"parameters":[{"name":"bet","type":"Integer"}],"returntype":"Void","safe":false}],"events":[{"name":"SlotResult","parameters":[{"name":"array","type":"Array"}]},{"name":"playerBalance","parameters":[{"name":"int","type":"Integer"}]}]},"features":{},"groups":[],"permissions":[{"contract":"*","methods":"*"}],"supportedstandards":[],"trusts":[],"extra":null}

View file

@ -1,16 +1,16 @@
name: SlotMashine
supportedstandards: []
events:
- name: "SlotResult"
- name: SlotResult
parameters:
- name: "array"
type: "Array"
- name: "playerBalance"
- name: array
type: Array
- name: playerBalance
parameters:
- name: "int"
type: "Integer"
- name: int
type: Integer
permissions:
- methods: '*'
events:
- "SlotResult"
- "playerBalance"
- SlotResult
- playerBalance

View file

@ -56,10 +56,10 @@ func RollSlot(bet int) {
}
func roll() int {
var result [3]int
var result []int
for i:=0; i<3; i++ {
wheel := (runtime.GetRandom() % 8) + 1
result[i] = wheel
result = append(result, wheel)
runtime.Log("WheelNumber=" + string(i + 1) +", value="+string(wheel))
}
runtime.Notify("SlotResult", result)

Binary file not shown.