Skip to content

Commit 842c0f8

Browse files
committed
remove oracle update call addresses and signers from liquidation pallet
1 parent e55bbeb commit 842c0f8

5 files changed

Lines changed: 0 additions & 156 deletions

File tree

pallets/liquidation/src/lib.rs

Lines changed: 0 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -83,19 +83,6 @@ pub enum Function {
8383
FlashLoan = "flashLoan(address,address,uint256,bytes)",
8484
}
8585

86-
sp_api::decl_runtime_apis! {
87-
/// The API to query allowed signers and call addresses of DIA oracle update transactions.
88-
/// This api is used to expose these values to the liquidation worker.
89-
pub trait LiquidationWorkerApi where
90-
{
91-
/// Get the list of allowed signers.
92-
fn oracle_signers() -> Vec<EvmAddress>;
93-
94-
/// Get the list of allowed call addresses.
95-
fn oracle_call_addresses() -> Vec<EvmAddress>;
96-
}
97-
}
98-
9986
#[frame_support::pallet]
10087
pub mod pallet {
10188
use super::*;
@@ -159,43 +146,11 @@ pub mod pallet {
159146
EvmAddress::from_slice(hex_literal::hex!("1b02E051683b5cfaC5929C25E84adb26ECf87B38").as_slice())
160147
}
161148

162-
#[pallet::type_value]
163-
pub fn DefaultSigners() -> BoundedVec<EvmAddress, ConstU32<MAX_ADDRESSES>> {
164-
let vec = vec![
165-
EvmAddress::from_slice(hex_literal::hex!("33a5e905fB83FcFB62B0Dd1595DfBc06792E054e").as_slice()),
166-
EvmAddress::from_slice(hex_literal::hex!("ff0c624016c873d359dde711b42a2f475a5a07d3").as_slice()),
167-
];
168-
169-
BoundedVec::truncate_from(vec)
170-
}
171-
172-
#[pallet::type_value]
173-
pub fn DefaultCallAddresses() -> BoundedVec<EvmAddress, ConstU32<MAX_ADDRESSES>> {
174-
let vec = vec![
175-
EvmAddress::from_slice(hex_literal::hex!("dee629af973ebf5bf261ace12ffd1900ac715f5e").as_slice()),
176-
EvmAddress::from_slice(hex_literal::hex!("48ae7803cd09c48434e3fc5629f15fb76f0b5ce5").as_slice()),
177-
];
178-
179-
BoundedVec::truncate_from(vec)
180-
}
181-
182149
/// Borrowing market contract address
183150
#[pallet::storage]
184151
#[pallet::getter(fn borrowing_contract)]
185152
pub type BorrowingContract<T: Config> = StorageValue<_, EvmAddress, ValueQuery, DefaultBorrowingContract>;
186153

187-
/// Whitelisted signers of DIA oracle updates.
188-
#[pallet::storage]
189-
#[pallet::getter(fn oracle_signers)]
190-
pub type OracleSigners<T: Config> =
191-
StorageValue<_, BoundedVec<EvmAddress, ConstU32<MAX_ADDRESSES>>, ValueQuery, DefaultSigners>;
192-
193-
/// Whitelisted call addresses of DIA oracle updates.
194-
#[pallet::storage]
195-
#[pallet::getter(fn oracle_call_addresses)]
196-
pub type OracleCallAddresses<T: Config> =
197-
StorageValue<_, BoundedVec<EvmAddress, ConstU32<MAX_ADDRESSES>>, ValueQuery, DefaultCallAddresses>;
198-
199154
#[pallet::validate_unsigned]
200155
impl<T: Config> ValidateUnsigned for Pallet<T>
201156
where
@@ -352,36 +307,6 @@ pub mod pallet {
352307

353308
Ok(())
354309
}
355-
356-
/// Set expected signers of DIA oracle updates.
357-
/// Used in the liquidation worker.
358-
#[pallet::call_index(2)]
359-
#[pallet::weight(<T as Config>::WeightInfo::set_oracle_signers())]
360-
pub fn set_oracle_signers(
361-
origin: OriginFor<T>,
362-
signers: BoundedVec<EvmAddress, ConstU32<MAX_ADDRESSES>>,
363-
) -> DispatchResult {
364-
T::AuthorityOrigin::ensure_origin(origin)?;
365-
366-
OracleSigners::<T>::put(signers);
367-
368-
Ok(())
369-
}
370-
371-
/// Set expected call addresses of DIA oracle updates.
372-
/// Used in the liquidation worker.
373-
#[pallet::call_index(3)]
374-
#[pallet::weight(<T as Config>::WeightInfo::set_oracle_call_addresses())]
375-
pub fn set_oracle_call_addresses(
376-
origin: OriginFor<T>,
377-
call_addresses: BoundedVec<EvmAddress, ConstU32<MAX_ADDRESSES>>,
378-
) -> DispatchResult {
379-
T::AuthorityOrigin::ensure_origin(origin)?;
380-
381-
OracleCallAddresses::<T>::put(call_addresses);
382-
383-
Ok(())
384-
}
385310
}
386311
}
387312

