Skip to content

Commit

Permalink
added new rpc getExchangeRate to foucoco, amplitude
Browse files Browse the repository at this point in the history
  • Loading branch information
gianfra-t committed Oct 3, 2023
1 parent 7a89762 commit 0030f12
Show file tree
Hide file tree
Showing 8 changed files with 84 additions and 67 deletions.
52 changes: 29 additions & 23 deletions Cargo.lock

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

13 changes: 7 additions & 6 deletions node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,14 @@ codec = { package = "parity-scale-codec", version = "3.0.0" }
serde = { version = "1.0.145", features = ["derive"] }
jsonrpsee = { version = "0.16.2", features = ["server"] }

module-issue-rpc = { git = "https://github.com/pendulum-chain/spacewalk", rev = "eae146c3795debfdab7215fa82ff1ffc4c2cae48"}
module-oracle-rpc = { git = "https://github.com/pendulum-chain/spacewalk", rev = "eae146c3795debfdab7215fa82ff1ffc4c2cae48"}
module-redeem-rpc = { git = "https://github.com/pendulum-chain/spacewalk", rev = "eae146c3795debfdab7215fa82ff1ffc4c2cae48"}
module-replace-rpc = { git = "https://github.com/pendulum-chain/spacewalk", rev = "eae146c3795debfdab7215fa82ff1ffc4c2cae48"}
module-vault-registry-rpc = { git = "https://github.com/pendulum-chain/spacewalk", rev = "eae146c3795debfdab7215fa82ff1ffc4c2cae48"}
module-issue-rpc = { git = "https://github.com/pendulum-chain/spacewalk", rev = "6a3b14a33da0a97f391a5a7e689ee658da52da84"}
module-oracle-rpc = { git = "https://github.com/pendulum-chain/spacewalk", rev = "6a3b14a33da0a97f391a5a7e689ee658da52da84"}
module-redeem-rpc = { git = "https://github.com/pendulum-chain/spacewalk", rev = "6a3b14a33da0a97f391a5a7e689ee658da52da84"}
module-replace-rpc = { git = "https://github.com/pendulum-chain/spacewalk", rev = "6a3b14a33da0a97f391a5a7e689ee658da52da84"}
module-vault-registry-rpc = { git = "https://github.com/pendulum-chain/spacewalk", rev = "6a3b14a33da0a97f391a5a7e689ee658da52da84"}

spacewalk-primitives = { git = "https://github.com/pendulum-chain/spacewalk", rev = "eae146c3795debfdab7215fa82ff1ffc4c2cae48"}
spacewalk-primitives = { git = "https://github.com/pendulum-chain/spacewalk", rev = "6a3b14a33da0a97f391a5a7e689ee658da52da84"}
dia-oracle-runtime-api = { git = "https://github.com/pendulum-chain/oracle-pallet", default-features = false, branch = "polkadot-v0.9.40" }

# Local
amplitude-runtime = {path = "../runtime/amplitude"}
Expand Down
36 changes: 18 additions & 18 deletions runtime/amplitude/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,24 +26,24 @@ smallvec = "1.9.0"
runtime-common = { path = "../common", default-features = false }

