Skip to content

Commit

Permalink
Change the event we emit when selecting issuers (#1706)
Browse files Browse the repository at this point in the history
  • Loading branch information
nambrot authored and celo-ci-bot-user committed Nov 14, 2019
1 parent 7feadc0 commit f29e6d9
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 21 deletions.
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,
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

0 comments on commit f29e6d9

Please sign in to comment.