Roy Crihfield
bc3a7934cf
* refactor vulcanize => cerc * update geth and cerc dependencies * update packages, ginkgo * refactor chain generation * update integration tests, contract, makefile * go embed contract code * rm old readme * move unit tests into package * rm ginkgo where not needed * use tx in ref integrity functions
23 lines
449 B
Go
23 lines
449 B
Go
package chaingen
|
|
|
|
import (
|
|
"strings"
|
|
|
|
"github.com/ethereum/go-ethereum/accounts/abi"
|
|
"github.com/ethereum/go-ethereum/common"
|
|
)
|
|
|
|
type ContractSpec struct {
|
|
DeploymentCode []byte
|
|
ABI abi.ABI
|
|
}
|
|
|
|
func ParseContract(abiStr, binStr string) (*ContractSpec, error) {
|
|
parsedABI, err := abi.JSON(strings.NewReader(abiStr))
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
data := common.Hex2Bytes(binStr)
|
|
return &ContractSpec{data, parsedABI}, nil
|
|
}
|