示例#1
0
 public static void OnPayment(UInt160 from, BigInteger amount, object data)
 {
     if (AssetStorage.GetPaymentStatus())
     {
         if (ExecutionEngine.CallingScriptHash == NEO.Hash)
         {
             Mint(amount * TokensPerNEO);
         }
         else if (ExecutionEngine.CallingScriptHash == GAS.Hash)
         {
             if (from != null)
             {
                 Mint(amount * TokensPerGAS);
             }
         }
         else
         {
             throw new Exception("Wrong calling script hash");
         }
     }
     else
     {
         throw new Exception("Payment is disable on this contract!");
     }
 }