pallets/liquidation/src/tests/liquidation.rs

Lines changed: 0 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -276,49 +276,3 @@ fn set_borrowing_contract_should_work() {
276276
assert_eq!(Liquidation::borrowing_contract(), EvmAddress::from_slice(&[1; 20]));
277277
});
278278
}
279-
280-
#[test]
281-
fn set_oracle_signers_should_work() {
282-
ExtBuilder::default().build().execute_with(|| {
283-
assert_eq!(
284-
Liquidation::oracle_signers(),
285-
BoundedVec::<EvmAddress, ConstU32<MAX_ADDRESSES>>::truncate_from(vec![
286-
EvmAddress::from_slice(hex_literal::hex!("33a5e905fB83FcFB62B0Dd1595DfBc06792E054e").as_slice()),
287-
EvmAddress::from_slice(hex_literal::hex!("ff0c624016c873d359dde711b42a2f475a5a07d3").as_slice())
288-
])
289-
);
290-
291-
assert_ok!(Liquidation::set_oracle_signers(
292-
RuntimeOrigin::root(),
293-
BoundedVec::truncate_from(vec![EvmAddress::from_slice(&[1; 20])])
294-
));
295-
296-
assert_eq!(
297-
Liquidation::oracle_signers(),
298-
BoundedVec::<EvmAddress, ConstU32<MAX_ADDRESSES>>::truncate_from(vec![EvmAddress::from_slice(&[1; 20])])
299-
);
300-
});
301-
}
302-
303-
#[test]
304-
fn set_oracle_call_addresses_should_work() {
305-
ExtBuilder::default().build().execute_with(|| {
306-
assert_eq!(
307-
Liquidation::oracle_call_addresses(),
308-
BoundedVec::<EvmAddress, ConstU32<MAX_ADDRESSES>>::truncate_from(vec![
309-
EvmAddress::from_slice(hex_literal::hex!("dee629af973ebf5bf261ace12ffd1900ac715f5e").as_slice()),
310-
EvmAddress::from_slice(hex_literal::hex!("48ae7803cd09c48434e3fc5629f15fb76f0b5ce5").as_slice())
311-
])
312-
);
313-
314-
assert_ok!(Liquidation::set_oracle_call_addresses(
315-
RuntimeOrigin::root(),
316-
BoundedVec::truncate_from(vec![EvmAddress::from_slice(&[1; 20])])
317-
));
318-
319-
assert_eq!(
320-
Liquidation::oracle_call_addresses(),
321-
BoundedVec::<EvmAddress, ConstU32<MAX_ADDRESSES>>::truncate_from(vec![EvmAddress::from_slice(&[1; 20])])
322-
);
323-
});
324-
}

