Skip to content

Instantly share code, notes, and snippets.

@ylv-io
Created August 8, 2022 12:40
Show Gist options
  • Save ylv-io/59f415f2ca1e115e7b0526130bf467d5 to your computer and use it in GitHub Desktop.
Save ylv-io/59f415f2ca1e115e7b0526130bf467d5 to your computer and use it in GitHub Desktop.
Force a smart contract to receive ETH
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.1;
/**
* @title ShutUpAndTakeMyMoney
* @dev Force target to accept msg.value amount of ETH
* https://docs.soliditylang.org/en/v0.8.13/introduction-to-smart-contracts.html?highlight=selfdestruct#deactivate-and-self-destruct
*/
contract ShutUpAndTakeMyMoney {
constructor(address _target) payable {
selfdestruct(payable(_target));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment