Ejemplo n.º 1
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.º 2
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);
        }