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
+14
View File
@@ -262,6 +262,20 @@ func AssertRepositoryBehavior(buildRepository func() repositories.Repository) {
Expect(contract).ToNot(BeNil())
Expect(contract.Abi).To(Equal("{\"some\": \"json\"}"))
})
It("updates the ABI of the contract if hash already present", func() {
repository.CreateContract(core.Contract{
Abi: "{\"some\": \"json\"}",
Hash: "x123",
})
repository.CreateContract(core.Contract{
Abi: "{\"some\": \"different json\"}",
Hash: "x123",
})
contract := repository.FindContract("x123")
Expect(contract).ToNot(BeNil())
Expect(contract.Abi).To(Equal("{\"some\": \"different json\"}"))
})
})
}