Skip to content

Latest commit

 

History

History
77 lines (53 loc) · 2.16 KB

README.md

File metadata and controls

77 lines (53 loc) · 2.16 KB

Soliditish Compiler

A compiler for a language to create smart contracts, that is transpiled to Solidity.

Sample contract

The following is a smart contract written in Soliditish, that creates minimal proxies of an NFT contract:

contract NFTFactory {

    ERC721 nftContract = 0x24862BDE3581a23552CE4EE712614550d7aE49FC;

    event NewCollection(address proxy);

    // @notice decorators are used to specify the visibility of the function
    @public
    function deployNewCollections(uint amount) {
        address[amount] newCollections;

        uint i;

        if (amount > 0) {
            for (i = 0; i < amount; i++) {
                // out-of-the-box support for creating minimal proxies
                address tokenClone = createProxyTo(nftContract);

                newCollections[i] = tokenClone;

                // out-of-the-box support for logging
                log("New Token Clone:", newCollections[i]);
                emit NewCollection(newCollections[i]);
            }
        } else {
            log("Amount must be greater than 0");
        }
    }

}

See more examples in the test/accept folder.

Requirements

The following dependencies are required to build the project:

Build

To build the project, run the following command from the root directory:

script/build.sh

Compile a file

  1. Create a file with the program to compile.
  2. Run the compiler from the root directory of the project, passing the path to the program to compile as a parameter:
    script/start.sh <program>
  3. The compiler will generate a file with the same name as the program, but with the extension .sol, in the same directory as the program.

Run tests

script/test.sh

To add new test cases, create new files containing the program to test, inside the test/accept or test/reject folders as appropriate (i.e., whether it should be accepted or rejected by the compiler).