pallets/liquidation/src/weights.rs

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ use core::marker::PhantomData;
1010
pub trait WeightInfo {
1111
fn liquidate() -> Weight;
1212
fn set_borrowing_contract() -> Weight;
13-
fn set_oracle_signers() -> Weight;
14-
fn set_oracle_call_addresses() -> Weight;
1513
}
1614
/// Weights for `pallet_liquidation` using the HydraDX node and recommended hardware.
1715
impl WeightInfo for () {
@@ -40,16 +38,4 @@ impl WeightInfo for () {
4038
Weight::from_parts(4_696_000, 0)
4139
.saturating_add(RocksDbWeight::get().writes(1_u64))
4240
}
43-
/// Storage: `Liquidation::OracleSigners` (r:0 w:1)
44-
/// Proof: `Liquidation::OracleSigners` (`max_values`: Some(1), `max_size`: Some(101), added: 596, mode: `MaxEncodedLen`)
45-
fn set_oracle_signers() -> Weight {
46-
Weight::from_parts(5_688_000, 0)
47-
.saturating_add(RocksDbWeight::get().writes(1_u64))
48-
}
49-
/// Storage: `Liquidation::OracleCallAddresses` (r:0 w:1)
50-
/// Proof: `Liquidation::OracleCallAddresses` (`max_values`: Some(1), `max_size`: Some(101), added: 596, mode: `MaxEncodedLen`)
51-
fn set_oracle_call_addresses() -> Weight {
52-
Weight::from_parts(5_725_000, 0)
53-
.saturating_add(RocksDbWeight::get().writes(1_u64))
54-
}
5541
}

runtime/hydradx/src/lib.rs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -994,15 +994,6 @@ impl_runtime_apis! {
994994
}
995995
}
996996

997-
impl pallet_liquidation::LiquidationWorkerApi<Block> for Runtime {
998-
fn oracle_signers() -> Vec<EvmAddress> {
999-
pallet_liquidation::Pallet::<Runtime>::oracle_signers().into_inner()
1000-
}
1001-
fn oracle_call_addresses() -> Vec<EvmAddress> {
1002-
pallet_liquidation::Pallet::<Runtime>::oracle_call_addresses().into_inner()
1003-
}
1004-
}
1005-
1006997
impl xcm_runtime_apis::fees::XcmPaymentApi<Block> for Runtime {
1007998
fn query_acceptable_payment_assets(xcm_version: polkadot_xcm::Version) -> Result<Vec<VersionedAssetId>, XcmPaymentApiError> {
1008999
if !matches!(xcm_version, 3 | 4) {

runtime/hydradx/src/weights/pallet_liquidation.rs

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -82,16 +82,4 @@ impl<T: frame_system::Config> pallet_liquidation::WeightInfo for HydraWeight<T>
8282
Weight::from_parts(4_696_000, 0)
8383
.saturating_add(T::DbWeight::get().writes(1_u64))
8484
}
85-
/// Storage: `Liquidation::OracleSigners` (r:0 w:1)
86-
/// Proof: `Liquidation::OracleSigners` (`max_values`: Some(1), `max_size`: Some(101), added: 596, mode: `MaxEncodedLen`)
87-
fn set_oracle_signers() -> Weight {
88-
Weight::from_parts(5_688_000, 0)
89-
.saturating_add(T::DbWeight::get().writes(1_u64))
90-
}
91-
/// Storage: `Liquidation::OracleCallAddresses` (r:0 w:1)
92-
/// Proof: `Liquidation::OracleCallAddresses` (`max_values`: Some(1), `max_size`: Some(101), added: 596, mode: `MaxEncodedLen`)
93-
fn set_oracle_call_addresses() -> Weight {
94-
Weight::from_parts(5_725_000, 0)
95-
.saturating_add(T::DbWeight::get().writes(1_u64))
96-
}
9785
}

0 commit comments

Comments
 (0)