2019-01-15 21:49:18 +00:00
|
|
|
// VulcanizeDB
|
2019-03-12 15:46:42 +00:00
|
|
|
// Copyright © 2019 Vulcanize
|
2019-01-15 21:49:18 +00:00
|
|
|
|
|
|
|
// This program is free software: you can redistribute it and/or modify
|
|
|
|
// it under the terms of the GNU Affero General Public License as published by
|
|
|
|
// the Free Software Foundation, either version 3 of the License, or
|
|
|
|
// (at your option) any later version.
|
|
|
|
|
|
|
|
// This program is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
// GNU Affero General Public License for more details.
|
|
|
|
|
|
|
|
// You should have received a copy of the GNU Affero General Public License
|
|
|
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
2020-02-20 22:13:19 +00:00
|
|
|
package integration_test
|
2019-01-15 21:49:18 +00:00
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/ethereum/go-ethereum/ethclient"
|
|
|
|
"github.com/ethereum/go-ethereum/rpc"
|
|
|
|
. "github.com/onsi/ginkgo"
|
|
|
|
. "github.com/onsi/gomega"
|
|
|
|
|
2019-10-28 11:30:24 +00:00
|
|
|
"github.com/vulcanize/vulcanizedb/pkg/eth"
|
|
|
|
"github.com/vulcanize/vulcanizedb/pkg/eth/client"
|
2020-01-29 19:00:07 +00:00
|
|
|
"github.com/vulcanize/vulcanizedb/pkg/eth/contract_watcher/shared/constants"
|
|
|
|
"github.com/vulcanize/vulcanizedb/pkg/eth/contract_watcher/shared/getter"
|
2019-10-28 11:30:24 +00:00
|
|
|
rpc2 "github.com/vulcanize/vulcanizedb/pkg/eth/converters/rpc"
|
|
|
|
"github.com/vulcanize/vulcanizedb/pkg/eth/node"
|
2019-03-14 20:07:39 +00:00
|
|
|
"github.com/vulcanize/vulcanizedb/test_config"
|
2019-01-15 21:49:18 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
var _ = Describe("Interface Getter", func() {
|
|
|
|
Describe("GetAbi", func() {
|
|
|
|
It("Constructs and returns a custom abi based on results from supportsInterface calls", func() {
|
|
|
|
expectedABI := `[` + constants.AddrChangeInterface + `,` + constants.NameChangeInterface + `,` + constants.ContentChangeInterface + `,` + constants.AbiChangeInterface + `,` + constants.PubkeyChangeInterface + `]`
|
2019-10-31 16:19:34 +00:00
|
|
|
con := test_config.TestClient
|
|
|
|
testIPC := con.IPCPath
|
2019-01-15 21:49:18 +00:00
|
|
|
blockNumber := int64(6885696)
|
2019-10-31 16:19:34 +00:00
|
|
|
rawRpcClient, err := rpc.Dial(testIPC)
|
2019-01-15 21:49:18 +00:00
|
|
|
Expect(err).NotTo(HaveOccurred())
|
2019-10-18 16:16:19 +00:00
|
|
|
rpcClient := client.NewRPCClient(rawRpcClient, testIPC)
|
2019-01-15 21:49:18 +00:00
|
|
|
ethClient := ethclient.NewClient(rawRpcClient)
|
|
|
|
blockChainClient := client.NewEthClient(ethClient)
|
|
|
|
node := node.MakeNode(rpcClient)
|
2019-10-18 16:16:19 +00:00
|
|
|
transactionConverter := rpc2.NewRPCTransactionConverter(ethClient)
|
2019-10-28 11:30:24 +00:00
|
|
|
blockChain := eth.NewBlockChain(blockChainClient, rpcClient, node, transactionConverter)
|
2019-01-15 21:49:18 +00:00
|
|
|
interfaceGetter := getter.NewInterfaceGetter(blockChain)
|
2019-10-28 10:48:31 +00:00
|
|
|
abi, err := interfaceGetter.GetABI(constants.PublicResolverAddress, blockNumber)
|
|
|
|
Expect(err).NotTo(HaveOccurred())
|
2019-01-15 21:49:18 +00:00
|
|
|
Expect(abi).To(Equal(expectedABI))
|
2019-10-28 11:30:24 +00:00
|
|
|
_, err = eth.ParseAbi(abi)
|
2019-01-15 21:49:18 +00:00
|
|
|
Expect(err).ToNot(HaveOccurred())
|
|
|
|
})
|
|
|
|
})
|
|
|
|
})
|