Skip to content

Instantly share code, notes, and snippets.

Avatar
🌱
Working, Learning, Growing

slorenzo slorenzo

🌱
Working, Learning, Growing
View GitHub Profile
View FlashLoanAttacker.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/Address.sol";
interface IFlashLoanPool {
function flashLoan(uint256 amount) external;
function deposit() external payable;
function withdraw() external;
View deepFlatten.js
const deepFlatten = function(arr) {
const flatten = function(arr) {
return [].concat(...arr)
}
return flatten( // return shalowly flattened array
arr.map(x=> // with each x in array
Array.isArray(x) // is x an array?
? deepFlatten(x) // if yes, return deeply flattened x
: x // if no, return just x
)