{"_id":"@aragon/apps-time-lock","_rev":"23-b6c8ab183bbe2bad88b6c16931ec38fb","name":"@aragon/apps-time-lock","dist-tags":{"latest":"2.0.0"},"versions":{"2.0.0":{"name":"@aragon/apps-time-lock","version":"2.0.0","keywords":[],"_id":"@aragon/apps-time-lock@2.0.0","maintainers":[{"name":"arabot-1","email":"devops@aragon.org"},{"name":"hack0","email":"scherer.mat@gmail.com"},{"name":"yuetlooo","email":"contact@yuetloo.com"},{"name":"izqui","email":"jorge@aragon.one"},{"name":"luisivan","email":"me@luisivan.net"},{"name":"aragon-ci","email":"jorge+npmci@aragon.one"},{"name":"nivida","email":"sam@aragon.one"},{"name":"npmdoramon","email":"emaildoramon@gmail.com"},{"name":"vracine","email":"valentinracine@hotmail.com"},{"name":"novaknole","email":"giorgi.lagidze@toptal.com"}],"dist":{"shasum":"bf081cec955d42c1d13267c2766e485299119a62","tarball":"https://registry.npmjs.org/@aragon/apps-time-lock/-/apps-time-lock-2.0.0.tgz","fileCount":13,"integrity":"sha512-xhsDSQBPSuwMOjvzwAVGHZwPfn9eh1c78zJPmgj2HCyIY76gyW/3RfSrHVFKUgarhnGe5uknqR2nv8s0Mxe4Lw==","signatures":[{"sig":"MEQCICzQ1lGz5+Yp/rmG3FX1wtJ4gdbo/nL6YND9fD+Fjt15AiBgM0HdwvcPrDiPWfaxve7bj+FsObfQVCp7lBHcXqb65A==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":92490,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhzFtWCRA9TVsSAnZWagAAyXIP/0dlsLYhmkgXazOFQKXK\n53A61h93jlMnoEKsTM9j0uc8+QiWhCC9k18OgAcC1i3pfpjFyC3aXo3lgDNB\nb/KY0LICW3l0AnTxVS4F8X4vNbWWACF7TVlIkiuHTNQ0zPl3SixT/LOzzQ36\n+lxgC2vlDjrErNrTE7my+5y7A7zZXauqpoSHLKFUfnSO3jFHt776Nd/40SzY\nhA0Olmlgk7uO9LV/XTKyjZkZxZMh4ipqLM0ks9buhKr2Hxfanfju4DYZNZhE\nWmhgM0tt7O1tin/wH2qHu8sZnou/mC55P4S/J1cqEgkEER0lVk0bY8TgKdEh\nqIksmCvwomukddgW5u+jRmc0IOII8mGD09226KHPT9B7BZb4wEsNpBHBcBJd\napuq3DXJ1Ev8s5MwYVByrZ/afifYGzYMpt81Qooqino9pAEPvXx6T96BoIiW\nUrmQlS+/N2noXyHk44PSVxb+qVFCC+FuUeTppUkCKcVQzEpErpQKbHcyLjCe\nYPKtdO/MoYE/bOvpeUhNWXYF8hv4eb7zaAFtK7EFuJS+sA7Qlpz0M6divFpk\nA0/mcHoxVNPrC/i+uA/rq/wGAp7DniKlalnj63fjipYbzaY9arEcBPDYoOzl\nwlcDA8+ny4eq8G69Lqe7fa8zr43K+P09nju2VLvI3Cv51hSJPriIf3ymAbJg\n0RuA\r\n=y8Bi\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","scripts":{"lint":"eslint . & solium --dir ./contracts","test":"cross-env TRUFFLE_TEST=true npm run ganache-cli:test","build":"cd app && npm install && npm run build","compile":"hardhat compile --force","coverage":"cross-env SOLIDITY_COVERAGE=true npm run ganache-cli:test","lint:fix":"eslint . --fix & solium --dir ./contracts --fix","coveralls":"cat ./coverage/lcov.info | npx coveralls","set-oracle":"./scripts/setTokenOracle.sh development","ganache-cli:test":"sh ./node_modules/@aragon/test-helpers/ganache-cli.sh","set-oracle:mainnet":"./scripts/setTokenOracle.sh mainnet","set-oracle:rinkeby":"./scripts/setTokenOracle.sh rinkeby"},"_npmUser":{"name":"yuetlooo","email":"contact@yuetloo.com"},"_npmVersion":"6.14.15","description":"[![CircleCI](https://circleci.com/gh/1Hive/time-lock-app.svg?style=svg)](https://circleci.com/gh/1Hive/time-lock-app) [![Coverage Status](https://coveralls.io/repos/github/1Hive/lock-app/badge.svg?branch=master&service=github)](https://coveralls.io/github","directories":{},"_nodeVersion":"14.17.6","dependencies":{"@aragon/os":"^4.0.1"},"_hasShrinkwrap":false,"devDependencies":{"eslint":"^5.13.0","ethers":"^5.4.7","ethlint":"^1.2.3","hardhat":"^2.6.5","truffle":"^5.0.1","prettier":"^1.17.1","coveralls":"3.0.2","cross-env":"^5.2.0","@aragon/cli":"^6.3.3","ganache-cli":"^6.0.0","babel-eslint":"^10.0.1","eth-ens-namehash":"^2.0.8","solidity-coverage":"^0.6.2","@aragon/apps-vault":"^4.1.0","eslint-plugin-node":"^8.0.1","@aragon/apps-voting":"^2.1.0","eslint-plugin-react":"^7.12.4","@aragon/test-helpers":"^2.0.0","eslint-plugin-import":"^2.16.0","eslint-plugin-promise":"^4.0.1","@aragon/hardhat-aragon":"^0.3.0","@aragon/hardhat-config":"^0.2.0","eslint-config-prettier":"^4.0.0","eslint-config-standard":"^12.0.0","eslint-plugin-prettier":"^3.0.1","eslint-plugin-standard":"^4.0.0","@nomiclabs/hardhat-ethers":"^2.0.2","eslint-plugin-react-hooks":"^1.6.0","@aragon/apps-shared-minime":"1.0.0","@aragon/apps-token-manager":"^2.1.0","@1hive/oracle-token-balance":"^2.0.0","@nomiclabs/hardhat-etherscan":"^2.1.6","eslint-config-standard-react":"^7.0.2"},"_npmOperationalInternal":{"tmp":"tmp/apps-time-lock_2.0.0_1634850770873_0.6641035006001756","host":"s3://npm-registry-packages"}}},"time":{"created":"2021-10-21T21:12:50.816Z","modified":"2025-05-09T12:19:19.083Z","2.0.0":"2021-10-21T21:12:51.106Z"},"keywords":[],"description":"[![CircleCI](https://circleci.com/gh/1Hive/time-lock-app.svg?style=svg)](https://circleci.com/gh/1Hive/time-lock-app) [![Coverage Status](https://coveralls.io/repos/github/1Hive/lock-app/badge.svg?branch=master&service=github)](https://coveralls.io/github","maintainers":[{"email":"devops-master@aragon.org","name":"devops-master"},{"email":"jjavieralvarezrodriguez@gmail.com","name":"jjavieralv"},{"email":"devops@aragon.org","name":"arabot-1"}],"readme":"# Time Lock <img align=\"right\" src=\"https://github.com/1Hive/website/blob/master/website/static/img/bee.png\" height=\"80px\" />\n\n[![CircleCI](https://circleci.com/gh/1Hive/time-lock-app.svg?style=svg)](https://circleci.com/gh/1Hive/time-lock-app)\n[![Coverage Status](https://coveralls.io/repos/github/1Hive/lock-app/badge.svg?branch=master&service=github)](https://coveralls.io/github/1Hive/lock-app?branch=master&service=github)\n[![Crytic Status](https://crytic.io/api/repositories/bRQyzLe1Qm2ckDlBsGQKLQ/badge.svg?token=4d485d8b-e6c1-4a3b-9f8e-cb3133ee3c4f)](https://crytic.io/1Hive/lock-app)\n\n1Hive's Time Lock app allows an Aragon organization to require users to lock tokens by sending them to the Time Lock app for a configurable period of time in order to forward an intent. For example the organization may require users to lock 100 tokens for 1 month before creating a new vote. The user would be able to come back in a month and claim their locked tokens.\n\n#### 🐲 Project stage: Mainnet\n\n#### 🚨 Security review status: [Contracts audited](https://diligence.consensys.net/audits/2019/12/dandelion-organizations/)\n\n## How does it work?\n\nThe Time Lock app is a [forwarder](https://hack.aragon.org/docs/forwarding-intro). By granting the Time Lock app a permission like `Create Votes` the user will be prompted and required to lock tokens before the user's intent can be forwarded.\n\nWe keep track of when locks are made and by whom so that users are only able to re-claim locks that they have made after the duration has elapsed.\n\nWe recommend (but do not require) that the lock function is used with the [Token Balance Oracle](https://github.com/1Hive/token-oracle) to restrict use of the application to members of the organization. This is how permissions are set up in our [demo template](https://github.com/1Hive/time-lock-app/blob/master/contracts/examples/Template.sol#L122). This allows the Oracle to check if the `msg.sender` of a proposal has tokens (and thus is a member of the DAO who's qualified to create proposals) before granting the `canForward()` functionality. This means that in order to submit a proposal one must lock tokens, and in order to lock tokens one must be a member of the DAO.\n\n### Initialization\n\nThe Time Lock app is initialized with a `_token`, `_lockDuration`, `_lockAmount` and `_spamPenaltyFactor` parameters which determines the token to be locked, how long tokens are locked, the amount of tokens to lock and a penalty percentage for spamming proposals.\nAt initialization the `_token` parameter can be set to an ERC20 token. It cannot be changed. If a change is necessary the user can install a new instance and change permissions in the organization to reflect the change.\n\n### Roles\n\nThe Time Lock app implements the following roles:\n\n- **Change Duration**: This allows for changing the configured duration.\n- **Change Lock Amount**: This allows for changing the amount of tokens required to lock.\n- **Change Spam Penalty**: This allows for changing the spam penalty factor for subsequent locks.\n- **Lock Tokens**: This should be granted to `Any Entity` and paramaterized using the [ACL Token Oracle](https://github.com/1Hive/token-oracle) or similar contract.\n\n### Interface\n\nThe Time Lock app provides an interface for a user to see any locks they have made, and how much time until they can re-claim the lock. It also shows the total unlocked balance they currently have for re-claim.\n\nThe Time Lock app does not provide an interface for changing the duration or lock amount. This can be done via the aragonCLI or directly interacting with the contract.\n\n## How to run Time Lock app locally\n\nFirst make sure that you have node, npm, and the aragonCLI installed and working. Instructions on how to set that up can be found [here](https://hack.aragon.org/docs/cli-intro.html). You'll also need to have [Metamask](https://metamask.io) or some kind of web wallet enabled to sign transactions in the browser.\n\nGit clone this repo.\n\n```sh\ngit clone https://github.com/1Hive/time-lock-app.git\n```\n\nNavigate into the `time-lock-app` directory.\n\n```sh\ncd time-lock-app\n```\n\nInstall npm dependencies.\n\n```sh\nnpm i\n```\n\nDeploy a dao with Time Lock app installed on your local environment.\n\n```sh\nnpm run start:template\n```\n\nIf everything is working correctly, your new DAO will be deployed and your browser will open http://localhost:3000/#/YOUR-DAO-ADDRESS. It should look something like this:\n\n![Newly deploy DAO with lock app](./docs/resources/screenshot.png)\n\nYou will also see the configuration for your local deployment in the terminal. It should look something like this:\n\n```sh\n    Ethereum Node: ws://localhost:8545\n    ENS registry: 0x5f6f7e8cc7346a11ca2def8f827b7a0b612c56a1\n    APM registry: aragonpm.eth\n    DAO address: YOUR-DAO-ADDRESS\n```\n\n### Template\n\nThe Time Lock app is initialized with a `_lockDuration` of 1:30 minutes, a `_lockAmount` of 20 LKT tokens and a `_spamPenaltyFactor` of 100%.\nThe app has the permission to create votes, so if you try to mint yourself some tokens from the `tokens` app it will first prompt you to approve the Time Lock app to transfer 20 LKT tokens to the contract on your behalf.\nOnce the forwarding is performed you should be able to see the current lock and a timer indicating how much time until you can re-claim your 20 LKT tokens.\n\n### Re-claiming your tokens\n\nOnce your balance is unlocked you will be able to re-claim your tokens via the withdraw button.\nYou will have to input how many locks you'll re-claim and they'll be withdrawn on a FIFO basis (first in first out)\n\n## Aragon DAO Installation\n\nThe Time Lock app has been published to APM on Mainnet and Rinkeby at `time-lock.aragonpm.eth`\n\nTo deploy to an organization you can use the [aragonCLI](https://hack.aragon.org/docs/cli-intro.html).\n\n```sh\naragon dao install <dao-address> time-lock.aragonpm.eth --app-init-args <token-address> <lock-duration> <lock-amount>\n```\n\nYou have to set up permissions depending on your requirements for users to lock tokens before forwarding an intent. So for example if you want to require users to lock tokens before creating votes you should grant the Time Lock app the role to create votes on the Voting app.\n\n:warning: <span style=\"color:#f3d539\">Currently the Time Lock app has to be the first forwarder in the transaction pathing in order to properly prompt you to perform an approve for the required amount of tokens</span>\n\n## Contributing\n\nWe welcome community contributions!\n\nPlease check out our [open Issues](https://github.com/1Hive/time-lock-app/issues) to get started.\n\nIf you discover something that could potentially impact security, please notify us immediately. The quickest way to reach us is via the #dev channel in our [team Keybase chat](https://keybase.io/team/1hive). Just say hi and that you discovered a potential security vulnerability and we'll DM you to discuss details.\n","readmeFilename":"README.md"}