Skip to content

Instantly share code, notes, and snippets.

@ElementalBrian
ElementalBrian / pivotpoints.pine
Created November 5, 2024 10:55
help visual high and low pivot points
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// @version=5
indicator("Auto-Pivot", overlay=true)
// Get user input
var devTooltip = "Deviation is a multiplier that affects how much the price should deviate from the previous pivot in order for the bar to become a new pivot."
var depthTooltip = "The minimum number of bars that will be taken into account when calculating the indicator."
threshold_multiplier = input.float(title="Deviation", defval=3, minval=0, tooltip=devTooltip)
depth = input.int(title="Depth", defval=10, minval=1, tooltip=depthTooltip)
reverse = input.bool(title="Reverse", defval=false, tooltip="Flips the fibonacci levels around.")
{
"name": "elementalBrian",
"website": "https://elementalblockchain.co",
"description": "Accelerating Web3",
"logo": "https://static.wixstatic.com/media/693f48_d8347e5783874776848adf1206bab61c%7Emv2.jpg/v1/fit/w_2500,h_1330,al_c/693f48_d8347e5783874776848adf1206bab61c%7Emv2.png",
"twitter": "https://x.com/elementalblockchain"
}
@ElementalBrian
ElementalBrian / IERC20NonStandard.sol
Created January 22, 2021 14:21
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.5.17+commit.d19bba13.js&optimize=false&runs=200&gist=
pragma solidity ^0.5.0;
/**
* Version of ERC20 with no return values for `transfer` and `transferFrom
* https://medium.com/coinmonks/missing-return-value-bug-at-least-130-tokens-affected-d67bf08521ca
*/
interface IERC20NonStandard {
function transfer(address to, uint256 value) external;
function approve(address spender, uint256 value) external;
### Keybase proof
I hereby claim:
* I am elementalblockchain on github.
* I am elementalbrian (https://keybase.io/elementalbrian) on keybase.
* I have a public key ASBt0OXee99jSkoXrM0lxR_tQfZ_ckszf2OCnt-DcgWjnAo
To claim this, I am signing this object:
@ElementalBrian
ElementalBrian / Address.sol
Created October 1, 2020 20:59
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.6.6+commit.6c089d02.js&optimize=false&gist=
pragma solidity ^0.6.6;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
#this uses the uniswap smart contract to find the exchange rate on uniswap from one token to another
import requests, logging, json, os, time, sys
from web3 import Web3
inputToken = "dai"
outputToken = "usdc"
inputAmount = 100
tokens = json.load(open('abi/kyber_currencies.json', 'r'))["data"]
#this uses the uniswap smart contract to find the exchange rate on uniswap from one token to another
import requests, logging, json, os, time, sys
from web3 import Web3
inputToken = "dai"
outputToken = "usdc"
inputAmount = 100
tokens = json.load(open('abi/kyber_currencies.json', 'r'))["data"]
#this uses the uniswap smart contract to find the exchange rate on uniswap from one token to another
import requests, logging, json, os, time, sys
from web3 import Web3
inputToken = sys.argv[1]
outputToken = sys.argv[2]
inputAmount = sys.argv[3]
tokens = json.load(open('abi/kyber_currencies.json', 'r'))["data"]
#this uses the uniswap smart contract to find the exchange rate on uniswap from one token to another
import requests, logging, json, os, time, sys
from web3 import Web3
inputToken = sys.argv[1]
outputToken = sys.argv[2]
inputAmount = sys.argv[3]
tokens = json.load(open('abi/kyber_currencies.json', 'r'))["data"]
#this uses the uniswap smart contract to find the exchange rate on uniswap from one token to another
import requests, logging, json, os, time, sys
from web3 import Web3
tokens = json.load(open('abi/kyber_currencies.json', 'r'))["data"]
tokenarray = {}
for i in tokens: tokenarray[i["symbol"].lower()] = (Web3.toChecksumAddress(i["address"]), i["decimals"])
#print(tokenarray)