Skip to content

Commit

Permalink
Add boilerplate for babylon vault
Browse files Browse the repository at this point in the history
  • Loading branch information
lubkoll committed Jul 22, 2024
1 parent 22d0cd2 commit d2c71dc
Show file tree
Hide file tree
Showing 17 changed files with 548 additions and 0 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/babylon_vault.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
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
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: 'contracts/babylon-vault'
1 change: 1 addition & 0 deletions scripts/git/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,4 @@ update_schemas_and_formatting token-burner
update_schemas_and_formatting cl-vault
update_schemas_and_formatting merkle-incentives
update_schemas_and_formatting range-middleware
update_schemas_and_formatting babylon-vault
11 changes: 11 additions & 0 deletions smart-contracts/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions smart-contracts/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ members = [
"contracts/dex-router-osmosis",
"contracts/lst-dex-adapter-osmosis",
"contracts/lst-adapter-osmosis",
"contracts/babylon-vault",
]

[workspace.dependencies]
Expand Down
31 changes: 31 additions & 0 deletions smart-contracts/contracts/babylon-vault/Cargo.toml
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 smart-contracts/contracts/babylon-vault/examples/schema.rs
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,
}
}
196 changes: 196 additions & 0 deletions smart-contracts/contracts/babylon-vault/schema/babylon-vault.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,196 @@
{
"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",
"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"
}
}
}
}
}
66 changes: 66 additions & 0 deletions smart-contracts/contracts/babylon-vault/schema/raw/execute.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
{
"$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
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "InstantiateMsg",
"type": "object",
"additionalProperties": false
}
Loading

0 comments on commit d2c71dc

Please sign in to comment.