View ExampleSlidingWindowOracleDaiWethKovan.sol
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 { |
View TokenSwapWith0x.sol
// 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); | |
} |
View BalancerExample.sol
// 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); |
View ExtCodeHashExample.sol
// 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; |
View FutureBlockHash.example.sol
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; | |
} |