Files
using.cash/Logic/Financial/HotBitcoinAddressUnspent.cs
T

40 lines
1.3 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Swarmops.Basic.Types.Financial;
using Swarmops.Database;
namespace Swarmops.Logic.Financial
{
public class HotBitcoinAddressUnspent: BasicHotBitcoinAddressUnspent
{
private HotBitcoinAddressUnspent (BasicHotBitcoinAddressUnspent basic): base (basic)
{
// private ctor
}
public static HotBitcoinAddressUnspent FromBasic (BasicHotBitcoinAddressUnspent basic)
{
return new HotBitcoinAddressUnspent (basic);
}
public static HotBitcoinAddressUnspent FromIdentity (int hotBitcoinAddressUnspentId)
{
return FromBasic (SwarmDb.GetDatabaseForReading().GetHotBitcoinAddressUnspent (hotBitcoinAddressUnspentId));
}
public HotBitcoinAddress Address
{
get { return HotBitcoinAddress.FromIdentity (base.HotBitcoinAddressId); }
}
public void Delete()
{
SwarmDb.GetDatabaseForWriting().DeleteHotBitcoinAddressUnspent (this.Identity);
SwarmDb.GetDatabaseForWriting().SetHotBitcoinAddressBalance (base.HotBitcoinAddressId, this.Address.Unspents.AmountSatoshisTotal); // re-fetches from db
}
}
}