{"id":20078739,"url":"https://github.com/wpdas/places-near-smart-contract","last_synced_at":"2026-05-31T21:32:09.559Z","repository":{"id":213993988,"uuid":"735210186","full_name":"wpdas/places-near-smart-contract","owner":"wpdas","description":"A smart contract in the NEAR network. This contract allows users to store places, rate and navigate through them.","archived":false,"fork":false,"pushed_at":"2024-01-02T13:45:18.000Z","size":59,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-02T13:14:45.919Z","etag":null,"topics":["near","near-protocol","rust","rust-lang","smart-contracts"],"latest_commit_sha":null,"homepage":"","language":"Rust","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/wpdas.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}},"created_at":"2023-12-24T04:12:49.000Z","updated_at":"2023-12-27T02:26:04.000Z","dependencies_parsed_at":"2024-01-13T10:13:38.401Z","dependency_job_id":"f4cd3d74-d0d9-4b9b-9e49-843a55228ce9","html_url":"https://github.com/wpdas/places-near-smart-contract","commit_stats":{"total_commits":19,"total_committers":1,"mean_commits":19.0,"dds":0.0,"last_synced_commit":"8fe718d6548f6b1128e3613ff0c79e6ddaa83b78"},"previous_names":["wpdas/places-near-smart-contract"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/wpdas/places-near-smart-contract","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wpdas%2Fplaces-near-smart-contract","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wpdas%2Fplaces-near-smart-contract/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wpdas%2Fplaces-near-smart-contract/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wpdas%2Fplaces-near-smart-contract/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wpdas","download_url":"https://codeload.github.com/wpdas/places-near-smart-contract/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wpdas%2Fplaces-near-smart-contract/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33750474,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-05-31T02:00:06.040Z","response_time":95,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["near","near-protocol","rust","rust-lang","smart-contracts"],"created_at":"2024-11-13T15:16:24.279Z","updated_at":"2026-05-31T21:32:09.540Z","avatar_url":"https://github.com/wpdas.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Places - NEAR Contract\n\nA smart contract in the NEAR network. This contract allows uses to register places around the world, evaluate them, post feedback and consult them.\n\nAccess the live dapp here:\n\n- [**Places DApp (mainnet)**](https://places-dapp-near.vercel.app/)\n- [**Places DApp (testnet)**](https://places-dapp-near-testnet.vercel.app/)\n\nFrontend repository: [**places-near-dapp**](https://github.com/wpdas/places-near-dapp)\n\n\u003cbr /\u003e\n\n# General Info\n\n1. Make sure you have installed [rust](https://rust.org/).\n2. Install the [`NEAR CLI`](https://github.com/near/near-cli#setup)\n\n\u003cbr /\u003e\n\n## 1. Build, Test and Deploy\n\nTo build the contract you can execute the `./build.sh` script, which will in turn run:\n\n```bash\nrustup target add wasm32-unknown-unknown\ncargo build --target wasm32-unknown-unknown --release\n```\n\nThen, run the `./deploy.sh` script, which will in turn run:\n\n```bash\nnear dev-deploy --wasmFile ./target/wasm32-unknown-unknown/release/hello_near.wasm\n```\n\nthe command [`near dev-deploy`](https://docs.near.org/tools/near-cli#near-dev-deploy) automatically creates an account in the NEAR testnet, and deploys the compiled contract on it.\n\nOnce finished, check the `./neardev/dev-account` file to find the address in which the contract was deployed:\n\n```bash\ncat ./neardev/dev-account\n# e.g. dev-1659899566943-21539992274727\n```\n\n\u003cbr /\u003e\n\n## 2. Write Methods [payable]\n\n```rs\n// Init contract - called by-owner only (determines who can do admin actions)\npub fn init(owner: AccountId, admins: Option\u003cVec\u003cAccountId\u003e\u003e)\n\n// Add Place\npub fn add_place(\u0026mut self, place: PlaceInput)\n\n// Vote\npub fn vote(\u0026mut self, place_id: u64, vote: i8)\n\n// Add pictures to a Place\npub fn add_picture_to_place(\u0026mut self, place_id: u64, pictures: Vec\u003cString\u003e)\n\n// Remove a place\npub fn remove_place(\u0026mut self, place_id: u64)\n```\n\n## 3. Read Methods\n\n```rs\n// Returns the Places\npub fn get_places(\u0026self) -\u003e Vec\u003cPlace\u003e\n\n// Get places by its id\npub fn get_places_by_id(\u0026self, place_id: u64) -\u003e Option\u003cPlace\u003e\n```\n\n## 4. Retrieve the Places\n\n`get_places` and `get_places_by_id` is a read-only method (aka `view` method).\n\n`View` methods can be called for **free** by anyone, even people **without a NEAR account**!\n\n```bash\n# Use near-cli to get the places\nnear view \u003ccontract-id\u003e get_places\n```\n\n\u003cbr /\u003e\n\n## 5. Store a New Place\n\n`add_place`, `vote`, `add_picture_to_place` and `remove_place` changes the contract's state, for which it is a `change` method.\n\n`Change` methods can only be invoked using a NEAR account, since the account needs to pay GAS for the transaction. In this case, we are asking the account we created in step 1 to sign the transaction.\n\n```bash\n# Use near-cli to add a new place\nnear call \u003ccontract-id\u003e add_place '{\"place\":{\"name\": \"Natura Store\",\"address\": \"Pampulha\",\"description\": \"A place to buy perfume.\",\"pictures\": [\"https://lh5.googleusercontent.com/p/AF1QipMBMUOyXp7E1gZRB_KVeKLOLOpZv1bzZt-JxsAd=w408-h306-k-no\"]}}' --accountId \u003cuser-account-id\u003e\n```\n\n**Tip:** If you would like to call `add_place` using your own account, first login into NEAR using:\n\n```bash\n# Use near-cli to login your NEAR account\nnear login\n```\n\nand then use the logged account to sign the transaction: `--accountId \u003cyour-account\u003e`.\n\n\u003cbr /\u003e\n\n## 6. View Contract State with Postman\n\nYou can see the contract state by sending a POST to `https://rpc.testnet.near.org` with the following body:\n\n```json\n{\n  \"jsonrpc\": \"2.0\",\n  \"id\": \"dontcare\",\n  \"method\": \"query\",\n  \"params\": {\n    \"request_type\": \"view_state\",\n    \"finality\": \"final\",\n    \"account_id\": \"\u003ccontract-id\u003e\",\n    \"prefix_base64\": \"\"\n  }\n}\n```\n\n\u003cbr /\u003e\n\n## 7. Deploying to Mainnet (Production)\n\nYou can go to [NEAR CLI](https://docs.near.org/tools/near-cli) page to understand more. But below, are some steps to deploy the contract for Mainnet.\n\nChange the network by prepending an environment variable to the commands.\n\nAfter building your contract:\n\n1. Login with your account:\n\n```sh\nNEAR_ENV=mainnet near login\n```\n\n2. Create an account/sub-account to store the Contract\n\n```sh\n# In this case, you'll use your credentials\nNEAR_ENV=mainnet near create-account \u003ccreated-account-id\u003e.wendersonpires.near --masterAccount wendersonpires.near --initialBalance \u003camount-of-near-to-send-to-the-new-account-being-created\u003e\n\n# e.g NEAR_ENV=mainnet near create-account place-contract.wendersonpires.near --masterAccount wendersonpires.near --initialBalance 2\n```\n\n3. Deploy Contract to the created account\n\n```sh\nNEAR_ENV=mainnet near deploy --accountId \u003ccreated-account-id\u003e.wendersonpires.near --wasmFile ./target/wasm32-unknown-unknown/release/places_near_contract.wasm\n\n# e.g NEAR_ENV=mainnet near deploy --accountId place-contract.wendersonpires.near --wasmFile ./target/wasm32-unknown-unknown/release/places_near_contract.wasm\n```\n\n4. Now, the Contract is ready to be used\n\n```sh\nNEAR_ENV=mainnet near view place-contract.wendersonpires.near get_places\n```\n\n\u003cbr /\u003e\n\n## 8. Contract Address\n\n### Mainnet\n\n```\nplace-contract.wendersonpires.near\n```\n\n### Testnet\n\n```\nplace-contract.wendersonpires.testnet\n```\n\n## 9. Good to know\n\n### Mainnet\n\nAccount `place-contract.wendersonpires.near` created with:\n\n```sh\nNEAR_ENV=mainnet near create-account place-contract.wendersonpires.near --masterAccount wendersonpires.near --initialBalance 2\n```\n\nContract deployment using account id `place-contract.wendersonpires.near`:\n\n```sh\nNEAR_ENV=mainnet near deploy --accountId place-contract.wendersonpires.near --wasmFile ./target/wasm32-unknown-unknown/release/places_near_contract.wasm\n#Transaction: https://explorer.mainnet.near.org/transactions/BdX7Dyr3wKcTBmM14jyNfcrt344gN5sRexJweVdioLfr\n```\n\nContract initialized with:\n\n```sh\nNEAR_ENV=mainnet near call place-contract.wendersonpires.near init '{\"owner\": \"wendersonpires.near\"}' --accountId wendersonpires.near\n# Transaction: https://explorer.mainnet.near.org/transactions/GaTRTxFzGAHMU6PpypAvyARkForfRhhZJy2pdsawpyGg\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwpdas%2Fplaces-near-smart-contract","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwpdas%2Fplaces-near-smart-contract","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwpdas%2Fplaces-near-smart-contract/lists"}