Skip to content

Commit

Permalink
feat: add account id / withdrawal address to affiliate events (#5634)
Browse files Browse the repository at this point in the history
* feat: Added broker_id to WithdrawalRequest event

* chore: changed broker_id to account_id

I think this is a better name since it could be either a broker or an affiliate but in the end both is an account.

* feat: Added withdrawal address to AffiliateRegistration
  • Loading branch information
Janislav authored Feb 13, 2025
1 parent a5ff468 commit 1627902
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
4 changes: 4 additions & 0 deletions state-chain/pallets/cf-swapping/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -648,6 +648,7 @@ pub mod pallet {
},
/// A broker fee withdrawal has been requested.
WithdrawalRequested {
account_id: T::AccountId,
egress_id: EgressId,
egress_asset: Asset,
egress_amount: AssetAmount,
Expand Down Expand Up @@ -711,6 +712,7 @@ pub mod pallet {
AffiliateRegistration {
broker_id: T::AccountId,
short_id: AffiliateShortId,
withdrawal_address: EthereumAddress,
affiliate_id: T::AccountId,
},
BrokerBondSet {
Expand Down Expand Up @@ -1272,6 +1274,7 @@ pub mod pallet {
Self::deposit_event(Event::<T>::AffiliateRegistration {
broker_id,
short_id,
withdrawal_address,
affiliate_id,
});

Expand Down Expand Up @@ -1405,6 +1408,7 @@ pub mod pallet {
.map_err(Into::into)?;

Self::deposit_event(Event::<T>::WithdrawalRequested {
account_id: account_id.clone(),
egress_amount,
egress_asset: asset,
egress_fee: fee_withheld,
Expand Down
1 change: 1 addition & 0 deletions state-chain/pallets/cf-swapping/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1773,6 +1773,7 @@ mod affiliates {
Event::<Test>::AffiliateRegistration {
broker_id: BROKER,
short_id: SHORT_ID,
withdrawal_address,
affiliate_id: affiliate_account_id,
},
));
Expand Down
1 change: 1 addition & 0 deletions state-chain/pallets/cf-swapping/src/tests/fees.rs
Original file line number Diff line number Diff line change
Expand Up @@ -418,6 +418,7 @@ fn withdraw_broker_fees() {
assert!(egresses.len() == 1);
assert_eq!(egresses.pop().expect("must exist").amount(), 200);
System::assert_last_event(RuntimeEvent::Swapping(Event::<Test>::WithdrawalRequested {
account_id: BROKER,
egress_id: (ForeignChain::Ethereum, 1),
egress_asset: Asset::Eth,
egress_amount: 200,
Expand Down

0 comments on commit 1627902

Please sign in to comment.