/* Dapp名稱 = V-Box 說明🐳 = 可以製造您的V-Box 或向其他的V-Box付款。V-Box可永遠無限次使用,可以設定兩條文字信息(一條必須付款才可觀看) 及可設定 每次收款金額(以finney計算 1finney = 0.001ETH) 及 V_Fans功能。 由於V-Box是用您自己產生的以太錢包製造出來,所以無需擔心 您在本程式內作出的任何交易 都沒有經過任何第三者。 每一個地址只能製造出一個V-Box,如果您的以太錢包地址已經製造過V-Box,當您再用同一地址製造V-Box時 新的內容將會覆蓋舊內容。 但,此一個V-Box的交易記錄將永遠不會被覆蓋。 本程式會記錄您V-Box的總收款次數 及 每個付款的地址 及 每個地址已付的費用 。 每一個向您V-Box付款的以太錢包地址,將會獲得一個名為 V_Fans / V粉 的標記。 成為 V粉 後 這個以太錢包地址 將永遠可以看到您的隱藏信息。 (就算日後更新了V-Box資料 一樣可以免費看到) 每一個以太錢包地址 只能是 一個V-Box 的V_Fans,如這個 地址 已經是任何一個 V-Box的V_Fans 時 當他再次向任何其他的V-Box付款,他就會自動變成新V-Box的V_Fans,他在舊V-Box的V_Fans標記會立即失效。 隱藏信息部份使用 bytes 方法加密。但 我們不保証您任何信息的安全,使用本程式請自行衡量風險。 信息部份可以儲存所有文字類型 而由於在以太網絡,寫入每一個資料都要計費,所以我們不建設使用'信息'來儲存大量資料 最好的方法是寫入簡單的一個網址,或一句 感謝惠顧 ? 如任何人因使用本程式直接或間接受到任何損失,我們將不會作出任何賠償。 任何人士使用本程式前,必須先看清本條款,當任何人士使用本程式時 ,即當同意本條款內所有內容。 本條款以繁體中文本為準。 本程式代碼可作非營利教學研究用途,如需作營利用途 請聯絡我 給我一點錢就好 ^3^=♥♥ 謝謝,本程式創作者保留一切權利🐳🐳。 未解決問題🐳 = 103.108 20180412 收費🐳 = (會隨時更改) 每製造一個V-Box 或 更改V-Box內容 = 3 finney (0.003ETH 或 $HKD11左右...) 20180412 向V-Box付款 = 1 finney (0.001ETH 或 $HKD4左右...) 20180412 查看已追隨V-Box的信息 = 免費 */ import "./基本規則.sol"; /*引用其他驗證條件*/ import "./BigBoss.sol"; /*我的權限 */ pragma solidity ^0.4.19; contract ValueBox is SetNeed,SetBigBoss{ /*******************************************************************************************************記錄資料*/ uint256 private GrowthRing_ValueBox; /*Anyone making V-Box++1 */ mapping(uint256 => address) GV_A; /*MyValueBoxAddress 年輪映射V-Box地址*/ mapping(address => uint) My_ValueBox_List; /*MyValueBoxList 我的V-Box列表*/ mapping(uint => address) MVBL_A; /*MyValueBoxOwenr 這V-Box Owenr*/ mapping(uint => uint) MVBL_P; /*MyValueBoxPrice 這V-Box的價格*/ mapping(uint => bytes) MVBL_D_P; /*MyValueBoxDataPublic 這V-Box的公開信息*/ mapping(uint => bytes) MVBL_D_H; /*MyValueBoxDataHide 這V-Box的隱藏信息*/ mapping(uint => uint) MVBL_T; /*MyValueBoxUpdataTime 這V-Box的最後更新時間*/ mapping(uint => uint) MVBL_PayList; /*MyValueBoxFansList 這V-Box的購買記錄(V_Fans)*/ mapping(uint => address) MVBL_P_A; /*MyValueBoxFansAddress 這V-Box購買者的地址*/ mapping(uint => uint) MVBL_P_V; /*MyValueBoxFansPayVal 這V-Box購買者使用了的金額 */ mapping(uint => uint) MVBL_P_T; /*MyValueBoxUpdataTime 購買時間*/ mapping(uint => uint) MVBL_CommentList; /*MyValueBoxCommentList 這V-Box的評論記錄(V_Fans)*/ mapping(uint => address) MVBL_C_A; /*MyValueBoxCommentaddress 地址*/ mapping(uint => bytes) MVBL_C_D; /*V_FansCommentData V_Fans的評論*/ mapping(uint => uint) MVBL_C_T; /*MyValueBoxUpdataTime 評論時間*/ mapping(address => uint) My_Pay_List; /*Pay Allway++1 */ mapping(uint => uint) MPL_G; /*Pay to this V-box */ mapping(uint => uint) MPL_V; /*Pay this Val */ mapping(uint => uint) MPL_T; /*Pay Time */ mapping(address => uint) My_Comment_List; /*My_Comment_List */ mapping(uint => bytes) MCL_D; /*Comment data */ mapping(uint => uint) MCL_T; /*Comment Time 評論時間*/ /****************************************************************************************************************/ /*********************************************************************************************************************************************************內部功能*/ /*V-Box主人權限*************************************************************************/ modifier JustGV_A(uint _VBL_no){assert(msg.sender == MVBL_A[_VBL_no[msg.sender]]);_;} /*MakingValueBox*************************************************************************************************************/ function MakingValueBox(string _InpSTR01, string _InpSTR02, uint _InpPIC) private{ /*製造新的V-Box (內容01,內容02,價格) */ GrowthRing_ValueBox++; /*Anyone making V-Box++1 */ My_ValueBox_List[msg.sender]++; /*MyValueBoxList++1 */ GV_A[GrowthRing_ValueBox] = MVBL_A[My_ValueBox_List[msg.sender]] = msg.sender; /*V-Box=MyValueBoxOwenr=現使用者地址 */ MVBL_P[msg.sender] = _InpPIC * 1 finney; /*V-Box價格1=0.001Ether可以是0(留白) */ MVBL_D_P[msg.sender] = bytes(_InpSTR01); /*公開信息 */ MVBL_D_H[msg.sender] = bytes(_InpSTR02); /*隱藏信息 */ MVBL_T[msg.sender] = block.timestamp; /*記錄最後更新時間 */ emit EventTheValueBox ( /*出Even 返回記好的資料 */ GrowthRing_ValueBox,GV_A[GrowthRing_ValueBox],My_ValueBox_List[msg.sender], MVBL_P[msg.sender],MVBL_D_P[msg.sender],MVBL_D_H[msg.sender],MVBL_T[msg.sender] ); } /*ChangeValueBox**************************************************************************************************************/ function ChangeValueBox( uint _InpVBL_no, string _InpSTR01, string _InpSTR02, uint _InpPIC ) JustGV_A(_InpVBL_no) private { /*修V-Box(VBL_no,內容01,內容02,價格)*/ GrowthRing_ValueBox++; /*Anyone making V-Box++1 */ MVBL_P[_InpVBL_no[msg.sender]] = _InpPIC * 1 finney; /* 1=0.001Ether 可以是0(留白即可) */ MVBL_D_P[_InpVBL_no[msg.sender]] = bytes(_InpSTR01); /*公開信息 */ MVBL_D_H[_InpVBL_no[msg.sender]] = bytes(_InpSTR02); /*隱藏信息 */ MVBL_T[_InpVBL_no[msg.sender]] = block.timestamp; /*記錄最後更新時間 */ emit EventTheValueBox ( /*出Even 返回記好的資料 */ GrowthRing_ValueBox,GV_A[GrowthRing_ValueBox],My_ValueBox_List[msg.sender], MVBL_P[msg.sender],MVBL_D_P[msg.sender],MVBL_D_H[msg.sender], MVBL_T[msg.sender]); } /******************************************************************************************************************************************************************/ /***********************************************************************************************************************************************公開功能*/ /*My_V_Box********************************************************************************************************/ function My_V_Box /*使用V-Box (內容01,內容02,價格) */ ( uint If_you_need_Change_Your_V_box_please_input_the_V_box_serial_number, string Please_Input_Your_Public_Data, string Please_Input_Your_Hide_Data, uint Please_Input_Your_Price___Price_Is_Finney_One_Finney_Is_Thousandths_ETH ) external payable { IAmBigBossHaHa.transfer(msg.value); /*入帳給我 先 */ require(msg.value > Price_ValueBox || msg.value == Price_ValueBox); /*驗證入帳大於或等於使用V-Box的費用 */ if(GV_A[If_you_need_Change_Your_V_box_please_input_the_V_box_serial_number[msg.sender]] == msg.sender) /*if Vbox owenr is me goto Change Vbox*/ { ChangeValueBox( If_you_need_Change_Your_V_box_please_input_the_V_box_serial_number, Please_Input_Your_Public_Data, Please_Input_Your_Hide_Data, Please_Input_Your_Price___Price_Is_Finney_One_Finney_Is_Thousandths_ETH); } else { MakingValueBox(If_you_need_Change_Your_V_box_please_input_the_V_box_serial_number, Please_Input_Your_Public_Data,Please_Input_Your_Hide_Data, Please_Input_Your_Price___Price_Is_Finney_One_Finney_Is_Thousandths_ETH); } /*if not goto Making new Vbox */ } /*顯示最新的價值箱**********************************************************************************************************/ function V_Box_News (address Please_input_any_Vbox_address,uint Or_input_any_Vbox_serial_number) public constant returns ( uint V_Box_serial_number_is, address V_Box_Address, uint V_Box_Address_Price, string V_Box_Public_Data, bytes V_Box_Hide_Data, uint V_Box_updata_time, uint V_Box_fans_amount ) { /*if add + uint all have or not*/ if (0 == Please_input_any_Vbox_address && 0 == Or_input_any_Vbox_serial_number || 0 != Please_input_any_Vbox_address && 0 != Or_input_any_Vbox_serial_number) { return ( GrowthRing_ValueBox, /*ID V_Box_serial_number_is */ GV_A[GrowthRing_ValueBox], /*ADD V_Box_Address */ MVBL_P[GV_A[GrowthRing_ValueBox]], /*打開本盒需要的價格 */ string(MVBL_D_P[GV_A[GrowthRing_ValueBox]]), /*記錄內容01 */ MVBL_D_P[GV_A[GrowthRing_ValueBox]], /*記錄內容02 */ MVBL_T[GV_A[GrowthRing_ValueBox]], /*更新時間 */ My_ValueBox_List[GV_A[GrowthRing_ValueBox]] /*購買人數 */ ); } if (0 != Please_input_any_Vbox_address && 0 == Or_input_any_Vbox_serial_number) { return ( 0, /*ID V_Box_serial_number_is */ Please_input_any_Vbox_address, /*ADD V_Box_Address */ MVBL_P[Please_input_any_Vbox_address], /*打開本盒需要的價格 */ string(MVBL_D_P[Please_input_any_Vbox_address]), /*記錄內容01 */ MVBL_D_P[Please_input_any_Vbox_address], /*記錄內容02 */ MVBL_T[Please_input_any_Vbox_address], /*更新時間 */ My_ValueBox_List[Please_input_any_Vbox_address] /*購買人數 */ ); } if (0 == Please_input_any_Vbox_address && 0 != Or_input_any_Vbox_serial_number) { return ( Or_input_any_Vbox_serial_number, /*ID V_Box_serial_number_is */ GV_A[Or_input_any_Vbox_serial_number], /*ADD V_Box_Address */ MVBL_P[GV_A[Or_input_any_Vbox_serial_number]], /*打開本盒需要的價格 */ string(MVBL_D_P[GV_A[Or_input_any_Vbox_serial_number]]), /*記錄內容01 */ MVBL_D_P[GV_A[Or_input_any_Vbox_serial_number]], /*記錄內容02 */ MVBL_T[GV_A[Or_input_any_Vbox_serial_number]], /*更新時間 */ My_ValueBox_List[GV_A[Or_input_any_Vbox_serial_number]] /*購買人數 */ ); } } /*顯示製造新V-Box的費用********************************************************/ function Help() public constant returns ( address This_App_Address_Is, uint Our_fee_is_Finney_one_finney_is_thousandths_ETH ) { return ( this, (Price_ValueBox / 0.1 finney) ); } /*付款 (地址)*/ function Pay_To_V_Box(address Please_Input_The_GV_Address) NeedNot0(Please_Input_The_GV_Address) public payable { require(GV_A[V_Box_I[Please_Input_The_GV_Address]] == Please_Input_The_GV_Address); /*驗證V-Box地址*/ Please_Input_The_GV_Address.transfer(msg.value); /*付款到V-Box */ require(msg.value>MVBL_P[Please_Input_The_GV_Address]||msg.value==MVBL_P[Please_Input_The_GV_Address]); /*驗證付款*/ MVBL_PayList[Please_Input_The_GV_Address]++; /*V_Fans記錄+1*/ MVBL_P_A[MVBL_PayList[Please_Input_The_GV_Address]] = msg.sender; /*V_Fans的地址*/ V_Fans[msg.sender] = Please_Input_The_GV_Address; /*加入V_Fans標記*/ MVBL_P_V[MVBL_PayList[V_Fans[msg.sender]]] = V_Fans_R[V_Fans[msg.sender]] = msg.value; /*V_Fans已付的金額*/ emit EventPay ( /*出Even 返回記好的資料*/ V_Box_I[V_Fans[msg.sender]], V_Fans[msg.sender], MVBL_PayList[V_Fans[msg.sender]],MVBL_P_A[MVBL_PayList[V_Fans[msg.sender]]], V_Fans_R[V_Fans[msg.sender]] ); } /********************************************************************************************************************************************************/ /**********************************************************************************************************************************************Event功能*/ /*沒這2個合約收不到錢*/ function () private payable{emit fallbackTrigged(msg.data);}event fallbackTrigged(bytes data); /*使用V-Box 出的Event*/ event EventTheValueBox(uint New_VBox_serial_number,address This_VBox_address,uint This_address_VBox_serial_number,uint This_VBox_price, bytes This_VBox_Public_Data,bytes This_VBox_Hide_Data,uint New_VBox_making_time); /*打開V-Box 出的Event*/ event EventPay(uint V_Box_I, address V_Fans, uint MVBL_PayList,address MVBL_P_A,uint V_Fans_R); /********************************************************************************************************************************************************/ }
0.4.18