-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
bc13fce
commit 7e45b46
Showing
4 changed files
with
66 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
|
||
var owner; | ||
var value = 0; | ||
|
||
function init(owner_) { | ||
owner = owner_; | ||
} | ||
|
||
function add(count) public { | ||
if(count > 10) { | ||
fail("count > 10"); | ||
} | ||
value += count; | ||
} | ||
|
||
function increment() public { | ||
value++; | ||
} | ||
|
||
function get_value() public const { | ||
return value; | ||
} | ||
|
||
function reset() public { | ||
if(this.user != owner) { | ||
fail("user != owner"); | ||
} | ||
value = 0; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
|
||
|
||
function init() {} | ||
|
||
function cross_add(value) public { | ||
rcall("counter", "add", value); | ||
} | ||
|
||
function cross_increment() public { | ||
rcall("counter", "increment"); | ||
} | ||
|
||
function cross_read_update() public { | ||
const value = rcall("counter", "get_value"); | ||
if(value % 2 != 0) { | ||
rcall("counter", "increment"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"__type": "mmx.contract.Executable", | ||
"name": "contract_02", | ||
"binary": "mmx1davfr6uds7hr3g7vzd4qqvzzduatkpautsdvm5s452xqjsgcwdfsrq2daz", | ||
"init_args": [], | ||
"depends": { | ||
"counter": "mmx1euuy4wtcvd50nat7q2gdcr78g37j6g3r6g7yjk3z9twr2fz45lqq7p0f4z" | ||
} | ||
} |