Wax Smart Contract Development Guide
  • WAX Smart Contract Development Guide
  • Tips And Tricks
    • Table Indexing
    • eosio.code Permission
    • Structuring Your Contract
    • Random Number Generation
    • uint8_t + enum For Statuses
    • Passing Iterators To Functions
    • Log Actions
    • Action Return Values
    • Readonly Actions
    • Debugging
    • Having Users Pay RAM
    • Inline Actions
    • Renouncing Contract Ownership
    • Creating Permission Structures
  • Tools
    • Self Audit Checklist
    • Unit Tests
Powered by GitBook
On this page
  1. Tips And Tricks

Structuring Your Contract

Previouseosio.code PermissionNextRandom Number Generation

Last updated 9 months ago

The way you structure your smart contract is really a matter of personal preference. However, I've created a boilerplate contract with the structure that I personally use.

You don't have to use my structure, but if you're stuck and don't know where to start, this can be helpful for you. The boilerplate contract is located at the following Github URL.

Note: Standard header files, and files that are not in the main directory can be included using <angle brackets>. Other files will need to use a relative path in quotation marks (i.e. #include "somefile.cpp") During compilation, you will need to specify any non-standard directories that you want files to be included from if you use angle brackets, using the -I flag. e.g. eosio-cpp -I directory_to_include boiler.cpp -o boiler.wasm --abigen

As I mentioned, this is all a matter of personal preference. Many contract developers like to keep all of the logic in 1 or 2 files, as you can see with something like the .

My personal preference - especially since my contracts can grow quite large, is to separate different purposes into different files. I like having contract actions in 1 file, regular functions in another file, constants in another file, etc.

AtomicAssets Contract