{"id":20008306,"url":"https://github.com/bethanyuo/solidity-contracts","last_synced_at":"2025-07-19T10:10:26.418Z","repository":{"id":116556693,"uuid":"244574322","full_name":"bethanyuo/solidity-contracts","owner":"bethanyuo","description":"Smart Contracts and Solidity using the Remix IDE.","archived":false,"fork":false,"pushed_at":"2020-07-09T08:56:36.000Z","size":23,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-12T14:25:04.650Z","etag":null,"topics":["data-structures","remix","remix-ide","smart-contracts","solidity"],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bethanyuo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-03-03T07:53:29.000Z","updated_at":"2020-07-12T17:22:13.000Z","dependencies_parsed_at":null,"dependency_job_id":"5704d836-d7aa-44d4-95c4-9c522f39f5ea","html_url":"https://github.com/bethanyuo/solidity-contracts","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bethanyuo%2Fsolidity-contracts","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bethanyuo%2Fsolidity-contracts/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bethanyuo%2Fsolidity-contracts/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bethanyuo%2Fsolidity-contracts/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bethanyuo","download_url":"https://codeload.github.com/bethanyuo/solidity-contracts/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241446712,"owners_count":19964215,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["data-structures","remix","remix-ide","smart-contracts","solidity"],"created_at":"2024-11-13T07:09:20.155Z","updated_at":"2025-03-02T01:29:17.366Z","avatar_url":"https://github.com/bethanyuo.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# Solidity Contracts\nSolidity exercises from Kingsland.\n\n## Table of Contents\n* [Simple Storage Contract](#simple-storage-contract)\n* [Incrementor Contract](#incrementor-contract)\n* [Previous Invoker](#previous-invoker)\n* [Registry of Certificates](#registry-of-certificates)\n* [Simple Token](#simple-token)\n* [The Diary](#the-diary)\n* [Planet Earth Contract](#planet-earth-contract)\n* [Students Info Tracker](#students-info-tracker)\n* [Lambo Crowdsale](#lambo-crowdsale)\n* [Solidity and Remix](#solidity-and-remix)\n\n## Simple Storage Contract\nWrite a simple contract in Solidity that keeps in the blockchain an integer variable and provides public functions to read it and to change it. \n\n## Incrementor Contract\nWrite a Solidity contract, as described below:\n* The contract holds a certain value\n    * value (uint) -\u003e not accessible outside the contract\n*\tAnyone can see the function and read the value\n    *\tReturns uint\n    *\tNot modifying the state of blockchain!\n*\tAnyone can increment the value\n    *\tincrement(uint delta) \n    * No output!\n* Test and play around with the contract.\n\n## Previous Invoker\nWrite a Solidity contract as described below:\n* Keep the address of its previous invoker in the persistent storage -\u003e not accessible outside the contract\n  * getLastInvoker() -\u003e returns (bool, address)\n  * true / false – if a previous invoker exists or not\n  * The address that has invoked the contract before you\n  * Accessible from outside the contract\nAdd appropriate events for the functions [Events](http://solidity.readthedocs.io/en/v0.4.21/contracts.html#events). Test and play around with the contract.\n\n## Registry of Certificates\nWrite a simple contract in Solidity that represents a registry of certificates:\n* Each certificate has its owner and content calculated as hash\n* The registry holds of all valid certificate hashes stored on the blockchain (as string)\n* Only the owner can add certificate hashes: add(hash)\n* You may use this [tool](https://emn178.github.io/online-tools/sha3_512.html) to calculate hashes\n* Anyone can verify а certificate by its hash: verify(hash)\nAdd appropriate events for the functions. Test and play around with the contract.\n\n## Simple Token\nWrite a contract that represents a simple token:\n* The initial supply must be set at contract’s creation \n  * This amount must be allocated to the address that creates the contract\n* You should store the balances of the addresses -\u003e mapping\n* Add a functionality that allows for transfer(to, value) of tokens between the address of the contract’s creator and other addresses\n  * The number of tokens for transfer must be bigger than 0\n  * Check for overflow\nAdd appropriate events for the functions. Test and play around with the contract.\n\n## The Diary\nAlice loves to document facts. In fact, every night before she goes to sleep she loves to remember all the thing which has happened through the day and to write them down in her diary.\n\nCreate a Diary Contract in Solidity which:\n* Keep in the blockchain a string array of facts and the contract owner\n*\tOnly contract owner (creator) can\n  *\tAdd facts (string fact) -\u003e accessible outside the contract\n* Only people who are approved can read the facts\n  * getFact(index) – returns specified fact by index [0…count-1]\n  *\tSolidity cannot return all facts at once (array of strings)\n  *\tApproved addresses are hardcoded in the contract\n*\tEveryone can see how many facts there are in the diary \n  *\tcount() – returns the count of facts -\u003e not change the state of the contract\n*\tNobody can delete facts or destroy the contract\t\nUse modifiers where it is appropriate. Add appropriate events for the functions. Test and play around with the contract.\n\n## Planet Earth Contract\nCreate contract that:\n*\tDeclares all continents (Europe, Asia, etc..). Use the best way to declare them – we know that there are fixed amount of continents and we know their names\n*\tDeclares a data representing a single country (name, continent, population)\n*\tKeep track of each country’s capital, so people can check country’s capital by simply giving a name\n*\tStore only European countries\n*\tHave a function to add country (should accept only European countries). The function accepts all countrie’s properties (name, continent, population)\n*\tHave function to add a capital to a single country (No duplicates – i.e. Sofia cannot be a capital of both Bulgaria and Romania)\n*\tHave a function that gives the capital by a given country name\n*\tHave a function to remove a capital\n*\tHave a function that returns the string representation of each continent (i.e. I receive “Asia”, “Europe”, etc.)\n*\tHave a function that returns all European countries\n\n## Students Info Tracker\n \nIn the first Blockchain Secondary School every lecturer should store the students’ information. The information should be public and everyone could see it.  \n*\tWrite a simple contract in Solidity that keeps track of students’ names, addresses(eth), array of marks and number in class:\n  *\tOnly the owner of the contract (lecturer) can create students profile and give marks it does not matter the class/lecture (should be store in appropriate data structure)\n    * Hint -\u003e use struct\n    * Students profile should be stored in an array -\u003e Students[]\n  * Everyone can get the information -\u003e get(index) \nUse modifiers where it is appropriate. Add appropriate events for the functions. Test and play around with the contract.\n\n## Lambo Crowdsale\n \nNowadays everyone makes Crowdsales which means everyone gives you money because you just give them promises about better world. Then you just withdraw the money and go to Bali or buy a Lambo. Let’s make one! Let’s buy Lambo and go to Bali!\nWrite a Solidity contract that has a function through which anyone can send it ethers:\n*\tFunction deposit() should store ethers to the contract balance\n  * Hint -\u003e use payable\n* Only the owner of the contract can check the current balance of the contract \n  * Contract balance -\u003e this.balance\n*\tWhen the owner wants, he can withdraw the ethers and then kill the contract\n  *\tHint -\u003e address.transfer(amount)\n  *\tHint -\u003e suicide(owner)\nUse modifiers where it is appropriate. Add appropriate events for the functions. Test and play around with the contract.\n\n# Solidity and Remix\nInstalling the remix IDE on iMac for using your own GitHub repo. Make sure that you have the full developer version of Xcode.app installed. As a precaution, go to the app store and install it regardless. Follow the instructions. The goal is to get the remixd installed, but it needs the Xcode developer installed to do that.\n\n## Website Resources\n* gyp install and the xcode-select comands: [node-gyp on macOS](https://github.com/nodejs/node-gyp/blob/master/macOS_Catalina.md)\n* node-gyp and node-gyp-install: [node-gyp GitHub](https://github.com/nodejs/node-gyp/issues/569)\n* online IDE locahost setup: [remix-ide](https://remix-ide.readthedocs.io/en/latest/remixd.html)\n* dmg to install on MAC: [remix-desktop](https://github.com/ethereum/remix-desktop/releases)\n\n## Requirements\nXcode Developer\n\n## Installation\n```bash\n$ npm install -g node-gyp-install\n$ sudo xcode-select -s /Applications/Xcode.app/Contents/Developer\n$ xcodebuild -version\n$ npm install -g remixd\ninstall the dmg file.\n$ remixd -s /Users/Bethany/git/solidity --remix-ide https://remix.ethereum.org\n```\nIn step 5. you will set it up for the online web IDE. Once you get the remix.app installed, activate the remix plugin from the plugins list. When it tries to connect to your local file system, you will get something like:\n```\nSun Jan 19 2020 15:49:17 GMT-0500 (Eastern Standard Time) Connection from origin package://a7df6d3c223593f3550b35e90d7b0b1f.mod rejected.\n```\nCopy the \"package://a7df6d3c223593f3550b35e90d7b0b1f.mod\".\n\nStop the remixd with `Ctrl-C`.\n\nThen restart it with something like:\n```\nremixd -s /Users/Bethany/git/solidity --remix-ide package://a7df6d3c223593f3550b35e90d7b0b1f.mod\n```\nNow the remixd will point to your local remix IDE rather than the online IDE.\n\n### Purpose \nSo that you can create a repo in your own github account, clone it to your local file system, and then hookup your local remix IDE to use your local github repo. This will allow you to check in code to github.\nUnfortunately, it doesn't seem to be possible to create new files in the localhost of the FILE EXPLORERS section of the remix IDE. So I used the Visual Studio Code IDE in conjuction with the remix IDE, so that I can create and edit files locally in the VSC IDE, and then compile and deploy in the remix IDE.\n\n## Remix IDE\nNotice the http vs the https. This will allow you to use the remix IDE in the browser and see the local directory on your machine.\n\nTo do this:\n\n1. Start the remixd according to the [Installation Steps](#installation) as shown above.\n2. In the remix IDE that you started at http://remix.ethereum.org, connect to localhost. You will see: Sat Feb 08 2020 13:55:21 GMT-0500 (Eastern Standard Time) Remixd is listening on 127.0.0.1:65520 Sat Feb 08 2020 13:55:51 GMT-0500 (Eastern Standard Time) Connection accepted.\n3. At this point you should see your local files in the browser remixIDE.\n4. You can then use the Visual Studio Code (VSC) to edit and syntax check your code.\n5. If you have to set the compiler version in the VSC IDE, then create the file .vscode/settings.json in the project home directory and add the following text: { \"solidity.compileUsingRemoteVersion\": \"0.5.5+commit.47a71e8f\" }\n6. This will cause the VSC solidity compiler to use version 0.5.5.\n7. At this point, any changes that you make locally in VSC or in the browser IDE will be reflected on both sides.\n8. This will allow you to have a git repo on your local machine that is connected to github on the web and allow to check in changes to your remote github account.\n\n## Module\nMI3: Module 3: E1\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbethanyuo%2Fsolidity-contracts","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbethanyuo%2Fsolidity-contracts","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbethanyuo%2Fsolidity-contracts/lists"}