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
fn instantiate2_address_impl( | |
checksum: &[u8], | |
creator: &CanonicalAddr, | |
salt: &[u8], | |
msg: &[u8], | |
) -> Result<CanonicalAddr, Instantiate2AddressError> { | |
if checksum.len() != 32 { | |
return Err(Instantiate2AddressError::InvalidChecksumLength); | |
} |
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
// SPDX-License-Identifier: MIT | |
pragma solidity ^0.7.0; | |
contract ERC20 { | |
mapping(address => uint256) private _balances; | |
mapping(address => mapping(address => uint256)) private _allowances; | |
uint256 private _totalSupply; | |
string private _name; | |
string private _symbol; |
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
// SPDX-License-Identifier: MIT | |
pragma solidity =0.7.6; | |
pragma abicoder v2; | |
import "https://github.com/Uniswap/uniswap-v3-periphery/blob/main/contracts/interfaces/ISwapRouter.sol"; | |
import "https://github.com/Uniswap/uniswap-v3-periphery/blob/main/contracts/interfaces/IQuoter.sol"; | |
import {IERC20, SafeERC20} from "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/release-v3.4-solc-0.7/contracts/token/ERC20/SafeERC20.sol"; | |
interface IUniswapRouter is ISwapRouter { |
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
// SPDX-License-Identifier: MIT | |
pragma solidity ^0.8.0; | |
contract BankOwned { | |
address public bankAddress; | |
constructor() { | |
bankAddress = msg.sender; | |
} |
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.6; | |
pragma experimental ABIEncoderV2; | |
import "https://github.com/Uniswap/uniswap-v2-core/blob/master/contracts/interfaces/IUniswapV2Pair.sol"; | |
import "https://github.com/Uniswap/uniswap-lib/blob/master/contracts/libraries/FixedPoint.sol"; | |
import "https://github.com/Uniswap/uniswap-lib/blob/master/contracts/libraries/FullMath.sol"; | |
import "https://github.com/Uniswap/uniswap-lib/blob/master/contracts/libraries/Babylonian.sol"; | |
import "https://github.com/Uniswap/uniswap-lib/blob/master/contracts/libraries/BitMath.sol"; | |
library SafeMath { |
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
// SPDX-License-Identifier: MIT | |
pragma solidity ^0.7.4; | |
interface IERC20 { | |
function balanceOf(address owner) external view returns (uint256); | |
function approve(address spender, uint256 amount) external returns (bool); | |
function transfer(address to, uint256 amount) external returns (bool); | |
function transferFrom(address from, address to, uint256 amount) external returns (bool); | |
} |
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
// SPDX-License-Identifier: MIT | |
pragma solidity 0.7.2; | |
interface PoolInterface { | |
function swapExactAmountIn(address, uint, address, uint, uint) external returns (uint, uint); | |
function swapExactAmountOut(address, uint, address, uint, uint) external returns (uint, uint); | |
} | |
interface TokenInterface { | |
function balanceOf(address) external returns (uint); |
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
// SPDX-License-Identifier: MIT | |
pragma solidity 0.6.10; | |
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/access/Ownable.sol"; | |
interface ExternalContractInterface { | |
function game() external returns(ExtCodeHashExample); | |
function payoutToWinner(address winner) external; | |
function withdrawTo(uint roundId, address receiver) external; | |
receive() external payable; |
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
mapping (address => uint256) gameWeiValues; | |
mapping (address => uint256) blockHashesToBeUsed; | |
function playGame() public { | |
if (!blockHashesToBeUsed[msg.sender]) { | |
// first run, determine block hash to be used | |
blockHashesToBeUsed[msg.sender] = block.number + 2; // use 2 or more | |
gameWeiValues[msg.sender] = msg.value; | |
return; | |
} |