Skip to content

Commit

Permalink
Merge branch 'main' into feat/connectors-v2-message-poc
Browse files Browse the repository at this point in the history
  • Loading branch information
NunoAlexandre committed Apr 3, 2023
2 parents 3ba9230 + 79f2b05 commit 06ef965
Show file tree
Hide file tree
Showing 21 changed files with 352 additions and 523 deletions.
41 changes: 2 additions & 39 deletions Cargo.lock

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

1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ members = [
"pallets/investments",
"pallets/keystore",
"pallets/liquidity-rewards",
"pallets/loans",
"pallets/loans-ref",
"pallets/migration",
"pallets/nft",
Expand Down
2 changes: 1 addition & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@
};

# This is a hash of all the Cargo dependencies, for reproducibility.
cargoSha256 = "sha256-cfGNrb4391DiYSSFr0pB+UxaahZsFopwj5dMxs/1kJM=";
cargoSha256 = "sha256-BBuNvCWqMQDNDeDNCr/C4CvJay/2sPGAZQefaKg0EFg=";

nativeBuildInputs = with pkgs; [ clang git-mock pkg-config ];
buildInputs = with pkgs; [ openssl ] ++ (
Expand Down
25 changes: 8 additions & 17 deletions libs/traits/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ pub trait InterestAccrual<InterestRate, Balance, Adjustment> {

/// Calculate the current debt using normalized debt * cumulative rate
fn current_debt(
interest_rate_per_sec: InterestRate,
interest_rate_per_year: InterestRate,
normalized_debt: Self::NormalizedDebt,
) -> Result<Balance, DispatchError>;

Expand All @@ -244,14 +244,14 @@ pub trait InterestAccrual<InterestRate, Balance, Adjustment> {
/// (effectively "rewinding the clock" to before the value was
/// valid)
fn previous_debt(
interest_rate_per_sec: InterestRate,
interest_rate_per_year: InterestRate,
normalized_debt: Self::NormalizedDebt,
when: Moment,
) -> Result<Balance, DispatchError>;

/// Increase or decrease the normalized debt
fn adjust_normalized_debt(
interest_rate_per_sec: InterestRate,
interest_rate_per_year: InterestRate,
normalized_debt: Self::NormalizedDebt,
adjustment: Adjustment,
) -> Result<Self::NormalizedDebt, DispatchError>;
Expand All @@ -263,23 +263,14 @@ pub trait InterestAccrual<InterestRate, Balance, Adjustment> {
normalized_debt: Self::NormalizedDebt,
) -> Result<Self::NormalizedDebt, DispatchError>;

/// Indicate that a yearly rate is in use
///
/// Validates that the rate is allowed, and converts it to a per-second rate for future operations
fn reference_yearly_rate(
interest_rate_per_year: InterestRate,
) -> Result<InterestRate, DispatchError>;

/// Indicate that a rate is in use
fn reference_rate(interest_rate_per_sec: InterestRate) -> DispatchResult;
/// Validate and indicate that a yearly rate is in use
fn reference_rate(interest_rate_per_year: InterestRate) -> DispatchResult;

/// Indicate that a rate is no longer in use
fn unreference_rate(interest_rate_per_sec: InterestRate) -> DispatchResult;
fn unreference_rate(interest_rate_per_year: InterestRate) -> DispatchResult;

/// Verifies a yearly additive rate and converts it to a per-second additive rate
fn convert_additive_rate_to_per_sec(
interset_rate_per_year: InterestRate,
) -> Result<InterestRate, DispatchError>;
/// Ask if the rate is valid to use by the implementation
fn validate_rate(interest_rate_per_year: InterestRate) -> DispatchResult;

/// Returns a collection of pre-computed rates to perform multiple operations with
fn rates() -> Self::Rates;
Expand Down
10 changes: 0 additions & 10 deletions pallets/connectors/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,6 @@ xcm-primitives = { git = "https://github.com/PureStake/moonbeam", default-featur
hex = "0.4.3"
serde = { version = "1.0.102" }

# Our pallets
pallet-interest-accrual = { path = "../interest-accrual", default-features = true }
pallet-loans = { path = "../loans", default-features = true }
pallet-permissions = { path = "../permissions", default-features = true }
pallet-pool-system = { path = "../pool-system", default-features = true }

# Substrate crates & pallets
pallet-balances = { git = "https://github.com/paritytech/substrate", default-features = true, branch = "polkadot-v0.9.32" }
pallet-timestamp = { git = "https://github.com/paritytech/substrate", default-features = true, branch = "polkadot-v0.9.32" }
Expand Down Expand Up @@ -103,10 +97,6 @@ std = [
"pallet-ethereum/std",
"xcm-primitives/std",
"ethabi/std",
"pallet-interest-accrual/std",
"pallet-permissions/std",
"pallet-loans/std",
"pallet-pool-system/std",
"pallet-uniques/std",
"cfg-primitives/std",
"frame-benchmarking/std",
Expand Down

0 comments on commit 06ef965

Please sign in to comment.