Get ABI via etherscan API (#96)

- Added ABI request
- Add unique constraint on contract hash for watched contracts
This commit is contained in:
Matt K
2017-12-07 09:58:06 -06:00
committed by GitHub
parent f496303f15
commit 18163f970e
13 changed files with 213 additions and 108 deletions
-17
View File
@@ -2,15 +2,12 @@ package geth
import (
"errors"
"fmt"
"path/filepath"
"sort"
"context"
"math/big"
"github.com/8thlight/vulcanizedb/pkg/config"
"github.com/8thlight/vulcanizedb/pkg/core"
"github.com/ethereum/go-ethereum"
"github.com/ethereum/go-ethereum/common"
@@ -59,17 +56,3 @@ func (blockchain *GethBlockchain) GetAttributes(contract core.Contract) (core.Co
sort.Sort(contractAttributes)
return contractAttributes, nil
}
func (blockchain *GethBlockchain) GetContractAttributesOld(contractHash string) (core.ContractAttributes, error) {
abiFilePath := filepath.Join(config.ProjectRoot(), "contracts", "public", fmt.Sprintf("%s.json", contractHash))
parsed, _ := ParseAbiFile(abiFilePath)
var contractAttributes core.ContractAttributes
for _, abiElement := range parsed.Methods {
if (len(abiElement.Outputs) > 0) && (len(abiElement.Inputs) == 0) && abiElement.Const {
attributeType := abiElement.Outputs[0].Type.String()
contractAttributes = append(contractAttributes, core.ContractAttribute{abiElement.Name, attributeType})
}
}
sort.Sort(contractAttributes)
return contractAttributes, nil
}