Skip to content

Commit

Permalink
fix: DualVMToken totalSupply
Browse files Browse the repository at this point in the history
  • Loading branch information
enitrat committed Nov 4, 2024
1 parent 6cbc820 commit 171db61
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion solidity_contracts/src/CairoPrecompiles/DualVmToken.sol
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,8 @@ contract DualVmToken {

function totalSupply() external view returns (uint256) {
bytes memory returnData = starknetToken.staticcallCairo("total_supply");
return abi.decode(returnData, (uint256));
(uint128 valueLow, uint128 valueHigh) = abi.decode(returnData, (uint128, uint128));
return uint256(valueLow) + (uint256(valueHigh) << 128);
}

/// @dev This function is used to get the balance of an evm account
Expand Down
2 changes: 1 addition & 1 deletion tests/end_to_end/CairoPrecompiles/test_dual_vm_token.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
@pytest_asyncio.fixture(scope="function")
async def starknet_token(owner):
address = await deploy_starknet(
"StarknetToken", int(1e18), owner.starknet_contract.address
"StarknetToken", int(2**256 - 1), owner.starknet_contract.address
)
return get_contract_starknet("StarknetToken", address=address)

Expand Down

0 comments on commit 171db61

Please sign in to comment.