Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change the event we emit when selecting issuers #1706

Merged
merged 3 commits into from
Nov 14, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions packages/protocol/contracts/identity/Attestations.sol
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,10 @@ contract Attestations is
address attestationRequestFeeToken
);

event AttestationIssuersSelected(
event AttestationIssuerSelected(
bytes32 indexed identifier,
address indexed account,
uint256 attestationsRequested,
address indexed issuer,
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: change event name to the singular, i.e. AttestationIssuerSelected

address attestationRequestFeeToken
);

Expand Down Expand Up @@ -204,13 +204,6 @@ contract Attestations is
);

addIncompleteAttestations(identifier);
emit AttestationIssuersSelected(
identifier,
msg.sender,
state.unselectedRequests[msg.sender].attestationsRequested,
state.unselectedRequests[msg.sender].attestationRequestFeeToken
);

delete state.unselectedRequests[msg.sender];
}

Expand Down Expand Up @@ -590,6 +583,13 @@ contract Attestations is
attestation.blockNumber = unselectedRequest.blockNumber;
attestation.attestationRequestFeeToken = unselectedRequest.attestationRequestFeeToken;
state.selectedIssuers.push(issuer);

emit AttestationIssuerSelected(
identifier,
msg.sender,
issuer,
unselectedRequest.attestationRequestFeeToken
);
}
}

Expand Down
26 changes: 14 additions & 12 deletions packages/protocol/test/identity/attestations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -459,19 +459,21 @@ contract('Attestations', (accounts: string[]) => {
assertEqualBN(actualAttestationsRequested, 0)
})

it('should emit the AttestationIssuersSelected event', async () => {
it('should emit the AttestationIssuerSelected event', async () => {
const response = await attestations.selectIssuers(phoneHash)

assert.lengthOf(response.logs, 1)
const event = response.logs[0]
assertLogMatches2(event, {
event: 'AttestationIssuersSelected',
args: {
identifier: phoneHash,
account: caller,
attestationsRequested: new BigNumber(attestationsRequested),
attestationRequestFeeToken: mockStableToken.address,
},
const issuers = await attestations.getAttestationIssuers(phoneHash, caller)
assert.lengthOf(response.logs, 3)

issuers.forEach((issuer, index) => {
assertLogMatches2(response.logs[index], {
event: 'AttestationIssuerSelected',
args: {
identifier: phoneHash,
account: caller,
issuer,
attestationRequestFeeToken: mockStableToken.address,
},
})
})
})

Expand Down