Skip to content

Commit

Permalink
For now, keeping track of the number of actions processed by each val…
Browse files Browse the repository at this point in the history
…idator
  • Loading branch information
Master Sprouts committed Oct 8, 2022
1 parent 1cdf272 commit 8c75006
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion contracts/CawActions.sol
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ contract CawActions is Context {

bytes32 public eip712DomainHash;

mapping(uint64 => uint64) public processedActions;

// tokenID => reducedSig => action
mapping(uint64 => mapping(bytes32 => uint32)) public likes;

Expand Down Expand Up @@ -159,17 +161,20 @@ contract CawActions is Context {
);
}

function processActions(MultiActionData calldata data) external {
function processActions(uint64 senderTokenId, MultiActionData calldata data) external {
uint8[] calldata v = data.v;
bytes32[] calldata r = data.r;
bytes32[] calldata s = data.s;
uint16 processed;
for (uint16 i=0; i < data.actions.length; i++) {
try CawActions(this).processAction(data.actions[i], v[i], r[i], s[i]) {
emit ActionProcessed(data.actions[i].senderTokenId, r[i]);
processed += 1;
} catch Error(string memory _err) {
emit ActionRejected(data.actions[i].senderTokenId, r[i], _err);
}
}
processedActions[senderTokenId] += processed;
}

}
Expand Down
2 changes: 1 addition & 1 deletion test/username-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ async function processActions(actions, params) {

console.log("Data", signedActions.map(function(action) {return action.data.message}))

t = await cawActions.processActions({
t = await cawActions.processActions(params.senderTokenId || 1, {
v: signedActions.map(function(action) {return action.sigData.v}),
r: signedActions.map(function(action) {return action.sigData.r}),
s: signedActions.map(function(action) {return action.sigData.s}),
Expand Down

0 comments on commit 8c75006

Please sign in to comment.