This containerised Lilypad module generates random Solidity contracts and validates them using the Solidity compiler (solc
). Only validated contracts are included in the final ZIP archive output. If a generated contract contains errors, it is discarded and a new one is generated until the requested number of valid contracts is achieved.
Contract reference data is available in the refdata
directory collected from:
To run on Lilypad via the CLI:
lilypad run github.com/Lilypad-Tech/lilypad-module-synthetic-data:0.2.3 -i Contracts=10 -i Seed=42
You can run the script directly from the command line or within a Docker container.
Set the environment variables and run the script:
SEED=42 NUM_CONTRACTS=5 TOKEN_STANDARD=ERC-20 node generate.js
Build the Docker image:
docker build -t solidity-generator .
Run the container with the required environment variables and a mapped outputs
directory:
docker run -e SEED=42 -e NUM_CONTRACTS=5 -e TOKEN_STANDARD=ERC-20 -v $(pwd)/outputs:/outputs solidity-generator
SEED
: The seed used for the random number generator. This ensures reproducibility of the generated contracts.NUM_CONTRACTS
: The number of valid contracts to generate.
The script creates a ZIP archive named contracts_<seed>.zip
containing only valid generated contracts that have been validated using the solc
library.