Compiling contracts in truffle results in generating artifact objects with the abi and unlinked_binary set. To compile, run this command:
truffle compile
Truffle will compile only the contracts that have been changed since the last compilation in order to avoid any unnecessary compilation. If you'd like to override this behavior, run the preceding command with the --all option.
You can find the artifacts in the build/contracts directory. You are free to edit these files according to your needs. These files get modified at the time of running the compile and migrate commands.
Here are a few things you need to take care of before compiling:
- Truffle expects your contract files to define contracts that match their filenames exactly. For instance, if you have a file called MyContract.sol, one of these should exist within the contract file: contract MyContract{} or library myContract{}.
- Filename matching is case-sensitive, which means that if your filename isn't capitalized, your contract name shouldn't be capitalized either.
- You can declare contract dependencies using Solidity's import command. Truffle will compile contracts in the correct order and link libraries automatically when necessary. Dependencies must be specified as relative to the current Solidity file, beginning with either ./ or ../.
Truffle version 3.1.2 uses compiler version 0.4.8. Truffle doesn't currently support changing the compiler version, so it's fixed.