-
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.
feat(maker): add fee swapper contract (maker) (#14)
* WIP: add custom maker for Osmosis deployment * WIP: maker first version * WIP: add maker tests * WIP: preapare test suite * covering with tests * more tests * use spot price query instead of twap * add test-tube based tests for maker * linter happy * bump deps * add migration from dummy maker * fix comment * bump main crate version
- Loading branch information
Showing
25 changed files
with
2,914 additions
and
266 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
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,34 @@ | ||
[package] | ||
name = "astroport-maker-osmosis" | ||
version = "1.0.0" | ||
authors = ["Astroport"] | ||
edition = "2021" | ||
description = "Astroport maker contract for Osmosis" | ||
license = "GPL-3.0-only" | ||
|
||
[lib] | ||
crate-type = ["cdylib", "rlib"] | ||
|
||
[features] | ||
library = [] | ||
|
||
[dependencies] | ||
cosmwasm-std = { version = "1", features = ["cosmwasm_1_1"] } | ||
cosmwasm-schema = "1" | ||
cw-storage-plus = "0.15" | ||
osmosis-std.workspace = true | ||
cw-utils = "1" | ||
cw2 = "1" | ||
astroport.workspace = true | ||
astroport-on-osmosis = { path = "../../packages/astroport_on_osmosis", version = "1" } | ||
astro-satellite-package = "1" | ||
thiserror = "1.0" | ||
itertools.workspace = true | ||
|
||
[dev-dependencies] | ||
cw-multi-test = { version = "0.20.0", features = ["cosmwasm_1_1"] } | ||
anyhow = "1" | ||
derivative = "2" | ||
astroport-native-coin-registry = { workspace = true } | ||
astroport-factory = { package = "astroport-factory-osmosis", path = "../factory" } | ||
astroport-pcl-osmo = { path = "../pair_concentrated" } |
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,63 @@ | ||
use cosmwasm_std::{CheckedMultiplyRatioError, OverflowError, StdError}; | ||
use cw2::VersionError; | ||
use cw_utils::PaymentError; | ||
use thiserror::Error; | ||
|
||
use astroport_on_osmosis::maker::{PoolRoute, MAX_ALLOWED_SPREAD, MAX_SWAPS_DEPTH}; | ||
|
||
#[derive(Error, Debug, PartialEq)] | ||
pub enum ContractError { | ||
#[error("{0}")] | ||
Std(#[from] StdError), | ||
|
||
#[error("{0}")] | ||
OverflowError(#[from] OverflowError), | ||
|
||
#[error("{0}")] | ||
PaymentError(#[from] PaymentError), | ||
|
||
#[error("{0}")] | ||
CheckedMultiplyRatioError(#[from] CheckedMultiplyRatioError), | ||
|
||
#[error("{0}")] | ||
VersionError(#[from] VersionError), | ||
|
||
#[error("Unauthorized")] | ||
Unauthorized {}, | ||
|
||
#[error("Max spread too high. Max allowed: {MAX_ALLOWED_SPREAD}")] | ||
MaxSpreadTooHigh {}, | ||
|
||
#[error("Incorrect cooldown. Min: {min}, Max: {max}")] | ||
IncorrectCooldown { min: u64, max: u64 }, | ||
|
||
#[error("Empty routes")] | ||
EmptyRoutes {}, | ||
|
||
#[error("Pool {pool_id} doesn't have denom {denom}")] | ||
InvalidPoolDenom { pool_id: u64, denom: String }, | ||
|
||
#[error("Message contains duplicated routes")] | ||
DuplicatedRoutes {}, | ||
|
||
#[error("Route cannot start with ASTRO. Error in route: {route:?}")] | ||
AstroInRoute { route: PoolRoute }, | ||
|
||
#[error("No registered route for {denom}")] | ||
RouteNotFound { denom: String }, | ||
|
||
#[error("Collect cooldown has not elapsed. Next collect is possible at {next_collect_ts}")] | ||
Cooldown { next_collect_ts: u64 }, | ||
|
||
#[error("Failed to build route for {denom}. Max swap depth {MAX_SWAPS_DEPTH}. Check for possible loops. Route taken: {route_taken}")] | ||
FailedToBuildRoute { denom: String, route_taken: String }, | ||
|
||
#[error("Invalid reply id")] | ||
InvalidReplyId {}, | ||
|
||
#[error("Empty collectable assets vector")] | ||
EmptyAssets {}, | ||
|
||
#[error("Nothing to collect")] | ||
NothingToCollect {}, | ||
} |
Oops, something went wrong.