Skip to main content
Version: next

Odra.toml

As mentioned in the previous article, Odra.toml is a file that contains information about all the contracts that Odra will build. Let's take a look at the file structure again:

[[contracts]]
fqn = "flipper::Flipper"

The fqn (Fully Qualified Name) is the Rust path to your contract's struct, and it is used by the building tools to locate and build the contract. In a single-crate project it has two segments: the module (here flipper, i.e. src/flipper.rs) and the struct (Flipper).

The last segment of the fqn will be used as the name for your contract - the generated wasm file will be in the above case named Flipper.wasm, matching the struct name exactly, capital letter included.

note

In a workspace project (cargo odra new -t workspace) the fqn gains a third, leading segment - the crate name - so it reads <crate>::<module>::<Struct>, for example flipper::flipper::Flipper.

Adding a new contract manually

Besides using the cargo odra generate command, you can add a new contract to be compiled by hand. To do this, add another [[contracts]] element, name it and make sure that the fqn is set correctly.

For example, if you want to create a new contract called counter, your Odra.toml file should finally look like this:

[[contracts]]
fqn = "flipper::Flipper"

[[contracts]]
fqn = "counter::Counter"

What's next

In the next section, we'll take a closer look at the code that was generated by Odra by default - the famous Flipper contract.