{"id":23218810,"url":"https://github.com/ahmetson/mistransfer","last_synced_at":"2026-04-28T18:35:36.614Z","repository":{"id":208296680,"uuid":"721275776","full_name":"ahmetson/mistransfer","owner":"ahmetson","description":"Accidently received a token into your smartcontract? Help users to recover and get reward 💵","archived":false,"fork":false,"pushed_at":"2023-12-08T15:00:23.000Z","size":876,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-10-15T04:32:36.654Z","etag":null,"topics":["chainlink","ethereum","smartcontract-security","social-good","ux"],"latest_commit_sha":null,"homepage":"","language":"Solidity","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ahmetson.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,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-11-20T18:07:40.000Z","updated_at":"2024-08-05T04:35:26.000Z","dependencies_parsed_at":"2023-11-27T00:26:19.574Z","dependency_job_id":"af771efb-b03e-427a-ab6d-f766c0a0fce8","html_url":"https://github.com/ahmetson/mistransfer","commit_stats":null,"previous_names":["ahmetson/user-caring","ahmetson/mistransfer"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ahmetson%2Fmistransfer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ahmetson%2Fmistransfer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ahmetson%2Fmistransfer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ahmetson%2Fmistransfer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ahmetson","download_url":"https://codeload.github.com/ahmetson/mistransfer/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247229373,"owners_count":20905039,"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":["chainlink","ethereum","smartcontract-security","social-good","ux"],"created_at":"2024-12-18T21:17:57.723Z","updated_at":"2026-04-28T18:35:31.578Z","avatar_url":"https://github.com/ahmetson.png","language":"Solidity","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Mistransfer\n\n\u003e This is a project submitted to the [Chainlink Constellation 2023 Hackathon](https://devpost.com/software/user-caring).\n\nDid you send NFT or Token to the wrong smartcontract?\n\n**Mistransfer** is a decentralized, automated solution to recover lost assets.\nVisit the demo website on [Vercel](https://mistransfer-website-git-main-ahmetson.vercel.app/) to see how it works for the users.\n\nThe only thing required from the developers is to extend the smartcontract with `UserCaring.sol` smartcontract.\n\n\n```solidity\nimport { UserCaring } from \"mistransfer/contracts/UserCaring.sol\";\n\ncontract Sample is UserCaring {\n  constructor(address _userInterface) UserCaring(_userInterface) {}\n}\n```\n\nThen, ask users to go to the **Mistransfer** website.\n\nThe `_userInterface` of deployed UserInterface:\n\n* Sepolia Testnet: `0x1C5a4E5345E81db66EF3D739f7702DFb76a758b8`\n\n## How it works?\nAll other options require a centralized responsibility from the decentralized project owner.\n\n*A developer needs to check the transaction on the explorer. Then call the function on their smartcontract.*\nIt's a hassle as it adds a high responsibility for the user's mistakes.\n\n**Mistransfer** solves the developer's hassle. We host a website for the users.\nThe transaction to get the lost tokens is executed by the users. All the fees are paid by the users.\nNot only for a transaction fee, but also to the smartcontract owner too.\nNo actions required from smartcontract owners.\n\nHere is the screenshot of **Mistransfer** website where user's can reclaim back the mis-transferred NFTs.\n\n![screenshot of lost nfts](lostnfts.png \"Mistransfer Reclaim lost nft\")\n\n### Is it secure?\nDoes any user can call withdraw function? **Nope**!\n\nWhen a user clicks to **Reclaim** button by adding transaction id. \nThe smartcontract verifies transaction itself. Then unlocks the tokens if it's valid.\n\nThe smartcontract checks transactions using *[Chainlink Functions](https://chain.link/functions)*.\nThe *Chainlink Functions* are a decentralized oracles that execute the Javascript code from the smartcontract.\n\nThe javascript code to verify the code is hardcoded into the smartcontract:\n\n[UserInterface.sol#L51](https://github.com/ahmetson/mistransfer/blob/main/contracts/UserInterface.sol#L51).\n\n---\n\n# Code structure\n\nThe project consists of four parts.\n\nThe primary component is the smartcontracts which is this repository.\n\nThe javascript codes for the oracles are\nin the [scripts/](./scripts/) directory in `.txt` format.\n\nThe third part is the [website](https://github.com/ahmetson/mistransfer-website) repository. \nThe website is loaded as a submodule in the `website` directory.\n\n*The fourth parameter is optional.\nIt converts the POST method to GET.\nChainlink Functions sometimes doesn't execute POST requests.*\n\n*The POST-2-GET converter is stored in `app` directory. The live version hosted at https://eth-get-api-b395abe5e4a3.herokuapp.com*\n\n## Smartcontracts\n\nThe project has two smartcontracts.\n\n### UserInterface\nThe `UserInterface` is the smartcontract\nthat receives the transaction id. \nIt's then verifies it using Chainlink Functions.\n\nThen unlocks the tokens.\n\n### UserCaring\n\n`UserCaring` adds a token/NFT withdrawing functionality with a permission to\n[UserInterface](#userinterface).\n\nThe `UserCaring` is intended to be used by the project owners.\nThus available as the [NPM Package](https://www.npmjs.com/package/@turkmenson/mistransfer).\n\n```solidity\nimport { UserCaring } from \"mistransfer/contracts/UserCaring.sol\";\n\ncontract Sample is UserCaring {\n  constructor(address _userInterface) UserCaring(_userInterface) {}\n}\n```\n\n#### Preventing Load\n\nSome dapps require the user assets. For example, games, bridges, or staking contracts may lock the asset.\nTo prevent recovering them, the `UserCaring` provides the modifiers. \nPut them in the functions that lock/burn:\n\n```solidity\n    contract UserCaring {\n        constructor(address userinterface) UserCaring(userinterface) {}\n\n        modifier intentionalNftAdd(address nft, address user, uint tokenId) {};\n        modifier intentionalNftRemove(address nft, address user, uint tokenId);\n\n        modifier intentionalTokenAdd(address token, address user, uint tokenId) {};\n        modifier intentionalTokenRemove(address token, address user, uint tokenId);\n    }\n```\n\n---\n\n# Usage\nBefore starting, we need a Chainlink Functions Subscriptions.\nGo to [New Sub](https://functions.chain.link/sepolia/new).\nRemember the `subId` and paste it in the `scripts/user_interface.ts` script.\n\nDownload the user interface as a submodule.\nCreate `.env` from `.env.example`.\n\nCompile the smartcontracts:\n\n```shell\nnpx hardhat compile\n```\n\nOnce compiled, deploy the user interface.\n\n```shell\nnpx hardhat run scripts/user_interface.ts --network sepolia\n```\n\nVerify it on etherscan (optionally).\n\n```shell\nnpx hardhat verify --network sepolia \u003caddress\u003e \u003crouter\u003e \u003csubId\u003e \u003cdonId\u003e\n```\n\nThen export the abi.\n\n```shell\nnpx hardhat export-abi\n```\n\nWe need to add the User Interface as a consumer:\n\n```shell\nhttps://functions.chain.link/sepolia/\u003csub_id\u003e\n```\n\nFinally, we need to set the JS code for the oracles:\n\n```shell\nnpx hardhat set-js-source --network sepolia --address \u003cuser_interface\u003e --type NFT\n```\n\n```shell\nnpx hardhat set-js-source --network sepolia --address \u003cuser_interface\u003e --type ERC20\n```\n\nAnd it's done.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fahmetson%2Fmistransfer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fahmetson%2Fmistransfer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fahmetson%2Fmistransfer/lists"}