Ejemplo n.º 1
0
        /// <summary>
        /// Disbursement Testament method(遺言状と相続権の払い出し)
        /// </summary>
        /// <param name="RequesterAddress"></param>
        /// <param name="Familyname"></param>
        public void Disbursementtestament(Address RequesterAddress, string Familyname)
        {
            var InheritanceManagement = GetInheritanceManagementTableName();

            if (!StateWriter.TryGetTableWriter <IBinaryTableWriter>(InheritanceManagement, out var InheritancemanageTable))
            {
                return;
            }

            //親族チェック
            if (!InheritancemanageTable.TryGetValue(RequesterAddress.Encoded, out var familyname))
            {
                return;
            }

            if (Familyname != (familyname.ToString()))
            {
                return;
            }

            //遺言状トークン情報(トークンID)の取得
            var keyinfo = Familyname + "_Testament";

            if (!InheritancemanageTable.TryGetValue(ByteString.Encode(keyinfo), out var tokenId))
            {
                return;
            }
            var tokeninfo = tokenId.ToString();

            //遺言者の死亡確認
            var Diedinfokey = Familyname + "_DiedTestatorAddress";

            if (!TryGetInternalValue(ByteString.Encode(Diedinfokey), out var TestatorAddress))
            {
                return;
            }

            //相続要求者の鍵一致確認
            var Inheritanceinfokey = Familyname + "_InheritanceAddress";

            if (!TryGetInternalValue(ByteString.Encode(Inheritanceinfokey), out var inheritanceAddress))
            {
                return;
            }
            var InheritanceAddress = PublicKeyAddress.Decode(inheritanceAddress);

            if (InheritanceAddress != RequesterAddress)
            {
                return;
            }

            //NFTテーブルの呼び出し
            var TestamentNFTTableName = GetTestamentNFTTableName();

            if (!StateWriter.TryGetTableWriter <INFTTableWriter>(TestamentNFTTableName, out var nfttable))
            {
                return;
            }
            nfttable.TransferToken(tokeninfo, RequesterAddress);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Deposit Testament NFT method(遺言状をスマートコントラクトにあづける)
        /// </summary>
        /// <param name="tokenId"></param>
        /// <param name="Familyname"></param>
        public void deposittestamentNFT(string tokenId, string Familyname)
        {
            var InheritanceManagement = GetInheritanceManagementTableName();

            if (!StateWriter.TryGetTableWriter <IBinaryTableWriter>(InheritanceManagement, out var InheritancemanageTable))
            {
                return;
            }
            var keyinfo = Familyname + "_Testament";

            //スマートコントラクトに預けた〇〇家の遺言状情報の登録
            InheritancemanageTable.SetValue(ByteString.Encode(keyinfo), ByteString.Encode(tokenId));

            var TestamentNFTTable = GetTestamentNFTTableName();

            if (!StateWriter.TryGetTableWriter <INFTTableWriter>(TestamentNFTTable, out var Table))
            {
                return;
            }

            Table.TransferToken(tokenId, GetContractAddress());
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Deposit HeritageAsset method (現金、預金の財産をスマートコントラクトに預ける)
        /// </summary>
        /// <param name="TestatorAddress"></param>
        /// <param name="deposit"></param>
        /// <param name="Familyname"></param>
        public void depositheritageasset(Address TestatorAddress, decimal deposit, string Familyname)
        {
            var InheritanceManagement = GetInheritanceManagementTableName();

            if (!StateWriter.TryGetTableWriter <IBinaryTableWriter>(InheritanceManagement, out var InheritancemanageTable))
            {
                return;
            }
            var keyinfo = Familyname + "_HeritageAsset";
            var amount  = Convert.ToString(deposit);

            //スマートコントラクトに預けた〇〇家の資産枚数を登録
            InheritancemanageTable.SetValue(ByteString.Encode(keyinfo), ByteString.Encode(amount));

            var HeritageAssetTable = GetHeritageAssetTableName();

            if (!StateWriter.TryGetTableWriter <IAssetTableWriter>(HeritageAssetTable, out var Table))   //happen false
            {
                return;
            }

            Table.MoveValue(TestatorAddress, GetContractAddress(), deposit);
        }