This file contains 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
const { ether, expectRevert } = require('@openzeppelin/test-helpers'); | |
const { accounts, contract } = require('@openzeppelin/test-environment'); | |
const DamnValuableToken = contract.fromArtifact('DamnValuableToken'); | |
const UnstoppableLender = contract.fromArtifact('UnstoppableLender'); | |
const ReceiverContract = contract.fromArtifact('ReceiverUnstoppable'); | |
const { expect } = require('chai'); | |
describe('[Challenge] Unstoppable', function () { |
This file contains 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 UnstoppableLender is ReentrancyGuard { | |
using SafeMath for uint256; | |
IERC20 public damnValuableToken; | |
uint256 public poolBalance; | |
constructor(address tokenAddress) public { | |
require(tokenAddress != address(0), "Token address cannot be zero"); | |
damnValuableToken = IERC20(tokenAddress); | |
} |
This file contains 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
const { ether, balance } = require('@openzeppelin/test-helpers'); | |
const { accounts, contract, web3 } = require('@openzeppelin/test-environment'); | |
const LenderPool = contract.fromArtifact('NaiveReceiverLenderPool'); | |
const FlashLoanReceiver = contract.fromArtifact('FlashLoanReceiver'); | |
const myAttackContract = contract.fromArtifact('AttackContract'); | |
const { expect } = require('chai'); | |
describe('[Challenge] Naive receiver', function () { |
This file contains 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
const { ether, balance } = require('@openzeppelin/test-helpers'); | |
const { accounts, contract } = require('@openzeppelin/test-environment'); | |
const SideEntranceLenderPool = contract.fromArtifact('SideEntranceLenderPool'); | |
const SideEntranceAttacker = contract.fromArtifact('SideEntranceAttacker'); | |
const { expect } = require('chai'); | |
describe('[Challenge] Side entrance', function () { |
This file contains 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
pragma solidity ^0.6.0; | |
contract AttackContract { | |
address payable pool; | |
address payable target; | |
constructor(address payable poolAddress,address payable targetAddress) public { | |
pool = poolAddress; | |
target = targetAddress; | |
} |
This file contains 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
function flashLoan( | |
uint256 borrowAmount, | |
address borrower, | |
address target, | |
bytes calldata data | |
) | |
external | |
nonReentrant | |
{ |
This file contains 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
pragma solidity ^0.6.0; | |
import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; | |
import "@openzeppelin/contracts/utils/ReentrancyGuard.sol"; | |
contract TrusterLenderPool is ReentrancyGuard { | |
IERC20 public damnValuableToken; | |
constructor (address tokenAddress) public { |
This file contains 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
pragma solidity ^0.6.0; | |
import "./TrusterLenderPool.sol"; | |
contract AttackerContract{ | |
uint256 public totalTokens = 1000000 ether; | |
address public attackerAddress; | |
// DamnValuableToken public dvTokenContract; | |
address public dvTokenContract; | |
TrusterLenderPool public poolContract; |
This file contains 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
const { ether } = require('@openzeppelin/test-helpers'); | |
const { accounts, contract } = require('@openzeppelin/test-environment'); | |
const DamnValuableToken = contract.fromArtifact('DamnValuableToken'); | |
const TrusterLenderPool = contract.fromArtifact('TrusterLenderPool'); | |
const AttackContract = contract.fromArtifact('AttackerContract'); | |
var Web3 = require("web3"); | |
var web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8545")); |
This file contains 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
pragma solidity ^0.6.0; | |
import "./SimpleGovernance.sol"; | |
import "./SelfiePool.sol"; | |
import "../DamnValuableTokenSnapshot.sol"; | |
contract AttackerContract{ | |
address public attackerAddress; | |
SelfiePool public selfiePool; |