Skip to content
Merged
Show file tree
Hide file tree
Changes from 32 commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
79bea4b
chore(deps): cargo update --workspace
mattsse Apr 15, 2021
7aacf06
fix(deps): update renamed xcm crate names
mattsse Apr 15, 2021
c3799e4
fix: rename ModuleId to PalletId
mattsse Apr 15, 2021
7b3b477
feat:pallets/orcale: add oracle pallet template
mattsse Apr 9, 2021
9c566a6
feat:pallets/orcale: rename to price feed and include chainlink feed
mattsse Apr 15, 2021
82f4b46
feat:pallets/price-feed: integrate latest chainlink price feed pallet
mattsse Apr 15, 2021
09c2662
rustfmt
mattsse Apr 15, 2021
e5325d5
chore(deps): sync with chainlink deps
mattsse Apr 15, 2021
82ff8c8
chore(deps): sort members
mattsse Apr 16, 2021
39edc21
feat:pallets/price-feed: add types
mattsse Apr 16, 2021
2a07bf4
feat:pallets/price-feed: introduce price feed types and price feed trait
mattsse Apr 16, 2021
f0bd7e8
feat:pallets/price-feed: empty price feed trait implementation
mattsse Apr 16, 2021
6112a62
rustfmt
mattsse Apr 16, 2021
7851a9f
chore(deps): enable std feature for balances
mattsse Apr 16, 2021
ba70d39
feat:pallets/price-feed: add mock config
mattsse Apr 16, 2021
1946262
docs:pallets/price-feed: clarify notes on precision
mattsse Apr 16, 2021
1d609bc
test:pallets/price-feed: add basic feed creation test
mattsse Apr 16, 2021
b7ace6d
rustfmt
mattsse Apr 16, 2021
92bc95e
Update pallets/price-feed/src/lib.rs
mattsse Apr 19, 2021
b36ae3f
feat:pallets/price-feed: add mapping from assetId to feedId
mattsse Apr 19, 2021
d23ca01
feat:pallets/price-feed: add genesis build support
mattsse Apr 19, 2021
b7e8fea
refactor:pallets/price-feed: replace generic price type with FixedU128
mattsse Apr 19, 2021
a23ba9c
feat:pallets/price-feed: implement get_price_pair
mattsse Apr 19, 2021
7007279
rustfmt
mattsse Apr 19, 2021
bb074a6
chore(clippy): make clippy happy
mattsse Apr 19, 2021
f1b60ab
chore(deps): update chainlink feed pallet
mattsse Apr 19, 2021
9763582
feat:pallets/price-feed: drop unused type
mattsse Apr 19, 2021
549f8f0
test:pallets/price-feed: update mock template
mattsse Apr 19, 2021
46aef80
test:pallets/price-feed: add price pair tests
mattsse Apr 19, 2021
70444ee
test:pallets/price-feed: reexport feedbuilder for tests
mattsse Apr 19, 2021
0b3cc33
test:pallets/price-feed: add price feed tests
mattsse Apr 19, 2021
0b62072
chore:pallets/price-feed: remove commented out config typ eartefacts
mattsse Apr 19, 2021
fbf1c66
Merge branch 'main' into matt/add-price-feed
mattsse Apr 22, 2021
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
4,339 changes: 2,680 additions & 1,659 deletions Cargo.lock

Large diffs are not rendered by default.

