| 915 | } |
| 916 | |
| 917 | pub async fn create_peg_in_graph(&mut self, input: Input, evm_address: &str) -> String { |
| 918 | if self.depositor_context.is_none() { |
| 919 | panic!("Depositor context must be initialized"); |
| 920 | } |
| 921 | |
| 922 | let peg_in_graph = |
| 923 | PegInGraph::new(self.depositor_context.as_ref().unwrap(), input, evm_address); |
| 924 | |
| 925 | let peg_in_graph_id = peg_in_generate_id(&peg_in_graph.peg_in_deposit_transaction); |
| 926 | |
| 927 | let graph = self |
| 928 | .data |
| 929 | .peg_in_graphs |
| 930 | .iter() |
| 931 | .find(|&peg_out_graph| peg_out_graph.id().eq(&peg_in_graph_id)); |
| 932 | if graph.is_some() { |
| 933 | panic!("Peg in graph already exists"); |
| 934 | } |
| 935 | |
| 936 | self.data.peg_in_graphs.push(peg_in_graph); |
| 937 | |
| 938 | peg_in_graph_id |
| 939 | } |
| 940 | |
| 941 | pub async fn broadcast_peg_in_deposit( |
| 942 | &mut self, |