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

Skip 0 value deposit #36

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
5 changes: 3 additions & 2 deletions script/Migrate.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,15 @@ import {Upgrades} from "openzeppelin-foundry-upgrades/Upgrades.sol";
import {Core} from "openzeppelin-foundry-upgrades/internal/Core.sol";

import {CollatorStakingHub} from "../src/collator/CollatorStakingHub.sol";
import {Deposit} from "../src/deposit/Deposit.sol";

contract MigrateScript is Script {
address proxy = 0xa4fFAC7A5Da311D724eD47393848f694Baee7930;
address proxy = 0x46275d29113f065c2aac262f34C7a3d8a8B7377D;

function run() public {
vm.startBroadcast();

address logic = address(new CollatorStakingHub());
address logic = address(new Deposit());
Core.upgradeProxyTo(proxy, logic, "");
require(logic == Upgrades.getImplementationAddress(proxy));
safeconsole.log("logic: ", logic);
Expand Down
4 changes: 3 additions & 1 deletion src/deposit/Deposit.sol
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,9 @@ contract Deposit is
uint256[] memory ids = new uint256[](len);
for (uint256 i = 0; i < len; i++) {
PalletInfo memory info = deposits[i];
require(info.value > 0, "!value");
if (info.value == 0) {
continue;
}
uint64 months = (info.expiredAt - info.startAt) / uint64(MONTH);
require(months <= 36 && months >= 1, "!months");
require(info.startAt <= block.timestamp, "!startAt");
Expand Down