Skip to content

Commit

Permalink
Merge branch 'main' into tokens/consistent-ed
Browse files Browse the repository at this point in the history
  • Loading branch information
wischli authored Oct 26, 2023
2 parents d0d9388 + 31fdef8 commit fe8b41d
Show file tree
Hide file tree
Showing 21 changed files with 1,395 additions and 558 deletions.
2 changes: 2 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,8 @@ fc-mapping-sync = { git = "https://github.com/PureStake/frontier", default-featu
fc-rpc = { git = "https://github.com/PureStake/frontier", default-features = false, branch = "moonbeam-polkadot-v0.9.38" }
fc-rpc-core = { git = "https://github.com/PureStake/frontier", default-features = false, branch = "moonbeam-polkadot-v0.9.38" }
fp-consensus = { git = "https://github.com/PureStake/frontier", default-features = false, branch = "moonbeam-polkadot-v0.9.38" }
fp-rpc = { git = "https://github.com/PureStake/frontier", default-features = false, branch = "moonbeam-polkadot-v0.9.38" }
fp-evm = { git = "https://github.com/PureStake/frontier", default-features = false, branch = "moonbeam-polkadot-v0.9.38" }
fp-rpc = { git = "https://github.com/PureStake/frontier", default-features = false, branch = "moonbeam-polkadot-v0.9.38" }
fp-storage = { git = "https://github.com/PureStake/frontier", default-features = false, branch = "moonbeam-polkadot-v0.9.38" }
pallet-evm = { git = "https://github.com/PureStake/frontier", default-features = false, branch = "moonbeam-polkadot-v0.9.38" }

Expand Down
9 changes: 5 additions & 4 deletions pallets/liquidity-pools/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ pub mod pallet {
BalanceRatio = Self::BalanceRatio,
PoolId = Self::PoolId,
TrancheId = Self::TrancheId,
Moment = Seconds,
>;

/// The source of truth for investment permissions.
Expand Down Expand Up @@ -452,9 +453,8 @@ pub mod pallet {
// TODO(future): Once we diverge from 1-to-1 conversions for foreign and pool
// currencies, this price must be first converted into the currency_id and then
// re-denominated to 18 decimals (i.e. `Ratio` precision)
let price = T::TrancheTokenPrice::get(pool_id, tranche_id)
.ok_or(Error::<T>::MissingTranchePrice)?
.price;
let price_value = T::TrancheTokenPrice::get(pool_id, tranche_id)
.ok_or(Error::<T>::MissingTranchePrice)?;

// Check that the registered asset location matches the destination
match Self::try_get_wrapped_token(&currency_id)? {
Expand All @@ -474,7 +474,8 @@ pub mod pallet {
pool_id,
tranche_id,
currency,
price,
price: price_value.price,
computed_at: price_value.last_updated,
},
)?;

Expand Down
8 changes: 7 additions & 1 deletion pallets/liquidity-pools/src/message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ where
tranche_id: TrancheId,
currency: u128,
price: Ratio,
/// The timestamp at which the price was computed
computed_at: Seconds,
},
/// Whitelist an address for the specified pair of pool and tranche token on
/// the target domain.
Expand Down Expand Up @@ -449,13 +451,15 @@ impl<
tranche_id,
currency,
price,
computed_at,
} => encoded_message(
self.call_type(),
vec![
encode_be(pool_id),
tranche_id.encode(),
encode_be(currency),
encode_be(price),
computed_at.to_be_bytes().to_vec(),
],
),
Message::UpdateMember {
Expand Down Expand Up @@ -751,6 +755,7 @@ impl<
tranche_id: decode::<16, _, _>(input)?,
currency: decode_be_bytes::<16, _, _>(input)?,
price: decode_be_bytes::<16, _, _>(input)?,
computed_at: decode_be_bytes::<8, _, _>(input)?,
}),
6 => Ok(Self::UpdateMember {
pool_id: decode_be_bytes::<8, _, _>(input)?,
Expand Down Expand Up @@ -1025,8 +1030,9 @@ mod tests {
tranche_id: default_tranche_id(),
currency: TOKEN_ID,
price: Ratio::one(),
computed_at: 1698131924,
},
"050000000000000001811acd5b3f17c06841c7e41e9e04cb1b0000000000000000000000000eb5ec7b00000000000000000de0b6b3a7640000",
"050000000000000001811acd5b3f17c06841c7e41e9e04cb1b0000000000000000000000000eb5ec7b00000000000000000de0b6b3a76400000000000065376fd4",
)
}

Expand Down
4 changes: 2 additions & 2 deletions runtime/centrifuge/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
spec_name: create_runtime_str!("centrifuge"),
impl_name: create_runtime_str!("centrifuge"),
authoring_version: 1,
spec_version: 1023,
spec_version: 1024,
impl_version: 1,
#[cfg(not(feature = "disable-runtime-api"))]
apis: RUNTIME_API_VERSIONS,
Expand Down Expand Up @@ -1946,7 +1946,7 @@ pub type Executive = frame_executive::Executive<
frame_system::ChainContext<Runtime>,
Runtime,
AllPalletsWithSystem,
migrations::UpgradeCentrifuge1022,
migrations::UpgradeCentrifuge1024,
>;

pub struct TransactionConverter;
Expand Down
Loading

0 comments on commit fe8b41d

Please sign in to comment.