//Write your own contracts here. Currently compiles using solc v0.4.15+commit.bbb8e64f. pragma solidity >=0.4.0 <0.6.0; contract Average_Dynamic_Price { address MBroker; //_______________________________________________________________________________ // Constructor The Genesis constructor () public { MBroker = 0x1E5Fee96D21f01B5F38261ea81ed303bCCc174b2; // First Broker, Opens the first account } //_____________________________________________________________________________ //Variables for account creation address Address; // User Address address IDBroker; //Addres the Broker (Any Created Account can be a broker for new accounts) uint TotalAccount; //TotalAccountCreated uint Date; // Block Mining (We work with block to avoid errors with timestamp) uint searchIDBroker; //Find Broker uint searchIDAddress; //Find Address uint searchIDProfile; //Find ID Address uint ClanAccount; //Clan account //________________________________________________ // Array Account uint []ArrayAccountTotalAccount; //List ID account uint [] ArrayAccountDate; //list of blocks that were created the accounts address [] ArrayAccountBroker; //List Broker address [] ArrayAccountAddress; //List of Address //_____________________________________________________________ // Function to save data sing in function SingIn(address Broker) public { // Broker Addres IDBroker = Broker; //Broker cadastred Date = block.number; //Date Sing in Address = msg.sender; //your Adderess //________________________________________________________________ // Check Registered Account for (searchIDAddress = 0; searchIDAddress < TotalAccount ; searchIDAddress ++ ) if (Address == ArrayAccountAddress[searchIDAddress]){ break;} if (searchIDAddress == TotalAccount) { //true for non-existent accounts //________________________________________________________________ //Register Account if(TotalAccount > 0){ for (searchIDBroker = 0; searchIDBroker < TotalAccount ; searchIDBroker ++ ) if (Broker == ArrayAccountAddress[searchIDBroker]){ TotalAccount++; //Total Account Created +1 //_____________________________________________________________________ //Save Array ArrayAccountTotalAccount.push(TotalAccount); //Save Array Total of Account Created ArrayAccountDate.push(Date); //Save Date ArrayAccountBroker.push(Broker); //save broker ArrayAccountAddress.push(Address); //Save Your Address break;}} //_____________________________________________________________________ else { if (Broker == MBroker){ TotalAccount ++; //Total Account Created +1 //_____________________________________________________________________ //Save Array ArrayAccountTotalAccount.push(TotalAccount); //Save Array Total of Account Created ArrayAccountDate.push(Date); //Save Date ArrayAccountBroker.push(Broker); //save broker ArrayAccountAddress.push(Address); //Save Your Address }}}} //________________________________________________________________ //Created eperfils list function Account() public constant returns ( //Creating Variables the perfil List address MainBroker, //Fist Broker uint[] TotalAccount, // ID Accounts uint [] Date, //Creation Block address [] Broker, // Broker the Account address [] Address) { // Broker the Address //Retourn return (MBroker, //the Main Broker ArrayAccountTotalAccount, //ID Account ArrayAccountDate, //Creation Block ArrayAccountBroker, //Broker the Account ArrayAccountAddress);}//Broker the Address //_______________________________________________________________________________ //You Profile (Profile Address call) //variables function YouProfile() public constant returns ( uint IDAccount, //ID account uint DateCreation, //Creation Block address BrokerAccount, //Broker the Account address AddressAccount //Broker the Address ) { //Search the ID in List of Profiles for (searchIDProfile = 0; searchIDProfile < TotalAccount ; searchIDProfile ++ ) if (Address == ArrayAccountAddress[searchIDProfile]){ break;} //Retour return ( ArrayAccountTotalAccount [searchIDProfile],//ID account ArrayAccountDate [searchIDProfile], //Creation Block ArrayAccountBroker [searchIDProfile], //Broker the Account ArrayAccountAddress [searchIDProfile]//Broker the Address );} //_____________________________________________________________________ //Creting Clan //the Clan serves to join with other investors and create an average price between friends. Who owns Clan pays a 5% profit tax. //This rate is 100% converted into the clan's internal bonus. which should only be used when the current ETH Price is lower than the average Clan price. //We treat the clans as ID so that we can locate in the list, //unfortunately the solidity has not yet introduced the data of type string, text. //but you can disclose your clan with the name you want, //you need only his ID for an account to be registered //____________________________________________________________________ //Variables Creating Clan address OwnerClan; //OwnerClan Address uint TotalOwnerClan; //Total Owner Clan uint TotalClan; //Total Clan Cadastred uint Clan; //Pay the Friends address ClanMember; uint searchClanID; uint TotalListClan; uint ClanAccountID; //___________________________________________________________________ //Array Clan uint [] ArrayIdClanAccount; //List Clan per Account uint [] TotalAccountClan; address [] ArrayClanAccount; address [] ArrayCreatClanAccount; //Creat Clan function CreatClan() public { OwnerClan = msg.sender; //OwnerClan Adderess //___________________________________________________________________ //Search Account Address for (TotalOwnerClan = 0; TotalOwnerClan < TotalAccount ; TotalOwnerClan ++ ) if (OwnerClan == ArrayAccountAddress[TotalOwnerClan]){ //If the creator's address is registered, then create the ID clan TotalClan ++; //_____________________________________________________________________ //Save Array TotalAccountClan.push(TotalClan); //Save Array Total of Clan Created ArrayCreatClanAccount.push(OwnerClan); break;}} //__________________________________________________________________________________ //View List Clan function ClanList() public constant returns ( uint [] IDClan, address [] OwnerClan){ return ( TotalAccountClan, ArrayCreatClanAccount);} //_________________________________________________________ //Linking an account to a clan function JoinClan(uint EnterIDClan) public { // join Clan ClanMember = msg.sender; for (searchIDAddress = 0; searchIDAddress < TotalAccount ; searchIDAddress ++ ) if (ClanMember == ArrayAccountAddress[searchIDAddress]){ TotalListClan ++; ArrayClanAccount.push(ClanMember); //save anddress account ArrayIdClanAccount.push(EnterIDClan); //List Clan per Account break;}} //________________________________________________________________ //Search the ID Clan function AccountClan() public constant returns ( address Account, uint IDClan ) { ClanMember = msg.sender; for (searchClanID = 0; searchClanID < TotalListClan ; searchClanID ++ ) if (ClanMember == ArrayClanAccount[searchClanID]){ ClanAccountID = searchClanID;} return ( ArrayClanAccount[ClanAccountID], ArrayIdClanAccount [ClanAccountID]);} //___________________________________________________________________________________ }
0.4.24