Skip to content

Instantly share code, notes, and snippets.

contract YourContract {
address aaveContractAddress;
function initiateFlashLoan(address erc20token, uint256 amount) {
Aave(aaveContractAddress).flashLoan(address(this), erc20token, amount);
}
function executeOperation(address erc20token, uint256 amount, uint256 fee) {
// you're now approved for the "amount". do whatever you want with it
contract OKPC is ERC721A {
address public metadataAddress;
function setMetadataAddress(address addr) external onlyOwner {
if (addr == address(0)) revert InvalidAddress();
metadataAddress = addr;
emit MetadataAddressUpdated(addr);
}
function tokenURI(uint256 pcId) public view override returns (string memory) {
contract YourNFTContract is ERC721 {
bytes32 private _allowlistMerkleRoot;
function setMerkleRoot(bytes32 newRoot) external onlyOwner {
_allowlistMerkleRoot = newRoot;
}
modifier onlyIfValidMerkleProof(bytes32[] calldata proof) {
// leaf is just the address of the sender
bytes32 leaf = keccak256(abi.encodePacked(msg.sender));
contract MarketDownBad {
uint256 public supply = 1;
uint256 public lastSoldPrice;
function price() public view returns (uint256) {
return 1000 / supply;
}
function panicSell() public {
lastSoldPrice = price();
contract BuyOptionForUNIToken {
address public constant UNIERC20Address = "0x....";
uint public price;
uint public endPeriod;
address public contractHolder;
constructor(uint _price, uint _endPeriod, address _contractHolder) {
price = _price;
endPeriod = _endPeriod;
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.13;
import {ERC721} from "./ERC721.sol";
contract Runes is ERC721 {
uint256 public constant RUNE_OF_ALPHA = 6;
uint256 public lastDelta;
uint256 public lastPurchaseBasefee;
/**
* @title CanonicalTransactionChain
* @dev The Canonical Transaction Chain (CTC) contract is an append-only log of transactions
* which must be applied to the rollup state. It defines the ordering of rollup transactions by
* writing them to the 'CTC:batches' instance of the Chain Storage Container.
* The CTC also allows any account to 'enqueue' an L2 transaction, which will require that the
* Sequencer will eventually append it to the rollup state.
*
*/
contract CanonicalTransactionChain is ICanonicalTransactionChain, Lib_AddressResolver {
contract OVM_FraudVerifier is Lib_AddressResolver, OVM_FraudContributor, iOVM_FraudVerifier {
/**
* Finalizes the fraud verification process.
* @param _preStateRoot State root before the fraudulent transaction.
* @param _preStateRootBatchHeader Batch header for the provided pre-state root.
* @param _preStateRootProof Inclusion proof for the provided pre-state root.
* @param _txHash The transaction for the state root
* @param _postStateRoot State root after the fraudulent transaction.
* @param _postStateRootBatchHeader Batch header for the provided post-state root.
* @param _postStateRootProof Inclusion proof for the provided post-state root.
/**
* @title CanonicalTransactionChain
* @dev The Canonical Transaction Chain (CTC) contract is an append-only log of transactions
* which must be applied to the rollup state. It defines the ordering of rollup transactions by
* writing them to the 'CTC:batches' instance of the Chain Storage Container.
* The CTC also allows any account to 'enqueue' an L2 transaction, which will require that the
* Sequencer will eventually append it to the rollup state.
*
*/
contract CanonicalTransactionChain is ICanonicalTransactionChain, Lib_AddressResolver {
/**
* @title L2StandardBridge
* @dev The L2 Standard bridge is a contract which works together with the L1 Standard bridge to
* enable ETH and ERC20 transitions between L1 and L2.
* This contract acts as a minter for new tokens when it hears about deposits into the L1 Standard
* bridge.
* This contract also acts as a burner of the tokens intended for withdrawal, informing the L1
* bridge to release L1 funds.
*/
contract L2StandardBridge is IL2ERC20Bridge, CrossDomainEnabled {