-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
sam bacha
authored
Apr 6, 2021
1 parent
f898586
commit 065bc14
Showing
1 changed file
with
60 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
== Requirements for Blooms to be queryable | ||
|
||
Blooms do not work with eth transactions (purely sending eth), eth transactions do not emit logs so do not exist in the bloom filter. This is what ethereum did purposely but it means you should query the eth balance every block to make sure it's in sync. Blooms will only work if the transaction emits an event which then ends up in the logs. The bloom filter is there to help you find logs. A contract can be written which does not emit an event and in that case, would not be queryable from a bloom filter. The erc20 token spec requires you to fire an event on approval and transfer so blooms will work for approval and transfer for ALL erc20 tokens, this will be most people's primary use-case. Saying that this can be used in any way you want with any use-case as long as events are emitted then it's queryable. | ||
Functions | ||
|
||
[source, javascript] | ||
----------------- | ||
isBloom | ||
isBloom(bloom: string): boolean; | ||
----------------- | ||
|
||
Returns true if the bloom is a valid bloom. | ||
|
||
[source, javascript] | ||
----------------- | ||
isUserEthereumAddressInBloom | ||
isUserEthereumAddressInBloom(bloom: string, ethereumAddress: string): boolean; | ||
----------------- | ||
Returns true if the ethereum users address is part of the given bloom note: false positives are possible. | ||
|
||
[source, javascript] | ||
----------------- | ||
isContractAddressInBloom | ||
isContractAddressInBloom(bloom: string, contractAddress: string): boolean; | ||
----------------- | ||
Returns true if the contract address is part of the given bloom note: false positives are possible. | ||
|
||
[source, javascript] | ||
----------------- | ||
isTopic | ||
isTopic(topic: string): boolean; | ||
----------------- | ||
|
||
Returns true if the topic is valid | ||
[source, javascript] | ||
----------------- | ||
isTopicInBloom | ||
|
||
isTopicInBloom(bloom: string, topic: string): boolean; | ||
----------------- | ||
|
||
Returns true if the topic is part of the given bloom note: false positives are possible. | ||
|
||
[source, javascript] | ||
----------------- | ||
isInBloom | ||
----------------- | ||
This is the raw base method which the other bloom methods above use. You can pass in a bloom and a value which will return true if its part of the given bloom. | ||
|
||
[source, javascript] | ||
----------------- | ||
isInBloom(bloom: string, value: string | Uint8Array): boolean; | ||
----------------- | ||
|
||
Returns true if the value is part of the given bloom note: false positives are possible. | ||
|