Update event variants (#4262)

* update event variants

* fmt

* fixes

* update substrate

Co-authored-by: thiolliere <gui.thiolliere@gmail.com>
This commit is contained in:
David Salami
2021-11-16 03:53:48 +01:00
committed by GitHub
parent 59e90a77f0
commit 0ca459d2f2
3 changed files with 203 additions and 190 deletions
+163 -163
View File
File diff suppressed because it is too large Load Diff
@@ -149,7 +149,7 @@ where
events events
.iter() .iter()
.filter_map(|event| match event.event { .filter_map(|event| match event.event {
Event::Democracy(democracy::Event::PreimageNoted(ref proposal_hash, _, _)) => Event::Democracy(democracy::Event::PreimageNoted { ref proposal_hash, .. }) =>
Some(proposal_hash.clone()), Some(proposal_hash.clone()),
_ => None, _ => None,
}) })
@@ -181,8 +181,12 @@ where
let (index, hash): (u32, H256) = events let (index, hash): (u32, H256) = events
.iter() .iter()
.filter_map(|event| match event.event { .filter_map(|event| match event.event {
Event::Council(CouncilCollectiveEvent::Proposed(_, index, ref hash, _)) => Event::Council(CouncilCollectiveEvent::Proposed {
Some((index, hash.clone())), account: _,
proposal_index,
ref proposal_hash,
threshold: _,
}) => Some((proposal_index, proposal_hash.clone())),
_ => None, _ => None,
}) })
.next() .next()
@@ -212,12 +216,16 @@ where
.events() .events()
.into_iter() .into_iter()
.filter(|event| match event.event { .filter(|event| match event.event {
Event::Council(CouncilCollectiveEvent::Closed(_hash, _, _)) if hash == _hash => Event::Council(CouncilCollectiveEvent::Closed { proposal_hash, yes: _, no: _ })
if hash == proposal_hash =>
true, true,
Event::Council(CouncilCollectiveEvent::Approved(_hash)) if hash == _hash => true, Event::Council(CouncilCollectiveEvent::Approved { proposal_hash })
Event::Council(CouncilCollectiveEvent::Executed(_hash, Ok(()))) if hash == proposal_hash =>
if hash == _hash =>
true, true,
Event::Council(CouncilCollectiveEvent::Executed {
proposal_hash,
result: Ok(()),
}) if hash == proposal_hash => true,
_ => false, _ => false,
}) })
.collect::<Vec<_>>(); .collect::<Vec<_>>();
@@ -253,12 +261,12 @@ where
let (index, hash) = events let (index, hash) = events
.iter() .iter()
.filter_map(|event| match event.event { .filter_map(|event| match event.event {
Event::TechnicalCommittee(TechnicalCollectiveEvent::Proposed( Event::TechnicalCommittee(TechnicalCollectiveEvent::Proposed {
_, account: _,
index, proposal_index,
ref hash, ref proposal_hash,
_, threshold: _,
)) => Some((index, hash.clone())), }) => Some((proposal_index, proposal_hash.clone())),
_ => None, _ => None,
}) })
.next() .next()
@@ -289,15 +297,17 @@ where
.events() .events()
.into_iter() .into_iter()
.filter(|event| match event.event { .filter(|event| match event.event {
Event::TechnicalCommittee(TechnicalCollectiveEvent::Closed(_hash, _, _)) Event::TechnicalCommittee(TechnicalCollectiveEvent::Closed {
if hash == _hash => proposal_hash: _hash,
true, ..
Event::TechnicalCommittee(TechnicalCollectiveEvent::Approved(_hash)) }) if hash == _hash => true,
if hash == _hash => Event::TechnicalCommittee(TechnicalCollectiveEvent::Approved {
true, proposal_hash: _hash,
Event::TechnicalCommittee(TechnicalCollectiveEvent::Executed(_hash, Ok(()))) }) if hash == _hash => true,
if hash == _hash => Event::TechnicalCommittee(TechnicalCollectiveEvent::Executed {
true, proposal_hash: _hash,
result: Ok(()),
}) if hash == _hash => true,
_ => false, _ => false,
}) })
.collect::<Vec<_>>(); .collect::<Vec<_>>();
@@ -316,7 +326,7 @@ where
.events() .events()
.into_iter() .into_iter()
.filter_map(|event| match event.event { .filter_map(|event| match event.event {
Event::Democracy(democracy::Event::Started(index, _)) => Some(index), Event::Democracy(democracy::Event::Started { ref_index: index, .. }) => Some(index),
_ => None, _ => None,
}) })
.next() .next()
@@ -344,11 +354,14 @@ where
.events() .events()
.into_iter() .into_iter()
.filter(|event| match event.event { .filter(|event| match event.event {
Event::Democracy(democracy::Event::Passed(_index)) if _index == ref_index => true, Event::Democracy(democracy::Event::Passed { ref_index: _index })
Event::Democracy(democracy::Event::PreimageUsed(_hash, _, _)) if _index == ref_index =>
true,
Event::Democracy(democracy::Event::PreimageUsed { proposal_hash: _hash, .. })
if _hash == proposal_hash => if _hash == proposal_hash =>
true, true,
Event::Democracy(democracy::Event::Executed(_index, Ok(()))) if _index == ref_index => Event::Democracy(democracy::Event::Executed { ref_index: _index, result: Ok(()) })
if _index == ref_index =>
true, true,
_ => false, _ => false,
}) })
@@ -85,7 +85,7 @@ fn main() -> Result<(), Box<dyn Error>> {
.events() .events()
.into_iter() .into_iter()
.filter(|event| match event.event { .filter(|event| match event.event {
Event::Balances(balances::Event::Transfer(_, _, _)) => true, Event::Balances(balances::Event::Transfer { .. }) => true,
_ => false, _ => false,
}) })
.collect::<Vec<_>>(); .collect::<Vec<_>>();