diff --git a/contracts/cairo/deploy.sh b/contracts/cairo/deploy.sh index f647f934..43d022c3 100755 --- a/contracts/cairo/deploy.sh +++ b/contracts/cairo/deploy.sh @@ -28,3 +28,5 @@ echo $NATIVE_TOKEN_ETH_STARKNET CONTRACT_ADDRESS=`starkli deploy --rpc $SN_RPC_URL $CLASS_HASH $HERODOTUS_FACTS_REGISTRY $ETH_CONTRACT_ADDR $MM_ETHEREUM_WALLET $SN_WALLET_ADDR $NATIVE_TOKEN_ETH_STARKNET 2>&1 | grep -A1 "Contract deployed" | sed '1d'` echo $CONTRACT_ADDRESS + +starkli invoke --rpc $SN_RPC_URL eth approve $CONTRACT_ADDRESS 1000000000 1000000000 diff --git a/contracts/cairo/src/escrow.cairo b/contracts/cairo/src/escrow.cairo index f8c4de1f..b67dece1 100644 --- a/contracts/cairo/src/escrow.cairo +++ b/contracts/cairo/src/escrow.cairo @@ -3,7 +3,8 @@ use starknet::{ContractAddress, EthAddress}; #[derive(Copy, Drop, Serde, starknet::Store)] struct Order { recipient_address: EthAddress, - amount: u256 + amount: u256, + fee: u256 } #[starknet::interface] @@ -16,6 +17,8 @@ trait IEscrow { fn get_order_used(self: @ContractState, order_id: u256) -> bool; + fn get_order_fee(self: @ContractState, order_id: u256) -> u256; + fn withdraw(ref self: ContractState, order_id: u256, block: u256, slot: u256); fn get_herodotus_facts_registry_contract(self: @ContractState) -> ContractAddress; @@ -34,7 +37,7 @@ trait IEscrow { mod Escrow { use super::{IEscrow, Order}; - use starknet::{ContractAddress, EthAddress, get_caller_address, get_contract_address}; + use starknet::{ContractAddress, EthAddress, get_caller_address, get_contract_address, get_block_timestamp}; use yab::interfaces::IERC20::{IERC20Dispatcher, IERC20DispatcherTrait}; use yab::interfaces::IEVMFactsRegistry::{ @@ -59,6 +62,7 @@ mod Escrow { order_id: u256, recipient_address: EthAddress, amount: u256, + fee: u256 } #[derive(Drop, starknet::Event)] @@ -74,6 +78,8 @@ mod Escrow { current_order_id: u256, orders: LegacyMap::, orders_used: LegacyMap::, + orders_senders: LegacyMap::, + orders_timestamps: LegacyMap::, herodotus_facts_registry_contract: ContractAddress, eth_transfer_contract: EthAddress, // our transfer contract in L1 mm_ethereum_wallet: EthAddress, @@ -107,22 +113,22 @@ mod Escrow { } fn set_order(ref self: ContractState, order: Order) -> u256 { - // TODO expiry can't be less than 24h assert(order.amount > 0, 'Amount must be greater than 0'); let mut order_id = self.current_order_id.read(); self.orders.write(order_id, order); self.orders_used.write(order_id, false); - - // TODO: add allowance ? + self.orders_senders.write(order_id, get_caller_address()); + self.orders_timestamps.write(order_id, get_block_timestamp()); + let payment_amount = order.amount + order.fee; IERC20Dispatcher { contract_address: self.native_token_eth_starknet.read() } - .transferFrom(get_caller_address(), get_contract_address(), order.amount); + .transferFrom(get_caller_address(), get_contract_address(), payment_amount); self .emit( SetOrder { - order_id, recipient_address: order.recipient_address, amount: order.amount + order_id, recipient_address: order.recipient_address, amount: order.amount, fee: order.fee } ); @@ -132,14 +138,28 @@ mod Escrow { fn cancel_order( ref self: ContractState, order_id: u256 - ) { // TODO the order can be cancelled if no one reserved yet - // the user can retrieve all the funds without waiting for the expiry + ) { + assert(!self.orders_used.read(order_id), 'Order already withdrawed'); + assert(get_block_timestamp() - self.orders_timestamps.read(order_id) < 43200, 'Didnt passed enough time'); + + let sender = self.orders_senders.read(order_id); + assert(sender == get_caller_address(), 'Only sender allowed'); + let order = self.orders.read(order_id); + let payment_amount = order.amount + order.fee; + + IERC20Dispatcher { contract_address: self.native_token_eth_starknet.read() } + .transfer(sender, payment_amount); } fn get_order_used(self: @ContractState, order_id: u256) -> bool { self.orders_used.read(order_id) } + fn get_order_fee(self: @ContractState, order_id: u256) -> u256 { + let order: Order = self.orders.read(order_id); + order.fee + } + fn withdraw(ref self: ContractState, order_id: u256, block: u256, slot: u256) { assert(!self.orders_used.read(order_id), 'Order already withdrawed'); @@ -182,9 +202,10 @@ mod Escrow { assert(order.amount == amount, 'amount not match L1'); self.orders_used.write(order_id, true); + let payment_amount = order.amount + order.fee; IERC20Dispatcher { contract_address: self.native_token_eth_starknet.read() } - .transfer(self.mm_starknet_wallet.read(), amount); + .transfer(self.mm_starknet_wallet.read(), payment_amount); self.emit(Withdraw { order_id, address: self.mm_starknet_wallet.read(), amount }); } @@ -258,9 +279,10 @@ mod Escrow { assert(order.amount == amount, 'amount not match L1'); self.orders_used.write(order_id, true); + let payment_amount = order.amount + order.fee; IERC20Dispatcher { contract_address: self.native_token_eth_starknet.read() } - .transfer(self.mm_starknet_wallet.read(), amount); + .transfer(self.mm_starknet_wallet.read(), payment_amount); self.emit(Withdraw { order_id, address: self.mm_starknet_wallet.read(), amount }); } diff --git a/contracts/cairo/src/mocks/mock_EVMFactsRegistry.cairo b/contracts/cairo/src/mocks/mock_EVMFactsRegistry.cairo index a3e46904..1896be10 100644 --- a/contracts/cairo/src/mocks/mock_EVMFactsRegistry.cairo +++ b/contracts/cairo/src/mocks/mock_EVMFactsRegistry.cairo @@ -10,7 +10,7 @@ mod EVMFactsRegistry { #[constructor] fn constructor(ref self: ContractState) { self.slots.write(0, 12345); // mock recipient_address - self.slots.write(2, 500); // mock amount + self.slots.write(1, 500); // mock amount } #[external(v0)] diff --git a/contracts/cairo/src/tests/test_escrow.cairo b/contracts/cairo/src/tests/test_escrow.cairo index 86cc9936..f114506f 100644 --- a/contracts/cairo/src/tests/test_escrow.cairo +++ b/contracts/cairo/src/tests/test_escrow.cairo @@ -82,7 +82,7 @@ mod Escrow { assert(eth_token.balanceOf(MM_STARKNET()) == 0, 'init: wrong balance'); start_prank(escrow.contract_address, USER()); - let order = Order { recipient_address: 12345.try_into().unwrap(), amount: 500 }; + let order = Order { recipient_address: 12345.try_into().unwrap(), amount: 500, fee: 0 }; let order_id = escrow.set_order(order); stop_prank(escrow.contract_address); diff --git a/mm-bot/abi/YABTransfer.json b/mm-bot/abi/YABTransfer.json index 8d9a7a7c..c1533da6 100644 --- a/mm-bot/abi/YABTransfer.json +++ b/mm-bot/abi/YABTransfer.json @@ -1,5 +1,26 @@ { "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "snMessaging", + "type": "address" + }, + { + "internalType": "uint256", + "name": "snEscrowAddress", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "snEscrowWithdrawSelector", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, { "anonymous": false, "inputs": [ @@ -42,6 +63,32 @@ "name": "Transfer", "type": "event" }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "snEscrowAddress", + "type": "uint256" + } + ], + "name": "setEscrowAddress", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "snEscrowWithdrawSelector", + "type": "uint256" + } + ], + "name": "setEscrowWithdrawSelector", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, { "inputs": [ { @@ -68,9 +115,9 @@ { "inputs": [ { - "internalType": "uint256", + "internalType": "bytes32", "name": "", - "type": "uint256" + "type": "bytes32" } ], "name": "transfers", @@ -93,30 +140,77 @@ ], "stateMutability": "view", "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "orderId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "destAddress", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "withdraw", + "outputs": [], + "stateMutability": "payable", + "type": "function" } ], "bytecode": { - "object": "0x608060405234801561001057600080fd5b506103ed806100206000396000f3fe6080604052600436106100295760003560e01c806390dd26271461002e5780639377d71114610043575b600080fd5b61004161003c366004610372565b6100a3565b005b34801561004f57600080fd5b5061008261005e36600461039e565b60006020819052908152604090208054600182015460029092015490919060ff1683565b60408051938452602084019290925215159082015260600160405180910390f35b816000036100f85760405162461bcd60e51b815260206004820152601c60248201527f496e76616c69642064657374696e6174696f6e20616464726573732e0000000060448201526064015b60405180910390fd5b600081116101595760405162461bcd60e51b815260206004820152602860248201527f496e76616c696420616d6f756e742c2073686f756c6420626520686967686572604482015267103a3430b710181760c11b60648201526084016100ef565b8034146101b85760405162461bcd60e51b815260206004820152602760248201527f496e76616c696420616d6f756e742c2073686f756c64206d61746368206d7367604482015266173b30b63ab29760c91b60648201526084016100ef565b60008381526020819052604090206002015460ff161561021a5760405162461bcd60e51b815260206004820152601b60248201527f5472616e7366657220616c72656164792070726f6365737365642e000000000060448201526064016100ef565b604080516060810182528381526020808201848152600183850181815260008981529384905285842094518555915190840155516002909201805460ff19169215159290921790915590516001600160a01b0384169034908381818185875af1925050503d80600081146102aa576040519150601f19603f3d011682016040523d82523d6000602084013e6102af565b606091505b50509050806102f35760405162461bcd60e51b815260206004820152601060248201526f2a3930b739b332b9103330b4b632b21760811b60448201526064016100ef565b837fb2511a43843fb5ad643d84c36214ea6ac6368d0ba2f4714f59c2c36124e87e27336000808881526020019081526020016000206040516103649291906001600160a01b0392909216825280546020830152600181015460408301526002015460ff161515606082015260800190565b60405180910390a250505050565b60008060006060848603121561038757600080fd5b505081359360208301359350604090920135919050565b6000602082840312156103b057600080fd5b503591905056fea2646970667358221220990615ab1729dc1baf8436923bb696069d9a39442bc0306bb092d8e1c56ab61f64736f6c63430008160033", - "sourceMap": "65:993:15:-:0;;;;;;;;;;;;;;;;;;;", + "object": "0x608060405234801561001057600080fd5b5060405161086b38038061086b83398101604081905261002f91610069565b60018054336001600160a01b031991821617909155600280549091166001600160a01b0394909416939093179092556003556004556100ac565b60008060006060848603121561007e57600080fd5b83516001600160a01b038116811461009557600080fd5b602085015160409095015190969495509392505050565b6107b0806100bb6000396000f3fe60806040526004361061004a5760003560e01c80633c64f04b1461004f5780633e95784a146100af57806390dd2627146100d15780639a63d92d146100e4578063a41fe49f14610104575b600080fd5b34801561005b57600080fd5b5061008e61006a366004610664565b60006020819052908152604090208054600182015460029092015490919060ff1683565b60408051938452602084019290925215159082015260600160405180910390f35b3480156100bb57600080fd5b506100cf6100ca366004610664565b610117565b005b6100cf6100df36600461067d565b61014f565b3480156100f057600080fd5b506100cf6100ff366004610664565b610450565b6100cf61011236600461067d565b61047f565b6001546001600160a01b0316331461014a5760405162461bcd60e51b8152600401610141906106a9565b60405180910390fd5b600455565b8160000361019f5760405162461bcd60e51b815260206004820152601c60248201527f496e76616c69642064657374696e6174696f6e20616464726573732e000000006044820152606401610141565b600081116102005760405162461bcd60e51b815260206004820152602860248201527f496e76616c696420616d6f756e742c2073686f756c6420626520686967686572604482015267103a3430b710181760c11b6064820152608401610141565b80341461025f5760405162461bcd60e51b815260206004820152602760248201527f496e76616c696420616d6f756e742c2073686f756c64206d61746368206d7367604482015266173b30b63ab29760c91b6064820152608401610141565b60408051602081018590529081018390526060810182905260009060800160408051601f19818403018152918152815160209283012060008181529283905291206002015490915060ff16156102f75760405162461bcd60e51b815260206004820152601b60248201527f5472616e7366657220616c72656164792070726f6365737365642e00000000006044820152606401610141565b604080516060810182528481526020808201858152600183850181815260008781529384905285842094518555915190840155516002909201805460ff19169215159290921790915590516001600160a01b0385169034908381818185875af1925050503d8060008114610387576040519150601f19603f3d011682016040523d82523d6000602084013e61038c565b606091505b50509050806103d05760405162461bcd60e51b815260206004820152601060248201526f2a3930b739b332b9103330b4b632b21760811b6044820152606401610141565b847fb2511a43843fb5ad643d84c36214ea6ac6368d0ba2f4714f59c2c36124e87e27336000808681526020019081526020016000206040516104419291906001600160a01b0392909216825280546020830152600181015460408301526002015460ff161515606082015260800190565b60405180910390a25050505050565b6001546001600160a01b0316331461047a5760405162461bcd60e51b8152600401610141906106a9565b600355565b60408051602081018590529081018390526060810182905260009060800160408051601f198184030181529181528151602092830120600081815292839052912060028101549192509060ff1615156001146105135760405162461bcd60e51b81526020600482015260136024820152722a3930b739b332b9103737ba103337bab7321760691b6044820152606401610141565b60408051600580825260c082019092526000916020820160a080368337019050509050858160008151811061054a5761054a6106eb565b60200260200101818152505060008160018151811061056b5761056b6106eb565b60200260200101818152505081600001548160028151811061058f5761058f6106eb565b6020026020010181815250508160010154816003815181106105b3576105b36106eb565b6020026020010181815250506000816004815181106105d4576105d46106eb565b602090810291909101015260025460035460048054604051633e3aa6c560e01b81526001600160a01b0390941693633e3aa6c5933493610618939192889101610701565b604080518083038185885af1158015610635573d6000803e3d6000fd5b50505050506040513d601f19601f8201168201806040525081019061065a9190610756565b5050505050505050565b60006020828403121561067657600080fd5b5035919050565b60008060006060848603121561069257600080fd5b505081359360208301359350604090920135919050565b60208082526022908201527f4f6e6c79206f776e65722063616e2063616c6c20746869732066756e6374696f604082015261371760f11b606082015260800190565b634e487b7160e01b600052603260045260246000fd5b6000606082018583526020858185015260606040850152818551808452608086019150828701935060005b818110156107485784518352938301939183019160010161072c565b509098975050505050505050565b6000806040838503121561076957600080fd5b50508051602090910151909290915056fea2646970667358221220d0a958d7f2408ff56a3d1eee1e6f811a3f920768f8ffe1cbd3b500c41920070764736f6c63430008150033", + "sourceMap": "134:2667:24:-:0;;;575:315;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;702:6;:19;;711:10;-1:-1:-1;;;;;;702:19:24;;;;;;;731:12;:46;;;;;-1:-1:-1;;;;;731:46:24;;;;;;;;;;;787:16;:34;831:25;:52;134:2667;;14:412:26;102:6;110;118;171:2;159:9;150:7;146:23;142:32;139:52;;;187:1;184;177:12;139:52;213:16;;-1:-1:-1;;;;;258:31:26;;248:42;;238:70;;304:1;301;294:12;238:70;372:2;357:18;;351:25;416:2;401:18;;;395:25;327:5;;351:25;;-1:-1:-1;395:25:26;14:412;-1:-1:-1;;;14:412:26:o;:::-;134:2667:24;;;;;;", "linkReferences": {} }, "deployedBytecode": { - "object": "0x6080604052600436106100295760003560e01c806390dd26271461002e5780639377d71114610043575b600080fd5b61004161003c366004610372565b6100a3565b005b34801561004f57600080fd5b5061008261005e36600461039e565b60006020819052908152604090208054600182015460029092015490919060ff1683565b60408051938452602084019290925215159082015260600160405180910390f35b816000036100f85760405162461bcd60e51b815260206004820152601c60248201527f496e76616c69642064657374696e6174696f6e20616464726573732e0000000060448201526064015b60405180910390fd5b600081116101595760405162461bcd60e51b815260206004820152602860248201527f496e76616c696420616d6f756e742c2073686f756c6420626520686967686572604482015267103a3430b710181760c11b60648201526084016100ef565b8034146101b85760405162461bcd60e51b815260206004820152602760248201527f496e76616c696420616d6f756e742c2073686f756c64206d61746368206d7367604482015266173b30b63ab29760c91b60648201526084016100ef565b60008381526020819052604090206002015460ff161561021a5760405162461bcd60e51b815260206004820152601b60248201527f5472616e7366657220616c72656164792070726f6365737365642e000000000060448201526064016100ef565b604080516060810182528381526020808201848152600183850181815260008981529384905285842094518555915190840155516002909201805460ff19169215159290921790915590516001600160a01b0384169034908381818185875af1925050503d80600081146102aa576040519150601f19603f3d011682016040523d82523d6000602084013e6102af565b606091505b50509050806102f35760405162461bcd60e51b815260206004820152601060248201526f2a3930b739b332b9103330b4b632b21760811b60448201526064016100ef565b837fb2511a43843fb5ad643d84c36214ea6ac6368d0ba2f4714f59c2c36124e87e27336000808881526020019081526020016000206040516103649291906001600160a01b0392909216825280546020830152600181015460408301526002015460ff161515606082015260800190565b60405180910390a250505050565b60008060006060848603121561038757600080fd5b505081359360208301359350604090920135919050565b6000602082840312156103b057600080fd5b503591905056fea2646970667358221220990615ab1729dc1baf8436923bb696069d9a39442bc0306bb092d8e1c56ab61f64736f6c63430008160033", - "sourceMap": "65:993:15:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;348:708;;;;;;:::i;:::-;;:::i;:::-;;292:49;;;;;;;;;;-1:-1:-1;292:49:15;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;716:25:16;;;772:2;757:18;;750:34;;;;827:14;820:22;800:18;;;793:50;704:2;689:18;292:49:15;;;;;;;348:708;455:11;470:1;455:16;447:57;;;;-1:-1:-1;;;447:57:15;;1056:2:16;447:57:15;;;1038:21:16;1095:2;1075:18;;;1068:30;1134;1114:18;;;1107:58;1182:18;;447:57:15;;;;;;;;;531:1;522:6;:10;514:63;;;;-1:-1:-1;;;514:63:15;;1413:2:16;514:63:15;;;1395:21:16;1452:2;1432:18;;;1425:30;1491:34;1471:18;;;1464:62;-1:-1:-1;;;1542:18:16;;;1535:38;1590:19;;514:63:15;1211:404:16;514:63:15;608:6;595:9;:19;587:71;;;;-1:-1:-1;;;587:71:15;;1822:2:16;587:71:15;;;1804:21:16;1861:2;1841:18;;;1834:30;1900:34;1880:18;;;1873:62;-1:-1:-1;;;1951:18:16;;;1944:37;1998:19;;587:71:15;1620:403:16;587:71:15;676:9;:18;;;;;;;;;;:25;;;;;:34;668:74;;;;-1:-1:-1;;;668:74:15;;2230:2:16;668:74:15;;;2212:21:16;2269:2;2249:18;;;2242:30;2308:29;2288:18;;;2281:57;2355:18;;668:74:15;2028:351:16;668:74:15;774:70;;;;;;;;;;;;;;;;;;838:4;774:70;;;;;;-1:-1:-1;753:18:15;;;;;;;;;;:91;;;;;;;;;;;;;;;;;-1:-1:-1;;753:91:15;;;;;;;;;;;873:65;;-1:-1:-1;;;;;873:43:15;;;924:9;;-1:-1:-1;873:65:15;-1:-1:-1;873:65:15;924:9;873:43;:65;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;855:83;;;957:7;949:36;;;;-1:-1:-1;;;949:36:15;;2796:2:16;949:36:15;;;2778:21:16;2835:2;2815:18;;;2808:30;-1:-1:-1;;;2854:18:16;;;2847:46;2910:18;;949:36:15;2594:340:16;949:36:15;1009:7;1000:49;1018:10;1030:9;:18;1040:7;1030:18;;;;;;;;;;;1000:49;;;;;;-1:-1:-1;;;;;3191:32:16;;;;3173:51;;3260:13;;3255:2;3240:18;;3233:41;3220:1;3316:17;;3310:24;3305:2;3290:18;;3283:52;3407:4;3395:17;3389:24;3415:4;3385:35;3378:43;3371:51;3366:2;3351:18;;3344:79;3160:3;3145:19;;2939:490;1000:49:15;;;;;;;;437:619;348:708;;;:::o;14:316:16:-;91:6;99;107;160:2;148:9;139:7;135:23;131:32;128:52;;;176:1;173;166:12;128:52;-1:-1:-1;;199:23:16;;;269:2;254:18;;241:32;;-1:-1:-1;320:2:16;305:18;;;292:32;;14:316;-1:-1:-1;14:316:16:o;335:180::-;394:6;447:2;435:9;426:7;422:23;418:32;415:52;;;463:1;460;453:12;415:52;-1:-1:-1;486:23:16;;335:180;-1:-1:-1;335:180:16:o", + "object": "0x60806040526004361061004a5760003560e01c80633c64f04b1461004f5780633e95784a146100af57806390dd2627146100d15780639a63d92d146100e4578063a41fe49f14610104575b600080fd5b34801561005b57600080fd5b5061008e61006a366004610664565b60006020819052908152604090208054600182015460029092015490919060ff1683565b60408051938452602084019290925215159082015260600160405180910390f35b3480156100bb57600080fd5b506100cf6100ca366004610664565b610117565b005b6100cf6100df36600461067d565b61014f565b3480156100f057600080fd5b506100cf6100ff366004610664565b610450565b6100cf61011236600461067d565b61047f565b6001546001600160a01b0316331461014a5760405162461bcd60e51b8152600401610141906106a9565b60405180910390fd5b600455565b8160000361019f5760405162461bcd60e51b815260206004820152601c60248201527f496e76616c69642064657374696e6174696f6e20616464726573732e000000006044820152606401610141565b600081116102005760405162461bcd60e51b815260206004820152602860248201527f496e76616c696420616d6f756e742c2073686f756c6420626520686967686572604482015267103a3430b710181760c11b6064820152608401610141565b80341461025f5760405162461bcd60e51b815260206004820152602760248201527f496e76616c696420616d6f756e742c2073686f756c64206d61746368206d7367604482015266173b30b63ab29760c91b6064820152608401610141565b60408051602081018590529081018390526060810182905260009060800160408051601f19818403018152918152815160209283012060008181529283905291206002015490915060ff16156102f75760405162461bcd60e51b815260206004820152601b60248201527f5472616e7366657220616c72656164792070726f6365737365642e00000000006044820152606401610141565b604080516060810182528481526020808201858152600183850181815260008781529384905285842094518555915190840155516002909201805460ff19169215159290921790915590516001600160a01b0385169034908381818185875af1925050503d8060008114610387576040519150601f19603f3d011682016040523d82523d6000602084013e61038c565b606091505b50509050806103d05760405162461bcd60e51b815260206004820152601060248201526f2a3930b739b332b9103330b4b632b21760811b6044820152606401610141565b847fb2511a43843fb5ad643d84c36214ea6ac6368d0ba2f4714f59c2c36124e87e27336000808681526020019081526020016000206040516104419291906001600160a01b0392909216825280546020830152600181015460408301526002015460ff161515606082015260800190565b60405180910390a25050505050565b6001546001600160a01b0316331461047a5760405162461bcd60e51b8152600401610141906106a9565b600355565b60408051602081018590529081018390526060810182905260009060800160408051601f198184030181529181528151602092830120600081815292839052912060028101549192509060ff1615156001146105135760405162461bcd60e51b81526020600482015260136024820152722a3930b739b332b9103737ba103337bab7321760691b6044820152606401610141565b60408051600580825260c082019092526000916020820160a080368337019050509050858160008151811061054a5761054a6106eb565b60200260200101818152505060008160018151811061056b5761056b6106eb565b60200260200101818152505081600001548160028151811061058f5761058f6106eb565b6020026020010181815250508160010154816003815181106105b3576105b36106eb565b6020026020010181815250506000816004815181106105d4576105d46106eb565b602090810291909101015260025460035460048054604051633e3aa6c560e01b81526001600160a01b0390941693633e3aa6c5933493610618939192889101610701565b604080518083038185885af1158015610635573d6000803e3d6000fd5b50505050506040513d601f19601f8201168201806040525081019061065a9190610756565b5050505050505050565b60006020828403121561067657600080fd5b5035919050565b60008060006060848603121561069257600080fd5b505081359360208301359350604090920135919050565b60208082526022908201527f4f6e6c79206f776e65722063616e2063616c6c20746869732066756e6374696f604082015261371760f11b606082015260800190565b634e487b7160e01b600052603260045260246000fd5b6000606082018583526020858185015260606040850152818551808452608086019150828701935060005b818110156107485784518352938301939183019160010161072c565b509098975050505050505050565b6000806040838503121561076957600080fd5b50508051602090910151909290915056fea2646970667358221220d0a958d7f2408ff56a3d1eee1e6f811a3f920768f8ffe1cbd3b500c41920070764736f6c63430008150033", + "sourceMap": "134:2667:24:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;361:49;;;;;;;;;;-1:-1:-1;361:49:24;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;395:25:26;;;451:2;436:18;;429:34;;;;506:14;499:22;479:18;;;472:50;383:2;368:18;361:49:24;;;;;;;2575:224;;;;;;;;;;-1:-1:-1;2575:224:24;;;;;:::i;:::-;;:::i;:::-;;896:786;;;;;;:::i;:::-;;:::i;2381:188::-;;;;;;;;;;-1:-1:-1;2381:188:24;;;;;:::i;:::-;;:::i;1688:687::-;;;;;;:::i;:::-;;:::i;2575:224::-;2685:6;;-1:-1:-1;;;;;2685:6:24;2671:10;:20;2663:67;;;;-1:-1:-1;;;2663:67:24;;;;;;;:::i;:::-;;;;;;;;;2740:25;:52;2575:224::o;896:786::-;1003:11;1018:1;1003:16;995:57;;;;-1:-1:-1;;;995:57:24;;1644:2:26;995:57:24;;;1626:21:26;1683:2;1663:18;;;1656:30;1722;1702:18;;;1695:58;1770:18;;995:57:24;1442:352:26;995:57:24;1079:1;1070:6;:10;1062:63;;;;-1:-1:-1;;;1062:63:24;;2001:2:26;1062:63:24;;;1983:21:26;2040:2;2020:18;;;2013:30;2079:34;2059:18;;;2052:62;-1:-1:-1;;;2130:18:26;;;2123:38;2178:19;;1062:63:24;1799:404:26;1062:63:24;1156:6;1143:9;:19;1135:71;;;;-1:-1:-1;;;1135:71:24;;2410:2:26;1135:71:24;;;2392:21:26;2449:2;2429:18;;;2422:30;2488:34;2468:18;;;2461:62;-1:-1:-1;;;2539:18:26;;;2532:37;2586:19;;1135:71:24;2208:403:26;1135:71:24;1243:46;;;;;;2801:19:26;;;2836:12;;;2829:28;;;2873:12;;;2866:28;;;1217:13:24;;2910:12:26;;1243:46:24;;;-1:-1:-1;;1243:46:24;;;;;;;;;1233:57;;1243:46;1233:57;;;;1308:9;:16;;;;;;;;;:23;;;1233:57;;-1:-1:-1;1308:23:24;;:32;1300:72;;;;-1:-1:-1;;;1300:72:24;;3135:2:26;1300:72:24;;;3117:21:26;3174:2;3154:18;;;3147:30;3213:29;3193:18;;;3186:57;3260:18;;1300:72:24;2933:351:26;1300:72:24;1402:70;;;;;;;;;;;;;;;;;;1466:4;1402:70;;;;;;-1:-1:-1;1383:16:24;;;;;;;;;;:89;;;;;;;;;;;;;;;;;-1:-1:-1;;1383:89:24;;;;;;;;;;;1501:65;;-1:-1:-1;;;;;1501:43:24;;;1552:9;;-1:-1:-1;1501:65:24;-1:-1:-1;1501:65:24;1552:9;1501:43;:65;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1483:83;;;1585:7;1577:36;;;;-1:-1:-1;;;1577:36:24;;3701:2:26;1577:36:24;;;3683:21:26;3740:2;3720:18;;;3713:30;-1:-1:-1;;;3759:18:26;;;3752:46;3815:18;;1577:36:24;3499:340:26;1577:36:24;1637:7;1628:47;1646:10;1658:9;:16;1668:5;1658:16;;;;;;;;;;;1628:47;;;;;;-1:-1:-1;;;;;4096:32:26;;;;4078:51;;4165:13;;4160:2;4145:18;;4138:41;4125:1;4221:17;;4215:24;4210:2;4195:18;;4188:52;4312:4;4300:17;4294:24;4320:4;4290:35;4283:43;4276:51;4271:2;4256:18;;4249:79;4065:3;4050:19;;3844:490;1628:47:24;;;;;;;;985:697;;896:786;;;:::o;2381:188::-;2473:6;;-1:-1:-1;;;;;2473:6:24;2459:10;:20;2451:67;;;;-1:-1:-1;;;2451:67:24;;;;;;;:::i;:::-;2528:16;:34;2381:188::o;1688:687::-;1813:46;;;;;;2801:19:26;;;2836:12;;;2829:28;;;2873:12;;;2866:28;;;1787:13:24;;2910:12:26;;1813:46:24;;;-1:-1:-1;;1813:46:24;;;;;;;;;1803:57;;1813:46;1803:57;;;;1870:33;1906:16;;;;;;;;;1940:19;;;;1803:57;;-1:-1:-1;1906:16:24;1940:19;;:27;;:19;:27;1932:59;;;;-1:-1:-1;;;1932:59:24;;4541:2:26;1932:59:24;;;4523:21:26;4580:2;4560:18;;;4553:30;-1:-1:-1;;;4599:18:26;;;4592:49;4658:18;;1932:59:24;4339:343:26;1932:59:24;2029:16;;;2043:1;2029:16;;;;;;;;;2002:24;;2029:16;;;;;;;;;;-1:-1:-1;2029:16:24;2002:43;;2068:7;2055;2063:1;2055:10;;;;;;;;:::i;:::-;;;;;;:20;;;;;2098:1;2085:7;2093:1;2085:10;;;;;;;;:::i;:::-;;;;;;:14;;;;;2122:12;:24;;;2109:7;2117:1;2109:10;;;;;;;;:::i;:::-;;;;;;:37;;;;;2169:12;:19;;;2156:7;2164:1;2156:10;;;;;;;;:::i;:::-;;;;;;:32;;;;;2211:1;2198:7;2206:1;2198:10;;;;;;;;:::i;:::-;;;;;;;;;;:14;2231:12;;2291:16;;2321:25;;;2231:137;;-1:-1:-1;;;2231:137:24;;-1:-1:-1;;;;;2231:12:24;;;;:28;;2267:9;;2231:137;;2291:16;;2360:7;;2231:137;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;1777:598;;;1688:687;;;:::o;14:180:26:-;73:6;126:2;114:9;105:7;101:23;97:32;94:52;;;142:1;139;132:12;94:52;-1:-1:-1;165:23:26;;14:180;-1:-1:-1;14:180:26:o;718:316::-;795:6;803;811;864:2;852:9;843:7;839:23;835:32;832:52;;;880:1;877;870:12;832:52;-1:-1:-1;;903:23:26;;;973:2;958:18;;945:32;;-1:-1:-1;1024:2:26;1009:18;;;996:32;;718:316;-1:-1:-1;718:316:26:o;1039:398::-;1241:2;1223:21;;;1280:2;1260:18;;;1253:30;1319:34;1314:2;1299:18;;1292:62;-1:-1:-1;;;1385:2:26;1370:18;;1363:32;1427:3;1412:19;;1039:398::o;4819:127::-;4880:10;4875:3;4871:20;4868:1;4861:31;4911:4;4908:1;4901:15;4935:4;4932:1;4925:15;4951:775;5149:4;5197:2;5186:9;5182:18;5227:6;5216:9;5209:25;5253:2;5291:6;5286:2;5275:9;5271:18;5264:34;5334:2;5329;5318:9;5314:18;5307:30;5357:6;5392;5386:13;5423:6;5415;5408:22;5461:3;5450:9;5446:19;5439:26;;5500:2;5492:6;5488:15;5474:29;;5521:1;5531:169;5545:6;5542:1;5539:13;5531:169;;;5606:13;;5594:26;;5675:15;;;;5640:12;;;;5567:1;5560:9;5531:169;;;-1:-1:-1;5717:3:26;;4951:775;-1:-1:-1;;;;;;;;4951:775:26:o;5731:245::-;5810:6;5818;5871:2;5859:9;5850:7;5846:23;5842:32;5839:52;;;5887:1;5884;5877:12;5839:52;-1:-1:-1;;5910:16:26;;5966:2;5951:18;;;5945:25;5910:16;;5945:25;;-1:-1:-1;5731:245:26:o", "linkReferences": {} }, "methodIdentifiers": { + "setEscrowAddress(uint256)": "9a63d92d", + "setEscrowWithdrawSelector(uint256)": "3e95784a", "transfer(uint256,uint256,uint256)": "90dd2627", - "transfers(uint256)": "9377d711" + "transfers(bytes32)": "3c64f04b", + "withdraw(uint256,uint256,uint256)": "a41fe49f" }, - "rawMetadata": "{\"compiler\":{\"version\":\"0.8.22+commit.4fc1097e\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"orderId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"srcAddress\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"destAddress\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"isUsed\",\"type\":\"bool\"}],\"indexed\":false,\"internalType\":\"struct YABTransfer.TransferInfo\",\"name\":\"transferInfo\",\"type\":\"tuple\"}],\"name\":\"Transfer\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"orderId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"destAddress\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"transfer\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"transfers\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"destAddress\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"isUsed\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"src/YABTransfer.sol\":\"YABTransfer\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[\":forge-std/=lib/forge-std/src/\"]},\"sources\":{\"src/YABTransfer.sol\":{\"keccak256\":\"0x7f9d1215091c15c69b0c12cfbbf76096c83d3bbb7c1446545cda773daad38dae\",\"license\":\"Apache-2.0\",\"urls\":[\"bzz-raw://d8acfe1796fdc72482bcee1201100e0f7ff42d76e8fdff64f13987446ec2eebc\",\"dweb:/ipfs/QmVVfobQSqBrj5ahzgvR2HBkMY3J9BsrEfY43P67pam8N7\"]}},\"version\":1}", + "rawMetadata": "{\"compiler\":{\"version\":\"0.8.21+commit.d9974bed\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"snMessaging\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"snEscrowAddress\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"snEscrowWithdrawSelector\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"orderId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"srcAddress\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"destAddress\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"isUsed\",\"type\":\"bool\"}],\"indexed\":false,\"internalType\":\"struct YABTransfer.TransferInfo\",\"name\":\"transferInfo\",\"type\":\"tuple\"}],\"name\":\"Transfer\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"snEscrowAddress\",\"type\":\"uint256\"}],\"name\":\"setEscrowAddress\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"snEscrowWithdrawSelector\",\"type\":\"uint256\"}],\"name\":\"setEscrowWithdrawSelector\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"orderId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"destAddress\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"transfer\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"name\":\"transfers\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"destAddress\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"isUsed\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"orderId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"destAddress\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"withdraw\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"src/YABTransfer.sol\":\"YABTransfer\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[\":ds-test/=lib/forge-std/lib/ds-test/src/\",\":forge-std/=lib/forge-std/src/\",\":starknet/=lib/starknet/\"]},\"sources\":{\"lib/starknet/IStarknetMessaging.sol\":{\"keccak256\":\"0x40014108e2795fd544af0f6322882e99cc3f0872990d504c1ccebce2afea9617\",\"license\":\"Apache-2.0.\",\"urls\":[\"bzz-raw://d3eec1c3f47243734573b4ac3fc42db2eee4d110d8c39be16fbc6f93498e318d\",\"dweb:/ipfs/QmdYdJFPdEPUFQATa24jNvL59GtdoJeym1w7EARyCq8CvY\"]},\"lib/starknet/IStarknetMessagingEvents.sol\":{\"keccak256\":\"0x71171b10854a020b53b175ed9dc068a56675e2b80f823c0f841ae18977b96e8c\",\"license\":\"Apache-2.0.\",\"urls\":[\"bzz-raw://70d345e80b4fbbceba9bc0b64be0688710434a5b5d6eb4a60fae808d2bcc03d9\",\"dweb:/ipfs/QmQBdERT6NHiC2cDvTwS7aob1CwuuqQZvZt5ibGzvYawvB\"]},\"src/YABTransfer.sol\":{\"keccak256\":\"0xf299be714d637c45b70e5e33fc5bb7fdf212250426f0bd8d5b07c670af15fce1\",\"license\":\"Apache-2.0\",\"urls\":[\"bzz-raw://960761a2e29d625090440d2745fd240c18e68bbb25a25d8e4e8c4f1cbf57dc80\",\"dweb:/ipfs/QmP6ZGkfS1uJYDkDGu2N82BpDs6ixrQRk1ycPqnKuLBJv6\"]}},\"version\":1}", "metadata": { "compiler": { - "version": "0.8.22+commit.4fc1097e" + "version": "0.8.21+commit.d9974bed" }, "language": "Solidity", "output": { "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "snMessaging", + "type": "address" + }, + { + "internalType": "uint256", + "name": "snEscrowAddress", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "snEscrowWithdrawSelector", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, { "inputs": [ { @@ -159,6 +253,30 @@ "name": "Transfer", "anonymous": false }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "snEscrowAddress", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function", + "name": "setEscrowAddress" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "snEscrowWithdrawSelector", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function", + "name": "setEscrowWithdrawSelector" + }, { "inputs": [ { @@ -184,9 +302,9 @@ { "inputs": [ { - "internalType": "uint256", + "internalType": "bytes32", "name": "", - "type": "uint256" + "type": "bytes32" } ], "stateMutability": "view", @@ -209,6 +327,28 @@ "type": "bool" } ] + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "orderId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "destAddress", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "stateMutability": "payable", + "type": "function", + "name": "withdraw" } ], "devdoc": { @@ -224,7 +364,9 @@ }, "settings": { "remappings": [ - "forge-std/=lib/forge-std/src/" + "ds-test/=lib/forge-std/lib/ds-test/src/", + "forge-std/=lib/forge-std/src/", + "starknet/=lib/starknet/" ], "optimizer": { "enabled": true, @@ -239,11 +381,27 @@ "libraries": {} }, "sources": { + "lib/starknet/IStarknetMessaging.sol": { + "keccak256": "0x40014108e2795fd544af0f6322882e99cc3f0872990d504c1ccebce2afea9617", + "urls": [ + "bzz-raw://d3eec1c3f47243734573b4ac3fc42db2eee4d110d8c39be16fbc6f93498e318d", + "dweb:/ipfs/QmdYdJFPdEPUFQATa24jNvL59GtdoJeym1w7EARyCq8CvY" + ], + "license": "Apache-2.0." + }, + "lib/starknet/IStarknetMessagingEvents.sol": { + "keccak256": "0x71171b10854a020b53b175ed9dc068a56675e2b80f823c0f841ae18977b96e8c", + "urls": [ + "bzz-raw://70d345e80b4fbbceba9bc0b64be0688710434a5b5d6eb4a60fae808d2bcc03d9", + "dweb:/ipfs/QmQBdERT6NHiC2cDvTwS7aob1CwuuqQZvZt5ibGzvYawvB" + ], + "license": "Apache-2.0." + }, "src/YABTransfer.sol": { - "keccak256": "0x7f9d1215091c15c69b0c12cfbbf76096c83d3bbb7c1446545cda773daad38dae", + "keccak256": "0xf299be714d637c45b70e5e33fc5bb7fdf212250426f0bd8d5b07c670af15fce1", "urls": [ - "bzz-raw://d8acfe1796fdc72482bcee1201100e0f7ff42d76e8fdff64f13987446ec2eebc", - "dweb:/ipfs/QmVVfobQSqBrj5ahzgvR2HBkMY3J9BsrEfY43P67pam8N7" + "bzz-raw://960761a2e29d625090440d2745fd240c18e68bbb25a25d8e4e8c4f1cbf57dc80", + "dweb:/ipfs/QmP6ZGkfS1uJYDkDGu2N82BpDs6ixrQRk1ycPqnKuLBJv6" ], "license": "Apache-2.0" } @@ -252,19 +410,22 @@ }, "ast": { "absolutePath": "src/YABTransfer.sol", - "id": 39445, + "id": 45077, "exportedSymbols": { + "IStarknetMessaging": [ + 44666 + ], "YABTransfer": [ - 39444 + 45076 ] }, "nodeType": "SourceUnit", - "src": "39:1020:15", + "src": "39:2763:24", "nodes": [ { - "id": 39337, + "id": 44792, "nodeType": "PragmaDirective", - "src": "39:24:15", + "src": "39:24:24", "nodes": [], "literals": [ "solidity", @@ -274,26 +435,52 @@ ] }, { - "id": 39444, + "id": 44794, + "nodeType": "ImportDirective", + "src": "65:67:24", + "nodes": [], + "absolutePath": "lib/starknet/IStarknetMessaging.sol", + "file": "starknet/IStarknetMessaging.sol", + "nameLocation": "-1:-1:-1", + "scope": 45077, + "sourceUnit": 44667, + "symbolAliases": [ + { + "foreign": { + "id": 44793, + "name": "IStarknetMessaging", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 44666, + "src": "73:18:24", + "typeDescriptions": {} + }, + "nameLocation": "-1:-1:-1" + } + ], + "unitAlias": "" + }, + { + "id": 45076, "nodeType": "ContractDefinition", - "src": "65:993:15", + "src": "134:2667:24", "nodes": [ { - "id": 39344, + "id": 44801, "nodeType": "StructDefinition", - "src": "92:101:15", + "src": "161:101:24", "nodes": [], "canonicalName": "YABTransfer.TransferInfo", "members": [ { "constant": false, - "id": 39339, + "id": 44796, "mutability": "mutable", "name": "destAddress", - "nameLocation": "130:11:15", + "nameLocation": "199:11:24", "nodeType": "VariableDeclaration", - "scope": 39344, - "src": "122:19:15", + "scope": 44801, + "src": "191:19:24", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { @@ -301,10 +488,10 @@ "typeString": "uint256" }, "typeName": { - "id": 39338, + "id": 44795, "name": "uint256", "nodeType": "ElementaryTypeName", - "src": "122:7:15", + "src": "191:7:24", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" @@ -314,13 +501,13 @@ }, { "constant": false, - "id": 39341, + "id": 44798, "mutability": "mutable", "name": "amount", - "nameLocation": "159:6:15", + "nameLocation": "228:6:24", "nodeType": "VariableDeclaration", - "scope": 39344, - "src": "151:14:15", + "scope": 44801, + "src": "220:14:24", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { @@ -328,10 +515,10 @@ "typeString": "uint256" }, "typeName": { - "id": 39340, + "id": 44797, "name": "uint256", "nodeType": "ElementaryTypeName", - "src": "151:7:15", + "src": "220:7:24", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" @@ -341,13 +528,13 @@ }, { "constant": false, - "id": 39343, + "id": 44800, "mutability": "mutable", "name": "isUsed", - "nameLocation": "180:6:15", + "nameLocation": "249:6:24", "nodeType": "VariableDeclaration", - "scope": 39344, - "src": "175:11:15", + "scope": 44801, + "src": "244:11:24", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { @@ -355,10 +542,10 @@ "typeString": "bool" }, "typeName": { - "id": 39342, + "id": 44799, "name": "bool", "nodeType": "ElementaryTypeName", - "src": "175:4:15", + "src": "244:4:24", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" @@ -368,33 +555,33 @@ } ], "name": "TransferInfo", - "nameLocation": "99:12:15", - "scope": 39444, + "nameLocation": "168:12:24", + "scope": 45076, "visibility": "public" }, { - "id": 39353, + "id": 44810, "nodeType": "EventDefinition", - "src": "199:87:15", + "src": "268:87:24", "nodes": [], "anonymous": false, "eventSelector": "b2511a43843fb5ad643d84c36214ea6ac6368d0ba2f4714f59c2c36124e87e27", "name": "Transfer", - "nameLocation": "205:8:15", + "nameLocation": "274:8:24", "parameters": { - "id": 39352, + "id": 44809, "nodeType": "ParameterList", "parameters": [ { "constant": false, - "id": 39346, + "id": 44803, "indexed": true, "mutability": "mutable", "name": "orderId", - "nameLocation": "230:7:15", + "nameLocation": "299:7:24", "nodeType": "VariableDeclaration", - "scope": 39353, - "src": "214:23:15", + "scope": 44810, + "src": "283:23:24", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { @@ -402,10 +589,10 @@ "typeString": "uint256" }, "typeName": { - "id": 39345, + "id": 44802, "name": "uint256", "nodeType": "ElementaryTypeName", - "src": "214:7:15", + "src": "283:7:24", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" @@ -415,14 +602,14 @@ }, { "constant": false, - "id": 39348, + "id": 44805, "indexed": false, "mutability": "mutable", "name": "srcAddress", - "nameLocation": "247:10:15", + "nameLocation": "316:10:24", "nodeType": "VariableDeclaration", - "scope": 39353, - "src": "239:18:15", + "scope": 44810, + "src": "308:18:24", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { @@ -430,10 +617,10 @@ "typeString": "address" }, "typeName": { - "id": 39347, + "id": 44804, "name": "address", "nodeType": "ElementaryTypeName", - "src": "239:7:15", + "src": "308:7:24", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", @@ -444,102 +631,102 @@ }, { "constant": false, - "id": 39351, + "id": 44808, "indexed": false, "mutability": "mutable", "name": "transferInfo", - "nameLocation": "272:12:15", + "nameLocation": "341:12:24", "nodeType": "VariableDeclaration", - "scope": 39353, - "src": "259:25:15", + "scope": 44810, + "src": "328:25:24", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { - "typeIdentifier": "t_struct$_TransferInfo_$39344_memory_ptr", + "typeIdentifier": "t_struct$_TransferInfo_$44801_memory_ptr", "typeString": "struct YABTransfer.TransferInfo" }, "typeName": { - "id": 39350, + "id": 44807, "nodeType": "UserDefinedTypeName", "pathNode": { - "id": 39349, + "id": 44806, "name": "TransferInfo", "nameLocations": [ - "259:12:15" + "328:12:24" ], "nodeType": "IdentifierPath", - "referencedDeclaration": 39344, - "src": "259:12:15" + "referencedDeclaration": 44801, + "src": "328:12:24" }, - "referencedDeclaration": 39344, - "src": "259:12:15", + "referencedDeclaration": 44801, + "src": "328:12:24", "typeDescriptions": { - "typeIdentifier": "t_struct$_TransferInfo_$39344_storage_ptr", + "typeIdentifier": "t_struct$_TransferInfo_$44801_storage_ptr", "typeString": "struct YABTransfer.TransferInfo" } }, "visibility": "internal" } ], - "src": "213:72:15" + "src": "282:72:24" } }, { - "id": 39358, + "id": 44815, "nodeType": "VariableDeclaration", - "src": "292:49:15", + "src": "361:49:24", "nodes": [], "constant": false, - "functionSelector": "9377d711", + "functionSelector": "3c64f04b", "mutability": "mutable", "name": "transfers", - "nameLocation": "332:9:15", - "scope": 39444, + "nameLocation": "401:9:24", + "scope": 45076, "stateVariable": true, "storageLocation": "default", "typeDescriptions": { - "typeIdentifier": "t_mapping$_t_uint256_$_t_struct$_TransferInfo_$39344_storage_$", - "typeString": "mapping(uint256 => struct YABTransfer.TransferInfo)" + "typeIdentifier": "t_mapping$_t_bytes32_$_t_struct$_TransferInfo_$44801_storage_$", + "typeString": "mapping(bytes32 => struct YABTransfer.TransferInfo)" }, "typeName": { - "id": 39357, + "id": 44814, "keyName": "", "keyNameLocation": "-1:-1:-1", "keyType": { - "id": 39354, - "name": "uint256", + "id": 44811, + "name": "bytes32", "nodeType": "ElementaryTypeName", - "src": "300:7:15", + "src": "369:7:24", "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" } }, "nodeType": "Mapping", - "src": "292:32:15", + "src": "361:32:24", "typeDescriptions": { - "typeIdentifier": "t_mapping$_t_uint256_$_t_struct$_TransferInfo_$39344_storage_$", - "typeString": "mapping(uint256 => struct YABTransfer.TransferInfo)" + "typeIdentifier": "t_mapping$_t_bytes32_$_t_struct$_TransferInfo_$44801_storage_$", + "typeString": "mapping(bytes32 => struct YABTransfer.TransferInfo)" }, "valueName": "", "valueNameLocation": "-1:-1:-1", "valueType": { - "id": 39356, + "id": 44813, "nodeType": "UserDefinedTypeName", "pathNode": { - "id": 39355, + "id": 44812, "name": "TransferInfo", "nameLocations": [ - "311:12:15" + "380:12:24" ], "nodeType": "IdentifierPath", - "referencedDeclaration": 39344, - "src": "311:12:15" + "referencedDeclaration": 44801, + "src": "380:12:24" }, - "referencedDeclaration": 39344, - "src": "311:12:15", + "referencedDeclaration": 44801, + "src": "380:12:24", "typeDescriptions": { - "typeIdentifier": "t_struct$_TransferInfo_$39344_storage_ptr", + "typeIdentifier": "t_struct$_TransferInfo_$44801_storage_ptr", "typeString": "struct YABTransfer.TransferInfo" } } @@ -547,60 +734,525 @@ "visibility": "public" }, { - "id": 39443, + "id": 44817, + "nodeType": "VariableDeclaration", + "src": "416:22:24", + "nodes": [], + "constant": false, + "mutability": "mutable", + "name": "_owner", + "nameLocation": "432:6:24", + "scope": 45076, + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 44816, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "416:7:24", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "private" + }, + { + "id": 44820, + "nodeType": "VariableDeclaration", + "src": "444:39:24", + "nodes": [], + "constant": false, + "mutability": "mutable", + "name": "_snMessaging", + "nameLocation": "471:12:24", + "scope": 45076, + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IStarknetMessaging_$44666", + "typeString": "contract IStarknetMessaging" + }, + "typeName": { + "id": 44819, + "nodeType": "UserDefinedTypeName", + "pathNode": { + "id": 44818, + "name": "IStarknetMessaging", + "nameLocations": [ + "444:18:24" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 44666, + "src": "444:18:24" + }, + "referencedDeclaration": 44666, + "src": "444:18:24", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IStarknetMessaging_$44666", + "typeString": "contract IStarknetMessaging" + } + }, + "visibility": "private" + }, + { + "id": 44822, + "nodeType": "VariableDeclaration", + "src": "489:32:24", + "nodes": [], + "constant": false, + "mutability": "mutable", + "name": "_snEscrowAddress", + "nameLocation": "505:16:24", + "scope": 45076, + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 44821, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "489:7:24", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "private" + }, + { + "id": 44824, + "nodeType": "VariableDeclaration", + "src": "527:41:24", + "nodes": [], + "constant": false, + "mutability": "mutable", + "name": "_snEscrowWithdrawSelector", + "nameLocation": "543:25:24", + "scope": 45076, + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 44823, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "527:7:24", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "private" + }, + { + "id": 44853, "nodeType": "FunctionDefinition", - "src": "348:708:15", + "src": "575:315:24", "nodes": [], "body": { - "id": 39442, + "id": 44852, "nodeType": "Block", - "src": "437:619:15", + "src": "692:198:24", "nodes": [], "statements": [ { "expression": { - "arguments": [ - { - "commonType": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "id": 39370, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftExpression": { - "id": 39368, - "name": "destAddress", + "id": 44836, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 44833, + "name": "_owner", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 44817, + "src": "702:6:24", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "expression": { + "id": 44834, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -15, + "src": "711:3:24", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" + } + }, + "id": 44835, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "715:6:24", + "memberName": "sender", + "nodeType": "MemberAccess", + "src": "711:10:24", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "src": "702:19:24", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "id": 44837, + "nodeType": "ExpressionStatement", + "src": "702:19:24" + }, + { + "expression": { + "id": 44842, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 44838, + "name": "_snMessaging", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 44820, + "src": "731:12:24", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IStarknetMessaging_$44666", + "typeString": "contract IStarknetMessaging" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "arguments": [ + { + "id": 44840, + "name": "snMessaging", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 39362, - "src": "455:11:15", + "referencedDeclaration": 44826, + "src": "765:11:24", "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" + "typeIdentifier": "t_address", + "typeString": "address" } - }, - "nodeType": "BinaryOperation", - "operator": "!=", + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + } + ], + "id": 44839, + "name": "IStarknetMessaging", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 44666, + "src": "746:18:24", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_IStarknetMessaging_$44666_$", + "typeString": "type(contract IStarknetMessaging)" + } + }, + "id": 44841, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "746:31:24", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_contract$_IStarknetMessaging_$44666", + "typeString": "contract IStarknetMessaging" + } + }, + "src": "731:46:24", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IStarknetMessaging_$44666", + "typeString": "contract IStarknetMessaging" + } + }, + "id": 44843, + "nodeType": "ExpressionStatement", + "src": "731:46:24" + }, + { + "expression": { + "id": 44846, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 44844, + "name": "_snEscrowAddress", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 44822, + "src": "787:16:24", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "id": 44845, + "name": "snEscrowAddress", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 44828, + "src": "806:15:24", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "787:34:24", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 44847, + "nodeType": "ExpressionStatement", + "src": "787:34:24" + }, + { + "expression": { + "id": 44850, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 44848, + "name": "_snEscrowWithdrawSelector", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 44824, + "src": "831:25:24", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "id": 44849, + "name": "snEscrowWithdrawSelector", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 44830, + "src": "859:24:24", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "831:52:24", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 44851, + "nodeType": "ExpressionStatement", + "src": "831:52:24" + } + ] + }, + "implemented": true, + "kind": "constructor", + "modifiers": [], + "name": "", + "nameLocation": "-1:-1:-1", + "parameters": { + "id": 44831, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 44826, + "mutability": "mutable", + "name": "snMessaging", + "nameLocation": "604:11:24", + "nodeType": "VariableDeclaration", + "scope": 44853, + "src": "596:19:24", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 44825, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "596:7:24", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 44828, + "mutability": "mutable", + "name": "snEscrowAddress", + "nameLocation": "633:15:24", + "nodeType": "VariableDeclaration", + "scope": 44853, + "src": "625:23:24", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 44827, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "625:7:24", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 44830, + "mutability": "mutable", + "name": "snEscrowWithdrawSelector", + "nameLocation": "666:24:24", + "nodeType": "VariableDeclaration", + "scope": 44853, + "src": "658:32:24", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 44829, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "658:7:24", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "586:105:24" + }, + "returnParameters": { + "id": 44832, + "nodeType": "ParameterList", + "parameters": [], + "src": "692:0:24" + }, + "scope": 45076, + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "public" + }, + { + "id": 44949, + "nodeType": "FunctionDefinition", + "src": "896:786:24", + "nodes": [], + "body": { + "id": 44948, + "nodeType": "Block", + "src": "985:697:24", + "nodes": [], + "statements": [ + { + "expression": { + "arguments": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 44865, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 44863, + "name": "destAddress", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 44857, + "src": "1003:11:24", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "!=", "rightExpression": { "hexValue": "30", - "id": 39369, + "id": 44864, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", - "src": "470:1:15", + "src": "1018:1:24", "typeDescriptions": { "typeIdentifier": "t_rational_0_by_1", "typeString": "int_const 0" }, "value": "0" }, - "src": "455:16:15", + "src": "1003:16:24", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" @@ -608,14 +1260,14 @@ }, { "hexValue": "496e76616c69642064657374696e6174696f6e20616464726573732e", - "id": 39371, + "id": 44866, "isConstant": false, "isLValue": false, "isPure": true, "kind": "string", "lValueRequested": false, "nodeType": "Literal", - "src": "473:30:15", + "src": "1021:30:24", "typeDescriptions": { "typeIdentifier": "t_stringliteral_2fa297eccd710853c85d8d9f7a4eaeeeaa7b619ef35c43f422f6799890e61a7b", "typeString": "literal_string \"Invalid destination address.\"" @@ -634,7 +1286,7 @@ "typeString": "literal_string \"Invalid destination address.\"" } ], - "id": 39367, + "id": 44862, "name": "require", "nodeType": "Identifier", "overloadedDeclarations": [ @@ -642,13 +1294,13 @@ -18 ], "referencedDeclaration": -18, - "src": "447:7:15", + "src": "995:7:24", "typeDescriptions": { "typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$", "typeString": "function (bool,string memory) pure" } }, - "id": 39372, + "id": 44867, "isConstant": false, "isLValue": false, "isPure": false, @@ -657,16 +1309,16 @@ "nameLocations": [], "names": [], "nodeType": "FunctionCall", - "src": "447:57:15", + "src": "995:57:24", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, - "id": 39373, + "id": 44868, "nodeType": "ExpressionStatement", - "src": "447:57:15" + "src": "995:57:24" }, { "expression": { @@ -676,18 +1328,18 @@ "typeIdentifier": "t_uint256", "typeString": "uint256" }, - "id": 39377, + "id": 44872, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { - "id": 39375, + "id": 44870, "name": "amount", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 39364, - "src": "522:6:15", + "referencedDeclaration": 44859, + "src": "1070:6:24", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" @@ -697,21 +1349,21 @@ "operator": ">", "rightExpression": { "hexValue": "30", - "id": 39376, + "id": 44871, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", - "src": "531:1:15", + "src": "1079:1:24", "typeDescriptions": { "typeIdentifier": "t_rational_0_by_1", "typeString": "int_const 0" }, "value": "0" }, - "src": "522:10:15", + "src": "1070:10:24", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" @@ -719,14 +1371,14 @@ }, { "hexValue": "496e76616c696420616d6f756e742c2073686f756c6420626520686967686572207468616e20302e", - "id": 39378, + "id": 44873, "isConstant": false, "isLValue": false, "isPure": true, "kind": "string", "lValueRequested": false, "nodeType": "Literal", - "src": "534:42:15", + "src": "1082:42:24", "typeDescriptions": { "typeIdentifier": "t_stringliteral_fe4820437fc35a3f0e23566ebf2749a14357cf76424103f2c52b0da44824d1c2", "typeString": "literal_string \"Invalid amount, should be higher than 0.\"" @@ -745,7 +1397,7 @@ "typeString": "literal_string \"Invalid amount, should be higher than 0.\"" } ], - "id": 39374, + "id": 44869, "name": "require", "nodeType": "Identifier", "overloadedDeclarations": [ @@ -753,13 +1405,13 @@ -18 ], "referencedDeclaration": -18, - "src": "514:7:15", + "src": "1062:7:24", "typeDescriptions": { "typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$", "typeString": "function (bool,string memory) pure" } }, - "id": 39379, + "id": 44874, "isConstant": false, "isLValue": false, "isPure": false, @@ -768,16 +1420,16 @@ "nameLocations": [], "names": [], "nodeType": "FunctionCall", - "src": "514:63:15", + "src": "1062:63:24", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, - "id": 39380, + "id": 44875, "nodeType": "ExpressionStatement", - "src": "514:63:15" + "src": "1062:63:24" }, { "expression": { @@ -787,33 +1439,33 @@ "typeIdentifier": "t_uint256", "typeString": "uint256" }, - "id": 39385, + "id": 44880, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "expression": { - "id": 39382, + "id": 44877, "name": "msg", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": -15, - "src": "595:3:15", + "src": "1143:3:24", "typeDescriptions": { "typeIdentifier": "t_magic_message", "typeString": "msg" } }, - "id": 39383, + "id": 44878, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, - "memberLocation": "599:5:15", + "memberLocation": "1147:5:24", "memberName": "value", "nodeType": "MemberAccess", - "src": "595:9:15", + "src": "1143:9:24", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" @@ -822,18 +1474,18 @@ "nodeType": "BinaryOperation", "operator": "==", "rightExpression": { - "id": 39384, + "id": 44879, "name": "amount", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 39364, - "src": "608:6:15", + "referencedDeclaration": 44859, + "src": "1156:6:24", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, - "src": "595:19:15", + "src": "1143:19:24", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" @@ -841,14 +1493,14 @@ }, { "hexValue": "496e76616c696420616d6f756e742c2073686f756c64206d61746368206d73672e76616c75652e", - "id": 39386, + "id": 44881, "isConstant": false, "isLValue": false, "isPure": true, "kind": "string", "lValueRequested": false, "nodeType": "Literal", - "src": "616:41:15", + "src": "1164:41:24", "typeDescriptions": { "typeIdentifier": "t_stringliteral_32321d8777936c29a4e4ba262029f40bd22d3edb82ec61a8e9aa2f0992b03972", "typeString": "literal_string \"Invalid amount, should match msg.value.\"" @@ -867,7 +1519,7 @@ "typeString": "literal_string \"Invalid amount, should match msg.value.\"" } ], - "id": 39381, + "id": 44876, "name": "require", "nodeType": "Identifier", "overloadedDeclarations": [ @@ -875,13 +1527,13 @@ -18 ], "referencedDeclaration": -18, - "src": "587:7:15", + "src": "1135:7:24", "typeDescriptions": { "typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$", "typeString": "function (bool,string memory) pure" } }, - "id": 39387, + "id": 44882, "isConstant": false, "isLValue": false, "isPure": false, @@ -890,55 +1542,225 @@ "nameLocations": [], "names": [], "nodeType": "FunctionCall", - "src": "587:71:15", + "src": "1135:71:24", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, - "id": 39388, + "id": 44883, "nodeType": "ExpressionStatement", - "src": "587:71:15" + "src": "1135:71:24" }, { - "expression": { + "assignments": [ + 44885 + ], + "declarations": [ + { + "constant": false, + "id": 44885, + "mutability": "mutable", + "name": "index", + "nameLocation": "1225:5:24", + "nodeType": "VariableDeclaration", + "scope": 44948, + "src": "1217:13:24", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 44884, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "1217:7:24", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "id": 44894, + "initialValue": { "arguments": [ { - "commonType": { - "typeIdentifier": "t_bool", - "typeString": "bool" + "arguments": [ + { + "id": 44889, + "name": "orderId", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 44855, + "src": "1260:7:24", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "id": 44890, + "name": "destAddress", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 44857, + "src": "1269:11:24", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "id": 44891, + "name": "amount", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 44859, + "src": "1282:6:24", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "expression": { + "id": 44887, + "name": "abi", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -1, + "src": "1243:3:24", + "typeDescriptions": { + "typeIdentifier": "t_magic_abi", + "typeString": "abi" + } + }, + "id": 44888, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "1247:12:24", + "memberName": "encodePacked", + "nodeType": "MemberAccess", + "src": "1243:16:24", + "typeDescriptions": { + "typeIdentifier": "t_function_abiencodepacked_pure$__$returns$_t_bytes_memory_ptr_$", + "typeString": "function () pure returns (bytes memory)" + } }, - "id": 39395, + "id": 44892, "isConstant": false, "isLValue": false, "isPure": false, + "kind": "functionCall", "lValueRequested": false, - "leftExpression": { - "expression": { - "baseExpression": { - "id": 39390, - "name": "transfers", - "nodeType": "Identifier", + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "1243:46:24", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + ], + "id": 44886, + "name": "keccak256", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -8, + "src": "1233:9:24", + "typeDescriptions": { + "typeIdentifier": "t_function_keccak256_pure$_t_bytes_memory_ptr_$returns$_t_bytes32_$", + "typeString": "function (bytes memory) pure returns (bytes32)" + } + }, + "id": 44893, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "1233:57:24", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "1217:73:24" + }, + { + "expression": { + "arguments": [ + { + "commonType": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "id": 44901, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "expression": { + "baseExpression": { + "id": 44896, + "name": "transfers", + "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 39358, - "src": "676:9:15", + "referencedDeclaration": 44815, + "src": "1308:9:24", "typeDescriptions": { - "typeIdentifier": "t_mapping$_t_uint256_$_t_struct$_TransferInfo_$39344_storage_$", - "typeString": "mapping(uint256 => struct YABTransfer.TransferInfo storage ref)" + "typeIdentifier": "t_mapping$_t_bytes32_$_t_struct$_TransferInfo_$44801_storage_$", + "typeString": "mapping(bytes32 => struct YABTransfer.TransferInfo storage ref)" } }, - "id": 39392, + "id": 44898, "indexExpression": { - "id": 39391, - "name": "orderId", + "id": 44897, + "name": "index", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 39360, - "src": "686:7:15", + "referencedDeclaration": 44885, + "src": "1318:5:24", "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" } }, "isConstant": false, @@ -946,22 +1768,22 @@ "isPure": false, "lValueRequested": false, "nodeType": "IndexAccess", - "src": "676:18:15", + "src": "1308:16:24", "typeDescriptions": { - "typeIdentifier": "t_struct$_TransferInfo_$39344_storage", + "typeIdentifier": "t_struct$_TransferInfo_$44801_storage", "typeString": "struct YABTransfer.TransferInfo storage ref" } }, - "id": 39393, + "id": 44899, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, - "memberLocation": "695:6:15", + "memberLocation": "1325:6:24", "memberName": "isUsed", "nodeType": "MemberAccess", - "referencedDeclaration": 39343, - "src": "676:25:15", + "referencedDeclaration": 44800, + "src": "1308:23:24", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" @@ -971,21 +1793,21 @@ "operator": "==", "rightExpression": { "hexValue": "66616c7365", - "id": 39394, + "id": 44900, "isConstant": false, "isLValue": false, "isPure": true, "kind": "bool", "lValueRequested": false, "nodeType": "Literal", - "src": "705:5:15", + "src": "1335:5:24", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" }, "value": "false" }, - "src": "676:34:15", + "src": "1308:32:24", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" @@ -993,14 +1815,14 @@ }, { "hexValue": "5472616e7366657220616c72656164792070726f6365737365642e", - "id": 39396, + "id": 44902, "isConstant": false, "isLValue": false, "isPure": true, "kind": "string", "lValueRequested": false, "nodeType": "Literal", - "src": "712:29:15", + "src": "1342:29:24", "typeDescriptions": { "typeIdentifier": "t_stringliteral_1eb30a0985af0e424e609034fe49983c0c05fd15617b9b2529e83648a32b1438", "typeString": "literal_string \"Transfer already processed.\"" @@ -1019,7 +1841,7 @@ "typeString": "literal_string \"Transfer already processed.\"" } ], - "id": 39389, + "id": 44895, "name": "require", "nodeType": "Identifier", "overloadedDeclarations": [ @@ -1027,13 +1849,13 @@ -18 ], "referencedDeclaration": -18, - "src": "668:7:15", + "src": "1300:7:24", "typeDescriptions": { "typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$", "typeString": "function (bool,string memory) pure" } }, - "id": 39397, + "id": 44903, "isConstant": false, "isLValue": false, "isPure": false, @@ -1042,48 +1864,48 @@ "nameLocations": [], "names": [], "nodeType": "FunctionCall", - "src": "668:74:15", + "src": "1300:72:24", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, - "id": 39398, + "id": 44904, "nodeType": "ExpressionStatement", - "src": "668:74:15" + "src": "1300:72:24" }, { "expression": { - "id": 39407, + "id": 44913, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "baseExpression": { - "id": 39399, + "id": 44905, "name": "transfers", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 39358, - "src": "753:9:15", + "referencedDeclaration": 44815, + "src": "1383:9:24", "typeDescriptions": { - "typeIdentifier": "t_mapping$_t_uint256_$_t_struct$_TransferInfo_$39344_storage_$", - "typeString": "mapping(uint256 => struct YABTransfer.TransferInfo storage ref)" + "typeIdentifier": "t_mapping$_t_bytes32_$_t_struct$_TransferInfo_$44801_storage_$", + "typeString": "mapping(bytes32 => struct YABTransfer.TransferInfo storage ref)" } }, - "id": 39401, + "id": 44907, "indexExpression": { - "id": 39400, - "name": "orderId", + "id": 44906, + "name": "index", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 39360, - "src": "763:7:15", + "referencedDeclaration": 44885, + "src": "1393:5:24", "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" } }, "isConstant": false, @@ -1091,9 +1913,9 @@ "isPure": false, "lValueRequested": true, "nodeType": "IndexAccess", - "src": "753:18:15", + "src": "1383:16:24", "typeDescriptions": { - "typeIdentifier": "t_struct$_TransferInfo_$39344_storage", + "typeIdentifier": "t_struct$_TransferInfo_$44801_storage", "typeString": "struct YABTransfer.TransferInfo storage ref" } }, @@ -1102,24 +1924,24 @@ "rightHandSide": { "arguments": [ { - "id": 39403, + "id": 44909, "name": "destAddress", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 39362, - "src": "801:11:15", + "referencedDeclaration": 44857, + "src": "1429:11:24", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, { - "id": 39404, + "id": 44910, "name": "amount", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 39364, - "src": "822:6:15", + "referencedDeclaration": 44859, + "src": "1450:6:24", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" @@ -1127,14 +1949,14 @@ }, { "hexValue": "74727565", - "id": 39405, + "id": 44911, "isConstant": false, "isLValue": false, "isPure": true, "kind": "bool", "lValueRequested": false, "nodeType": "Literal", - "src": "838:4:15", + "src": "1466:4:24", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" @@ -1157,27 +1979,27 @@ "typeString": "bool" } ], - "id": 39402, + "id": 44908, "name": "TransferInfo", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 39344, - "src": "774:12:15", + "referencedDeclaration": 44801, + "src": "1402:12:24", "typeDescriptions": { - "typeIdentifier": "t_type$_t_struct$_TransferInfo_$39344_storage_ptr_$", + "typeIdentifier": "t_type$_t_struct$_TransferInfo_$44801_storage_ptr_$", "typeString": "type(struct YABTransfer.TransferInfo storage pointer)" } }, - "id": 39406, + "id": 44912, "isConstant": false, "isLValue": false, "isPure": false, "kind": "structConstructorCall", "lValueRequested": false, "nameLocations": [ - "788:11:15", - "814:6:15", - "830:6:15" + "1416:11:24", + "1442:6:24", + "1458:6:24" ], "names": [ "destAddress", @@ -1185,38 +2007,38 @@ "isUsed" ], "nodeType": "FunctionCall", - "src": "774:70:15", + "src": "1402:70:24", "tryCall": false, "typeDescriptions": { - "typeIdentifier": "t_struct$_TransferInfo_$39344_memory_ptr", + "typeIdentifier": "t_struct$_TransferInfo_$44801_memory_ptr", "typeString": "struct YABTransfer.TransferInfo memory" } }, - "src": "753:91:15", + "src": "1383:89:24", "typeDescriptions": { - "typeIdentifier": "t_struct$_TransferInfo_$39344_storage", + "typeIdentifier": "t_struct$_TransferInfo_$44801_storage", "typeString": "struct YABTransfer.TransferInfo storage ref" } }, - "id": 39408, + "id": 44914, "nodeType": "ExpressionStatement", - "src": "753:91:15" + "src": "1383:89:24" }, { "assignments": [ - 39410, + 44916, null ], "declarations": [ { "constant": false, - "id": 39410, + "id": 44916, "mutability": "mutable", "name": "success", - "nameLocation": "861:7:15", + "nameLocation": "1489:7:24", "nodeType": "VariableDeclaration", - "scope": 39442, - "src": "856:12:15", + "scope": 44948, + "src": "1484:12:24", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { @@ -1224,10 +2046,10 @@ "typeString": "bool" }, "typeName": { - "id": 39409, + "id": 44915, "name": "bool", "nodeType": "ElementaryTypeName", - "src": "856:4:15", + "src": "1484:4:24", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" @@ -1237,19 +2059,19 @@ }, null ], - "id": 39427, + "id": 44933, "initialValue": { "arguments": [ { "hexValue": "", - "id": 39425, + "id": 44931, "isConstant": false, "isLValue": false, "isPure": true, "kind": "string", "lValueRequested": false, "nodeType": "Literal", - "src": "935:2:15", + "src": "1563:2:24", "typeDescriptions": { "typeIdentifier": "t_stringliteral_c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", "typeString": "literal_string \"\"" @@ -1278,12 +2100,12 @@ { "arguments": [ { - "id": 39417, + "id": 44923, "name": "destAddress", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 39362, - "src": "897:11:15", + "referencedDeclaration": 44857, + "src": "1525:11:24", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" @@ -1297,26 +2119,26 @@ "typeString": "uint256" } ], - "id": 39416, + "id": 44922, "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "nodeType": "ElementaryTypeNameExpression", - "src": "889:7:15", + "src": "1517:7:24", "typeDescriptions": { "typeIdentifier": "t_type$_t_uint160_$", "typeString": "type(uint160)" }, "typeName": { - "id": 39415, + "id": 44921, "name": "uint160", "nodeType": "ElementaryTypeName", - "src": "889:7:15", + "src": "1517:7:24", "typeDescriptions": {} } }, - "id": 39418, + "id": 44924, "isConstant": false, "isLValue": false, "isPure": false, @@ -1325,7 +2147,7 @@ "nameLocations": [], "names": [], "nodeType": "FunctionCall", - "src": "889:20:15", + "src": "1517:20:24", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_uint160", @@ -1340,26 +2162,26 @@ "typeString": "uint160" } ], - "id": 39414, + "id": 44920, "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "nodeType": "ElementaryTypeNameExpression", - "src": "881:7:15", + "src": "1509:7:24", "typeDescriptions": { "typeIdentifier": "t_type$_t_address_$", "typeString": "type(address)" }, "typeName": { - "id": 39413, + "id": 44919, "name": "address", "nodeType": "ElementaryTypeName", - "src": "881:7:15", + "src": "1509:7:24", "typeDescriptions": {} } }, - "id": 39419, + "id": 44925, "isConstant": false, "isLValue": false, "isPure": false, @@ -1368,7 +2190,7 @@ "nameLocations": [], "names": [], "nodeType": "FunctionCall", - "src": "881:29:15", + "src": "1509:29:24", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_address", @@ -1383,27 +2205,27 @@ "typeString": "address" } ], - "id": 39412, + "id": 44918, "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "nodeType": "ElementaryTypeNameExpression", - "src": "873:8:15", + "src": "1501:8:24", "typeDescriptions": { "typeIdentifier": "t_type$_t_address_payable_$", "typeString": "type(address payable)" }, "typeName": { - "id": 39411, + "id": 44917, "name": "address", "nodeType": "ElementaryTypeName", - "src": "873:8:15", + "src": "1501:8:24", "stateMutability": "payable", "typeDescriptions": {} } }, - "id": 39420, + "id": 44926, "isConstant": false, "isLValue": false, "isPure": false, @@ -1412,28 +2234,28 @@ "nameLocations": [], "names": [], "nodeType": "FunctionCall", - "src": "873:38:15", + "src": "1501:38:24", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" } }, - "id": 39421, + "id": 44927, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, - "memberLocation": "912:4:15", + "memberLocation": "1540:4:24", "memberName": "call", "nodeType": "MemberAccess", - "src": "873:43:15", + "src": "1501:43:24", "typeDescriptions": { "typeIdentifier": "t_function_barecall_payable$_t_bytes_memory_ptr_$returns$_t_bool_$_t_bytes_memory_ptr_$", "typeString": "function (bytes memory) payable returns (bool,bytes memory)" } }, - "id": 39424, + "id": 44930, "isConstant": false, "isLValue": false, "isPure": false, @@ -1445,39 +2267,39 @@ "options": [ { "expression": { - "id": 39422, + "id": 44928, "name": "msg", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": -15, - "src": "924:3:15", + "src": "1552:3:24", "typeDescriptions": { "typeIdentifier": "t_magic_message", "typeString": "msg" } }, - "id": 39423, + "id": 44929, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, - "memberLocation": "928:5:15", + "memberLocation": "1556:5:24", "memberName": "value", "nodeType": "MemberAccess", - "src": "924:9:15", + "src": "1552:9:24", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } } ], - "src": "873:61:15", + "src": "1501:61:24", "typeDescriptions": { "typeIdentifier": "t_function_barecall_payable$_t_bytes_memory_ptr_$returns$_t_bool_$_t_bytes_memory_ptr_$value", "typeString": "function (bytes memory) payable returns (bool,bytes memory)" } }, - "id": 39426, + "id": 44932, "isConstant": false, "isLValue": false, "isPure": false, @@ -1486,7 +2308,7 @@ "nameLocations": [], "names": [], "nodeType": "FunctionCall", - "src": "873:65:15", + "src": "1501:65:24", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_tuple$_t_bool_$_t_bytes_memory_ptr_$", @@ -1494,18 +2316,18 @@ } }, "nodeType": "VariableDeclarationStatement", - "src": "855:83:15" + "src": "1483:83:24" }, { "expression": { "arguments": [ { - "id": 39429, + "id": 44935, "name": "success", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 39410, - "src": "957:7:15", + "referencedDeclaration": 44916, + "src": "1585:7:24", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" @@ -1513,14 +2335,14 @@ }, { "hexValue": "5472616e73666572206661696c65642e", - "id": 39430, + "id": 44936, "isConstant": false, "isLValue": false, "isPure": true, "kind": "string", "lValueRequested": false, "nodeType": "Literal", - "src": "966:18:15", + "src": "1594:18:24", "typeDescriptions": { "typeIdentifier": "t_stringliteral_c81948f77ae7b56f1759fc612b6b373d090eebe7124f74c528fff8e0a139fe69", "typeString": "literal_string \"Transfer failed.\"" @@ -1539,7 +2361,7 @@ "typeString": "literal_string \"Transfer failed.\"" } ], - "id": 39428, + "id": 44934, "name": "require", "nodeType": "Identifier", "overloadedDeclarations": [ @@ -1547,13 +2369,13 @@ -18 ], "referencedDeclaration": -18, - "src": "949:7:15", + "src": "1577:7:24", "typeDescriptions": { "typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$", "typeString": "function (bool,string memory) pure" } }, - "id": 39431, + "id": 44937, "isConstant": false, "isLValue": false, "isPure": false, @@ -1562,27 +2384,27 @@ "nameLocations": [], "names": [], "nodeType": "FunctionCall", - "src": "949:36:15", + "src": "1577:36:24", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, - "id": 39432, + "id": 44938, "nodeType": "ExpressionStatement", - "src": "949:36:15" + "src": "1577:36:24" }, { "eventCall": { "arguments": [ { - "id": 39434, + "id": 44940, "name": "orderId", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 39360, - "src": "1009:7:15", + "referencedDeclaration": 44855, + "src": "1637:7:24", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" @@ -1590,26 +2412,26 @@ }, { "expression": { - "id": 39435, + "id": 44941, "name": "msg", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": -15, - "src": "1018:3:15", + "src": "1646:3:24", "typeDescriptions": { "typeIdentifier": "t_magic_message", "typeString": "msg" } }, - "id": 39436, + "id": 44942, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, - "memberLocation": "1022:6:15", + "memberLocation": "1650:6:24", "memberName": "sender", "nodeType": "MemberAccess", - "src": "1018:10:15", + "src": "1646:10:24", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" @@ -1617,28 +2439,28 @@ }, { "baseExpression": { - "id": 39437, + "id": 44943, "name": "transfers", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 39358, - "src": "1030:9:15", + "referencedDeclaration": 44815, + "src": "1658:9:24", "typeDescriptions": { - "typeIdentifier": "t_mapping$_t_uint256_$_t_struct$_TransferInfo_$39344_storage_$", - "typeString": "mapping(uint256 => struct YABTransfer.TransferInfo storage ref)" + "typeIdentifier": "t_mapping$_t_bytes32_$_t_struct$_TransferInfo_$44801_storage_$", + "typeString": "mapping(bytes32 => struct YABTransfer.TransferInfo storage ref)" } }, - "id": 39439, + "id": 44945, "indexExpression": { - "id": 39438, - "name": "orderId", + "id": 44944, + "name": "index", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 39360, - "src": "1040:7:15", + "referencedDeclaration": 44885, + "src": "1668:5:24", "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" } }, "isConstant": false, @@ -1646,9 +2468,9 @@ "isPure": false, "lValueRequested": false, "nodeType": "IndexAccess", - "src": "1030:18:15", + "src": "1658:16:24", "typeDescriptions": { - "typeIdentifier": "t_struct$_TransferInfo_$39344_storage", + "typeIdentifier": "t_struct$_TransferInfo_$44801_storage", "typeString": "struct YABTransfer.TransferInfo storage ref" } } @@ -1664,22 +2486,22 @@ "typeString": "address" }, { - "typeIdentifier": "t_struct$_TransferInfo_$39344_storage", + "typeIdentifier": "t_struct$_TransferInfo_$44801_storage", "typeString": "struct YABTransfer.TransferInfo storage ref" } ], - "id": 39433, + "id": 44939, "name": "Transfer", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 39353, - "src": "1000:8:15", + "referencedDeclaration": 44810, + "src": "1628:8:24", "typeDescriptions": { - "typeIdentifier": "t_function_event_nonpayable$_t_uint256_$_t_address_$_t_struct$_TransferInfo_$39344_memory_ptr_$returns$__$", + "typeIdentifier": "t_function_event_nonpayable$_t_uint256_$_t_address_$_t_struct$_TransferInfo_$44801_memory_ptr_$returns$__$", "typeString": "function (uint256,address,struct YABTransfer.TransferInfo memory)" } }, - "id": 39440, + "id": 44946, "isConstant": false, "isLValue": false, "isPure": false, @@ -1688,16 +2510,16 @@ "nameLocations": [], "names": [], "nodeType": "FunctionCall", - "src": "1000:49:15", + "src": "1628:47:24", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, - "id": 39441, + "id": 44947, "nodeType": "EmitStatement", - "src": "995:54:15" + "src": "1623:52:24" } ] }, @@ -1706,20 +2528,20 @@ "kind": "function", "modifiers": [], "name": "transfer", - "nameLocation": "357:8:15", + "nameLocation": "905:8:24", "parameters": { - "id": 39365, + "id": 44860, "nodeType": "ParameterList", "parameters": [ { "constant": false, - "id": 39360, + "id": 44855, "mutability": "mutable", "name": "orderId", - "nameLocation": "374:7:15", + "nameLocation": "922:7:24", "nodeType": "VariableDeclaration", - "scope": 39443, - "src": "366:15:15", + "scope": 44949, + "src": "914:15:24", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { @@ -1727,10 +2549,10 @@ "typeString": "uint256" }, "typeName": { - "id": 39359, + "id": 44854, "name": "uint256", "nodeType": "ElementaryTypeName", - "src": "366:7:15", + "src": "914:7:24", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" @@ -1740,13 +2562,13 @@ }, { "constant": false, - "id": 39362, + "id": 44857, "mutability": "mutable", "name": "destAddress", - "nameLocation": "391:11:15", + "nameLocation": "939:11:24", "nodeType": "VariableDeclaration", - "scope": 39443, - "src": "383:19:15", + "scope": 44949, + "src": "931:19:24", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { @@ -1754,10 +2576,10 @@ "typeString": "uint256" }, "typeName": { - "id": 39361, + "id": 44856, "name": "uint256", "nodeType": "ElementaryTypeName", - "src": "383:7:15", + "src": "931:7:24", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" @@ -1767,13 +2589,13 @@ }, { "constant": false, - "id": 39364, + "id": 44859, "mutability": "mutable", "name": "amount", - "nameLocation": "412:6:15", + "nameLocation": "960:6:24", "nodeType": "VariableDeclaration", - "scope": 39443, - "src": "404:14:15", + "scope": 44949, + "src": "952:14:24", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { @@ -1781,10 +2603,10 @@ "typeString": "uint256" }, "typeName": { - "id": 39363, + "id": 44858, "name": "uint256", "nodeType": "ElementaryTypeName", - "src": "404:7:15", + "src": "952:7:24", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" @@ -1793,18 +2615,1655 @@ "visibility": "internal" } ], - "src": "365:54:15" + "src": "913:54:24" }, "returnParameters": { - "id": 39366, + "id": 44861, "nodeType": "ParameterList", "parameters": [], - "src": "437:0:15" + "src": "985:0:24" }, - "scope": 39444, + "scope": 45076, "stateMutability": "payable", "virtual": false, "visibility": "external" + }, + { + "id": 45039, + "nodeType": "FunctionDefinition", + "src": "1688:687:24", + "nodes": [], + "body": { + "id": 45038, + "nodeType": "Block", + "src": "1777:598:24", + "nodes": [], + "statements": [ + { + "assignments": [ + 44959 + ], + "declarations": [ + { + "constant": false, + "id": 44959, + "mutability": "mutable", + "name": "index", + "nameLocation": "1795:5:24", + "nodeType": "VariableDeclaration", + "scope": 45038, + "src": "1787:13:24", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 44958, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "1787:7:24", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "id": 44968, + "initialValue": { + "arguments": [ + { + "arguments": [ + { + "id": 44963, + "name": "orderId", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 44951, + "src": "1830:7:24", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "id": 44964, + "name": "destAddress", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 44953, + "src": "1839:11:24", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "id": 44965, + "name": "amount", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 44955, + "src": "1852:6:24", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "expression": { + "id": 44961, + "name": "abi", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -1, + "src": "1813:3:24", + "typeDescriptions": { + "typeIdentifier": "t_magic_abi", + "typeString": "abi" + } + }, + "id": 44962, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberLocation": "1817:12:24", + "memberName": "encodePacked", + "nodeType": "MemberAccess", + "src": "1813:16:24", + "typeDescriptions": { + "typeIdentifier": "t_function_abiencodepacked_pure$__$returns$_t_bytes_memory_ptr_$", + "typeString": "function () pure returns (bytes memory)" + } + }, + "id": 44966, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "1813:46:24", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + ], + "id": 44960, + "name": "keccak256", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -8, + "src": "1803:9:24", + "typeDescriptions": { + "typeIdentifier": "t_function_keccak256_pure$_t_bytes_memory_ptr_$returns$_t_bytes32_$", + "typeString": "function (bytes memory) pure returns (bytes32)" + } + }, + "id": 44967, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "1803:57:24", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "1787:73:24" + }, + { + "assignments": [ + 44971 + ], + "declarations": [ + { + "constant": false, + "id": 44971, + "mutability": "mutable", + "name": "transferInfo", + "nameLocation": "1891:12:24", + "nodeType": "VariableDeclaration", + "scope": 45038, + "src": "1870:33:24", + "stateVariable": false, + "storageLocation": "storage", + "typeDescriptions": { + "typeIdentifier": "t_struct$_TransferInfo_$44801_storage_ptr", + "typeString": "struct YABTransfer.TransferInfo" + }, + "typeName": { + "id": 44970, + "nodeType": "UserDefinedTypeName", + "pathNode": { + "id": 44969, + "name": "TransferInfo", + "nameLocations": [ + "1870:12:24" + ], + "nodeType": "IdentifierPath", + "referencedDeclaration": 44801, + "src": "1870:12:24" + }, + "referencedDeclaration": 44801, + "src": "1870:12:24", + "typeDescriptions": { + "typeIdentifier": "t_struct$_TransferInfo_$44801_storage_ptr", + "typeString": "struct YABTransfer.TransferInfo" + } + }, + "visibility": "internal" + } + ], + "id": 44975, + "initialValue": { + "baseExpression": { + "id": 44972, + "name": "transfers", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 44815, + "src": "1906:9:24", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_bytes32_$_t_struct$_TransferInfo_$44801_storage_$", + "typeString": "mapping(bytes32 => struct YABTransfer.TransferInfo storage ref)" + } + }, + "id": 44974, + "indexExpression": { + "id": 44973, + "name": "index", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 44959, + "src": "1916:5:24", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "1906:16:24", + "typeDescriptions": { + "typeIdentifier": "t_struct$_TransferInfo_$44801_storage", + "typeString": "struct YABTransfer.TransferInfo storage ref" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "1870:52:24" + }, + { + "expression": { + "arguments": [ + { + "commonType": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "id": 44980, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "expression": { + "id": 44977, + "name": "transferInfo", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 44971, + "src": "1940:12:24", + "typeDescriptions": { + "typeIdentifier": "t_struct$_TransferInfo_$44801_storage_ptr", + "typeString": "struct YABTransfer.TransferInfo storage pointer" + } + }, + "id": 44978, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "memberLocation": "1953:6:24", + "memberName": "isUsed", + "nodeType": "MemberAccess", + "referencedDeclaration": 44800, + "src": "1940:19:24", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "hexValue": "74727565", + "id": 44979, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "bool", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1963:4:24", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "value": "true" + }, + "src": "1940:27:24", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + { + "hexValue": "5472616e73666572206e6f7420666f756e642e", + "id": 44981, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1969:21:24", + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_df5214ebe3bfb770904efebf94bed0b3d093cefba7c856223cd0f237ff41a67e", + "typeString": "literal_string \"Transfer not found.\"" + }, + "value": "Transfer not found." + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + { + "typeIdentifier": "t_stringliteral_df5214ebe3bfb770904efebf94bed0b3d093cefba7c856223cd0f237ff41a67e", + "typeString": "literal_string \"Transfer not found.\"" + } + ], + "id": 44976, + "name": "require", + "nodeType": "Identifier", + "overloadedDeclarations": [ + -18, + -18 + ], + "referencedDeclaration": -18, + "src": "1932:7:24", + "typeDescriptions": { + "typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$", + "typeString": "function (bool,string memory) pure" + } + }, + "id": 44982, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "1932:59:24", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 44983, + "nodeType": "ExpressionStatement", + "src": "1932:59:24" + }, + { + "assignments": [ + 44988 + ], + "declarations": [ + { + "constant": false, + "id": 44988, + "mutability": "mutable", + "name": "payload", + "nameLocation": "2019:7:24", + "nodeType": "VariableDeclaration", + "scope": 45038, + "src": "2002:24:24", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$dyn_memory_ptr", + "typeString": "uint256[]" + }, + "typeName": { + "baseType": { + "id": 44986, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2002:7:24", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 44987, + "nodeType": "ArrayTypeName", + "src": "2002:9:24", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$dyn_storage_ptr", + "typeString": "uint256[]" + } + }, + "visibility": "internal" + } + ], + "id": 44994, + "initialValue": { + "arguments": [ + { + "hexValue": "35", + "id": 44992, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2043:1:24", + "typeDescriptions": { + "typeIdentifier": "t_rational_5_by_1", + "typeString": "int_const 5" + }, + "value": "5" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_5_by_1", + "typeString": "int_const 5" + } + ], + "id": 44991, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "NewExpression", + "src": "2029:13:24", + "typeDescriptions": { + "typeIdentifier": "t_function_objectcreation_pure$_t_uint256_$returns$_t_array$_t_uint256_$dyn_memory_ptr_$", + "typeString": "function (uint256) pure returns (uint256[] memory)" + }, + "typeName": { + "baseType": { + "id": 44989, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2033:7:24", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 44990, + "nodeType": "ArrayTypeName", + "src": "2033:9:24", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$dyn_storage_ptr", + "typeString": "uint256[]" + } + } + }, + "id": 44993, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "2029:16:24", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$dyn_memory_ptr", + "typeString": "uint256[] memory" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "2002:43:24" + }, + { + "expression": { + "id": 44999, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "baseExpression": { + "id": 44995, + "name": "payload", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 44988, + "src": "2055:7:24", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$dyn_memory_ptr", + "typeString": "uint256[] memory" + } + }, + "id": 44997, + "indexExpression": { + "hexValue": "30", + "id": 44996, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2063:1:24", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "IndexAccess", + "src": "2055:10:24", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "id": 44998, + "name": "orderId", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 44951, + "src": "2068:7:24", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "2055:20:24", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 45000, + "nodeType": "ExpressionStatement", + "src": "2055:20:24" + }, + { + "expression": { + "id": 45005, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "baseExpression": { + "id": 45001, + "name": "payload", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 44988, + "src": "2085:7:24", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$dyn_memory_ptr", + "typeString": "uint256[] memory" + } + }, + "id": 45003, + "indexExpression": { + "hexValue": "31", + "id": 45002, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2093:1:24", + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "IndexAccess", + "src": "2085:10:24", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "hexValue": "30", + "id": 45004, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2098:1:24", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "src": "2085:14:24", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 45006, + "nodeType": "ExpressionStatement", + "src": "2085:14:24" + }, + { + "expression": { + "id": 45012, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "baseExpression": { + "id": 45007, + "name": "payload", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 44988, + "src": "2109:7:24", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$dyn_memory_ptr", + "typeString": "uint256[] memory" + } + }, + "id": 45009, + "indexExpression": { + "hexValue": "32", + "id": 45008, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2117:1:24", + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "IndexAccess", + "src": "2109:10:24", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "expression": { + "id": 45010, + "name": "transferInfo", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 44971, + "src": "2122:12:24", + "typeDescriptions": { + "typeIdentifier": "t_struct$_TransferInfo_$44801_storage_ptr", + "typeString": "struct YABTransfer.TransferInfo storage pointer" + } + }, + "id": 45011, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "memberLocation": "2135:11:24", + "memberName": "destAddress", + "nodeType": "MemberAccess", + "referencedDeclaration": 44796, + "src": "2122:24:24", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "2109:37:24", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 45013, + "nodeType": "ExpressionStatement", + "src": "2109:37:24" + }, + { + "expression": { + "id": 45019, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "baseExpression": { + "id": 45014, + "name": "payload", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 44988, + "src": "2156:7:24", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$dyn_memory_ptr", + "typeString": "uint256[] memory" + } + }, + "id": 45016, + "indexExpression": { + "hexValue": "33", + "id": 45015, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2164:1:24", + "typeDescriptions": { + "typeIdentifier": "t_rational_3_by_1", + "typeString": "int_const 3" + }, + "value": "3" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "IndexAccess", + "src": "2156:10:24", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "expression": { + "id": 45017, + "name": "transferInfo", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 44971, + "src": "2169:12:24", + "typeDescriptions": { + "typeIdentifier": "t_struct$_TransferInfo_$44801_storage_ptr", + "typeString": "struct YABTransfer.TransferInfo storage pointer" + } + }, + "id": 45018, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "memberLocation": "2182:6:24", + "memberName": "amount", + "nodeType": "MemberAccess", + "referencedDeclaration": 44798, + "src": "2169:19:24", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "2156:32:24", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 45020, + "nodeType": "ExpressionStatement", + "src": "2156:32:24" + }, + { + "expression": { + "id": 45025, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "baseExpression": { + "id": 45021, + "name": "payload", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 44988, + "src": "2198:7:24", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$dyn_memory_ptr", + "typeString": "uint256[] memory" + } + }, + "id": 45023, + "indexExpression": { + "hexValue": "34", + "id": 45022, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2206:1:24", + "typeDescriptions": { + "typeIdentifier": "t_rational_4_by_1", + "typeString": "int_const 4" + }, + "value": "4" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "IndexAccess", + "src": "2198:10:24", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "hexValue": "30", + "id": 45024, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2211:1:24", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "src": "2198:14:24", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 45026, + "nodeType": "ExpressionStatement", + "src": "2198:14:24" + }, + { + "expression": { + "arguments": [ + { + "id": 45033, + "name": "_snEscrowAddress", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 44822, + "src": "2291:16:24", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "id": 45034, + "name": "_snEscrowWithdrawSelector", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 44824, + "src": "2321:25:24", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "id": 45035, + "name": "payload", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 44988, + "src": "2360:7:24", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$dyn_memory_ptr", + "typeString": "uint256[] memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_array$_t_uint256_$dyn_memory_ptr", + "typeString": "uint256[] memory" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_array$_t_uint256_$dyn_memory_ptr", + "typeString": "uint256[] memory" + } + ], + "expression": { + "id": 45027, + "name": "_snMessaging", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 44820, + "src": "2231:12:24", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IStarknetMessaging_$44666", + "typeString": "contract IStarknetMessaging" + } + }, + "id": 45029, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "2244:15:24", + "memberName": "sendMessageToL2", + "nodeType": "MemberAccess", + "referencedDeclaration": 44624, + "src": "2231:28:24", + "typeDescriptions": { + "typeIdentifier": "t_function_external_payable$_t_uint256_$_t_uint256_$_t_array$_t_uint256_$dyn_memory_ptr_$returns$_t_bytes32_$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256[] memory) payable external returns (bytes32,uint256)" + } + }, + "id": 45032, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "names": [ + "value" + ], + "nodeType": "FunctionCallOptions", + "options": [ + { + "expression": { + "id": 45030, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -15, + "src": "2267:3:24", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" + } + }, + "id": 45031, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "2271:5:24", + "memberName": "value", + "nodeType": "MemberAccess", + "src": "2267:9:24", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "src": "2231:46:24", + "typeDescriptions": { + "typeIdentifier": "t_function_external_payable$_t_uint256_$_t_uint256_$_t_array$_t_uint256_$dyn_memory_ptr_$returns$_t_bytes32_$_t_uint256_$value", + "typeString": "function (uint256,uint256,uint256[] memory) payable external returns (bytes32,uint256)" + } + }, + "id": 45036, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "2231:137:24", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_bytes32_$_t_uint256_$", + "typeString": "tuple(bytes32,uint256)" + } + }, + "id": 45037, + "nodeType": "ExpressionStatement", + "src": "2231:137:24" + } + ] + }, + "functionSelector": "a41fe49f", + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "withdraw", + "nameLocation": "1697:8:24", + "parameters": { + "id": 44956, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 44951, + "mutability": "mutable", + "name": "orderId", + "nameLocation": "1714:7:24", + "nodeType": "VariableDeclaration", + "scope": 45039, + "src": "1706:15:24", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 44950, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1706:7:24", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 44953, + "mutability": "mutable", + "name": "destAddress", + "nameLocation": "1731:11:24", + "nodeType": "VariableDeclaration", + "scope": 45039, + "src": "1723:19:24", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 44952, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1723:7:24", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 44955, + "mutability": "mutable", + "name": "amount", + "nameLocation": "1752:6:24", + "nodeType": "VariableDeclaration", + "scope": 45039, + "src": "1744:14:24", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 44954, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1744:7:24", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "1705:54:24" + }, + "returnParameters": { + "id": 44957, + "nodeType": "ParameterList", + "parameters": [], + "src": "1777:0:24" + }, + "scope": 45076, + "stateMutability": "payable", + "virtual": false, + "visibility": "external" + }, + { + "id": 45057, + "nodeType": "FunctionDefinition", + "src": "2381:188:24", + "nodes": [], + "body": { + "id": 45056, + "nodeType": "Block", + "src": "2441:128:24", + "nodes": [], + "statements": [ + { + "expression": { + "arguments": [ + { + "commonType": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "id": 45048, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "expression": { + "id": 45045, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -15, + "src": "2459:3:24", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" + } + }, + "id": 45046, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "2463:6:24", + "memberName": "sender", + "nodeType": "MemberAccess", + "src": "2459:10:24", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "id": 45047, + "name": "_owner", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 44817, + "src": "2473:6:24", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "src": "2459:20:24", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + { + "hexValue": "4f6e6c79206f776e65722063616e2063616c6c20746869732066756e6374696f6e2e", + "id": 45049, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2481:36:24", + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_0fcea41e877c4f84237ea6b9061acc9b3fc97555de5ba31615eb7b8cf7110239", + "typeString": "literal_string \"Only owner can call this function.\"" + }, + "value": "Only owner can call this function." + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + { + "typeIdentifier": "t_stringliteral_0fcea41e877c4f84237ea6b9061acc9b3fc97555de5ba31615eb7b8cf7110239", + "typeString": "literal_string \"Only owner can call this function.\"" + } + ], + "id": 45044, + "name": "require", + "nodeType": "Identifier", + "overloadedDeclarations": [ + -18, + -18 + ], + "referencedDeclaration": -18, + "src": "2451:7:24", + "typeDescriptions": { + "typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$", + "typeString": "function (bool,string memory) pure" + } + }, + "id": 45050, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "2451:67:24", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 45051, + "nodeType": "ExpressionStatement", + "src": "2451:67:24" + }, + { + "expression": { + "id": 45054, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 45052, + "name": "_snEscrowAddress", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 44822, + "src": "2528:16:24", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "id": 45053, + "name": "snEscrowAddress", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 45041, + "src": "2547:15:24", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "2528:34:24", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 45055, + "nodeType": "ExpressionStatement", + "src": "2528:34:24" + } + ] + }, + "functionSelector": "9a63d92d", + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "setEscrowAddress", + "nameLocation": "2390:16:24", + "parameters": { + "id": 45042, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 45041, + "mutability": "mutable", + "name": "snEscrowAddress", + "nameLocation": "2415:15:24", + "nodeType": "VariableDeclaration", + "scope": 45057, + "src": "2407:23:24", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 45040, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2407:7:24", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "2406:25:24" + }, + "returnParameters": { + "id": 45043, + "nodeType": "ParameterList", + "parameters": [], + "src": "2441:0:24" + }, + "scope": 45076, + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "external" + }, + { + "id": 45075, + "nodeType": "FunctionDefinition", + "src": "2575:224:24", + "nodes": [], + "body": { + "id": 45074, + "nodeType": "Block", + "src": "2653:146:24", + "nodes": [], + "statements": [ + { + "expression": { + "arguments": [ + { + "commonType": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "id": 45066, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "expression": { + "id": 45063, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": -15, + "src": "2671:3:24", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" + } + }, + "id": 45064, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberLocation": "2675:6:24", + "memberName": "sender", + "nodeType": "MemberAccess", + "src": "2671:10:24", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "id": 45065, + "name": "_owner", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 44817, + "src": "2685:6:24", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "src": "2671:20:24", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + { + "hexValue": "4f6e6c79206f776e65722063616e2063616c6c20746869732066756e6374696f6e2e", + "id": 45067, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2693:36:24", + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_0fcea41e877c4f84237ea6b9061acc9b3fc97555de5ba31615eb7b8cf7110239", + "typeString": "literal_string \"Only owner can call this function.\"" + }, + "value": "Only owner can call this function." + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + { + "typeIdentifier": "t_stringliteral_0fcea41e877c4f84237ea6b9061acc9b3fc97555de5ba31615eb7b8cf7110239", + "typeString": "literal_string \"Only owner can call this function.\"" + } + ], + "id": 45062, + "name": "require", + "nodeType": "Identifier", + "overloadedDeclarations": [ + -18, + -18 + ], + "referencedDeclaration": -18, + "src": "2663:7:24", + "typeDescriptions": { + "typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$", + "typeString": "function (bool,string memory) pure" + } + }, + "id": 45068, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "nameLocations": [], + "names": [], + "nodeType": "FunctionCall", + "src": "2663:67:24", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 45069, + "nodeType": "ExpressionStatement", + "src": "2663:67:24" + }, + { + "expression": { + "id": 45072, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 45070, + "name": "_snEscrowWithdrawSelector", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 44824, + "src": "2740:25:24", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "id": 45071, + "name": "snEscrowWithdrawSelector", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 45059, + "src": "2768:24:24", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "2740:52:24", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 45073, + "nodeType": "ExpressionStatement", + "src": "2740:52:24" + } + ] + }, + "functionSelector": "3e95784a", + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "setEscrowWithdrawSelector", + "nameLocation": "2584:25:24", + "parameters": { + "id": 45060, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 45059, + "mutability": "mutable", + "name": "snEscrowWithdrawSelector", + "nameLocation": "2618:24:24", + "nodeType": "VariableDeclaration", + "scope": 45075, + "src": "2610:32:24", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 45058, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2610:7:24", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "2609:34:24" + }, + "returnParameters": { + "id": 45061, + "nodeType": "ParameterList", + "parameters": [], + "src": "2653:0:24" + }, + "scope": 45076, + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "external" } ], "abstract": false, @@ -1814,18 +4273,18 @@ "contractKind": "contract", "fullyImplemented": true, "linearizedBaseContracts": [ - 39444 + 45076 ], "name": "YABTransfer", - "nameLocation": "74:11:15", - "scope": 39445, + "nameLocation": "143:11:24", + "scope": 45077, "usedErrors": [], "usedEvents": [ - 39353 + 44810 ] } ], "license": "Apache-2.0" }, - "id": 15 + "id": 24 } \ No newline at end of file diff --git a/mm-bot/starknet.py b/mm-bot/starknet.py index 58529902..10834296 100644 --- a/mm-bot/starknet.py +++ b/mm-bot/starknet.py @@ -29,13 +29,14 @@ class SetOrderEvent: - def __init__(self, order_id, recipient_address, amount): + def __init__(self, order_id, recipient_address, amount, fee): self.order_id = order_id self.recipient_address = recipient_address self.amount = amount - + self.fee = fee + def __str__(self): - return f"order_id:{self.order_id}, recipent: {self.recipient_address}, amount: {self.amount}" + return f"order_id:{self.order_id}, recipent: {self.recipient_address}, amount: {self.amount}, fee: {self.fee}" async def get_starknet_events(): @@ -73,6 +74,10 @@ async def get_latest_unfulfilled_orders(): events = request_result.events orders = set() for event in events: + fee_threshold = 0.0001 * event.data[3] + if event.data[5] < fee_threshold: + print("[-] Order %s has a fee too low to process (%d < %d). Skipping" % (event.data[0], event.data[5], fee_threshold)) + continue status = await get_is_used_order(event.data[0]) if not status: order = SetOrderEvent(