decred.org/dcrdex@v1.0.5/dex/networks/erc20/erc20.go (about) 1 // This code is available on the terms of the project LICENSE.md file, 2 // also available online at https://blueoakcouncil.org/license/1.0.0. 3 4 package erc20 5 6 import ( 7 "fmt" 8 "strings" 9 10 v0 "decred.org/dcrdex/dex/networks/erc20/contracts/v0" 11 "github.com/ethereum/go-ethereum/accounts/abi" 12 ) 13 14 func parseABI(abiStr string) *abi.ABI { 15 erc20ABI, err := abi.JSON(strings.NewReader(abiStr)) 16 if err != nil { 17 panic(fmt.Sprintf("failed to parse erc20 abi: %v", err)) 18 } 19 return &erc20ABI 20 } 21 22 var ERC20ABI = parseABI(IERC20MetaData.ABI) 23 var ERC20SwapABIV0 = parseABI(v0.ERC20SwapMetaData.ABI)