Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement AMM 2.0-light #1092

Merged
merged 81 commits into from
Oct 11, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
81 commits
Select commit Hold shift + click to select a range
249eb33
Implement neo-swaps
maltekliemann Sep 4, 2023
5f55298
Fix compile issues
maltekliemann Sep 5, 2023
85252b0
Implement `DeployPoolsApi` as noop
maltekliemann Sep 5, 2023
61bacd4
Fix formatting
maltekliemann Sep 5, 2023
fdabb40
Add missing copyright notices
maltekliemann Sep 5, 2023
b14373b
Fix clippy issues
maltekliemann Sep 5, 2023
29b20e5
Fix more clippy issues and rename `balances` to `reserves`
maltekliemann Sep 5, 2023
e5b73fd
Remove `println!`
maltekliemann Sep 5, 2023
f0586d3
Add missing copyright notice
maltekliemann Sep 5, 2023
ac4eec2
.
maltekliemann Sep 6, 2023
7b6129e
Add benchmarking and include `NeoSwaps` in Runtime
maltekliemann Sep 6, 2023
e279746
Add neo-swaps benchmarks; remove `split` (for now)
maltekliemann Sep 6, 2023
6585807
Add benchmarks for `create_market_and_deploy_pool`
maltekliemann Sep 7, 2023
5c7a1a5
Properly implement `DeployPool`
maltekliemann Sep 7, 2023
a8ccf91
Fix benchmarks, remove unnecessary parameter
maltekliemann Sep 7, 2023
7419b6a
Fix formatting
maltekliemann Sep 7, 2023
7f40343
Fix dependencies
maltekliemann Sep 7, 2023
f4a0d99
Add math docs
maltekliemann Sep 8, 2023
3aaf3b7
Fix typo
maltekliemann Sep 8, 2023
e9e34ca
Make me codeowner of neo-swaps
maltekliemann Sep 8, 2023
744c3b5
Add neo-swaps to main README and fix link to PDF
maltekliemann Sep 8, 2023
ffdbd84
Fix link
maltekliemann Sep 8, 2023
1fbf3d5
Update versions to v0.4.0 (#1098)
sea212 Sep 11, 2023
bb0e671
Update weights (#1101)
sea212 Sep 12, 2023
36e0b52
Remove unnecessary comment from toml
maltekliemann Sep 14, 2023
fd4e49e
Use default features
maltekliemann Sep 14, 2023
eeb5e20
Bump version
maltekliemann Sep 14, 2023
31f48d8
Use checked math in `SoloLp`
maltekliemann Sep 14, 2023
780727f
Make match expression explicit
maltekliemann Sep 14, 2023
13f5c3e
Add comment about saturation
maltekliemann Sep 14, 2023
1559412
Use `MultiCurrency` instead of `ZeitgeistAssetManager`
maltekliemann Sep 14, 2023
9aeaae3
Apply suggestions from code review
maltekliemann Sep 14, 2023
9e02d06
Remove superfluous inserts
maltekliemann Sep 14, 2023
eb6d7a1
Fix error documentation
maltekliemann Sep 14, 2023
bf48133
Abstract reserve updates into `Pool`
maltekliemann Sep 14, 2023
dfd80ea
Make complete set operations require transactional
maltekliemann Sep 14, 2023
8c04059
Make test name not coffee-based
maltekliemann Sep 14, 2023
ec1416a
Update zrml/neo-swaps/src/mock.rs
maltekliemann Sep 14, 2023
05aad36
Update zrml/neo-swaps/src/mock.rs
maltekliemann Sep 14, 2023
deec29c
Reorganize tests
maltekliemann Sep 14, 2023
5e469da
Format
maltekliemann Sep 14, 2023
7a3bac8
Merge branch 'mkl-neo-swaps' of github.com:zeitgeistpm/zeitgeist into…
maltekliemann Sep 14, 2023
ffe0533
Fix comment
maltekliemann Sep 14, 2023
f8cbccc
Remove `macros.rs`
maltekliemann Sep 14, 2023
2ef5d61
Fix benchmarks
maltekliemann Sep 14, 2023
112e89d
Fix formatting
maltekliemann Sep 14, 2023
29af75d
Update benchmark script and add preliminary benchmarks
maltekliemann Sep 15, 2023
7cfc5c6
Update ED buffer handling
maltekliemann Sep 15, 2023
d8bbacc
Fix documentation
maltekliemann Sep 15, 2023
ce2b067
Merge branch 'main' into mkl-neo-swaps
maltekliemann Sep 15, 2023
cba23be
Implement market creation fees for neo-swaps
maltekliemann Sep 15, 2023
5c3a29d
Merge branch 'mkl-neo-swaps' into mkl-neo-swaps-benchmarks
maltekliemann Sep 15, 2023
b78728b
Use `MarketCreatorFee` in runtime
maltekliemann Sep 15, 2023
009af87
Add missing files
maltekliemann Sep 15, 2023
ce5bcfa
Add weights
maltekliemann Sep 15, 2023
785f10e
Merge branch 'mkl-neo-swaps-docs' into mkl-neo-swaps
maltekliemann Sep 15, 2023
c3e39c4
Reduce length of `MarketsCollectingSubsidy` (#1118)
maltekliemann Sep 19, 2023
40ad4b5
Add bad block of the proof size fiasko to Battery Station chain spec …
maltekliemann Sep 19, 2023
a12b24c
Update weights v0.4.0 (#1121)
sea212 Sep 20, 2023
8a50a78
Merge branch 'release-v0.4.0' into mkl-neo-swaps
maltekliemann Sep 20, 2023
64d3f59
Fix docs
maltekliemann Sep 23, 2023
4e38a45
Rename `IndexType` and change its type value
maltekliemann Sep 23, 2023
c8a2b24
Remove commented code
maltekliemann Sep 24, 2023
1cdaeed
Fix order of config parameters
maltekliemann Sep 24, 2023
647b943
Specify order of assets
maltekliemann Sep 24, 2023
d738cfb
Remove commented code
maltekliemann Sep 24, 2023
e11f262
Apply suggestions from code review
maltekliemann Sep 24, 2023
2ea7b8c
Fix `u16`/`u32` casts
maltekliemann Sep 24, 2023
d0c6808
Update zrml/prediction-markets/src/benchmarks.rs
maltekliemann Sep 24, 2023
0c7d643
Update zrml/prediction-markets/src/benchmarks.rs
maltekliemann Sep 24, 2023
b587582
Merge branch 'main' into mkl-neo-swaps
maltekliemann Sep 28, 2023
d96dd37
Update zrml/neo-swaps/src/math.rs
maltekliemann Sep 28, 2023
f4f4427
Update primitives/src/math/fixed.rs
maltekliemann Sep 28, 2023
7b796ee
Update primitives/src/math/fixed.rs
maltekliemann Sep 28, 2023
b4d9e8d
Fix formatting
maltekliemann Sep 28, 2023
7e347b2
Merge branch 'main' into mkl-neo-swaps
maltekliemann Sep 29, 2023
3e223ca
Fix conflicts
maltekliemann Sep 29, 2023
4c98579
Fix dispute period
maltekliemann Sep 29, 2023
3f7bb11
Merge branch 'main' into mkl-neo-swaps
maltekliemann Oct 4, 2023
65d2168
Format code
maltekliemann Oct 4, 2023
7211f85
Merge branch 'main' into mkl-neo-swaps
maltekliemann Oct 11, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions zrml/prediction-markets/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2288,7 +2288,7 @@ mod pallet {
};
Ok(())
}

#[require_transactional]
pub(crate) fn do_sell_complete_set(
who: T::AccountId,
Expand All @@ -2299,7 +2299,10 @@ mod pallet {

let market = <zrml_market_commons::Pallet<T>>::market(&market_id)?;
ensure!(
matches!(market.scoring_rule, ScoringRule::CPMM | ScoringRule::Lmsr | ScoringRule::Orderbook),
matches!(
market.scoring_rule,
ScoringRule::CPMM | ScoringRule::Lmsr | ScoringRule::Orderbook
),
Error::<T>::InvalidScoringRule
Chralt98 marked this conversation as resolved.
Show resolved Hide resolved
);
Self::ensure_market_is_active(&market)?;
Expand Down Expand Up @@ -2347,7 +2350,10 @@ mod pallet {
Error::<T>::NotEnoughBalance
);
ensure!(
matches!(market.scoring_rule, ScoringRule::CPMM | ScoringRule::Lmsr | ScoringRule::Orderbook),
matches!(
market.scoring_rule,
ScoringRule::CPMM | ScoringRule::Lmsr | ScoringRule::Orderbook
),
Chralt98 marked this conversation as resolved.
Show resolved Hide resolved
Error::<T>::InvalidScoringRule
);
Self::ensure_market_is_active(&market)?;
Expand Down Expand Up @@ -3169,7 +3175,9 @@ mod pallet {
}
let status: MarketStatus = match creation {
MarketCreation::Permissionless => match scoring_rule {
ScoringRule::CPMM | ScoringRule::Lmsr | ScoringRule::Orderbook => MarketStatus::Active,
ScoringRule::CPMM | ScoringRule::Lmsr | ScoringRule::Orderbook => {
MarketStatus::Active
}
ScoringRule::RikiddoSigmoidFeeMarketEma => MarketStatus::CollectingSubsidy,
},
MarketCreation::Advised => MarketStatus::Proposed,
Expand Down
8 changes: 6 additions & 2 deletions zrml/swaps/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2551,7 +2551,9 @@ mod pallet {
ScoringRule::RikiddoSigmoidFeeMarketEma => Ok(
T::WeightInfo::swap_exact_amount_in_rikiddo(pool.assets.len().saturated_into()),
),
ScoringRule::Lmsr | ScoringRule::Orderbook => Err(Error::<T>::InvalidScoringRule.into()),
ScoringRule::Lmsr | ScoringRule::Orderbook => {
Err(Error::<T>::InvalidScoringRule.into())
}
}
}

Expand Down Expand Up @@ -2723,7 +2725,9 @@ mod pallet {
pool.assets.len().saturated_into(),
))
}
ScoringRule::Lmsr | ScoringRule::Orderbook => Err(Error::<T>::InvalidScoringRule.into()),
ScoringRule::Lmsr | ScoringRule::Orderbook => {
Err(Error::<T>::InvalidScoringRule.into())
}
}
}
}
Expand Down
Loading