uniswap-router-go

command module
v0.0.0-...-a297569 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 20, 2021 License: MIT Imports: 8 Imported by: 0

README

uniswap-router-go

load Uniswap V2: Router 2 contract in go

#example

//enter your privatekey of infura
const privateKey string = ""

tokenMap := make(map[string]Token)
tokenMap["WETH"] = Token{"WETH", "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", 18}
tokenMap["DEA"] = Token{"DEA", "0x80aB141F324C3d6F2b18b030f1C4E95d4d658778", 18}
tokenMap["DEUS"] = Token{"DEUS", "0x3b62F3820e0B035cc4aD602dECe6d796BC325325", 18}
tokenMap["USDC"] = Token{"USDC", "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", 6}

routes := []Token{
	tokenMap["DEA"],
	tokenMap["DEUS"],
	tokenMap["WETH"],
	tokenMap["USDC"],
}

const inputAmount = 1

#install dependencies and run

go get -d ./..

go run . 

#output

uniswap contract is loaded
1 DEA is 203.552135 USDC

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL