This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// SPDX-License-Identifier: MIT | |
pragma solidity ^0.8.0; | |
contract Delegate { | |
address public owner; | |
constructor(address _owner) { | |
owner = _owner; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// SPDX-License-Identifier: MIT | |
pragma solidity ^0.8.0; | |
import "@openzeppelin/contracts/utils/Address.sol"; | |
import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; | |
import "../DamnValuableToken.sol"; | |
/** | |
* @title TrusterLenderPool |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @dev Performs a Solidity function call using a low level `call`. A | |
* plain `call` is an unsafe replacement for a function call: use this | |
* function instead. | |
* | |
* If `target` reverts with a revert reason, it is bubbled up by this | |
* function (like regular Solidity function calls). | |
* | |
* Returns the raw returned data. To convert to the expected return value, | |
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
contract TrusterAttacker { | |
TrusterLenderPool public immutable pool; | |
ERC20 public immutable token; | |
constructor(address _pool, address _token) { | |
pool = TrusterLenderPool(_pool); | |
token = ERC20(_token); | |
} | |
function fakeLoan() external { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
it('Execution', async function () { | |
/** CODE YOUR SOLUTION HERE */ | |
const TrusterAttacker = await ethers.getContractFactory('TrusterAttacker', player); | |
attack = await TrusterAttacker.deploy(pool.address,token.address); | |
await attack.connect(player).fakeLoan() | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// SPDX-License-Identifier: MIT | |
pragma solidity ^0.8.0; | |
contract Force {/* | |
MEOW ? | |
/\_/\ / | |
____/ o o \ | |
/~____ =ø= / | |
(______)__m_m) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// SPDX-License-Identifier: MIT | |
pragma solidity ^0.8.0; | |
contract Destruct { | |
constructor() payable { | |
} | |
function destroy(address apocalypse) public { | |
selfdestruct(payable(apocalypse)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// SPDX-License-Identifier: MIT | |
pragma solidity ^0.8.0; | |
contract Vault { | |
bool public locked; | |
bytes32 private password; | |
constructor(bytes32 _password) { | |
locked = true; | |
password = _password; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
➜ evm-puzzles git:(master) ✗ npx hardhat play | |
############ | |
# Puzzle 3 # | |
############ | |
00 36 CALLDATASIZE | |
01 56 JUMP | |
02 FD REVERT | |
03 FD REVERT | |
04 5B JUMPDEST |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
➜ evm-puzzles git:(master) ✗ npx hardhat play | |
############ | |
# Puzzle 4 # | |
############ | |
00 34 CALLVALUE | |
01 38 CODESIZE | |
02 18 XOR | |
03 56 JUMP | |
04 FD REVERT |
OlderNewer