/// <summary> /// Transfers a specified amount of ether from the input UserWallet to a specified address. /// </summary> /// <param name="userWalletManager"> The wallet to send the ether from. </param> /// <param name="gasLimit"> The gas limit to use for this ether send transaction. </param> /// <param name="gasPrice"> The gas price to use for this ether send transaction. </param> /// <param name="address"> The address to send the ether to. </param> /// <param name="amount"> The amount of ether to send. </param> public override void Transfer(UserWalletManager userWalletManager, HexBigInteger gasLimit, HexBigInteger gasPrice, string address, decimal amount) { userWalletManager.SignTransaction <ConfirmTransactionPopup>( request => EthUtils.SendEther(request, gasLimit, gasPrice, userWalletManager.GetWalletAddress(), address, amount), gasLimit, gasPrice, SolidityUtils.ConvertToUInt(amount, 18), address, "", address, AssetAddress, amount, "ETH"); }
/// <summary> /// Releases some purpose from the Hodler smart contract. /// </summary> /// <param name="userWalletManager"> The class managing the wallet. </param> /// <param name="gasLimit"> The gas limit to send with the transaction. </param> /// <param name="gasPrice"> The gas price to send with the transaction. </param> /// <param name="id"> The id of the locked purpose item. </param> /// <param name="amountToRelease"> The amount of purpose that will be released. </param> public void Release(UserWalletManager userWalletManager, HexBigInteger gasLimit, HexBigInteger gasPrice, BigInteger id, decimal amountToRelease) { var transactionInput = ContractFunction.CreateFunction <Messages.Release>( userWalletManager, gasPrice, gasLimit, id).CreateTransactionInput(ContractAddress); userWalletManager.SignTransaction <ConfirmReleasePopup>( request => ContractUtils.SendContractMessage("Releasing PRPS", transactionInput, request), gasLimit, gasPrice, 0, ContractAddress, transactionInput.Data, amountToRelease); }
/// <summary> /// Locks a certain amount of purpose into the Hodler smart contract. /// </summary> /// <param name="userWalletManager"> The class managing the wallet. </param> /// <param name="gasLimit"> The gas limit to send with the transaction. </param> /// <param name="gasPrice"> The gas price to send with the transaction. </param> /// <param name="id"> The id of the lock function call. </param> /// <param name="value"> The amount of purpose to lock. </param> /// <param name="monthsToLock"> How many months the purpose should be locked for. </param> public void Hodl(UserWalletManager userWalletManager, HexBigInteger gasLimit, HexBigInteger gasPrice, BigInteger id, decimal value, int monthsToLock) { var transactionInput = ContractFunction.CreateFunction <Messages.Hodl>( userWalletManager, gasPrice, gasLimit, id, SolidityUtils.ConvertToUInt(value, 18), new BigInteger(monthsToLock)).CreateTransactionInput(ContractAddress); userWalletManager.SignTransaction <ConfirmLockPopup>( request => ContractUtils.SendContractMessage("Locking PRPS", transactionInput, request), gasLimit, gasPrice, 0, ContractAddress, transactionInput.Data, monthsToLock, value); }
/// <summary> /// Transfers a certain number of tokens of this contract from a wallet to another address. /// </summary> /// <param name="userWalletManager"> The wallet to transfer the tokens from. </param> /// <param name="gasLimit"> The gas limit to use when sending the tokens. </param> /// <param name="gasPrice"> The gas price to use when sending the tokens. </param> /// <param name="address"> The address to transfer the tokens to. </param> /// <param name="amount"> The amount of tokens to transfer. </param> public void Transfer(UserWalletManager userWalletManager, HexBigInteger gasLimit, HexBigInteger gasPrice, string address, decimal amount) { var transactionInput = ContractFunction.CreateFunction <Messages.Transfer>( userWalletManager, gasPrice, gasLimit, address, SolidityUtils.ConvertToUInt(amount, Decimals.Value)).CreateTransactionInput(ContractAddress); userWalletManager.SignTransaction <ConfirmTransactionPopup>( request => ContractUtils.SendContractMessage($"Sending {Symbol}", transactionInput, request), gasLimit, gasPrice, 0, ContractAddress, transactionInput.Data, address, ContractAddress, amount, Symbol); }