Example #1
0
        /// <summary>
        ///
        /// This method will build a trigger that will transfer tokens from a holding account to a receiver.
        ///
        /// NOTE: UNDER CONSTRUCTION
        ///
        /// </summary>
        public static ISuccessTrigger BuildTokenTransferTrigger(this WonkaBizSource poSource, string psRecvAddress, long pnTransferAmt, string psWeb3Url = "", System.Threading.CancellationTokenSource poTokenSrc = null)
        {
            Nethereum.Web3.Web3 web3 = WonkaExtensions.GetWeb3(poSource.Password, psWeb3Url);

            var TransferTrigger = new WonkaEthEIP20TransferTrigger(web3, poSource.ContractAddress, psRecvAddress, pnTransferAmt, poTokenSrc);

            return(TransferTrigger);
        }
Example #2
0
        /// <summary>
        ///
        /// This method will use Nethereum to call upon the Registry and retrieve all member data affiliated with
        /// a particular Grove.
        ///
        /// <param name="poGrove">The Grove that we are interested in</param>
        /// <param name="psDefaultWonkaABI">The default ABI for the Wonka contract (since we might have different versions in the future)</param>
        /// <returns>None</returns>
        /// </summary>
        public static void PopulateFromRegistry(this WonkaRuleGrove poGrove, string psDefaultWonkaABI)
        {
            if (String.IsNullOrEmpty(poGrove.GroveId))
            {
                throw new Exception("ERROR!  No Grove ID provided.");
            }

            var contract             = WonkaExtensions.GetRegistryContract();
            var getGroveInfoFunction = contract.GetFunction("getRuleGrove");

            var groveRegistryInfo = getGroveInfoFunction.CallDeserializingToObjectAsync <RuleGroveRegistryData>(poGrove.GroveId).Result;

            poGrove.Ingest(groveRegistryInfo);

            foreach (string sTmpGroveId in groveRegistryInfo.RuleTreeMembers)
            {
                poGrove.OrderedRuleTrees.Add(new WonkaRegistryItem(WonkaExtensions.GetRuleTreeIndex(sTmpGroveId), psDefaultWonkaABI));
            }

            string sCreateDateTime = poGrove.CreationTime.ToString();
        }