Ejemplo n.º 1
0
 /// <summary>
 /// Set the conversion rate between base asset and APH.
 /// </summary>
 /// <param name="baseAssetId">the base asset</param>
 /// <param name="conversionRate">the amount (fixed8) of APH for 1 unit of base asset</param>
 /// <returns>true if successfully set, otherwise false.</returns>
 private static bool SetAssetToAphConversionRate(byte[] baseAssetId, BigInteger conversionRate)
 {
     if (baseAssetId.Length != 32 && baseAssetId.Length != 20)
     {
         return(false);
     }
     if (VerifyWhitelister() == false && VerifyManager() == false && VerifyOwner() == false)
     {
         return(false);
     }
     Storage.Put(Storage.CurrentContext, PREFIX_BASE_CONVERSION_RATE.Concat(baseAssetId), conversionRate);
     return(true);
 }
Ejemplo n.º 2
0
 public static BigInteger GetAssetToAphConversionRate(byte[] baseAssetId)
 {
     return(Storage.Get(Storage.CurrentContext, PREFIX_BASE_CONVERSION_RATE.Concat(baseAssetId)).AsBigInteger());
 }