-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Template for workspace project (#309)
* Added template for workspace project. To avoid name collisions of bins in workspace, bins had to be prepended with project name. Rewritten modules to fit changes to core. * Fixed contract template
- Loading branch information
Showing
31 changed files
with
325 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
#[[contracts]] | ||
#name = "mycontract" | ||
#name = "Mycontract" | ||
#fqn = "{{project-name}}::Mycontract" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
[[contracts]] | ||
name = "flipper" | ||
name = "Flipper" | ||
fqn = "{{project-name}}::Flipper" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# Changelog | ||
|
||
Changelog for `{{project-name}}`. | ||
|
||
## [0.1.0] - {{date}} | ||
### Added | ||
- `flipper` module. | ||
- `flapper` module. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
[workspace] | ||
members = [ | ||
"flipper", | ||
"flapper", | ||
] | ||
resolver = "2" | ||
|
||
[workspace.dependencies] | ||
#odra_dependency | ||
|
||
[profile.release] | ||
codegen-units = 1 | ||
lto = true | ||
|
||
[profile.dev.package."*"] | ||
opt-level = 3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
[[contracts]] | ||
name = "Flipper" | ||
fqn = "flipper::Flipper" | ||
|
||
[[contracts]] | ||
name = "Flapper" | ||
fqn = "flapper::Flapper" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# {{project-name}} | ||
|
||
## Usage | ||
It's recommended to install | ||
[cargo-odra](https://github.com/odradev/cargo-odra) first. | ||
|
||
### Build | ||
|
||
``` | ||
$ cargo odra build | ||
``` | ||
To build a wasm file, you need to pass the -b parameter. | ||
The result files will be placed in `${project-root}/wasm` directory. | ||
|
||
``` | ||
$ cargo odra build -b casper | ||
``` | ||
|
||
### Test | ||
To run test on your local machine, you can basically execute the command: | ||
|
||
``` | ||
$ cargo odra test | ||
``` | ||
|
||
To test actual wasm files against a backend, | ||
you need to specify the backend passing -b argument to `cargo-odra`. | ||
|
||
``` | ||
$ cargo odra test -b casper | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
.idea | ||
.vscode | ||
/target | ||
Cargo.lock | ||
.backend* | ||
.builder* | ||
/wasm |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
[package] | ||
name = "flapper" | ||
version = "0.1.0" | ||
edition = "2021" | ||
|
||
[dependencies] | ||
odra = { workspace = true } | ||
|
||
[[bin]] | ||
name = "flapper_build_contract" | ||
path = "bin/build_contract.rs" | ||
test = false | ||
|
||
[[bin]] | ||
name = "flapper_build_schema" | ||
path = "bin/build_schema.rs" | ||
test = false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#![no_std] | ||
#![no_main] | ||
#![allow(unused_imports, clippy::single_component_path_imports)] | ||
use flapper; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
use odra::contract_def::ContractBlueprint; | ||
|
||
extern "Rust" { | ||
fn module_schema() -> ContractBlueprint; | ||
} | ||
|
||
fn main() { | ||
let schema = unsafe { module_schema() }; | ||
println!("{:#?}", schema); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
use std::env; | ||
|
||
pub fn main() { | ||
println!("cargo:rerun-if-env-changed=ODRA_MODULE"); | ||
let module = env::var("ODRA_MODULE").unwrap_or_else(|_| "".to_string()); | ||
let msg = format!("cargo:rustc-cfg=odra_module=\"{}\"", module); | ||
println!("{}", msg); | ||
} |
Oops, something went wrong.