Remove unused contract methods
This commit is contained in:
+4
-38
@@ -1,8 +1,6 @@
|
||||
package fakes
|
||||
|
||||
import (
|
||||
"sort"
|
||||
|
||||
"math/big"
|
||||
|
||||
"github.com/vulcanize/vulcanizedb/pkg/core"
|
||||
@@ -18,6 +16,10 @@ type Blockchain struct {
|
||||
ContractReturnValue []byte
|
||||
}
|
||||
|
||||
func (blockchain *Blockchain) FetchContractData(abiJSON string, address string, method string, methodArg interface{}, result interface{}, blockNumber int64) error {
|
||||
panic("implement me")
|
||||
}
|
||||
|
||||
func (blockchain *Blockchain) CallContract(contractHash string, input []byte, blockNumber *big.Int) ([]byte, error) {
|
||||
return blockchain.ContractReturnValue, nil
|
||||
}
|
||||
@@ -40,16 +42,6 @@ func (blockchain *Blockchain) Node() core.Node {
|
||||
return blockchain.node
|
||||
}
|
||||
|
||||
func (blockchain *Blockchain) GetAttribute(contract core.Contract, attributeName string, blockNumber *big.Int) (interface{}, error) {
|
||||
var result interface{}
|
||||
if blockNumber == nil {
|
||||
result = blockchain.contractAttributes[contract.Hash+"-1"][attributeName]
|
||||
} else {
|
||||
result = blockchain.contractAttributes[contract.Hash+blockNumber.String()][attributeName]
|
||||
}
|
||||
return result, nil
|
||||
}
|
||||
|
||||
func NewBlockchain() *Blockchain {
|
||||
return &Blockchain{
|
||||
blocks: make(map[int64]core.Block),
|
||||
@@ -77,29 +69,3 @@ func (blockchain *Blockchain) AddBlock(block core.Block) {
|
||||
blockchain.blocks[block.Number] = block
|
||||
blockchain.blocksChannel <- block
|
||||
}
|
||||
|
||||
func (blockchain *Blockchain) SetContractStateAttribute(contractHash string, blockNumber *big.Int, attributeName string, attributeValue string) {
|
||||
var key string
|
||||
if blockNumber == nil {
|
||||
key = contractHash + "-1"
|
||||
} else {
|
||||
key = contractHash + blockNumber.String()
|
||||
}
|
||||
contractStateAttributes := blockchain.contractAttributes[key]
|
||||
if contractStateAttributes == nil {
|
||||
blockchain.contractAttributes[key] = make(map[string]string)
|
||||
}
|
||||
blockchain.contractAttributes[key][attributeName] = attributeValue
|
||||
}
|
||||
|
||||
func (blockchain *Blockchain) GetAttributes(contract core.Contract) (core.ContractAttributes, error) {
|
||||
var contractAttributes core.ContractAttributes
|
||||
attributes, ok := blockchain.contractAttributes[contract.Hash+"-1"]
|
||||
if ok {
|
||||
for key := range attributes {
|
||||
contractAttributes = append(contractAttributes, core.ContractAttribute{Name: key, Type: "string"})
|
||||
}
|
||||
}
|
||||
sort.Sort(contractAttributes)
|
||||
return contractAttributes, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user