Skip to content

Commit 5e7e17b

Browse files
committed
add check for code size
1 parent 2f60781 commit 5e7e17b

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/MigrationLocker.sol

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,11 @@ contract MigrationLocker is Initializable, Ownable2StepUpgradeable {
6161
/// @dev Emits a Locked event with the recipient address, amount, and a unique identifier
6262
/// @dev The function increments the counter to ensure unique identifiers for each lock
6363
function lock(uint _amount, address _recipient) external onlyUnlocked {
64-
if (_recipient == address(0)) {
64+
uint codeLength;
65+
assembly {
66+
codeLength := extcodesize(_recipient)
67+
}
68+
if (_recipient == address(0) || codeLength > 0) {
6569
revert("Invalid recipient");
6670
}
6771

0 commit comments

Comments
 (0)