Skip to content

Commit

Permalink
Implement new rpc function of spacewalks oracle pallet for all runtim…
Browse files Browse the repository at this point in the history
…es (#311)

* added new rpc getExchangeRate to foucoco, amplitude

* added missing clients info from main
  • Loading branch information
gianfra-t authored Oct 16, 2023
1 parent d9a453a commit 08b2eef
Show file tree
Hide file tree
Showing 8 changed files with 84 additions and 70 deletions.
51 changes: 27 additions & 24 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 = "31df1832483199b978ae07f6ed4e018a11ff4dba"}
module-oracle-rpc = { git = "https://github.com/pendulum-chain/spacewalk", rev = "31df1832483199b978ae07f6ed4e018a11ff4dba"}
module-redeem-rpc = { git = "https://github.com/pendulum-chain/spacewalk", rev = "31df1832483199b978ae07f6ed4e018a11ff4dba"}
module-replace-rpc = { git = "https://github.com/pendulum-chain/spacewalk", rev = "31df1832483199b978ae07f6ed4e018a11ff4dba"}
module-vault-registry-rpc = { git = "https://github.com/pendulum-chain/spacewalk", rev = "31df1832483199b978ae07f6ed4e018a11ff4dba"}
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 = "31df1832483199b978ae07f6ed4e018a11ff4dba"}
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
38 changes: 19 additions & 19 deletions runtime/amplitude/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,25 +26,25 @@ smallvec = "1.9.0"
runtime-common = { path = "../common", default-features = false }

# Custom libraries for Spacewalk
clients-info = { git = "https://github.com/pendulum-chain/spacewalk", default-features = false, rev = "31df1832483199b978ae07f6ed4e018a11ff4dba" }
currency = { git = "https://github.com/pendulum-chain/spacewalk", default-features = false, rev = "31df1832483199b978ae07f6ed4e018a11ff4dba" }
security = { git = "https://github.com/pendulum-chain/spacewalk", default-features = false, rev = "31df1832483199b978ae07f6ed4e018a11ff4dba" }
staking = { git = "https://github.com/pendulum-chain/spacewalk", default-features = false, rev = "31df1832483199b978ae07f6ed4e018a11ff4dba" }
oracle = { git = "https://github.com/pendulum-chain/spacewalk", default-features = false, rev = "31df1832483199b978ae07f6ed4e018a11ff4dba" }
stellar-relay = { git = "https://github.com/pendulum-chain/spacewalk", default-features = false, rev = "31df1832483199b978ae07f6ed4e018a11ff4dba" }
reward = { git = "https://github.com/pendulum-chain/spacewalk", default-features = false, rev = "31df1832483199b978ae07f6ed4e018a11ff4dba" }
fee = { git = "https://github.com/pendulum-chain/spacewalk", default-features = false, rev = "31df1832483199b978ae07f6ed4e018a11ff4dba" }
vault-registry = { git = "https://github.com/pendulum-chain/spacewalk", default-features = false, rev = "31df1832483199b978ae07f6ed4e018a11ff4dba" }
redeem = { git = "https://github.com/pendulum-chain/spacewalk", default-features = false, rev = "31df1832483199b978ae07f6ed4e018a11ff4dba" }
issue = { git = "https://github.com/pendulum-chain/spacewalk", default-features = false, rev = "31df1832483199b978ae07f6ed4e018a11ff4dba" }
nomination = { git = "https://github.com/pendulum-chain/spacewalk", default-features = false, rev = "31df1832483199b978ae07f6ed4e018a11ff4dba" }
replace = { git = "https://github.com/pendulum-chain/spacewalk", default-features = false, rev = "31df1832483199b978ae07f6ed4e018a11ff4dba" }
spacewalk-primitives = { git = "https://github.com/pendulum-chain/spacewalk", default-features = false, rev = "31df1832483199b978ae07f6ed4e018a11ff4dba" }
module-issue-rpc-runtime-api = { git = "https://github.com/pendulum-chain/spacewalk", default-features = false, rev = "31df1832483199b978ae07f6ed4e018a11ff4dba" }
module-oracle-rpc-runtime-api = { git = "https://github.com/pendulum-chain/spacewalk", default-features = false, rev = "31df1832483199b978ae07f6ed4e018a11ff4dba" }
module-redeem-rpc-runtime-api = { git = "https://github.com/pendulum-chain/spacewalk", default-features = false, rev = "31df1832483199b978ae07f6ed4e018a11ff4dba" }
module-replace-rpc-runtime-api = { git = "https://github.com/pendulum-chain/spacewalk", default-features = false, rev = "31df1832483199b978ae07f6ed4e018a11ff4dba" }
module-vault-registry-rpc-runtime-api = { git = "https://github.com/pendulum-chain/spacewalk", default-features = false, rev = "31df1832483199b978ae07f6ed4e018a11ff4dba" }
clients-info = { git = "https://github.com/pendulum-chain/spacewalk", default-features = false, rev = "6a3b14a33da0a97f391a5a7e689ee658da52da84"}
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 @@ -1771,6 +1771,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 = "31df1832483199b978ae07f6ed4e018a11ff4dba" }
spacewalk-primitives = { git = "https://github.com/pendulum-chain/spacewalk", default-features = false, rev = "6a3b14a33da0a97f391a5a7e689ee658da52da84" }

[features]
default = [
Expand Down
Loading

0 comments on commit 08b2eef

Please sign in to comment.