sol2ligo
sol2ligo copied to clipboard
Support index_access
example:
pragma solidity ^0.4.16;
contract BytesTest {
function test10(bytes20 b0) public {
bytes1 b6 = b0[1];
}
}
N.b. should be compiled as const b6 : bytes = Bytes.sub(1n, 2n, b0);
for cast to int
function foo (const a : int ; const b : int) : int is
block {
const initial : int = 17;
const packed : bytes = Bytes.pack(initial);
const unpacked : option(int) = Bytes.unpack(packed);
const value : int = case unpacked of
| None -> (failwith("cant unpack") : int)
| Some(value) -> value
end;
} with value
Also we need emulator tests for that