mirror of https://github.com/status-im/nimplay.git
Fix for abi_gen payable.
This commit is contained in:
parent
39f4294d2a
commit
1201dc828b
12
Makefile
12
Makefile
|
@ -61,12 +61,12 @@ vendors:
|
|||
|
||||
.PHONY: king_of_the_hill
|
||||
king_of_the_hill:
|
||||
# $(WASM32_NIMC) --out:examples/king_of_the_hill.wasm examples/king_of_the_hill.nim
|
||||
# $(POSTPROCESS) examples/king_of_the_hill.wasm
|
||||
# $(WASM32_NIMC) --out:examples/map.wasm examples/map.nim
|
||||
# $(POSTPROCESS) examples/map.wasm
|
||||
$(WASM32_NIMC) --out:examples/balances.wasm examples/balances.nim
|
||||
$(POSTPROCESS) examples/balances.wasm
|
||||
$(WASM32_NIMC) --out:examples/king_of_the_hill.wasm examples/king_of_the_hill.nim
|
||||
$(POSTPROCESS) examples/king_of_the_hill.wasm
|
||||
|
||||
.PHONY: examples
|
||||
examples: king_of_the_hill
|
||||
$(WASM32_NIMC) --out:examples/registry.wasm examples/registry.nim
|
||||
$(POSTPROCESS) examples/registry.wasm
|
||||
$(WASM32_NIMC) --out:examples/balances.wasm examples/balances.nim
|
||||
$(POSTPROCESS) examples/balances.wasm
|
||||
|
|
|
@ -0,0 +1,29 @@
|
|||
import ../nimplay0_1
|
||||
|
||||
|
||||
contract("Depository"):
|
||||
|
||||
balances: StorageTable[address, bytes32, wei_value]
|
||||
|
||||
proc deposit*(k: bytes32) {.self,msg,payable.} =
|
||||
self.balances[msg.sender][k] = msg.value
|
||||
|
||||
proc get_balance*(k: bytes32): wei_value {.self,msg.} =
|
||||
self.balances[msg.sender][k]
|
||||
|
||||
# proc withdraw*(amount: wei_value) =
|
||||
# var
|
||||
# balance = self.balances[msg.sender][k]
|
||||
|
||||
# if amount <= balance:
|
||||
# self.balances[msg.sender][k] =
|
||||
# call(
|
||||
# getGasLeft(),
|
||||
# addr msg.sender
|
||||
# amount,
|
||||
# )
|
||||
|
||||
|
||||
# proc call*(gas: int64, addressOffset, valueOffset, dataOffset: pointer,
|
||||
# dataLength: int32, resultOffset: pointer,
|
||||
# resultLength: int32): int32
|
|
@ -91,8 +91,9 @@ proc generate_function_signature(proc_def: PNode): FunctionSignature =
|
|||
else:
|
||||
raise newException(Exception, "unknown param type")
|
||||
of nkPragma:
|
||||
if child[0].kind == nkIdent and child[0].ident.s == "payable":
|
||||
func_sig.payable = true
|
||||
for pragma_child in child:
|
||||
if pragma_child.kind == nkIdent and pragma_child.ident.s == "payable":
|
||||
func_sig.payable = true
|
||||
else:
|
||||
discard
|
||||
return func_sig
|
||||
|
|
Loading…
Reference in New Issue