Skip to content
This repository was archived by the owner on Jan 9, 2025. It is now read-only.

[KGA-77] [KGA-35] [KGA-7] fix: DualVMToken totalSupply #1569

Merged
merged 2 commits into from
Nov 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading