Skip to content

Commit

Permalink
(migration): require migration amount to be greater than zero
Browse files Browse the repository at this point in the history
  • Loading branch information
benjaminbollen committed Oct 1, 2024
1 parent 74a6435 commit 8c857ce
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/errors/Errors.sol
Original file line number Diff line number Diff line change
Expand Up @@ -96,3 +96,7 @@ interface INameRegistryErrors {

error CirclesNamesOrganizationHasNoSymbol(address organization, uint8 code);
}

interface IMigrationErrors {
error CirclesMigrationAmountMustBeGreaterThanZero();
}
6 changes: 5 additions & 1 deletion src/migration/Migration.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import "../hub/IHub.sol";
import "./IHub.sol";
import "./IToken.sol";

contract Migration is ICirclesErrors {
contract Migration is ICirclesErrors, IMigrationErrors {
// Constant

uint256 private constant ACCURACY = uint256(10 ** 8);
Expand Down Expand Up @@ -75,6 +75,10 @@ contract Migration is ICirclesErrors {
// Invalid avatar, not registered in hub V1.
revert CirclesAddressCannotBeZero(2);
}
if (_amounts[i] == 0) {
// Amount must be greater than zero.
revert CirclesMigrationAmountMustBeGreaterThanZero();
}
convertedAmounts[i] = convertFromV1ToDemurrage(_amounts[i]);
// transfer the v1 Circles to this contract to be locked
circlesV1.transferFrom(msg.sender, address(this), _amounts[i]);
Expand Down

0 comments on commit 8c857ce

Please sign in to comment.