Skip to content

Instantly share code, notes, and snippets.

View monokh's full-sized avatar
🐧

monokh monokh

🐧
View GitHub Profile
@monokh
monokh / uniswap-sdk-v2-get-price.js
Last active March 21, 2023 09:47
Uniswap V2 SDK Get Price
const { Token, WETH9, CurrencyAmount, TradeType } = require('@uniswap/sdk-core')
const { Route, Trade, Pair } = require('@uniswap/v2-sdk')
const ethers = require('ethers')
;(async () => {
const CHAIN_ID = 1
const daiAddress = '0x6B175474E89094C44Da98b954EedeAC495271d0F'
const tokenA = WETH9[CHAIN_ID]
const tokenB = new Token(CHAIN_ID, daiAddress, 18, 'DAI', 'DAI')
const pairAddress = Pair.getAddress(tokenA, tokenB)
@monokh
monokh / HTLC.sol
Created February 6, 2021 14:03
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.7.6+commit.7338295f.js&optimize=true&runs=200&gist=
// SPDX-License-Identifier: MIT
// optimize=true&runs=200&evmVersion=null&version=soljson-v0.7.4+commit.3f05b770.js
pragma solidity ^0.7.4;
interface ERC20 {
function balanceOf(address tokenOwner) external view returns (uint balance);
function transfer(address to, uint tokens) external returns (bool success);
}
contract HTLC {
address payable recipientAddress = 0x1111111111111111111111111111111111111111;
address payable refundAddress = 0x2222222222222222222222222222222222222222;