You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -119,6 +122,45 @@ public function __construct(\stdClass $tx, array $options = [])
119
122
//foreach($this->result as $r) {echo "'".$r."',".PHP_EOL;}exit;
120
123
}
121
124
125
+
/**
126
+
* Logic handler for AMMWithdraw
127
+
* This method will detect AMM_ACCOUNT by comparing existing detected accounts.
128
+
* @return void
129
+
*/
130
+
privatefunctionlogic_detectAMMWithdraw()
131
+
{
132
+
if($this->tx->TransactionType != 'AMMWithdraw')
133
+
return;
134
+
$accounts = $this->accounts;
135
+
//Check if AMM_ACCOUNT role does not exist
136
+
foreach($this->accountsas$acc => $roles) {
137
+
if(\in_array('AMM_ACCOUNT',$roles))
138
+
return;
139
+
}
140
+
unset($acc);
141
+
unset($roles);
142
+
143
+
//This is AMMWithdraw but AMM_ACCOUNT was not detected
144
+
145
+
unset($accounts[self::ACCOUNT_ZERO]);
146
+
unset($accounts[self::ACCOUNT_ONE]);
147
+
unset($accounts[self::ACCOUNT_GENESIS]);
148
+
unset($accounts[self::ACCOUNT_BLACKHOLE]);
149
+
unset($accounts[self::ACCOUNT_NAN]);
150
+
151
+
//If there is two non special accounts present, one is transaction initiator other is AMM Account - see test 45
152
+
if(count($accounts) != 2) {
153
+
thrownew \Exception('Unhandled: unable to detect AMM_ACCOUNT in logic_detectAMMWithdraw - more than two accounts detected without obvious AMM account');
0 commit comments