public static async Task <aclContract> At(Meadow.JsonRpc.Client.IJsonRpcClient rpcClient, Meadow.Core.EthTypes.Address address, Meadow.Core.EthTypes.Address?defaultFromAccount = null) { defaultFromAccount = defaultFromAccount ?? (await rpcClient.Accounts())[0]; return(new aclContract(rpcClient, address, defaultFromAccount.Value)); }
/// <summary> /// Deploys the contract. <para/> /// </summary> /// <param name = "rpcClient">The RPC client to be used for this contract instance.</param> /// <param name = "defaultFromAccount">If null then the first account returned by eth_accounts will be used.</param> /// <returns>An contract instance pointed at the deployed contract address.</returns> public static async Task <aclContract> Deploy(Meadow.JsonRpc.Client.IJsonRpcClient rpcClient, Meadow.JsonRpc.Types.TransactionParams transactionParams = null, Meadow.Core.EthTypes.Address?defaultFromAccount = null) { transactionParams = transactionParams ?? new Meadow.JsonRpc.Types.TransactionParams(); defaultFromAccount = defaultFromAccount ?? transactionParams.From ?? (await rpcClient.Accounts())[0]; transactionParams.From = transactionParams.From ?? defaultFromAccount; var encodedParams = Array.Empty <byte>(); var contractAddr = await ContractFactory.Deploy(rpcClient, BYTECODE_BYTES.Value, transactionParams, encodedParams); return(new aclContract(rpcClient, contractAddr, defaultFromAccount.Value)); }
/// <summary> /// Deploys the contract. <para/> /// </summary> /// <param name = "total"><c>uint256</c></param> /// <param name = "rpcClient">The RPC client to be used for this contract instance.</param> /// <param name = "defaultFromAccount">If null then the first account returned by eth_accounts will be used.</param> /// <returns>An contract instance pointed at the deployed contract address.</returns> public static async Task <ERC20Basic> Deploy(Meadow.Core.EthTypes.UInt256 total, Meadow.JsonRpc.Client.IJsonRpcClient rpcClient, Meadow.JsonRpc.Types.TransactionParams transactionParams = null, Meadow.Core.EthTypes.Address?defaultFromAccount = null) { transactionParams = transactionParams ?? new Meadow.JsonRpc.Types.TransactionParams(); defaultFromAccount = defaultFromAccount ?? transactionParams.From ?? (await rpcClient.Accounts())[0]; transactionParams.From = transactionParams.From ?? defaultFromAccount; var encodedParams = Meadow.Core.AbiEncoding.EncoderUtil.Encode(EncoderFactory.LoadEncoder("uint256", total)); var contractAddr = await ContractFactory.Deploy(rpcClient, BYTECODE_BYTES.Value, transactionParams, encodedParams); return(new ERC20Basic(rpcClient, contractAddr, defaultFromAccount.Value)); }