@@ -94,8 +94,6 @@ public static object Main(string method, object[] args)
94
94
if ( method == "totalSupply" ) return TotalSupply ( ) ;
95
95
96
96
if ( method == "transfer" ) return Transfer ( ( byte [ ] ) args [ 0 ] , ( byte [ ] ) args [ 1 ] , ( BigInteger ) args [ 2 ] , callscript ) ;
97
-
98
- if ( method == "transferAPP" ) return TransferAPP ( ( byte [ ] ) args [ 0 ] , ( byte [ ] ) args [ 1 ] , ( BigInteger ) args [ 2 ] , callscript ) ;
99
97
}
100
98
else if ( Runtime . Trigger == TriggerType . VerificationR ) //Backward compatibility, refusing to accept other assets
101
99
{
@@ -163,7 +161,7 @@ public static bool MintTokens()
163
161
{
164
162
if ( input . AssetId . AsBigInteger ( ) == AssetId . AsBigInteger ( ) )
165
163
sender = sender ?? input . ScriptHash ;
166
- //SGAS address as inputs is not allowed
164
+ //CGAS address as inputs is not allowed
167
165
if ( input . ScriptHash . AsBigInteger ( ) == ExecutionEngine . ExecutingScriptHash . AsBigInteger ( ) )
168
166
return false ;
169
167
}
@@ -288,42 +286,9 @@ private static bool Transfer(byte[] from, byte[] to, BigInteger amount, byte[] c
288
286
throw new InvalidOperationException ( "The parameter amount MUST be greater than 0." ) ;
289
287
if ( ExecutionEngine . EntryScriptHash . AsBigInteger ( ) != callscript . AsBigInteger ( ) )
290
288
return false ;
291
- if ( ! IsPayable ( to ) || ! Runtime . CheckWitness ( from ) /*0.2*/ )
292
- return false ;
293
- StorageMap asset = Storage . CurrentContext . CreateMap ( nameof ( asset ) ) ;
294
- var fromAmount = asset . Get ( from ) . AsBigInteger ( ) ; //0.1
295
- if ( fromAmount < amount )
289
+ if ( ! IsPayable ( to ) )
296
290
return false ;
297
- if ( from == to )
298
- return true ;
299
-
300
- //Reduce payer balances
301
- if ( fromAmount == amount )
302
- asset . Delete ( from ) ; //0.1
303
- else
304
- asset . Put ( from , fromAmount - amount ) ; //1
305
-
306
- //Increase the payee balance
307
- var toAmount = asset . Get ( to ) . AsBigInteger ( ) ; //0.1
308
- asset . Put ( to , toAmount + amount ) ; //1
309
-
310
- SetTxInfo ( from , to , amount ) ;
311
- Transferred ( from , to , amount ) ;
312
- return true ;
313
- }
314
- #if DEBUG
315
- [ DisplayName ( "transferAPP" ) ] //Only for ABI file
316
- public static bool TransferAPP ( byte [ ] from , byte [ ] to , BigInteger amount ) => true ;
317
- #endif
318
- //Methods of actual execution
319
- private static bool TransferAPP ( byte [ ] from , byte [ ] to , BigInteger amount , byte [ ] callscript )
320
- {
321
- //Check parameters
322
- if ( from . Length != 20 || to . Length != 20 )
323
- throw new InvalidOperationException ( "The parameters from and to SHOULD be 20-byte addresses." ) ;
324
- if ( amount <= 0 )
325
- throw new InvalidOperationException ( "The parameter amount MUST be greater than 0." ) ;
326
- if ( ! IsPayable ( to ) || from . AsBigInteger ( ) != callscript . AsBigInteger ( ) )
291
+ if ( ! Runtime . CheckWitness ( from ) && from . AsBigInteger ( ) != callscript . AsBigInteger ( ) ) /*0.2*/
327
292
return false ;
328
293
StorageMap asset = Storage . CurrentContext . CreateMap ( nameof ( asset ) ) ;
329
294
var fromAmount = asset . Get ( from ) . AsBigInteger ( ) ; //0.1
0 commit comments