forked from cerc-io/ipld-eth-server
Remove unused contract methods
This commit is contained in:
@@ -14,84 +14,7 @@ import (
|
||||
|
||||
var _ = Describe("Reading contracts", func() {
|
||||
|
||||
Describe("Reading the list of attributes", func() {
|
||||
It("returns a string attribute for a real contract", func() {
|
||||
blockchain := geth.NewBlockchain(test_config.InfuraClient.IPCPath)
|
||||
contract := testing.SampleContract()
|
||||
|
||||
contractAttributes, err := blockchain.GetAttributes(contract)
|
||||
|
||||
Expect(err).To(BeNil())
|
||||
Expect(len(contractAttributes)).NotTo(Equal(0))
|
||||
symbolAttribute := *testing.FindAttribute(contractAttributes, "symbol")
|
||||
Expect(symbolAttribute.Name).To(Equal("symbol"))
|
||||
Expect(symbolAttribute.Type).To(Equal("string"))
|
||||
})
|
||||
|
||||
It("does not return an attribute that takes an input", func() {
|
||||
blockchain := geth.NewBlockchain(test_config.InfuraClient.IPCPath)
|
||||
contract := testing.SampleContract()
|
||||
|
||||
contractAttributes, err := blockchain.GetAttributes(contract)
|
||||
|
||||
Expect(err).To(BeNil())
|
||||
attribute := testing.FindAttribute(contractAttributes, "balanceOf")
|
||||
Expect(attribute).To(BeNil())
|
||||
})
|
||||
|
||||
It("does not return an attribute that is not constant", func() {
|
||||
blockchain := geth.NewBlockchain(test_config.InfuraClient.IPCPath)
|
||||
contract := testing.SampleContract()
|
||||
|
||||
contractAttributes, err := blockchain.GetAttributes(contract)
|
||||
|
||||
Expect(err).To(BeNil())
|
||||
attribute := testing.FindAttribute(contractAttributes, "unpause")
|
||||
Expect(attribute).To(BeNil())
|
||||
})
|
||||
})
|
||||
|
||||
Describe("Getting a contract attribute", func() {
|
||||
It("returns the correct attribute for a real contract", func() {
|
||||
blockchain := geth.NewBlockchain(test_config.InfuraClient.IPCPath)
|
||||
|
||||
contract := testing.SampleContract()
|
||||
name, err := blockchain.GetAttribute(contract, "name", nil)
|
||||
|
||||
Expect(err).To(BeNil())
|
||||
Expect(name).To(Equal("OMGToken"))
|
||||
})
|
||||
|
||||
It("returns the correct attribute for a real contract", func() {
|
||||
blockchain := geth.NewBlockchain(test_config.InfuraClient.IPCPath)
|
||||
contract := testing.SampleContract()
|
||||
|
||||
name, err := blockchain.GetAttribute(contract, "name", nil)
|
||||
|
||||
Expect(err).To(BeNil())
|
||||
Expect(name).To(Equal("OMGToken"))
|
||||
})
|
||||
|
||||
It("returns the correct attribute for a real contract at a specific block height", func() {
|
||||
blockchain := geth.NewBlockchain(test_config.InfuraClient.IPCPath)
|
||||
contract := testing.SampleContract()
|
||||
|
||||
name, err := blockchain.GetAttribute(contract, "name", big.NewInt(4701536))
|
||||
|
||||
Expect(name).To(Equal("OMGToken"))
|
||||
Expect(err).To(BeNil())
|
||||
})
|
||||
|
||||
It("returns an error when asking for an attribute that does not exist", func() {
|
||||
blockchain := geth.NewBlockchain(test_config.InfuraClient.IPCPath)
|
||||
contract := testing.SampleContract()
|
||||
|
||||
name, err := blockchain.GetAttribute(contract, "missing_attribute", nil)
|
||||
|
||||
Expect(err).To(Equal(geth.ErrInvalidStateAttribute))
|
||||
Expect(name).To(BeNil())
|
||||
})
|
||||
|
||||
It("retrieves the event log for a specific block and contract", func() {
|
||||
expectedLogZero := core.Log{
|
||||
BlockNumber: 4703824,
|
||||
|
||||
Reference in New Issue
Block a user