-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
567 additions
and
11 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,27 @@ | ||
name: Babylon Vault | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
paths: | ||
- 'smart-contracts/contracts/babylon-vault/Cargo.toml' | ||
- 'smart-contracts/contracts/babylon-vault/**.rs' | ||
- '.github/workflows/rust_basic.yml' | ||
- '.github/workflows/babylon_vault.yml' | ||
push: | ||
branches: | ||
- main | ||
- feat/babylon | ||
paths: | ||
- 'smart-contracts/contracts/babylon-vault/Cargo.toml' | ||
- 'smart-contracts/contracts/babylon-vault/**.rs' | ||
- '.github/workflows/rust_basic.yml' | ||
- '.github/workflows/babylon_vault.yml' | ||
workflow_dispatch: | ||
|
||
jobs: | ||
unit-test: | ||
uses: ./.github/workflows/rust_basic.yml | ||
with: | ||
target: 'contract/babylon-vault' |
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 |
---|---|---|
|
@@ -13,17 +13,9 @@ jobs: | |
steps: | ||
- name: Check out repository code | ||
uses: actions/checkout@v3 | ||
- name: Get git diff | ||
uses: technote-space/[email protected] | ||
with: | ||
PATTERNS: | | ||
${{inputs.contract}}/**.rs | ||
${{inputs.contract}}/Cargo.toml | ||
- name: Install Rust | ||
if: env.GIT_DIFF | ||
uses: dtolnay/rust-toolchain@stable | ||
- name: Restore dependencies | ||
if: env.GIT_DIFF | ||
uses: actions/cache/restore@v4 | ||
with: | ||
path: | | ||
|
@@ -33,14 +25,11 @@ jobs: | |
key: ${{ runner.os }}-cargo-$GITHUB_SHA | ||
restore-keys: ${{ runner.os }}-cargo | ||
- name: Rust lint | ||
if: env.GIT_DIFF | ||
run: RUSTFLAGS="-Dwarnings" cargo clippy --workspace -- -D warnings --A deprecated | ||
working-directory: smart-contracts/${{ inputs.target }} | ||
- name: Rust format check | ||
if: env.GIT_DIFF | ||
run: cargo fmt --all -- --check | ||
working-directory: smart-contracts/${{ inputs.target }} | ||
- name: Run unit-tests | ||
if: env.GIT_DIFF | ||
run: cargo unit-test | ||
working-directory: smart-contracts/${{ inputs.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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,31 @@ | ||
[package] | ||
authors = ["Quasar"] | ||
edition = "2021" | ||
name = "babylon-vault" | ||
version = "0.0.1" | ||
readme = "" | ||
repository = "https://github.com/quasar-finance/quasar" | ||
homepage = "https://quasar.fi" | ||
documentation = "" | ||
license = "MPL-2.0" | ||
description = "A vault for babylon lsts" | ||
keywords = ["cosmwasm", "lst", "btc"] | ||
|
||
exclude = [ | ||
"babylon_vault.wasm", | ||
"hash.txt", | ||
] | ||
|
||
[lib] | ||
crate-type = ["cdylib", "rlib"] | ||
|
||
[features] | ||
default = [] | ||
library = [] | ||
|
||
[dependencies] | ||
cosmwasm-std = { workspace = true } | ||
cosmwasm-schema = { workspace = true } | ||
cw-storage-plus = { workspace = true } | ||
thiserror = { workspace = true } | ||
cw2 = { workspace = true } |
10 changes: 10 additions & 0 deletions
10
smart-contracts/contracts/babylon-vault/examples/schema.rs
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 babylon_vault::msg::{ExecuteMsg, InstantiateMsg, QueryMsg}; | ||
use cosmwasm_schema::write_api; | ||
|
||
fn main() { | ||
write_api! { | ||
instantiate: InstantiateMsg, | ||
query: QueryMsg, | ||
execute: ExecuteMsg, | ||
} | ||
} |
204 changes: 204 additions & 0 deletions
204
smart-contracts/contracts/babylon-vault/schema/babylon-vault.json
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,204 @@ | ||
{ | ||
"contract_name": "babylon-vault", | ||
"contract_version": "0.0.1", | ||
"idl_version": "1.0.0", | ||
"instantiate": { | ||
"$schema": "http://json-schema.org/draft-07/schema#", | ||
"title": "InstantiateMsg", | ||
"type": "object", | ||
"required": [ | ||
"owner" | ||
], | ||
"properties": { | ||
"owner": { | ||
"type": "string" | ||
} | ||
}, | ||
"additionalProperties": false | ||
}, | ||
"execute": { | ||
"$schema": "http://json-schema.org/draft-07/schema#", | ||
"title": "ExecuteMsg", | ||
"oneOf": [ | ||
{ | ||
"type": "object", | ||
"required": [ | ||
"deposit" | ||
], | ||
"properties": { | ||
"deposit": { | ||
"type": "object", | ||
"additionalProperties": false | ||
} | ||
}, | ||
"additionalProperties": false | ||
}, | ||
{ | ||
"type": "object", | ||
"required": [ | ||
"withdraw" | ||
], | ||
"properties": { | ||
"withdraw": { | ||
"type": "object", | ||
"additionalProperties": false | ||
} | ||
}, | ||
"additionalProperties": false | ||
}, | ||
{ | ||
"type": "object", | ||
"required": [ | ||
"claim" | ||
], | ||
"properties": { | ||
"claim": { | ||
"type": "object", | ||
"additionalProperties": false | ||
} | ||
}, | ||
"additionalProperties": false | ||
}, | ||
{ | ||
"type": "object", | ||
"required": [ | ||
"register_lst" | ||
], | ||
"properties": { | ||
"register_lst": { | ||
"type": "object", | ||
"required": [ | ||
"denom" | ||
], | ||
"properties": { | ||
"denom": { | ||
"type": "string" | ||
} | ||
}, | ||
"additionalProperties": false | ||
} | ||
}, | ||
"additionalProperties": false | ||
} | ||
] | ||
}, | ||
"query": { | ||
"$schema": "http://json-schema.org/draft-07/schema#", | ||
"title": "QueryMsg", | ||
"oneOf": [ | ||
{ | ||
"type": "object", | ||
"required": [ | ||
"pending" | ||
], | ||
"properties": { | ||
"pending": { | ||
"type": "object", | ||
"required": [ | ||
"address" | ||
], | ||
"properties": { | ||
"address": { | ||
"type": "string" | ||
} | ||
}, | ||
"additionalProperties": false | ||
} | ||
}, | ||
"additionalProperties": false | ||
}, | ||
{ | ||
"type": "object", | ||
"required": [ | ||
"claimable" | ||
], | ||
"properties": { | ||
"claimable": { | ||
"type": "object", | ||
"required": [ | ||
"address" | ||
], | ||
"properties": { | ||
"address": { | ||
"type": "string" | ||
} | ||
}, | ||
"additionalProperties": false | ||
} | ||
}, | ||
"additionalProperties": false | ||
}, | ||
{ | ||
"type": "object", | ||
"required": [ | ||
"balance_in_underlying" | ||
], | ||
"properties": { | ||
"balance_in_underlying": { | ||
"type": "object", | ||
"additionalProperties": false | ||
} | ||
}, | ||
"additionalProperties": false | ||
} | ||
] | ||
}, | ||
"migrate": null, | ||
"sudo": null, | ||
"responses": { | ||
"balance_in_underlying": { | ||
"$schema": "http://json-schema.org/draft-07/schema#", | ||
"title": "Uint128", | ||
"description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", | ||
"type": "string" | ||
}, | ||
"claimable": { | ||
"$schema": "http://json-schema.org/draft-07/schema#", | ||
"title": "Uint128", | ||
"description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", | ||
"type": "string" | ||
}, | ||
"pending": { | ||
"$schema": "http://json-schema.org/draft-07/schema#", | ||
"title": "Array_of_Claim", | ||
"type": "array", | ||
"items": { | ||
"$ref": "#/definitions/Claim" | ||
}, | ||
"definitions": { | ||
"Claim": { | ||
"type": "object", | ||
"required": [ | ||
"amount", | ||
"expiration" | ||
], | ||
"properties": { | ||
"amount": { | ||
"$ref": "#/definitions/Uint128" | ||
}, | ||
"expiration": { | ||
"$ref": "#/definitions/Timestamp" | ||
} | ||
}, | ||
"additionalProperties": false | ||
}, | ||
"Timestamp": { | ||
"description": "A point in time in nanosecond precision.\n\nThis type can represent times from 1970-01-01T00:00:00Z to 2554-07-21T23:34:33Z.\n\n## Examples\n\n``` # use cosmwasm_std::Timestamp; let ts = Timestamp::from_nanos(1_000_000_202); assert_eq!(ts.nanos(), 1_000_000_202); assert_eq!(ts.seconds(), 1); assert_eq!(ts.subsec_nanos(), 202);\n\nlet ts = ts.plus_seconds(2); assert_eq!(ts.nanos(), 3_000_000_202); assert_eq!(ts.seconds(), 3); assert_eq!(ts.subsec_nanos(), 202); ```", | ||
"allOf": [ | ||
{ | ||
"$ref": "#/definitions/Uint64" | ||
} | ||
] | ||
}, | ||
"Uint128": { | ||
"description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", | ||
"type": "string" | ||
}, | ||
"Uint64": { | ||
"description": "A thin wrapper around u64 that is using strings for JSON encoding/decoding, such that the full u64 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u64` to get the value out:\n\n``` # use cosmwasm_std::Uint64; let a = Uint64::from(42u64); assert_eq!(a.u64(), 42);\n\nlet b = Uint64::from(70u32); assert_eq!(b.u64(), 70); ```", | ||
"type": "string" | ||
} | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.