# Custom libraries for Spacewalk
currency = { git = "https://github.com/pendulum-chain/spacewalk", default-features = false, rev = "eae146c3795debfdab7215fa82ff1ffc4c2cae48" }
security = { git = "https://github.com/pendulum-chain/spacewalk", default-features = false, rev = "eae146c3795debfdab7215fa82ff1ffc4c2cae48" }
staking = { git = "https://github.com/pendulum-chain/spacewalk", default-features = false, rev = "eae146c3795debfdab7215fa82ff1ffc4c2cae48" }
oracle = { git = "https://github.com/pendulum-chain/spacewalk", default-features = false, rev = "eae146c3795debfdab7215fa82ff1ffc4c2cae48" }
stellar-relay = { git = "https://github.com/pendulum-chain/spacewalk", default-features = false, rev = "eae146c3795debfdab7215fa82ff1ffc4c2cae48" }
reward = { git = "https://github.com/pendulum-chain/spacewalk", default-features = false, rev = "eae146c3795debfdab7215fa82ff1ffc4c2cae48" }
fee = { git = "https://github.com/pendulum-chain/spacewalk", default-features = false, rev = "eae146c3795debfdab7215fa82ff1ffc4c2cae48" }
vault-registry = { git = "https://github.com/pendulum-chain/spacewalk", default-features = false, rev = "eae146c3795debfdab7215fa82ff1ffc4c2cae48" }
redeem = { git = "https://github.com/pendulum-chain/spacewalk", default-features = false, rev = "eae146c3795debfdab7215fa82ff1ffc4c2cae48" }
issue = { git = "https://github.com/pendulum-chain/spacewalk", default-features = false, rev = "eae146c3795debfdab7215fa82ff1ffc4c2cae48" }
nomination = { git = "https://github.com/pendulum-chain/spacewalk", default-features = false, rev = "eae146c3795debfdab7215fa82ff1ffc4c2cae48" }
replace = { git = "https://github.com/pendulum-chain/spacewalk", default-features = false, rev = "eae146c3795debfdab7215fa82ff1ffc4c2cae48" }
spacewalk-primitives = { git = "https://github.com/pendulum-chain/spacewalk", default-features = false, rev = "eae146c3795debfdab7215fa82ff1ffc4c2cae48" }
module-issue-rpc-runtime-api = { git = "https://github.com/pendulum-chain/spacewalk", default-features = false, rev = "eae146c3795debfdab7215fa82ff1ffc4c2cae48" }
module-oracle-rpc-runtime-api = { git = "https://github.com/pendulum-chain/spacewalk", default-features = false, rev = "eae146c3795debfdab7215fa82ff1ffc4c2cae48" }
module-redeem-rpc-runtime-api = { git = "https://github.com/pendulum-chain/spacewalk", default-features = false, rev = "eae146c3795debfdab7215fa82ff1ffc4c2cae48" }
module-replace-rpc-runtime-api = { git = "https://github.com/pendulum-chain/spacewalk", default-features = false, rev = "eae146c3795debfdab7215fa82ff1ffc4c2cae48" }
module-vault-registry-rpc-runtime-api = { git = "https://github.com/pendulum-chain/spacewalk", default-features = false, rev = "eae146c3795debfdab7215fa82ff1ffc4c2cae48" }
currency = { git = "https://github.com/pendulum-chain/spacewalk", default-features = false, rev = "6a3b14a33da0a97f391a5a7e689ee658da52da84" }
security = { git = "https://github.com/pendulum-chain/spacewalk", default-features = false, rev = "6a3b14a33da0a97f391a5a7e689ee658da52da84" }
staking = { git = "https://github.com/pendulum-chain/spacewalk", default-features = false, rev = "6a3b14a33da0a97f391a5a7e689ee658da52da84" }
oracle = { git = "https://github.com/pendulum-chain/spacewalk", default-features = false, rev = "6a3b14a33da0a97f391a5a7e689ee658da52da84" }
stellar-relay = { git = "https://github.com/pendulum-chain/spacewalk", default-features = false, rev = "6a3b14a33da0a97f391a5a7e689ee658da52da84" }
reward = { git = "https://github.com/pendulum-chain/spacewalk", default-features = false, rev = "6a3b14a33da0a97f391a5a7e689ee658da52da84" }
fee = { git = "https://github.com/pendulum-chain/spacewalk", default-features = false, rev = "6a3b14a33da0a97f391a5a7e689ee658da52da84" }
vault-registry = { git = "https://github.com/pendulum-chain/spacewalk", default-features = false, rev = "6a3b14a33da0a97f391a5a7e689ee658da52da84" }
redeem = { git = "https://github.com/pendulum-chain/spacewalk", default-features = false, rev = "6a3b14a33da0a97f391a5a7e689ee658da52da84" }
issue = { git = "https://github.com/pendulum-chain/spacewalk", default-features = false, rev = "6a3b14a33da0a97f391a5a7e689ee658da52da84" }
nomination = { git = "https://github.com/pendulum-chain/spacewalk", default-features = false, rev = "6a3b14a33da0a97f391a5a7e689ee658da52da84" }
replace = { git = "https://github.com/pendulum-chain/spacewalk", default-features = false, rev = "6a3b14a33da0a97f391a5a7e689ee658da52da84" }
spacewalk-primitives = { git = "https://github.com/pendulum-chain/spacewalk", default-features = false, rev = "6a3b14a33da0a97f391a5a7e689ee658da52da84" }
module-issue-rpc-runtime-api = { git = "https://github.com/pendulum-chain/spacewalk", default-features = false, rev = "6a3b14a33da0a97f391a5a7e689ee658da52da84" }
module-oracle-rpc-runtime-api = { git = "https://github.com/pendulum-chain/spacewalk", default-features = false, rev = "6a3b14a33da0a97f391a5a7e689ee658da52da84" }
module-redeem-rpc-runtime-api = { git = "https://github.com/pendulum-chain/spacewalk", default-features = false, rev = "6a3b14a33da0a97f391a5a7e689ee658da52da84" }
module-replace-rpc-runtime-api = { git = "https://github.com/pendulum-chain/spacewalk", default-features = false, rev = "6a3b14a33da0a97f391a5a7e689ee658da52da84" }
module-vault-registry-rpc-runtime-api = { git = "https://github.com/pendulum-chain/spacewalk", default-features = false, rev = "6a3b14a33da0a97f391a5a7e689ee658da52da84" }

# Substrate
frame-benchmarking = { git = "https://github.com/paritytech/substrate", default-features = false, optional = true, branch = "polkadot-v0.9.40" }
Expand Down
5 changes: 5 additions & 0 deletions runtime/amplitude/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1762,6 +1762,11 @@ impl_runtime_apis! {
let result = Oracle::usd_to_currency(amount.amount, currency_id)?;
Ok(BalanceWrapper{amount:result})
}

fn get_exchange_rate(currency_id: CurrencyId) -> Result<UnsignedFixedPoint, DispatchError> {
let result = Oracle::get_exchange_rate(currency_id)?;
Ok(result)
}
}

}
Expand Down
2 changes: 1 addition & 1 deletion runtime/common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ orml-asset-registry = { git = "https://github.com/open-web3-stack/open-runtime-m
dia-oracle = { git = "https://github.com/pendulum-chain/oracle-pallet", default-features = false, branch = "polkadot-v0.9.40" }
zenlink-protocol = { git = "https://github.com/pendulum-chain/Zenlink-DEX-Module", default-features = false, branch = "polkadot-v0.9.40-protocol" }

spacewalk-primitives = { git = "https://github.com/pendulum-chain/spacewalk", default-features = false, rev = "eae146c3795debfdab7215fa82ff1ffc4c2cae48" }
spacewalk-primitives = { git = "https://github.com/pendulum-chain/spacewalk", default-features = false, rev = "6a3b14a33da0a97f391a5a7e689ee658da52da84" }

[features]
default = [
Expand Down
Loading

0 comments on commit 0030f12

Please sign in to comment.