Skip to content

Commit

Permalink
Update Reseed Account Status Events (#1116)
Browse files Browse the repository at this point in the history
  • Loading branch information
nickkatsios authored Sep 25, 2024
2 parents 437ade5 + e31a666 commit eb1dbb0
Showing 1 changed file with 19 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,16 @@ contract ReseedAccountStatus {
uint128 germinatingStalkEven;
}

// emitted when a status is migrated.
event MigratedAccountStatus(
event MigratedAccountTokenStatus(
address indexed account,
address indexed token,
uint256 stalk,
uint256 roots,
uint256 bdv,
int96 lastStem
);

// emitted when a status is migrated.
event MigratedAccountStatus(address indexed account, uint256 stalk, uint256 roots);

function init(AccountStatus[] calldata accountStatuses) external {
// for each account
for (uint i = 0; i < accountStatuses.length; i++) {
Expand All @@ -51,6 +51,14 @@ contract ReseedAccountStatus {
.accts[accountStatuses[i].account]
.mowStatuses[accountStatuses[i].tokens[j]]
.lastStem = accountStatuses[i].mowStatuses[j].lastStem;

// emit event on a per account per token basis.
emit MigratedAccountTokenStatus(
accountStatuses[i].account,
accountStatuses[i].tokens[j],
accountStatuses[i].mowStatuses[j].bdv,
accountStatuses[i].mowStatuses[j].lastStem
);
}
// set stalk and roots for account.
s.accts[accountStatuses[i].account].stalk = accountStatuses[i].stalk;
Expand All @@ -64,6 +72,13 @@ contract ReseedAccountStatus {
s.accts[accountStatuses[i].account].germinatingStalk[
GerminationSide.EVEN
] = accountStatuses[i].germinatingStalkEven;

// emit event on a per account basis.
emit MigratedAccountStatus(
accountStatuses[i].account,
accountStatuses[i].stalk,
accountStatuses[i].stalk * 1e12 // roots
);
}
}
}

0 comments on commit eb1dbb0

Please sign in to comment.