-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixed function selectors on dynamic arrays, added scripts to "see" th…
…e whole process end to end
- Loading branch information
1 parent
1f313bb
commit 1df2ff9
Showing
8 changed files
with
162 additions
and
7 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
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
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
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
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
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,17 @@ | ||
from ape import project, accounts, networks | ||
from scripts.helper_functions import get_account, get_or_deploy_contract | ||
|
||
|
||
def read_counter(): | ||
account = get_account() | ||
ecosystem = networks.active_provider.network.ecosystem.name | ||
chain_name = networks.active_provider.network.name | ||
|
||
keepers_consumer = project.KeepersConsumer.deployments[-1] | ||
response = keepers_consumer.counter() | ||
print(f"The current count is {response}") | ||
return keepers_consumer | ||
|
||
|
||
def main(): | ||
read_counter() |
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,17 @@ | ||
from ape import project, accounts, networks | ||
from scripts.helper_functions import get_account, get_or_deploy_contract | ||
|
||
|
||
def read_price_feed(): | ||
account = get_account() | ||
ecosystem = networks.active_provider.network.ecosystem.name | ||
chain_name = networks.active_provider.network.name | ||
|
||
price_feed_consumer = project.PriceConsumer.deployments[-1] | ||
response = price_feed_consumer.get_latest_price() | ||
print(f"The current price of ETH is {response}") | ||
return price_feed_consumer | ||
|
||
|
||
def main(): | ||
read_price_feed() |
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,38 @@ | ||
from ape import project, accounts, networks | ||
from scripts.helper_functions import get_account, get_or_deploy_contract | ||
import time | ||
|
||
|
||
def request_and_read_randomness(): | ||
account = get_account() | ||
ecosystem = networks.active_provider.network.ecosystem.name | ||
chain_name = networks.active_provider.network.name | ||
|
||
vrf_consumer = project.VRConsumerV2.deployments[-1] | ||
request_tx = vrf_consumer.request_random_words(sender=account) | ||
|
||
print("Request sent! Let's wait for a response...") | ||
|
||
randomness = wait_for_randomness(vrf_consumer) | ||
if randomness: | ||
print(f"The random number was {randomness}") | ||
else: | ||
print("No random number found") | ||
|
||
|
||
def wait_for_randomness(vrf_consumer, timeout=200, poll_interval=2): | ||
print("Waiting for random response...") | ||
start_time = time.time() | ||
current_time = time.time() | ||
while current_time - start_time < timeout: | ||
response = vrf_consumer.random_words(0) | ||
if response > 0: | ||
return response | ||
time.sleep(poll_interval) | ||
current_time = time.time() | ||
print("Done waiting!") | ||
return None | ||
|
||
|
||
def main(): | ||
request_and_read_randomness() |