Skip to content

A compiler for a language to create smart contracts, that is transpiled to Solidity. It is written in C + Flex/Bison.

License

Notifications You must be signed in to change notification settings

EperezOk/soliditish-compiler

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

87 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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).

About

A compiler for a language to create smart contracts, that is transpiled to Solidity. It is written in C + Flex/Bison.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •