{"id":30114179,"url":"https://github.com/near/core-contracts","last_synced_at":"2025-08-10T07:39:08.666Z","repository":{"id":40370453,"uuid":"249472355","full_name":"near/core-contracts","owner":"near","description":"Core contracts: reference staking pool, lockup, voting, whitelist, multisig.","archived":false,"fork":false,"pushed_at":"2024-10-23T17:06:17.000Z","size":9274,"stargazers_count":331,"open_issues_count":64,"forks_count":134,"subscribers_count":18,"default_branch":"master","last_synced_at":"2025-03-25T06:02:36.894Z","etag":null,"topics":["hacktoberfest"],"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/near.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":"CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-03-23T15:41:04.000Z","updated_at":"2025-03-14T16:37:10.000Z","dependencies_parsed_at":"2023-02-16T20:31:04.008Z","dependency_job_id":"4dc1595b-ae21-4b5b-afbc-100033f72c9d","html_url":"https://github.com/near/core-contracts","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/near/core-contracts","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/near%2Fcore-contracts","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/near%2Fcore-contracts/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/near%2Fcore-contracts/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/near%2Fcore-contracts/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/near","download_url":"https://codeload.github.com/near/core-contracts/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/near%2Fcore-contracts/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269693410,"owners_count":24460234,"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","status":"online","status_checked_at":"2025-08-10T02:00:08.965Z","response_time":71,"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":["hacktoberfest"],"created_at":"2025-08-10T07:39:00.502Z","updated_at":"2025-08-10T07:39:08.652Z","avatar_url":"https://github.com/near.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Core contracts\n\n- [Lockup / Vesting contract](./lockup/)\n- [Lockup Factory](./lockup-factory/)\n- [Multisig contract](./multisig/)\n- [Staking Pool / Delegation contract](./staking-pool/)\n- [Staking Pool Factory](./staking-pool-factory/)\n- [Voting Contract](./voting/)\n- [Whitelist Contract](./whitelist/)\n\n## Building and deploying\n\nSee [scripts](./scripts/) folder for details.\n\n## Initializing Contracts with near-shell\n\nWhen setting up the contract creating the contract account, deploying the binary, and initializing the state must all be done as an atomic step.  For example, in our tests for the lockup contract we initialize it like this:\n\n```rust\npub fn init_lockup(\n        \u0026self,\n        runtime: \u0026mut RuntimeStandalone,\n        args: \u0026InitLockupArgs,\n        amount: Balance,\n    ) -\u003e TxResult {\n        let tx = self\n            .new_tx(runtime, LOCKUP_ACCOUNT_ID.into())\n            .create_account()\n            .transfer(ntoy(35) + amount)\n            .deploy_contract(LOCKUP_WASM_BYTES.to_vec())\n            .function_call(\n                \"new\".into(),\n                serde_json::to_vec(args).unwrap(),\n                200000000000000,\n                0,\n            )\n            .sign(\u0026self.signer);\n        let res = runtime.resolve_tx(tx).unwrap();\n        runtime.process_all().unwrap();\n        outcome_into_result(res)\n    }\n```\n\n\nTo do this with near shell, first add a script like `deploy.js`:\n\n```js\nconst fs = require('fs');\nconst account = await near.account(\"foundation\");\nconst contractName = \"lockup-owner-id\";\nconst newArgs = {\n  \"lockup_duration\": \"31536000000000000\",\n  \"lockup_start_information\": {\n    \"TransfersDisabled\": {\n        \"transfer_poll_account_id\": \"transfers-poll\"\n    }\n  },\n  \"vesting_schedule\": {\n    \"start_timestamp\": \"1535760000000000000\",\n    \"cliff_timestamp\": \"1567296000000000000\",\n    \"end_timestamp\": \"1661990400000000000\"\n  },\n  \"staking_pool_whitelist_account_id\": \"staking-pool-whitelist\",\n  \"initial_owners_main_public_key\": \"KuTCtARNzxZQ3YvXDeLjx83FDqxv2SdQTSbiq876zR7\",\n  \"foundation_account_id\": \"near\"\n}\nconst result = account.signAndSendTransaction(\n    contractName,\n    [\n        nearAPI.transactions.createAccount(),\n        nearAPI.transactions.transfer(\"100000000000000000000000000\"),\n        nearAPI.transactions.deployContract(fs.readFileSync(\"res/lockup_contract.wasm\")),\n        nearAPI.transactions.functionCall(\"new\", Buffer.from(JSON.stringify(newArgs)), 100000000000000, \"0\"),\n    ]);\n```\n\nThen use the `near repl` command. Once at the command prompt, load the script:\n\n```js\n\u003e .load deploy.js\n```\n\nNote: `nearAPI` and `near` are both preloaded to the repl's context.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnear%2Fcore-contracts","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnear%2Fcore-contracts","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnear%2Fcore-contracts/lists"}