bitcoin-sv / sol2scrypt

Solidity to sCrypt Transplier
BSD 3-Clause "New" or "Revised" License
1 stars 0 forks source link

Better error handling #42

Closed xhliu closed 2 years ago

xhliu commented 2 years ago

when unimplemented features are encountered, masked in Nothing.

Depends on:

xhliu commented 2 years ago

E.g., (a, b) = (1, 2);

vs

21 : pragma

xhliu commented 2 years ago

image

Install the Solang VSCode

pragma solidity ^0.8.10;

contract Coin {
    // The keyword "public" makes those variables
    // readable from outside.
    address public minter;
    mapping (address => uint) public balances;

    // Events allow light clients to react on
    // changes efficiently.
    event Sent(address from, address to, uint amount);

    // This is the constructor whose code is
    // run only when the contract is created.
    constructor() {
        minter = msg.origin;
    }

    function mint(address receiver, uint amount) external {
        if (msg.sender != minter) return;
        balances[receiver] += amount;
        selfdestruct(receiver);
    }

    function send(address receiver, uint amount) external {
        int gas = tx.gasprice;
        if (balances[msg.sender] < amount) return;
        balances[msg.sender] -= amount;
        balances[receiver] += amount;
        emit Sent(msg.sender, receiver, amount);
    }

    function f(uint x) public view returns (uint r) {
        assembly {
            // We ignore the storage slot offset, we know it is zero
            // in this special case.
            r := mul(x, sload(b.slot))
        }
    }
}
xhliu commented 2 years ago

error

unsupported, e.g., inheritance do not generate output file?

vs

warning

e.g., emit()

xhliu commented 2 years ago

Eventually, source map