Datasets:
Tasks:
Text Generation
Modalities:
Text
Formats:
json
Languages:
English
Size:
< 1K
ArXiv:
Tags:
benchmark
code-generation
transaction-code-generation
execution-grounded-evaluation
blockchain
evm
License:
File size: 4,359 Bytes
edbc049 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 | {
"id": "contract_payable_fallback",
"version": "2.0.0",
"category": "advanced_features",
"subcategory": "fallback",
"difficulty": "medium",
"title": "Payable Fallback - Send BNB to Contract",
"natural_language_templates": [
"Send {amount} BNB to the contract at {contract_address}",
"Transfer {amount} BNB to contract {contract_address} without calling any function",
"I want to send {amount} BNB directly to {contract_address}",
"Send {amount} BNB to {contract_address} (no function call)"
],
"description": [
"Send BNB directly to a contract without calling any specific function.",
"This will trigger the contract's receive() or fallback() function.",
"",
"Technical context:",
"- When you send BNB to a contract without calldata, it triggers receive() if it exists",
"- If receive() doesn't exist, it triggers fallback() if it's payable",
"- The transaction 'to' field is the contract address",
"- The 'value' field contains the BNB amount to send",
"- The 'data' field should be empty (0x) or omitted",
"- Recommended gas limit: 100000",
"",
"Fallback vs Receive:",
"- receive() external payable: Called when BNB is sent with empty calldata",
"- fallback() external payable: Called when function doesn't exist or as fallback for receive()",
"- At least one must be payable for the contract to receive BNB",
"",
"Key considerations:",
"- Do NOT include any function call data",
"- Set transaction 'value' to the BNB amount (in wei)",
"- Leave 'data' field empty or set to '0x'",
"- The contract must have a payable receive() or fallback() function",
"",
"Success criteria:",
"- Transaction executes successfully",
"- Correct contract address is used",
"- Correct BNB amount is sent",
"- No function call data (empty data field)",
"- Contract balance increases by the sent amount"
],
"blockchain": {
"chain": "BSC",
"network": "mainnet"
},
"parameters": {
"contract_address": {
"type": "address",
"role": "contract",
"description": "Contract address with payable fallback/receive",
"generation": {
"method": "from_env",
"env_key": "fallback_receiver_address",
"comment": "Use dynamically deployed FallbackReceiver contract from environment"
}
},
"amount": {
"type": "number",
"unit": "BNB",
"description": "Amount of BNB to send",
"generation": {
"method": "random",
"min": 0.001,
"max": 0.05,
"decimals": 4
},
"role": "transfer_amount"
}
},
"validation": {
"pre_conditions": [
{
"type": "contract_exists",
"description": "Contract must exist",
"address": "{contract_address}"
},
{
"type": "sufficient_balance",
"description": "Agent must have sufficient BNB balance",
"required": "{amount}"
}
],
"post_conditions": [
{
"type": "transaction_success",
"weight": 0.3,
"description": "Transaction executed successfully"
},
{
"type": "contract_address",
"weight": 0.2,
"description": "Transaction sent to correct contract",
"expected": "{contract_address}"
},
{
"type": "value_sent",
"weight": 0.2,
"description": "Correct BNB amount sent",
"expected": "{amount}"
},
{
"type": "empty_data",
"weight": 0.15,
"description": "No function call data (empty or 0x)",
"expected": "empty"
},
{
"type": "balance_increase",
"weight": 0.15,
"description": "Contract balance increased by sent amount",
"expected": "{amount}"
}
]
},
"metadata": {
"tags": [
"fallback",
"receive",
"payable",
"direct_transfer",
"advanced"
],
"estimated_gas": 100000,
"requires_contract": true,
"contract_requirements": {
"contract_type": "FallbackReceiver",
"required_functions": [
"receive() or fallback()"
],
"note": "Tests understanding of fallback/receive functions"
},
"educational_value": "Understanding fallback/receive is important for contract interactions and DeFi protocols"
}
}
|