{"id":28471236,"url":"https://github.com/requestnetwork/near-contracts","last_synced_at":"2025-07-01T21:32:32.882Z","repository":{"id":38890480,"uuid":"495904708","full_name":"RequestNetwork/near-contracts","owner":"RequestNetwork","description":null,"archived":false,"fork":false,"pushed_at":"2023-09-29T12:50:35.000Z","size":142,"stargazers_count":2,"open_issues_count":5,"forks_count":4,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-06-07T10:48:44.326Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/RequestNetwork.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2022-05-24T16:31:17.000Z","updated_at":"2023-02-02T17:15:29.000Z","dependencies_parsed_at":"2023-09-28T13:10:40.494Z","dependency_job_id":null,"html_url":"https://github.com/RequestNetwork/near-contracts","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/RequestNetwork/near-contracts","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RequestNetwork%2Fnear-contracts","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RequestNetwork%2Fnear-contracts/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RequestNetwork%2Fnear-contracts/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RequestNetwork%2Fnear-contracts/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/RequestNetwork","download_url":"https://codeload.github.com/RequestNetwork/near-contracts/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RequestNetwork%2Fnear-contracts/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263039391,"owners_count":23404171,"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":[],"created_at":"2025-06-07T10:39:55.123Z","updated_at":"2025-07-01T21:32:32.817Z","avatar_url":"https://github.com/RequestNetwork.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Overview\n\nSmart contracts on NEAR used by the\n[Request Network](https://github.com/RequestNetwork/requestNetwork) protocol.\n\n## Setup\n\n1. Install [Rust](https://www.rust-lang.org/tools/install)\n2. Install GCC\n   ```\n   sudo apt install build-essential\n   ```\n3. Install clang\n   ```\n   sudo apt install clang\n   ```\n4. Install `wasm32-unknown-unknown` target\n   ```\n   rustup target add wasm32-unknown-unknown\n   ```\n\n## Unit tests\n\nRun all contracts unit tests like this:\n\n```\ncargo test -p conversion_proxy\ncargo test -p fungible_conversion_proxy\ncargo test -p fungible_proxy\n```\n\n## Integration tests (on a simulated VM with mocked 3rd party contracts)\n\nIntegration tests are located in [tests/sim](tests/sim).\n\n```\n# To test everything (unit tests, sanity checks, simulated tests)\n# Requires building contracts (release) and mocks (debug) for simulated tests.\n./test.sh\n\n# To run integration tests on contracts one by one:\ncargo test conversion_proxy\ncargo test fungible_conversionproxy\ncargo test fungible_proxy\n\n# To run any tests one by one (examples with main transfers on simulated VM):\ncargo test conversion_proxy::test_transfer -- --exact\ncargo test fungible_conversionproxy::test_transfer -- --exact\ncargo test fungible_proxy::test_transfer -- --exact\n```\n\n## Deploying contract\n\n```\nnear login\n# follow instructions to login with the account you will use below for deployment\n\ncargo\n\n# 1. For the first-time deployment\n./deploy.sh -a ACCOUNT_ID\n\n# 2. For subsequent contract updates\n./deploy.sh -a ACCOUNT_ID --patch\n\n# For both commands, use `-p` for production deployment.\n\n# For more details and options:\n./deploy.sh --help\n```\n\n## Calling contract\n\nCommands below assumes a few variables are set: `ACCOUNT_ID`, `BUILDER_ID` and `ISSUER_ID`.\n\nThis snippet makes a NEAR payment for $80.50, with a $1.00 fee.\n\n```\nnear call $ACCOUNT_ID transfer_with_reference '{\"to\": \"'$ISSUER_ID'\", \"payment_reference\": \"0x1230012300001234\", \"amount\": \"8050\", \"currency\": \"USD\", \"fee_amount\": \"100\", \"fee_address\": \"'$BUILDER_ID'\"}' --accountId $ACCOUNT_ID --gas 300000000000000 --deposit 30\n```\n\nThis snippet makes a fungible token payment, given that `fau.reqnetwork.testnet` is a fungible token address and the `fungible_proxy` contract is deployed at `pay.reqnetwork.testnet`.\n\n```\nnear call fau.reqnetwork.testnet ft_transfer_call '{\"receiver_id\": \"pay.reqnetwork.testnet\", \"amount\": \"2500000000000000000\", \"msg\": \"{\\\"fee_address\\\": \\\"'$BUILDER_ID'\\\", \\\"fee_amount\\\": \\\"1000000000000000000\\\", \\\"payment_reference\\\": \\\"abc7c8bb1234fd12\\\", \\\"to\\\": \\\"'$ISSUER_ID'\\\"}\"}' --accountId $ACCOUNT_ID --depositYocto 1 --gas 300000000000000\n```\n\n## FAU tokens (testnet)\n\nThe FAU token at `fau.reqnetwork.testnet` has 18 decimals and a total supply of 1'000'000.00 FAU.\nIt is based on the example at https://github.com/near/near-sdk-rs/tree/master/examples/fungible-token, slightly updated and deployed using the commands:\n\n```\n./build.sh\nnear create-account fau.reqnetwork.testnet --masterAccount reqnetwork.testnet --initialBalance 8\nnear deploy -f --wasmFile ./res/fungible_token.wasm --accountId fau.reqnetwork.testnet --initFunction new_default_meta --initArgs '{\"owner_id\": \"reqnetwork.testnet\", \"total_supply\": \"1000000000000000000000000\"}'\n```\n\nGet some FAU:\n\n```\n# Register the account\nnear call fau.reqnetwork.testnet storage_deposit '{\"account_id\": \"'$ACCOUNT_ID'\"}' --accountId $ACCOUNT_ID --amount 0.005\n# Transfer 1000.00 FAU to the account\nnear call fau.reqnetwork.testnet ft_transfer '{\"receiver_id\": \"'$ACCOUNT_ID'\", \"amount\": \"1000000000000000000000\"}' --accountId reqnetwork.testnet --depositYocto 1\n```\n\nTo use FAU on a new proxy, you need to register it first:\n\n```\n near call fau.reqnetwork.testnet storage_deposit '{\"account_id\": \"'$PROXY_ADDRESS'\"}' --accountId $ACCOUNT_ID --amount 0.005\n```\n\nYou need to run the same command for every account before they receive FAU, or the smart contract will panick with the error message `The account some_account is not registered`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frequestnetwork%2Fnear-contracts","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frequestnetwork%2Fnear-contracts","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frequestnetwork%2Fnear-contracts/lists"}