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

Update Reseed Account Status Events #1116

Merged
merged 3 commits into from
Sep 25, 2024
Merged
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
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
);
}
}
}