/// <summary> /// allow allocation of presale purchases by contract administrator. this allows the moonlight team to allocate the 25% of LX tokens sold in the private presale. /// as we accepted ETH in addition to NEO&GAS, using a mintTokens method here is not practical. /// 1. this method will not allow the presale allocation to exceed the defined amount /// 2. this method is permanently disabled once the method `LockPresaleAllocation` has been called. /// 3. the state of the `LockPresaleAllocation` can be determined by the public using the method `IsPresaleAllocationLocked` (returns timestamp that lock was put in place) /// </summary> /// <param name="address"></param> /// <param name="amountPurchased"></param> /// <returns></returns> public static bool AllocatePresalePurchase(byte[] address, BigInteger amountPurchased) { bool presaleLocked = Storage.Get(Storage.CurrentContext, StorageKeys.PresaleAllocationLocked()).AsBigInteger() > 0; if (presaleLocked) { Runtime.Notify("AllocatePresalePurchase() presaleLocked, can't allocate"); return(false); } BigInteger presaleAllocationMaxValue = ((ICOContract.TokenMaxSupply * (BigInteger)ICOContract.PresaleAllocationPercentage()) / 100) * NEP5.factor; BigInteger presaleAllocatedValue = Storage.Get(Storage.CurrentContext, StorageKeys.PresaleAllocatedValue()).AsBigInteger(); if ((presaleAllocatedValue + amountPurchased) > presaleAllocationMaxValue) { // this purchase will exceed the presale cap.. dont allow Runtime.Notify("AllocatePresalePurchase() purchase will exceed presale max allocation"); return(false); } TokenSale.SetVestingPeriodForAddress(address, amountPurchased); Storage.Put(Storage.CurrentContext, StorageKeys.PresaleAllocatedValue(), presaleAllocatedValue + amountPurchased); Runtime.Notify("AllocatePresalePurchase() tokens allocated", address, amountPurchased); return(true); }
public static object HandleHelperOperation(string operation, params object[] args) { switch (operation) { case "BalanceOfVestedAddress": if (!Helpers.RequireArgumentLength(args, 1)) { return(false); } return(Helpers.BalanceOfVestedAddress((byte[])args[0])); case "IsPresaleAllocationLocked": return(Storage.Get(Storage.CurrentContext, StorageKeys.PresaleAllocationLocked())); case "supportedStandards": return(DIVE.DIVE.supportedStandards()); } return(false); }
public static object HandleHelperOperation(string operation, params object[] args) { switch (operation) { case "BalanceOfVestedAddress": // retrieve the real balance of an address that has been subjected to whitepaper defined vesting period if (!Helpers.RequireArgumentLength(args, 1)) { return(false); } return(Helpers.BalanceOfVestedAddress((byte[])args[0])); case "IsPresaleAllocationLocked": // if the admin method `Administration.AllocatePresalePurchase` is permanently disabled, this method will return // the timestamp the lock was put in place. return(Storage.Get(Storage.CurrentContext, StorageKeys.PresaleAllocationLocked())); case "supportedStandards": // support NEP-10 by responding to supportedStandards // https://github.com/neo-project/proposals/blob/master/nep-10.mediawiki return(ICOTemplate.SupportedStandards()); } return(false); }
/// <summary> /// once initial presale allocation completed perform lock that prevents allocation being used /// </summary> /// <returns></returns> public static bool LockPresaleAllocation() { Runtime.Log("LockPresaleAllocation() further presale allocations locked"); Storage.Put(Storage.CurrentContext, StorageKeys.PresaleAllocationLocked(), Helpers.GetBlockTimestamp()); return(true); }