-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from mdehoog/refcell/enhancements
Feat: Handler Extensions and Testing
- Loading branch information
Showing
32 changed files
with
1,858 additions
and
595 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
{ | ||
"network": { | ||
"blockchain": "Optimism", | ||
"network": "Goerli", | ||
"sub_network_identifier": null | ||
}, | ||
"online_url": "http://localhost:8080", | ||
"data_directory": "", | ||
"http_timeout": 300, | ||
"max_retries": 100, | ||
"max_online_connections": 500, | ||
"force_retry": true, | ||
"max_sync_concurrency": 64, | ||
"tip_delay": 120, | ||
"max_reorg_depth": 64, | ||
"log_configuration": false, | ||
"compression_disabled": true, | ||
"l0_in_memory_enabled": true, | ||
"all_in_memory_enabled": true, | ||
"table_size": 1, | ||
"value_log_file_size": 1024, | ||
"construction": null, | ||
"data": { | ||
"start_index": 4307133, | ||
"reconciliation_disabled": true, | ||
"inactive_discrepancy_search_disabled": true, | ||
"balance_tracking_disabled": true, | ||
"initial_balance_fetch_disabled":true, | ||
"active_reconciliation_concurrency": 32, | ||
"bootstrap_balances": "", | ||
"log_balance_changes": true, | ||
"log_transactions": true, | ||
"log_blocks": true, | ||
"end_conditions": { | ||
"tip": true | ||
} | ||
} | ||
} |
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,137 @@ | ||
request_funds(1){ | ||
find_account{ | ||
currency = {"symbol":"ETH", "decimals":18}; | ||
random_account = find_balance({ | ||
"minimum_balance":{ | ||
"value": "0", | ||
"currency": {{currency}} | ||
}, | ||
"create_limit":1 | ||
}); | ||
}, | ||
|
||
// Create a separate scenario to request funds so that | ||
// the address we are using to request funds does not | ||
// get rolled back if funds do not yet exist. | ||
request{ | ||
loaded_account = find_balance({ | ||
"account_identifier": {{random_account.account_identifier}}, | ||
"minimum_balance":{ | ||
"value": "10000000000000", | ||
"currency": {{currency}} | ||
} | ||
}); | ||
} | ||
} | ||
|
||
create_account(1){ | ||
create{ | ||
network = {"network":"Goerli", "blockchain":"Optimism"}; | ||
key = generate_key({"curve_type": "secp256k1"}); | ||
account = derive({ | ||
"network_identifier": {{network}}, | ||
"public_key": {{key.public_key}} | ||
}); | ||
|
||
// If the account is not saved, the key will be lost! | ||
save_account({ | ||
"account_identifier": {{account.account_identifier}}, | ||
"keypair": {{key}} | ||
}); | ||
} | ||
} | ||
|
||
transfer(1){ | ||
transfer{ | ||
transfer.network = {"network":"Goerli", "blockchain":"Optimism"}; | ||
currency = {"symbol":"ETH", "decimals":18}; | ||
sender = find_balance({ | ||
"minimum_balance":{ | ||
"value": "10000000000000", | ||
"currency": {{currency}} | ||
} | ||
}); | ||
|
||
// Set the recipient_amount as some value <= sender.balance-max_fee | ||
max_fee = "0"; | ||
available_amount = {{sender.balance.value}} - {{max_fee}}; | ||
recipient_amount = random_number({"minimum": "1", "maximum": {{available_amount}}}); | ||
print_message({"recipient_amount":{{recipient_amount}}}); | ||
|
||
// Find recipient and construct operations | ||
sender_amount = 0 - {{recipient_amount}}; | ||
recipient = find_balance({ | ||
"not_account_identifier":[{{sender.account_identifier}}], | ||
"minimum_balance":{ | ||
"value": "0", | ||
"currency": {{currency}} | ||
}, | ||
"create_limit": 100, | ||
"create_probability": 50 | ||
}); | ||
transfer.confirmation_depth = "1"; | ||
transfer.operations = [ | ||
{ | ||
"operation_identifier":{"index":0}, | ||
"type":"CALL", | ||
"account":{{sender.account_identifier}}, | ||
"amount":{ | ||
"value":{{sender_amount}}, | ||
"currency":{{currency}} | ||
} | ||
}, | ||
{ | ||
"operation_identifier":{"index":1}, | ||
"type":"CALL", | ||
"account":{{recipient.account_identifier}}, | ||
"amount":{ | ||
"value":{{recipient_amount}}, | ||
"currency":{{currency}} | ||
} | ||
} | ||
]; | ||
} | ||
} | ||
|
||
return_funds(1){ | ||
transfer{ | ||
transfer.network = {"network":"Goerli", "blockchain":"Optimism"}; | ||
currency = {"symbol":"ETH", "decimals":18}; | ||
max_fee = "0"; | ||
sender = find_balance({ | ||
"minimum_balance":{ | ||
"value": {{max_fee}}, | ||
"currency": {{currency}} | ||
} | ||
}); | ||
|
||
// Set the recipient_amount as some sender.balance-max_fee | ||
available_amount = {{sender.balance.value}} - {{max_fee}}; | ||
print_message({"available_amount":{{available_amount}}}); | ||
sender_amount = 0 - {{available_amount}}; | ||
|
||
// Provide a static address as the recipient and construct operations | ||
faucet = {"address":"0xb41B39479a525AB69e38c701A713D98E3074252c"}; | ||
transfer.confirmation_depth = "1"; | ||
transfer.operations = [ | ||
{ | ||
"operation_identifier":{"index":0}, | ||
"type":"CALL", | ||
"account":{{sender.account_identifier}}, | ||
"amount":{ | ||
"value":{{sender_amount}}, | ||
"currency":{{currency}} | ||
} | ||
}, | ||
{ | ||
"operation_identifier":{"index":1}, | ||
"type":"CALL", | ||
"account":{{faucet}}, | ||
"amount":{ | ||
"value":{{available_amount}}, | ||
"currency":{{currency}} | ||
} | ||
} | ||
]; | ||
} | ||
} |
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,111 @@ | ||
create_account(1){ | ||
create{ | ||
network = {"network":"Goerli", "blockchain":"Optimism"}; | ||
key = generate_key({"curve_type": "secp256k1"}); | ||
account = derive({ | ||
"network_identifier": {{network}}, | ||
"public_key": {{key.public_key}} | ||
}); | ||
|
||
// If the account is not saved, the key will be lost! | ||
save_account({ | ||
"account_identifier": {{account.account_identifier}}, | ||
"keypair": {{key}} | ||
}); | ||
} | ||
} | ||
|
||
transfer(10){ | ||
transfer{ | ||
transfer.network = {"network":"Goerli", "blockchain":"Optimism"}; | ||
currency = {"symbol":"ETH", "decimals":18}; | ||
sender = find_balance({ | ||
"minimum_balance":{ | ||
"value": "10000000000000000", | ||
"currency": {{currency}} | ||
} | ||
}); | ||
|
||
// Set the recipient_amount as some value <= sender.balance-max_fee | ||
max_fee = "84000000000000"; | ||
available_amount = {{sender.balance.value}} - {{max_fee}}; | ||
recipient_amount = random_number({"minimum": "1", "maximum": {{available_amount}}}); | ||
print_message({"recipient_amount":{{recipient_amount}}}); | ||
|
||
// Find recipient and construct operations | ||
sender_amount = 0 - {{recipient_amount}}; | ||
recipient = find_balance({ | ||
"not_account_identifier":[{{sender.account_identifier}}], | ||
"minimum_balance":{ | ||
"value": "0", | ||
"currency": {{currency}} | ||
}, | ||
"create_limit": 100, | ||
"create_probability": 50 | ||
}); | ||
transfer.confirmation_depth = "1"; | ||
transfer.operations = [ | ||
{ | ||
"operation_identifier":{"index":0}, | ||
"type":"CALL", | ||
"account":{{sender.account_identifier}}, | ||
"amount":{ | ||
"value":{{sender_amount}}, | ||
"currency":{{currency}} | ||
} | ||
}, | ||
{ | ||
"operation_identifier":{"index":1}, | ||
"type":"CALL", | ||
"account":{{recipient.account_identifier}}, | ||
"amount":{ | ||
"value":{{recipient_amount}}, | ||
"currency":{{currency}} | ||
} | ||
} | ||
]; | ||
} | ||
} | ||
|
||
return_funds(10){ | ||
transfer{ | ||
transfer.network = {"network":"Goerli", "blockchain":"Optimism"}; | ||
currency = {"symbol":"ETH", "decimals":18}; | ||
max_fee = "84000000000000"; | ||
sender = find_balance({ | ||
"minimum_balance":{ | ||
"value": {{max_fee}}, | ||
"currency": {{currency}} | ||
} | ||
}); | ||
|
||
// Set the recipient_amount as some sender.balance-max_fee | ||
available_amount = {{sender.balance.value}} - {{max_fee}}; | ||
print_message({"available_amount":{{available_amount}}}); | ||
sender_amount = 0 - {{available_amount}}; | ||
|
||
// Provide a static address as the recipient and construct operations | ||
faucet = {"address":"0x9670d6977d0b10130E5d4916c9134363281B6B0e"}; | ||
transfer.confirmation_depth = "1"; | ||
transfer.operations = [ | ||
{ | ||
"operation_identifier":{"index":0}, | ||
"type":"CALL", | ||
"account":{{sender.account_identifier}}, | ||
"amount":{ | ||
"value":{{sender_amount}}, | ||
"currency":{{currency}} | ||
} | ||
}, | ||
{ | ||
"operation_identifier":{"index":1}, | ||
"type":"CALL", | ||
"account":{{faucet}}, | ||
"amount":{ | ||
"value":{{available_amount}}, | ||
"currency":{{currency}} | ||
} | ||
} | ||
]; | ||
} | ||
} |
Oops, something went wrong.