Skip to content

Instantly share code, notes, and snippets.

View voith's full-sized avatar
👨‍🎓
Building on top of Ethereum

Voith voith

👨‍🎓
Building on top of Ethereum
View GitHub Profile
@yurenju
yurenju / Ship.sol
Created January 6, 2022 07:52
OpenZeppelin BeaconProxy
pragma solidity 0.8.7;
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
contract Ship is Initializable {
string public name;
uint256 public fuel;
function initialize(string memory _name, uint256 _fuel) external initializer {
name = _name;
import "@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol";
import "@uniswap/v3-core/contracts/libraries/TickMath.sol";
import "@uniswap/v3-core/contracts/libraries/FixedPoint96.sol";
import "@uniswap/v3-core/contracts/libraries/FullMath.sol";
contract TwapGetter {
function getSqrtTwapX96(address uniswapV3Pool, uint32 twapInterval) public view returns (uint160 sqrtPriceX96) {
if (twapInterval == 0) {
// return the current price if twapInterval == 0
(sqrtPriceX96, , , , , , ) = IUniswapV3Pool(uniswapV3Pool).slot0();
#import asyncio
import logging
from flask import Blueprint, Flask, request, render_template, g
from flask_graphql import GraphQLView
from google.cloud import logging as glogging
#from graphql.execution.executors.asyncio import AsyncioExecutor
from web3 import Web3, HTTPProvider
from werkzeug.serving import run_simple
from graphql import (
graphql,