예제 #1
0
        private Deploy GetDeploy(DeployData protoDeploy)
        {
            Config config;

            if (protoDeploy.HasConfig)
            {
                config = (Config)Deserialize(protoDeploy.Config, typeof(Config));
            }
            else
            {
                config = ConfigurationFactory.Empty;
            }

            RouterConfig routerConfig;

            if (protoDeploy.HasRouterConfig)
            {
                routerConfig = (RouterConfig)Deserialize(protoDeploy.RouterConfig, typeof(RouterConfig));
            }
            else
            {
                routerConfig = RouterConfig.NoRouter;
            }

            Scope scope;

            if (protoDeploy.HasScope)
            {
                scope = (Scope)Deserialize(protoDeploy.Scope, typeof(Scope));
            }
            else
            {
                scope = Deploy.NoScopeGiven;
            }

            string dispatcher;

            if (protoDeploy.HasDispatcher)
            {
                dispatcher = protoDeploy.Dispatcher;
            }
            else
            {
                dispatcher = Deploy.NoDispatcherGiven;
            }

            return(new Deploy(protoDeploy.Path, config, routerConfig, scope, dispatcher));
        }
예제 #2
0
        private DeployData GetDeployData(Deploy deploy)
        {
            var res = DeployData.CreateBuilder()
                      .SetPath(deploy.Path);

            if (deploy.Config != ConfigurationFactory.Empty)
            {
                res.SetConfig(Serialize(deploy.Config));
            }
            if (deploy.RouterConfig != RouterConfig.NoRouter)
            {
                res.SetRouterConfig(Serialize(deploy.RouterConfig));
            }
            if (deploy.Scope != Deploy.NoScopeGiven)
            {
                res.SetScope(Serialize(deploy.Scope));
            }
            if (deploy.Dispatcher != Deploy.NoDispatcherGiven)
            {
                res.SetDispatcher(deploy.Dispatcher);
            }

            return(res.Build());
        }
예제 #3
0
        private string InternalDeployContract(SCCompiled sc, int gasLimit, int gweiGasPrice, KeyValuePair <string, string> ownerAddressEncryptedPassword)
        {
            DeployInfo = new DeployData()
            {
                ABI      = sc.ABI,
                Address  = ownerAddressEncryptedPassword.Key,
                Binary   = sc.Binary,
                GasLimit = gasLimit,
                GasPrice = GetBigNumberFormatted(new BigNumber(gweiGasPrice, 9)),
                Name     = sc.Name
            };
            ABIVariableInfo = new BigVariableData()
            {
                BaseName        = string.Format("abi{0}", DeployInfo.Name),
                RemainingString = DeployInfo.ABI,
                SplitCounter    = 0,
                VariableNames   = new List <string>(),
                NextFunction    = SetBinaryBigVariableCommand
            };
            BinaryVariableInfo = new BigVariableData()
            {
                BaseName        = string.Format("bin{0}", DeployInfo.Name),
                RemainingString = string.Format("0x{0}", DeployInfo.Binary),
                SplitCounter    = 0,
                VariableNames   = new List <string>(),
                NextFunction    = DeployCommand
            };
            ConsoleOutput output = Execute(GetUnlockAccountCommand(ownerAddressEncryptedPassword.Key, ownerAddressEncryptedPassword.Value, SetABIBigVariableCommand));

            if (!output.Ok || !output.Output.Contains("transactionHash"))
            {
                throw new Web3Exception(string.Format("Error to deploy contract.\n\n{0}", output.Output));
            }

            return(output.Output.Split(new string[] { "transactionHash:" }, StringSplitOptions.RemoveEmptyEntries).Last().Trim(' ', '\n', '\r', '}', '"'));
        }
        private Deploy GetDeploy(DeployData protoDeploy)
        {
            Config config;
            if (protoDeploy.HasConfig)
                config = (Config) Deserialize(protoDeploy.Config, typeof (Config));
            else
                config = ConfigurationFactory.Empty;

            RouterConfig routerConfig;
            if (protoDeploy.HasRouterConfig)
                routerConfig = (RouterConfig) Deserialize(protoDeploy.RouterConfig, protoDeploy.RouterConfig.GetType());
            else
                routerConfig = RouterConfig.NoRouter;

            Scope scope;
            if (protoDeploy.HasScope)
                scope = (Scope) Deserialize(protoDeploy.Scope, typeof (Scope));
            else
                scope = Deploy.NoScopeGiven;

            string dispatcher;
            if (protoDeploy.HasDispatcher)
                dispatcher = protoDeploy.Dispatcher;
            else 
                dispatcher = Deploy.NoDispatcherGiven;

            return new Deploy(protoDeploy.Path, config, routerConfig, scope, dispatcher);
        }
예제 #5
0
 /// <summary>
 /// 构造函数
 /// </summary>
 /// <param name="WebName">程序名称</param>
 /// <param name="Port">端口号</param>
 /// <param name="ServerDomainName">域名</param>
 public PublishWebHelper(DeployData deployData)
 {
     _deployData = deployData;
 }