diff options
author | Determinant <[email protected]> | 2020-07-01 17:29:39 -0400 |
---|---|---|
committer | Determinant <[email protected]> | 2020-07-01 17:29:39 -0400 |
commit | 2d396b3c69a26e4096ccb376c012911d299c68c7 (patch) | |
tree | fdf0269f63598620db2c26459e596727df7c0d02 /examples/multicoin/mc_test.sol | |
parent | a00cf4e6318e0dcda72725995653011c545e13ff (diff) |
make sure getBalance() works
Diffstat (limited to 'examples/multicoin/mc_test.sol')
-rw-r--r-- | examples/multicoin/mc_test.sol | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/examples/multicoin/mc_test.sol b/examples/multicoin/mc_test.sol index 031cba0..a7d468e 100644 --- a/examples/multicoin/mc_test.sol +++ b/examples/multicoin/mc_test.sol @@ -2,16 +2,17 @@ pragma solidity >=0.6.0; contract MCTest { address constant MultiCoin = 0x0100000000000000000000000000000000000000; + uint256 balance; 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) { + function updateBalance(uint256 coinid) public { (bool success, bytes memory data) = MultiCoin.delegatecall(abi.encodeWithSignature("getBalance(uint256)", coinid)); require(success); - return abi.decode(data, (uint256)); + balance = abi.decode(data, (uint256)); } function deposit() public payable {} |