Skip to content

Commit 462977d

Browse files
authored
Fix/rpc vesting (#96)
* fix: update get vesting rpc method * wip * wip * wip * fix: resolve issue with imports * add package for runtime api * small refactoring - remove VestingInfo * remove rpc vesting method * remove unnecessary serde serialization * fix lock file
1 parent 5002c08 commit 462977d

File tree

10 files changed

+5861
-6124
lines changed

10 files changed

+5861
-6124
lines changed

Cargo.lock

+5,858-5,858
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

frame/vesting-mangata/Cargo.toml

+2
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ readme = "README.md"
1313
targets = ["x86_64-unknown-linux-gnu"]
1414

1515
[dependencies]
16+
serde = { version = "1.0.136", features = ["derive"], optional = true }
1617
codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = [
1718
"derive",
1819
] }
@@ -33,6 +34,7 @@ orml-tokens = { git = "https://github.com/mangata-finance//open-runtime-module-l
3334
[features]
3435
default = ["std"]
3536
std = [
37+
"serde",
3638
"codec/std",
3739
"scale-info/std",
3840
"sp-std/std",

frame/vesting-mangata/rpc/Cargo.toml

-36
This file was deleted.

frame/vesting-mangata/rpc/README.md

-3
This file was deleted.

frame/vesting-mangata/rpc/runtime-api/Cargo.toml

-32
This file was deleted.

frame/vesting-mangata/rpc/runtime-api/README.md

-3
This file was deleted.

frame/vesting-mangata/rpc/runtime-api/src/lib.rs

-74
This file was deleted.

frame/vesting-mangata/rpc/src/lib.rs

-98
This file was deleted.

frame/vesting-mangata/src/lib.rs

-19
Original file line numberDiff line numberDiff line change
@@ -435,25 +435,6 @@ pub mod pallet {
435435
}
436436

437437
impl<T: Config> Pallet<T> {
438-
pub fn get_vesting_locked_at(
439-
who: &T::AccountId,
440-
token_id: TokenIdOf<T>,
441-
at_block_number: Option<T::BlockNumber>,
442-
) -> Result<Vec<(VestingInfo<BalanceOf<T>, T::BlockNumber>, BalanceOf<T>)>, DispatchError> {
443-
let at_block_number = at_block_number.unwrap_or(<frame_system::Pallet<T>>::block_number());
444-
Ok(Self::vesting(&who, token_id)
445-
.ok_or(Error::<T>::NotVesting)?
446-
.to_vec()
447-
.into_iter()
448-
.map(|x| {
449-
(
450-
x.into(),
451-
BalanceOf::<T>::from(x.locked_at::<T::BlockNumberToBalance>(at_block_number)),
452-
)
453-
})
454-
.collect::<Vec<(VestingInfo<BalanceOf<T>, T::BlockNumber>, BalanceOf<T>)>>())
455-
}
456-
457438
// Create a new `VestingInfo`, based off of two other `VestingInfo`s.
458439
// NOTE: We assume both schedules have had funds unlocked up through the current block.
459440
fn merge_vesting_info(

frame/vesting-mangata/src/vesting_info.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
use super::*;
2121

2222
/// Struct to encode the vesting schedule of an individual account.
23-
#[derive(Encode, Decode, Copy, Clone, PartialEq, Eq, RuntimeDebug, MaxEncodedLen, TypeInfo)]
23+
#[derive(Encode, Decode, Copy, Clone, PartialEq, Eq, MaxEncodedLen, RuntimeDebug, TypeInfo)]
2424
pub struct VestingInfo<Balance, BlockNumber> {
2525
/// Locked amount at genesis.
2626
locked: Balance,

0 commit comments

Comments
 (0)