13 changes: 4 additions & 9 deletions pallets/local-treasury/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,7 @@ mod tests;
// this is requires as the #[pallet::event] proc macro generates code that violates this lint
#[allow(clippy::unused_unit)]
pub mod pallet {
use frame_support::{
dispatch::DispatchResultWithPostInfo,
pallet_prelude::*,
sp_runtime::{traits::AccountIdConversion, ModuleId},
traits::{Currency, ExistenceRequirement::AllowDeath, Get},
};
use frame_support::{dispatch::DispatchResultWithPostInfo, pallet_prelude::*, sp_runtime::{traits::AccountIdConversion}, traits::{Currency, ExistenceRequirement::AllowDeath, Get}, PalletId};
use frame_system::pallet_prelude::*;

type AccountIdFor<T> = <T as frame_system::Config>::AccountId;
Expand All @@ -30,10 +25,10 @@ pub mod pallet {
pub trait Config: frame_system::Config {
/// Origin that is allowed to manage the treasury balance and initiate withdrawals
type AdminOrigin: EnsureOrigin<Self::Origin>;
/// ModuleId must be an unique 8 character string.
/// PalletId must be an unique 8 character string.
/// It is used to generate the account ID which holds the balance of the treasury.
#[pallet::constant]
type ModuleId: Get<ModuleId>;
type PalletId: Get<PalletId>;
/// The pallet to use as the base currency for this treasury
type Currency: Currency<Self::AccountId>;
type Event: From<Event<Self>> + IsType<<Self as frame_system::Config>::Event>;
Expand Down Expand Up @@ -62,7 +57,7 @@ pub mod pallet {
/// Returns the accountID for the treasury balance
/// Transferring balance to this account funds the treasury
pub fn account_id() -> T::AccountId {
T::ModuleId::get().into_account()
T::PalletId::get().into_account()
}
}

Expand Down
8 changes: 4 additions & 4 deletions pallets/local-treasury/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use sp_runtime::{
testing::Header,
traits::AccountIdConversion,
traits::{BlakeTwo256, IdentityLookup},
ModuleId,
PalletId,
};

type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<Test>;
Expand Down Expand Up @@ -86,19 +86,19 @@ impl pallet_balances::Config for Test {
type WeightInfo = ();
}

pub(crate) const LOCAL_TREASURE_MODULE_ID: ModuleId = ModuleId(*b"12345678");
pub(crate) const LOCAL_TREASURE_MODULE_ID: PalletId = PalletId(*b"12345678");
pub(crate) const ADMIN_ACCOUNT_ID: AccountId = 88;

parameter_types! {
pub const TestModuleId: ModuleId = LOCAL_TREASURE_MODULE_ID;
pub const TestPalletId: PalletId = LOCAL_TREASURE_MODULE_ID;
}
ord_parameter_types! {
pub const AdminAccountId: AccountId = ADMIN_ACCOUNT_ID;
}

impl pallet_local_treasury::Config for Test {
type AdminOrigin = frame_system::EnsureSignedBy<AdminAccountId, AccountId>;
type ModuleId = TestModuleId;
type PalletId = TestPalletId;
type Currency = Balances;
type Event = Event;
}
Expand Down
76 changes: 76 additions & 0 deletions pallets/price-feed/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
[package]
authors = ['ChainSafe Systems']
description = 'FRAME pallet to implement PINT price feeds.'
edition = '2018'
license = 'LGPL-3.0-only'
name = 'pallet-price-feed'
readme = 'README.md'
repository = 'https://github.com/ChainSafe/PINT/'
version = '0.0.1'

[features]
default = ['std']
std = [
'serde',
'codec/std',
'frame-support/std',
'frame-system/std',
'pallet-balances/std',
'pallet-chainlink-feed/std',
]
[dependencies.codec]
default-features = false
features = ['derive']
package = 'parity-scale-codec'
version = '2.0.0'

[dependencies.frame-support]
default-features = false
git = 'https://github.com/paritytech/substrate.git'
branch = 'rococo-v1'
version = '3.0.0'

[dependencies.frame-system]
default-features = false
git = 'https://github.com/paritytech/substrate.git'
branch = 'rococo-v1'
version = '3.0.0'

[dependencies.pallet-chainlink-feed]
default_features = false
package = 'pallet-chainlink-feed'
git = "https://github.com/mattsse/chainlink-polkadot"
# this is substrate v3 branch that is upstreamed with rococo-v1
# and requires https://github.com/ChainSafe/PINT/issues/37
# see also https://github.com/ChainSafe/PINT/pull/39
branch = "substrate-v3"

[dependencies]
serde = { version = "1.0.101", optional = true }

[dev-dependencies.pallet-balances]
default-features = false
git = 'https://github.com/paritytech/substrate.git'
branch = 'rococo-v1'
version = '3.0.0'

[dev-dependencies.sp-core]
default-features = false
git = 'https://github.com/paritytech/substrate.git'
branch = 'rococo-v1'
version = '3.0.0'

[dev-dependencies.sp-io]
default-features = false
git = 'https://github.com/paritytech/substrate.git'
branch = 'rococo-v1'
version = '3.0.0'

[dev-dependencies.sp-runtime]
default-features = false
git = 'https://github.com/paritytech/substrate.git'
branch = 'rococo-v1'
version = '3.0.0'

[package.metadata.docs.rs]
targets = ['x86_64-unknown-linux-gnu']
1 change: 1 addition & 0 deletions pallets/price-feed/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
License: LGPL-3.0-only
Loading