Skip to content
This repository has been archived by the owner on Oct 7, 2022. It is now read-only.

Add channelId argument to AssetTransferred event #595

Merged
merged 7 commits into from
Dec 3, 2019
Merged

Conversation

snario
Copy link
Contributor

@snario snario commented Nov 29, 2019

No description provided.

@snario snario requested review from geoknee and lalexgap November 29, 2019 18:23
@snario snario mentioned this pull request Nov 30, 2019
@snario snario force-pushed the liam-add-origin branch 2 times, most recently from 78485e3 to cc9da61 Compare November 30, 2019 19:10
@snario
Copy link
Contributor Author

snario commented Nov 30, 2019

Error in CI is related to #602

Copy link
Contributor

@geoknee geoknee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 This looks good! My only thoughts are nitpicking on terminology.

packages/wallet/src/redux/actions.ts Outdated Show resolved Hide resolved
assetHolderAddress: string,
origin: string,
// @ts-ignore
destination: string, // TODO: Should we take this into account?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's possible in future that destination is removed so that it is not even part of the data emitted in the event. We might decide that it is redundant information. It was introduced mainly to make testing easier, but we could get the data from somewhere else most likely. In the case of an ERC20, for example, the Token contract itself will emit a Transfer event when the Tokens are transferred.

Comment on lines 98 to 102
_transferAsset(_bytes32ToAddress(allocation[m].destination), payoutAmount);
emit AssetTransferred(allocation[m].destination, payoutAmount);
emit AssetTransferred(channelId, allocation[m].destination, payoutAmount);
} else {
holdings[allocation[m].destination] += payoutAmount;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My comments above are because the event is only emitted inside a _isExternalDestination block. Do you think we ought to also emit an event when the holdings are updated? This could be the same event or a new one (with some appropriate name(s)). As it is now, no events will be emitted during e.g. a transferAll on a ledger channel that only allocates to other channels. The holdings mapping is public, however: but clients won't have a "trigger" to remind them to inspect it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should make a decision on this at standup; it's not clear to me that it is important information for the wallet to keep track of.

@snario snario force-pushed the liam-add-origin branch 2 times, most recently from 84f1cd9 to 1325c09 Compare December 2, 2019 14:15
@snario snario changed the title Add origin argument to AssetTransferred event Add channelId argument to AssetTransferred event Dec 3, 2019
@@ -56,9 +56,12 @@ export interface DisplayMessageSent {

export interface AssetTransferredEvent {
type: "WALLET.ASSET_HOLDER.ASSET_TRANSFERRED";
assetHolderAddress: string;
channelId: string;

// This is either a `channelId` or an external destination (both bytes32).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// This is either a `channelId` or an external destination (both bytes32).
// This is either a `channelId` or an external destination (both bytes32):

@geoknee geoknee merged commit a2d239f into master Dec 3, 2019
@geoknee geoknee deleted the liam-add-origin branch December 3, 2019 09:13
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants