Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
110 commits
Select commit Hold shift + click to select a range
16654c4
Fix bug with double `AssetRegistered` event
Arjentix Dec 7, 2022
c79259a
Take `DataFeed` trait from `oracle-proxy-pallet` branch
Arjentix Dec 7, 2022
079d7af
Allow trading pair registration via method
Arjentix Dec 7, 2022
14dc823
Introduce new extrinsics
Arjentix Dec 7, 2022
87c2fd5
Merge branch 'develop' into custom_synthetics
Arjentix Dec 8, 2022
4e05c6f
Add "USD" corner case
Arjentix Dec 9, 2022
da06c1a
Add `asset_symbol` and `asset_name` parameters
Arjentix Dec 9, 2022
1f0daf7
Add synthetic asset id generation
Arjentix Dec 9, 2022
b91fd23
Fix reference_price() to work with all synthetics
Arjentix Dec 9, 2022
1b1c2eb
Add oracle prices to `buy_price()`
Arjentix Dec 9, 2022
01d0e65
Add oracle prices to `sell_price()`
Arjentix Dec 9, 2022
7f0bfe6
Add `SyntheticInfo` struct
Arjentix Dec 12, 2022
60acb34
Add extrinsics to set fees
Arjentix Dec 12, 2022
8bcd912
Implement fees logic
Arjentix Dec 12, 2022
dfe3f4c
Add fees into `enable_synthetic_asset()` extrinsic
Arjentix Dec 13, 2022
1dad40e
Remove some useless code
Arjentix Dec 13, 2022
0a7c8fc
Update Config usage in mock and runtime
Arjentix Dec 13, 2022
0c85af8
Some fixes to make it all compile
Arjentix Dec 14, 2022
2e47d6b
Revert "Implement fees logic"
Arjentix Dec 14, 2022
6ec0ae4
Make one fee instead of buy and sell fees
Arjentix Dec 14, 2022
a9f5db1
Fix calculation in `reference_price()`
Arjentix Dec 15, 2022
a46da94
Add tests for new extrinsics
Arjentix Dec 15, 2022
8ce807a
Merge branch 'develop' into custom_synthetics
Arjentix Dec 16, 2022
7ad8bc3
Partly fix benchmarks
Arjentix Dec 16, 2022
1acec10
Move `xst` pallet benchmarks to a separate crate
Arjentix Dec 16, 2022
ae9b741
Finish fixing benchmarks
Arjentix Dec 18, 2022
a5fdf5c
Update weights
Arjentix Dec 18, 2022
d14c109
Update extrinsics doc comments
Arjentix Dec 18, 2022
057b2ed
Add migration
Arjentix Dec 18, 2022
b0c5df0
Remove useless `LiquidityProxy` from xst::Config
Arjentix Dec 18, 2022
ed4af6c
Merge branch 'develop' into custom_synthetics
Arjentix Dec 22, 2022
cf68815
Merge branch 'develop' into custom_synthetics
Arjentix Jan 9, 2023
ea5b396
Merge branch 'develop' into custom_synthetics
Arjentix Jan 9, 2023
ce0bf0b
Merge branch 'develop' into custom_synthetics
vovac12 Jan 10, 2023
e748571
Move synthetic asset id generation to primitives
Arjentix Jan 12, 2023
4dfd15a
Add old base fee storage killing
Arjentix Jan 12, 2023
d200df8
Merge branch 'develop' into custom_synthetics
Arjentix Jan 12, 2023
ef4d1a7
Replace `fastmurmur3` with `sp_io::hashing`
Arjentix Jan 16, 2023
ce86959
Merge branch 'develop' into custom_synthetics
Arjentix Jan 23, 2023
9146ae7
Improve trait bounds for `xst::Config`
Arjentix Jan 23, 2023
3dc09bc
Merge branch 'develop' into custom_synthetics
pakrentos Feb 8, 2023
4f3e712
quickfix
pakrentos Feb 9, 2023
0ec3c4d
Merge branch 'develop' into custom_synthetics
pakrentos Feb 9, 2023
a0c4291
Merge branch 'develop' into custom_synthetics
pakrentos Feb 10, 2023
7066170
Merge remote-tracking branch 'origin/custom_synthetics' into custom_s…
pakrentos Feb 10, 2023
49bf6cc
remove unnecessary imports
pakrentos Feb 13, 2023
37dda2e
fix
pakrentos Feb 13, 2023
c77e687
fix
pakrentos Feb 14, 2023
c171811
removed XSTUSD from Assets pallet init (initialized in XST palllet)
pakrentos Feb 14, 2023
78f90cf
Merge branch 'develop' into custom_synthetics
pakrentos Feb 14, 2023
0eb9b07
Merge branch 'develop' into custom_synthetics
pakrentos Feb 15, 2023
ed947e0
Merge branch 'develop' into custom_synthetics
pakrentos Feb 20, 2023
6d56ba6
Merge branch 'develop' into custom_synthetics
pakrentos Feb 20, 2023
ba02ab6
quickfix
pakrentos Feb 21, 2023
b47e858
Merge branch 'develop' into custom_synthetics
pakrentos Mar 6, 2023
d0007ba
Merge branch 'develop' into custom_synthetics
pakrentos Mar 8, 2023
96c3152
Merge branch 'develop' into custom_synthetics
pakrentos Mar 13, 2023
c41469b
Merge branch 'develop' into custom_synthetics
pakrentos Mar 21, 2023
3f0d503
Merge branch 'develop' into custom_synthetics
pakrentos Mar 21, 2023
0a8558a
updated tests
pakrentos Mar 21, 2023
205e20d
updated storage definitions
pakrentos Mar 23, 2023
61eb9da
Merge branch 'develop' into custom_synthetics
pakrentos Mar 27, 2023
feb8818
fix
pakrentos Mar 28, 2023
d362897
fix tests
pakrentos Mar 28, 2023
368e92b
fixed migrations
pakrentos Mar 29, 2023
b0fb66b
fixed benchmarks
pakrentos Mar 29, 2023
96c18e4
fixed tests
pakrentos Mar 29, 2023
63576bb
updated xst config
pakrentos Mar 29, 2023
ce79b5c
quickfix
pakrentos Mar 29, 2023
6efb757
added outdated oracle rates check
pakrentos Apr 4, 2023
49b256f
Merge branch 'develop' into custom_synthetics
pakrentos Apr 4, 2023
b230c2e
moved rate expiration check to band pallet
pakrentos Apr 5, 2023
1193340
Merge branch 'develop' into custom_synthetics
pakrentos Apr 5, 2023
3b764a5
quickfix
pakrentos Apr 6, 2023
0740eef
quickfix
pakrentos Apr 7, 2023
a4d12c3
quickfix
pakrentos Apr 7, 2023
5351ba9
Merge branch 'develop' into custom_synthetics
pakrentos Apr 7, 2023
b55b30b
resolved merge conflicts
pakrentos Apr 11, 2023
684c296
Merge branch 'develop' into custom_synthetics
pakrentos Apr 11, 2023
ea4e2da
quickfix
pakrentos Apr 12, 2023
f1d88d4
quickfix
pakrentos Apr 12, 2023
59db668
Merge branch 'develop' into custom_synthetics
pakrentos Apr 13, 2023
13ae71f
fix
pakrentos Apr 13, 2023
c79f073
Merge branch 'develop' into custom_synthetics
pakrentos Apr 14, 2023
a61fd68
build fix
wer1st Apr 14, 2023
d1f0f0c
Merge remote-tracking branch 'origin/custom_synthetics' into custom_s…
pakrentos Apr 14, 2023
2fdc8f1
fixed xst benchmarks
pakrentos Apr 16, 2023
2e463fd
updated xst weights
pakrentos Apr 16, 2023
b681213
removed mocks
pakrentos Apr 16, 2023
12f9e26
removed unused imports
pakrentos Apr 17, 2023
9b209f0
Merge branch 'develop' into custom_synthetics
pakrentos Apr 17, 2023
9b1e0c4
resolved conflict
pakrentos Apr 17, 2023
d78c875
reverted benchmarks
pakrentos Apr 17, 2023
6d92d5e
fixed pallet-timestamp repo
pakrentos Apr 17, 2023
1eca45c
added empty line
pakrentos Apr 17, 2023
3a2cc74
fixed rate stale period constant
pakrentos Apr 17, 2023
a13f5f8
fixed xst migrations
pakrentos Apr 17, 2023
6c05706
updated synthetic asset registration process
pakrentos Apr 17, 2023
8e13574
fixed
pakrentos Apr 17, 2023
a14ea6a
resolved conflicts
pakrentos Apr 17, 2023
0814ce5
resolved conflicts
pakrentos Apr 17, 2023
5c027fe
Merge remote-tracking branch 'origin/custom_synthetics' into custom_s…
pakrentos Apr 17, 2023
c22b93c
Merge branch 'develop' into custom_synthetics
pakrentos Apr 17, 2023
7db3b6b
removed unused import
pakrentos Apr 17, 2023
cbcf7f1
Merge remote-tracking branch 'origin/custom_synthetics' into custom_s…
pakrentos Apr 17, 2023
74cd056
Merge branch 'develop' into custom_synthetics
pakrentos Apr 17, 2023
c4dc78f
fixed band dependencies
pakrentos Apr 17, 2023
a313b7e
check optimization
pakrentos Apr 17, 2023
e58ef02
added fee ratio check
pakrentos Apr 17, 2023
af68ee0
Merge branch 'develop' into custom_synthetics
pakrentos Apr 18, 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
Prev Previous commit
Next Next commit
Add old base fee storage killing
Signed-off-by: Daniil Polyakov <[email protected]>
  • Loading branch information
Arjentix committed Jan 12, 2023
commit 4dfd15a05febffeec8303498800d0097f58c034b
11 changes: 10 additions & 1 deletion pallets/xst/src/migrations/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,19 +29,28 @@
// USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

use super::pallet::{Config, Pallet};
use common::{fixed, XSTUSD};
use common::generate_storage_instance;
use common::{fixed, Fixed, XSTUSD};
use frame_support::pallet_prelude::{Get, StorageVersion};
use frame_support::pallet_prelude::{StorageValue, ValueQuery};
use frame_support::{log::info, traits::GetStorageVersion as _, weights::Weight};

use crate::{EnabledSymbols, EnabledSynthetics, SyntheticInfo};

generate_storage_instance!(PoolXST, BaseFee);
type OldBaseFee = StorageValue<BaseFeeOldInstance, Fixed, ValueQuery>;

/// Migration which migrates `XSTUSD` synthetic to the new format.
pub fn migrate<T: Config>() -> Weight {
if Pallet::<T>::on_chain_storage_version() >= 2 {
info!("Migration to version 2 has already been applied");
return 0;
}

if OldBaseFee::exists() {
OldBaseFee::kill();
}

EnabledSynthetics::<T>::insert(
T::AssetId::from(XSTUSD),
Some(SyntheticInfo {
Expand Down
6 changes: 4 additions & 2 deletions pallets/xst/src/migrations/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,15 @@
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
// USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

use crate::{mock::*, pallet::Pallet, EnabledSynthetics};
use common::{fixed, XSTUSD};
use crate::{migrations::OldBaseFee, mock::*, pallet::Pallet, EnabledSynthetics};
use common::{fixed, Fixed, XSTUSD};
use frame_support::traits::{GetStorageVersion as _, StorageVersion};

#[test]
fn test() {
ExtBuilder::default().build().execute_with(|| {
StorageVersion::new(1).put::<Pallet<Runtime>>();
OldBaseFee::put::<Fixed>(fixed!(0.00666));

super::migrate::<Runtime>();

Expand All @@ -44,6 +45,7 @@ fn test() {

assert_eq!(info.reference_symbol, "USD");
assert_eq!(info.fee_ratio, fixed!(0.00666));
assert!(!OldBaseFee::exists());

assert_eq!(Pallet::<Runtime>::on_chain_storage_version(), 2);
});
Expand Down