Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
I
ink
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Requirements
Requirements
List
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Environments
Packages & Registries
Packages & Registries
Package Registry
Container Registry
Analytics
Analytics
CI / CD
Insights
Issue
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
parity
ink
Commits
61c89eb8
Commit
61c89eb8
authored
Feb 18, 2019
by
Hero Bird
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[examples/fleet_inc] Add fleet_inc example
parent
5d7bc08f
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
88 additions
and
0 deletions
+88
-0
examples/fleet_inc/.cargo/config
examples/fleet_inc/.cargo/config
+4
-0
examples/fleet_inc/Cargo.toml
examples/fleet_inc/Cargo.toml
+26
-0
examples/fleet_inc/build.sh
examples/fleet_inc/build.sh
+8
-0
examples/fleet_inc/rust-toolchain
examples/fleet_inc/rust-toolchain
+1
-0
examples/fleet_inc/src/lib.rs
examples/fleet_inc/src/lib.rs
+49
-0
No files found.
examples/fleet_inc/.cargo/config
0 → 100644
View file @
61c89eb8
[target.wasm32-unknown-unknown]
rustflags = [
"-C", "link-args=-z stack-size=65536 --import-memory"
]
examples/fleet_inc/Cargo.toml
0 → 100644
View file @
61c89eb8
[package]
name
=
"fleet-inc"
version
=
"0.1.0"
authors
=
[
"Parity Technologies <admin@parity.io>"
]
edition
=
"2018"
[dependencies]
pdsl_core
=
{
path
=
"../../core"
}
pdsl_model
=
{
path
=
"../../model"
}
parity-codec
=
{
version
=
"2.2"
,
default-features
=
false
,
features
=
["derive"]
}
[lib]
name
=
"fleet_inc"
crate-type
=
["cdylib"]
[features]
default
=
[]
test-env
=
[
"pdsl_core/test-env"
,
"pdsl_model/test-env"
,
]
[profile.release]
panic
=
"abort"
lto
=
true
opt-level
=
"z"
examples/fleet_inc/build.sh
0 → 100755
View file @
61c89eb8
#!/bin/bash
# The wasm-build executable that is used to tree-shake the wasm binary
# resulting from the cargo build in the first step expects to find it
# under target/release/wasm32-unknown-unknown/ in the cwd.
cargo +nightly build
--release
--target
=
wasm32-unknown-unknown
--verbose
wasm-build target fleet_inc
--target-runtime
=
substrate
--final
=
fleet_inc
--save-raw
=
./target/fleet_inc-deployed.wasm
--target
wasm32-unknown-unknown
examples/fleet_inc/rust-toolchain
0 → 100644
View file @
61c89eb8
nightly-2019-01-26
examples/fleet_inc/src/lib.rs
0 → 100644
View file @
61c89eb8
#![no_std]
#![feature(const_str_as_bytes)]
use
pdsl_model
::{
ContractDecl
,
Contract
,
state
,
messages
,
};
use
pdsl_core
::
storage
;
state!
{
/// A simple contract having just one value that can be incremented and returned.
struct
Adder
{
/// The simple value on the contract storage.
val
:
storage
::
Value
<
u32
>
}
}
messages!
{
/// Increases the storage value by the given amount.
0
=>
Inc
(
by
:
u32
);
/// Returns the storage value.
1
=>
Get
()
->
u32
;
}
fn
instantiate
()
->
impl
Contract
{
ContractDecl
::
new
::
<
Adder
>
()
.on_deploy
(|
env
,
init_val
|
{
env
.state.val
.set
(
init_val
)
})
.on_msg_mut
::
<
Inc
>
(|
env
,
by
|
{
env
.state.val
+=
by
})
.on_msg
::
<
Get
>
(|
env
,
_
|
{
*
env
.state.val
.get
()
})
.instantiate
()
}
#[no_mangle]
fn
deploy
()
{
instantiate
()
.deploy
()
}
#[no_mangle]
fn
call
()
{
instantiate
()
.dispatch
()
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment