NethermindEth / warp

Warp - Bringing Solidity to Starknet at warp speed. Warp is a Solidity to Cairo Compiler, this allows teams to write/migrate Solidity to Cairo for easy onboarding into the StarkNet ecosystem.
https://nethermind.io/warp/
Apache License 2.0
754 stars 70 forks source link

Implement retrieving data from warp memory #1019

Closed piwonskp closed 1 year ago

piwonskp commented 1 year ago

The code below, copied from memory/staticArrays.sol in behaviour tests should be working properly:


//SPDX-License-Identifier: MIT

contract WARP {
    function uint8default() pure public returns (uint8, uint8) {
        uint8[2] memory x;
        return (x[0], x[1]);
    }

    function uint8write(uint8 v) pure public returns (uint8, uint8) {
        uint8[2] memory x;
        x[1] = v;
        return (x[0], x[1]);
    }

    function uint256default() pure public returns (uint256, uint256) {
        uint256[2] memory x;
        return (x[0], x[1]);
    }

    function uint256write(uint256 v) pure public returns (uint256, uint256) {
        uint256[2] memory x;
        x[1] = v;
        return (x[0], x[1]);
    }

    function assignToTuple(uint8 a, uint8 b) pure public returns (uint8, uint8) {
        uint8[2] memory arr = [a, b];
        return (arr[0], arr[1]);
    }
}