//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 = msg.sender; // User Address address IDBroker; //Addres the Broker (Any Created Account can be a broker for new accounts) uint TotalAccount; //TotalAccountCreated uint Date = block.number; // Block Mining (We work with block to avoid errors with timestamp) uint searchIDBroker; //Find Broker uint searchIDAddress; //Find Address uint searchIDProfile; //Find ID Address //____________________________________________________________________ //Variables Creating Clan address OwnerClan = msg.sender; //OwnerClan Address uint TotalOwnerClan; //Total Owner Clan uint TotalClan; //Total Clan Cadastred uint Clan; //Pay the Friends uint searchClanID; //Search clan ID uint TotalListClan; //Total Clan uint ClanAccountID; //ID clan Account uint ClanAccount; //Clan account uint noClan; //member no clan //________________________________________________ // 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 //__________________________________________________________________________ //Array Clan uint [] ArrayIdClanAccount; //List Clan per Account uint [] TotalAccountClan; address [] ArrayClanAccount; address [] ArrayCreatClanAccount; //________________________________________________________________ //_____________________________________________________________ // Function to save data sing in function SingIn(address Broker) public { // Broker Addres IDBroker = Broker; //Broker cadastred Date; //Date Sing in Address; //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 ListBroker() public constant returns ( //Creating Variables the perfil List address MainBroker, //Fist Broker address [] Broker) { // Broker //Retourn return (MBroker, //the Main Broker ArrayAccountAddress);}//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 //________________________________________________________________ //Creat Clan function CreatClan() public { OwnerClan; //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 Address; for (searchIDAddress = 0; searchIDAddress < TotalAccount ; searchIDAddress ++ ) if (Address == ArrayAccountAddress[searchIDAddress]){ TotalListClan ++; ArrayClanAccount.push(Address); //save anddress account ArrayIdClanAccount.push(EnterIDClan); //List Clan per Account break;}} //_______________________________________________________________________________ //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 uint IDClan // ID Clan ) { //Search the ID in List of Profiles for (searchIDProfile = 0; searchIDProfile < TotalAccount ; searchIDProfile ++ ) if (Address == ArrayAccountAddress[searchIDProfile]){ break;} Address; for (searchClanID = 0; searchClanID < TotalListClan ; searchClanID ++ ) if (Address == ArrayClanAccount[searchClanID]){ //true to address in list of clan ClanAccountID = searchClanID;} //retour large number the list if (ClanAccountID == TotalListClan) { //Retour return ( ArrayAccountTotalAccount [searchIDProfile],//ID account ArrayAccountDate [searchIDProfile], //Creation Block ArrayAccountBroker [searchIDProfile], //Broker the Account ArrayAccountAddress [searchIDProfile],//Broker the Address noClan//ID Clan );} else { return ( ArrayAccountTotalAccount [searchIDProfile],//ID account ArrayAccountDate [searchIDProfile], //Creation Block ArrayAccountBroker [searchIDProfile], //Broker the Account ArrayAccountAddress [searchIDProfile],//Broker the Address ArrayIdClanAccount [ClanAccountID]//ID Clan );} } //____________________________________________________________________________________ //_________________________________________________________________________ //Receiving money //Variables Open Position uint LastPrice; uint LastBlock; uint Value = msg.value; uint TotalPositions; uint [] ArrayDateOpenPosition; address [] ArrayAddressOpenPostion; uint [] ArrayIDClanOpenPosition; uint [] ArrayValueOpenPosition; uint [] ArrayPriceOpenPosition; // Open Position function OpenPosition()public payable { //Function Open Position // For to save the moment the address in clan for (searchClanID = 0; searchClanID < TotalListClan ; searchClanID ++ ) if (Address == ArrayClanAccount[searchClanID]){ //true to address in list of clan ClanAccountID = searchClanID;} //retour large number the list // Check Registered Account //for (searchIDAddress = 0; searchIDAddress < TotalAccount ; searchIDAddress ++ ) // if (Address == ArrayAccountAddress[searchIDAddress]){ //break;} // if (searchIDAddress < TotalAccount) { //true for existent accounts Date; //LastBlock Address; // Search Address ClanAccountID; // Address is member of any clan? Value; // search Value LastPrice; // Price Open Position //Increment +1 in Total Positions TotalPositions ++; //_____________________________________________________________________ //Save in array ArrayDateOpenPosition.push(Date); ArrayAddressOpenPostion.push(Address); ArrayIDClanOpenPosition.push(ClanAccountID); ArrayValueOpenPosition.push(Value); ArrayPriceOpenPosition.push(LastPrice); } //_________________________________________________________________________________________ //Show Open position function ShowPositions () public constant returns ( uint [] Date, //LastBlock address [] Address, // Search Address uint [] ClanAccountID, // Address is member of any clan? uint [] Value, // search Value uint [] LastPrice, // Price Open Position //Increment +1 in Total Positions uint TotalPositions ){ return ( ArrayDateOpenPosition, ArrayAddressOpenPostion, ArrayIDClanOpenPosition, ArrayValueOpenPosition, ArrayPriceOpenPosition, TotalPositions);} }
0.4.24