aboutsummaryrefslogtreecommitdiff
path: root/examples/multicoin/mc_test.sol
diff options
context:
space:
mode:
authorDeterminant <[email protected]>2020-07-01 16:34:08 -0400
committerDeterminant <[email protected]>2020-07-01 16:34:08 -0400
commita00cf4e6318e0dcda72725995653011c545e13ff (patch)
treeffed262282f64afac1f27f71fd140588f9995d46 /examples/multicoin/mc_test.sol
parentfbe0f2d6b14d7b6fc43068e224412d4e65176550 (diff)
embed mc lib into genesis
Diffstat (limited to 'examples/multicoin/mc_test.sol')
-rw-r--r--examples/multicoin/mc_test.sol18
1 files changed, 18 insertions, 0 deletions
diff --git a/examples/multicoin/mc_test.sol b/examples/multicoin/mc_test.sol
new file mode 100644
index 0000000..031cba0
--- /dev/null
+++ b/examples/multicoin/mc_test.sol
@@ -0,0 +1,18 @@
+pragma solidity >=0.6.0;
+
+contract MCTest {
+ address constant MultiCoin = 0x0100000000000000000000000000000000000000;
+ constructor() public {
+ // enable multi-coin functionality (it is disabled by default)
+ (bool success,) = MultiCoin.delegatecall(abi.encodeWithSignature("enableMultiCoin()"));
+ require(success);
+ }
+
+ function getBalance(uint256 coinid) public returns (uint256) {
+ (bool success, bytes memory data) = MultiCoin.delegatecall(abi.encodeWithSignature("getBalance(uint256)", coinid));
+ require(success);
+ return abi.decode(data, (uint256));
+ }
+
+ function deposit() public payable {}
+}