Skip to content

Commit

Permalink
osmo gamm lper (#72)
Browse files Browse the repository at this point in the history
* init osmosis lper

* clippy

* wip: osmosis lper integration into valence services; testing suite init

* update optimize.sh

* adding osmosis-utils package

* wip: osmo uploading contracts debugging

* fix unit test setup

* removing duplicate pool_id field from configs

* providing two sided liquidity

* extend test suite

* single sided liquidity provision

* add OsmosisPoolType

* move osmo message related utils to osmosis-utils package

* add pool_types mod

* concentrated liquidity mod

* add a shift cl pool helper

* cosmwasm pool test setup

* wip: transmuter

* remove cl & cw osmo lper logic

* rename to osmosis-gamm-lper

* cleanup; add lp token transfer from input -> output acc

* add post-lp transfer to single side lp

* cleanup osmo gamm lper

* add spot price range validation & tests

* add pool denom validation

* readme

* adjust cargo.toml

* rearrange utils

* remove valence_service_integration & balancer mods; toml updates

* rename ActionMsgs; schemagen

* ci

* merge
  • Loading branch information
bekauz authored Oct 18, 2024
1 parent c674643 commit 3245a68
Show file tree
Hide file tree
Showing 25 changed files with 2,051 additions and 46 deletions.
239 changes: 202 additions & 37 deletions Cargo.lock

Large diffs are not rendered by default.

6 changes: 5 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ overflow-checks = true

[workspace.dependencies]
anyhow = "1.0.86"
cosmwasm-std = { version = "2.1.3", features = ["cosmwasm_1_4"] }
cosmwasm-std = { version = "2.1.3" }
cosmwasm-schema = "2.1.3"
cw-denom = { package = "cw-denom", git = "https://github.com/DA0-DA0/dao-contracts", branch = "cw-std-2" }
cw-ownable = "2.0.0"
Expand All @@ -49,6 +49,7 @@ serde = { version = "1.0.207", default-features = false, features = [
serde_json = "1.0.125"
sha2 = "0.10.8"
thiserror = "1.0.63"
osmosis-std = "0.26.0"

# our contracts
valence-authorization = { path = "contracts/authorization", features = ["library"] }
Expand All @@ -62,10 +63,12 @@ valence-astroport-lper = { path = "contracts/services/astroport-lper",
valence-forwarder-service = { path = "contracts/services/forwarder", features = ["library"] }
valence-astroport-withdrawer = { path = "contracts/services/astroport-withdrawer", features = ["library"] }
valence-reverse-splitter-service = { path = "contracts/services/reverse-splitter", features = ["library"] }
valence-osmosis-gamm-lper = { path = "contracts/services/osmosis-gamm-lper", features = ["library"] }

# our packages
valence-account-utils = { path = "packages/account-utils" }
valence-astroport-utils = { path = "packages/astroport-utils" }
valence-osmosis-utils = { path = "packages/osmosis-utils" }
valence-authorization-utils = { path = "packages/authorization-utils" }
valence-macros = { path = "packages/valence-macros" }
valence-polytone-utils = { path = "packages/polytone-utils" }
Expand All @@ -83,3 +86,4 @@ hex = "0.4.3"
margined-neutron-std = "4.2.0"
neutron-test-tube = "4.2.0"
tokio = "1.40.0"
osmosis-test-tube = "25.0.0"
2 changes: 1 addition & 1 deletion contracts/accounts/base_account/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ optimize = """docker run --rm -v "$(pwd)":/code \

[dependencies]
cosmwasm-schema = { workspace = true }
cosmwasm-std = { workspace = true }
cosmwasm-std = { workspace = true, features = ["stargate"] }

cw-ownable = { workspace = true }
cw-storage-plus = { workspace = true }
Expand Down
2 changes: 1 addition & 1 deletion contracts/authorization/src/tests/helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ pub fn store_and_instantiate_authorization_with_processor_contract(
let salt = hex::encode("authorization");
let predicted_address = extended_wasm
.query_build_address(
hex::encode(&checksum),
hex::encode(checksum),
signer.address().to_string(),
salt.clone(),
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ pub fn create_withdraw_liquidity_msgs(
let token = query_liquidity_token(deps, cfg)?;

// Query the balance of the account that is going to withdraw
let balance = deps.querier.query_balance(&cfg.input_addr, &token)?;
let balance = deps.querier.query_balance(&cfg.input_addr, token)?;
if balance.amount.is_zero() {
return Err(ServiceError::ExecutionError(
"Nothing to withdraw".to_string(),
Expand Down
3 changes: 3 additions & 0 deletions contracts/services/osmosis-gamm-lper/.cargo/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[alias]
wasm = "build --release --lib --target wasm32-unknown-unknown"
schema = "run --bin schema"
31 changes: 31 additions & 0 deletions contracts/services/osmosis-gamm-lper/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
[package]
name = "valence-osmosis-gamm-lper"
authors = { workspace = true }
edition = { workspace = true }
license = { workspace = true }
version = { workspace = true }
repository = { workspace = true }

[lib]
crate-type = ["cdylib", "rlib"]

[features]
# use library feature to disable all instantiate/execute/query exports
library = []

[dependencies]
cosmwasm-std = { workspace = true }
cosmwasm-schema = { workspace = true }
cw-ownable = { workspace = true }
valence-macros = { workspace = true }
valence-service-utils = { workspace = true }
valence-service-base = { workspace = true }
osmosis-std = { workspace = true }
valence-account-utils = { workspace = true }
valence-osmosis-utils = { workspace = true }

[dev-dependencies]
cosmwasm-std-old = { package = "cosmwasm-std", version = "1.5.7" }
cw20 = { workspace = true }
osmosis-test-tube = { workspace = true }
valence-osmosis-utils = { workspace = true, features = ["testing"] }
1 change: 1 addition & 0 deletions contracts/services/osmosis-gamm-lper/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Osmosis GAMM liquidity provider service
12 changes: 12 additions & 0 deletions contracts/services/osmosis-gamm-lper/src/bin/schema.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
use cosmwasm_schema::write_api;

use valence_osmosis_gamm_lper::msg::{ActionMsgs, QueryMsg, ServiceConfig, ServiceConfigUpdate};
use valence_service_utils::msg::{ExecuteMsg, InstantiateMsg};

fn main() {
write_api! {
instantiate: InstantiateMsg<ServiceConfig>,
execute: ExecuteMsg<ActionMsgs, ServiceConfigUpdate>,
query: QueryMsg,
}
}
Loading

0 comments on commit 3245a68

Please sign in to comment.