A very simple contract that allows a targetWallet to attempt to recover a token quickly in the event it is comprised or locked out / keys lost.
The contract requires a targetWallet wallet containing the token, a receiver of the tokens, and a token address to transfer when triggered.
The EXECUTOR_ROLE allows many wallets the ability to trigger the contract and recover the funds, without being able to withdraw them from the contract.
The targetWallet can add additional executors making the ability of triggering the contract easier.
Once triggered, the tokens are initially transferred to the contract, with only the receiver being able to call withdraw() and remove them from the contract.
You can try it out for yourself at parallel-limit.surge.sh and going to the SaviorFactory which can deploy your own Savior contract, the last 10 created will be visible.
The SaviorToken contract is a standard ERC20 token with an extra faucet function to mint yourself fake tokens to test.
Got the idea from almost losing a hot wallet's keys and needing a quick solution...
TODO:
- Ability to transfer multiple tokens, as many as the
targetWalletadds and approves
Prerequisites: Node (v18 LTS) plus Yarn (v1.x) and Git
π¨ If you are using a version < v18 you will need to remove openssl-legacy-provider from the start script in package.json
1οΈβ£ clone/fork π scaffold-eth:
git clone https://github.com/scaffold-eth/scaffold-eth.git2οΈβ£ install and start your π·β Hardhat chain:
cd scaffold-eth
yarn install
yarn chain3οΈβ£ in a second terminal window, start your π± frontend:
π¨ if your contracts are not deployed to localhost, you will need to update the default network in App.jsx to match your default network in hardhat-config.js.
cd scaffold-eth
yarn start4οΈβ£ in a third terminal window, π° deploy your contract:
π¨ if you are not deploying to localhost, you will need to run yarn generate (using node v16.x) first and then fund the deployer account. To view account balances, run yarn account. You will aslo need to update hardhat-config.js with the correct default network.
π Side Quest: we need to update this process to use node v18.x πͺ
cd scaffold-eth
yarn deployπ Edit your smart contract Savior.sol in packages/hardhat/contracts
π Edit your frontend App.jsx in packages/react-app/src
πΌ Edit your deployment scripts in packages/hardhat/deploy
π± Open http://localhost:3000 to see the app
π¨π‘ To deploy to a public domain, use yarn surge. You will need to have a surge account and have the surge CLI installed. There is also the option to deploy to IPFS using yarn ipfs and yarn s3 to deploy to an AWS bucket πͺ£ There are scripts in the packages/react-app/src/scripts folder to help with this.`
Documentation, tutorials, challenges, and many more resources, visit: docs.scaffoldeth.io
- scaffold-eth-typescript
- scaffold-eth-tailwind
- scaffold-nextjs
- scaffold-chakra
- eth-hooks
- eth-components
- scaffold-eth-expo
- scaffold-eth-truffle
π Read the docs: https://docs.soliditylang.org
π Go through each topic from solidity by example editing Savior.sol in π scaffold-eth
π§ Learn the Solidity globals and units
Check out all the active branches, open issues, and join/fund the π° BuidlGuidl!
-
π« Extend the NFT example to make a "buyer mints" marketplace
-
βοΈ Learn how ecrecover works
-
π©βπ©βπ§βπ§ Build a multi-sig that uses off-chain signatures
-
βοΈ Learn how a simple DEX works
-
π¦ Ape into learning!
π You need an RPC key for testnets and production deployments, create an Alchemy account and replace the value of ALCHEMY_KEY = xxx in packages/react-app/src/constants.js with your new key.
π£ Make sure you update the InfuraID before you go to production. Huge thanks to Infura for our special account that fields 7m req/day!
Register as a builder here and start on some of the challenges and build a portfolio.
Join the telegram support chat π¬ or buidlguidl discord to ask questions and find others building with π scaffold-eth!
π Please check out our Gitcoin grant too!