-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from LoTerra/adapt-contract
Adapt contract
- Loading branch information
Showing
20 changed files
with
750 additions
and
310 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
[alias] | ||
wasm = "build --release --target wasm32-unknown-unknown" | ||
unit-test = "test --lib --features backtraces" | ||
schema = "run --example 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,56 @@ | ||
version: 2.1 | ||
|
||
jobs: | ||
build: | ||
docker: | ||
- image: rust:1.44.1 | ||
steps: | ||
- checkout | ||
- run: | ||
name: Version information | ||
command: rustc --version; cargo --version; rustup --version | ||
- restore_cache: | ||
keys: | ||
- v4-cargo-cache-{{ arch }}-{{ checksum "Cargo.lock" }} | ||
- run: | ||
name: Add wasm32 target | ||
command: rustup target add wasm32-unknown-unknown | ||
- run: | ||
name: Add fmt and clippy | ||
command: rustup component add rustfmt clippy | ||
- run: | ||
name: Unit tests | ||
env: RUST_BACKTRACE=1 | ||
command: cargo unit-test --locked | ||
- run: | ||
name: Format source code | ||
command: cargo fmt -- --check | ||
- run: | ||
name: Lint | ||
command: cargo clippy -- -D warnings | ||
- run: | ||
name: Build and run schema generator | ||
command: cargo schema --locked | ||
- run: | ||
name: Build | ||
command: cargo wasm --locked | ||
- run: | ||
name: Ensure checked-in source code and schemas are up-to-date | ||
command: | | ||
CHANGES_IN_REPO=$(git status --porcelain) | ||
if [[ -n "$CHANGES_IN_REPO" ]]; then | ||
echo "Repository is dirty. Showing 'git status' and 'git --no-pager diff' for debugging now:" | ||
git status && git --no-pager diff | ||
exit 1 | ||
fi | ||
- save_cache: | ||
paths: | ||
- /usr/local/cargo/registry | ||
- target/debug/.fingerprint | ||
- target/debug/build | ||
- target/debug/deps | ||
- target/wasm32-unknown-unknown/release/.fingerprint | ||
- target/wasm32-unknown-unknown/release/build | ||
- target/wasm32-unknown-unknown/release/deps | ||
key: v4-cargo-cache-{{ arch }}-{{ checksum "Cargo.lock" }} | ||
|
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,67 @@ | ||
{ | ||
"$schema": "http://json-schema.org/draft-07/schema#", | ||
"title": "Claim", | ||
"type": "object", | ||
"required": [ | ||
"amount", | ||
"release_at" | ||
], | ||
"properties": { | ||
"amount": { | ||
"$ref": "#/definitions/Uint128" | ||
}, | ||
"release_at": { | ||
"$ref": "#/definitions/Expiration" | ||
} | ||
}, | ||
"definitions": { | ||
"Expiration": { | ||
"description": "Expiration represents a point in time when some event happens. It can compare with a BlockInfo and will return is_expired() == true once the condition is hit (and for every block in the future)", | ||
"anyOf": [ | ||
{ | ||
"description": "AtHeight will expire when `env.block.height` >= height", | ||
"type": "object", | ||
"required": [ | ||
"at_height" | ||
], | ||
"properties": { | ||
"at_height": { | ||
"type": "integer", | ||
"format": "uint64", | ||
"minimum": 0.0 | ||
} | ||
} | ||
}, | ||
{ | ||
"description": "AtTime will expire when `env.block.time` >= time", | ||
"type": "object", | ||
"required": [ | ||
"at_time" | ||
], | ||
"properties": { | ||
"at_time": { | ||
"type": "integer", | ||
"format": "uint64", | ||
"minimum": 0.0 | ||
} | ||
} | ||
}, | ||
{ | ||
"description": "Never will never expire. Used to express the empty variant", | ||
"type": "object", | ||
"required": [ | ||
"never" | ||
], | ||
"properties": { | ||
"never": { | ||
"type": "object" | ||
} | ||
} | ||
} | ||
] | ||
}, | ||
"Uint128": { | ||
"type": "string" | ||
} | ||
} | ||
} |
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,81 @@ | ||
{ | ||
"$schema": "http://json-schema.org/draft-07/schema#", | ||
"title": "ClaimsResponse", | ||
"type": "object", | ||
"required": [ | ||
"claims" | ||
], | ||
"properties": { | ||
"claims": { | ||
"type": "array", | ||
"items": { | ||
"$ref": "#/definitions/Claim" | ||
} | ||
} | ||
}, | ||
"definitions": { | ||
"Claim": { | ||
"type": "object", | ||
"required": [ | ||
"amount", | ||
"release_at" | ||
], | ||
"properties": { | ||
"amount": { | ||
"$ref": "#/definitions/Uint128" | ||
}, | ||
"release_at": { | ||
"$ref": "#/definitions/Expiration" | ||
} | ||
} | ||
}, | ||
"Expiration": { | ||
"description": "Expiration represents a point in time when some event happens. It can compare with a BlockInfo and will return is_expired() == true once the condition is hit (and for every block in the future)", | ||
"anyOf": [ | ||
{ | ||
"description": "AtHeight will expire when `env.block.height` >= height", | ||
"type": "object", | ||
"required": [ | ||
"at_height" | ||
], | ||
"properties": { | ||
"at_height": { | ||
"type": "integer", | ||
"format": "uint64", | ||
"minimum": 0.0 | ||
} | ||
} | ||
}, | ||
{ | ||
"description": "AtTime will expire when `env.block.time` >= time", | ||
"type": "object", | ||
"required": [ | ||
"at_time" | ||
], | ||
"properties": { | ||
"at_time": { | ||
"type": "integer", | ||
"format": "uint64", | ||
"minimum": 0.0 | ||
} | ||
} | ||
}, | ||
{ | ||
"description": "Never will never expire. Used to express the empty variant", | ||
"type": "object", | ||
"required": [ | ||
"never" | ||
], | ||
"properties": { | ||
"never": { | ||
"type": "object" | ||
} | ||
} | ||
} | ||
] | ||
}, | ||
"Uint128": { | ||
"type": "string" | ||
} | ||
} | ||
} |
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
Oops, something went wrong.