{"_id":"@emilianobonassi/idle-token-helper","_rev":"10-d30ca8b7f462785476254bd1dd4d899c","time":{"created":"2020-12-30T23:04:46.651Z","1.0.0":"2020-12-30T23:04:46.903Z","modified":"2022-04-05T07:33:21.297Z","1.1.0":"2020-12-31T07:42:56.506Z"},"name":"@emilianobonassi/idle-token-helper","dist-tags":{"latest":"1.1.0"},"versions":{"1.0.0":{"name":"@emilianobonassi/idle-token-helper","version":"1.0.0","description":"Idle Token Helper is a collection of smart contracts to simplify interaction with Idle Protocol","license":"AGPL-3.0","dependencies":{"@openzeppelin/contracts":"3.1.0"},"gitHead":"e4830b745b5dbac0b23e94e65b60f8020ef8f45d","_id":"@emilianobonassi/idle-token-helper@1.0.0","_nodeVersion":"12.18.1","_npmVersion":"6.14.5","dist":{"integrity":"sha512-XkEO9T4rk44f3rmSG0HoGpkIVJfuAPngchJiu+6th+le9MI+3B8H8NtnJoyoqg0J0YBcGL/tPCB9sLzh+Hpstg==","shasum":"2e14876bd6570a944c1172967e70001271c5d960","tarball":"https://registry.npmjs.org/@emilianobonassi/idle-token-helper/-/idle-token-helper-1.0.0.tgz","fileCount":5,"unpackedSize":42186,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJf7QePCRA9TVsSAnZWagAAdrsP/RD3V+o/yL/OuDKwSIV6\nJHyqSYw3VgoI46HVfG9vWDKktu2FB/fkJ6UgEx1QFWdWK6l3/Wil3fjFtRH6\nneoR31lK2hJDWRHlgM5IZY8pbO247a8O0/nCP7ynBw1d5kGLQ7JhtgkvuoUf\nd8Q0uwCyc3eV0j4tSmAvgZunx9gZNlIIOYpTccD2IsywxUXoNx58TXNzV/Fk\noiUaoLzfXSPVOaIHl33JKN5DiZfwGwdaGH7cP+FXzf2TPyVgexJhxeezh6en\ng/reLvmy0h1apYj1Y4t8/XxDz8tgfIckU5p5ql3mH13VXZYT8Z8lo8uF4/jL\nU4HFVyitWFJoL0HE9nWSFWj/s4CFE5kKRD0EDNzlyCpaCJ429BIbYtsNLPZx\n8EZc9qemAD1OxSNrQVYssZcDOu/G0srLgI9DjU2cHGZ1m7SzXNxdEsmFVwnz\njlBk08nyKg1qq793JzYpC07r6VrDsoK5zAAOsAlsx6cTfCNPCgoLqPVJiSpZ\nES5P0/FjMDEYFA2PYyQ9aMT5TqSDOgbx6TzKrlab2moJ1Ll3IUJ6dOgQHmx/\nR/8oYatrtC7MQT3NjCXgO+qSUO4l/ywxuExzxbOQzAW/hE8Dp2fMGdloWr3L\nDNKH6K7r2UC2bI31tlO1VDfVSMz3APNP3H7itaAia3Sex6wWi0xzuKD56xIT\nUiln\r\n=Ap3e\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIGlA/TSLs7ZRjmMsRfbgPQeBXc8/V1WvF+LjH4M16mzFAiBbeooRVo8c0WIP4LajV804B3cMDpH2pMJEnsAFKaTpjA=="}]},"_npmUser":{"name":"emilianobonassi","email":"emiliano@defi-italy.xyz"},"directories":{},"maintainers":[{"name":"emilianobonassi","email":"emiliano@defi-italy.xyz"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/idle-token-helper_1.0.0_1609369486708_0.6649625227911202"},"_hasShrinkwrap":false},"1.1.0":{"name":"@emilianobonassi/idle-token-helper","version":"1.1.0","description":"Idle Token Helper is a collection of smart contracts to simplify interaction with Idle Protocol","license":"AGPL-3.0","dependencies":{"@openzeppelin/contracts":"3.1.0"},"gitHead":"5f20a1a0fc155c433067b9569e825e23cc81f00f","_id":"@emilianobonassi/idle-token-helper@1.1.0","_nodeVersion":"12.18.1","_npmVersion":"6.14.5","dist":{"integrity":"sha512-Om6mZi5bvvzpvk2sHu60TBOFP2LFtpqzXBW501CDhWwZedAdg2h/4TZc/uItMKH2HRp4lc8WZI05P/DOLkfITg==","shasum":"5c9a244db8e7f1c04406edbd1154811be68fea19","tarball":"https://registry.npmjs.org/@emilianobonassi/idle-token-helper/-/idle-token-helper-1.1.0.tgz","fileCount":5,"unpackedSize":42453,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJf7YEACRA9TVsSAnZWagAAo0EP/03We/Hkqymg84EO34H2\n2j1MPjjDaVAh+gfyFft9yXCjuQY/Avi+2jCok3vI6C8/uO5iyc/wLsztmlHK\noV2VNTtsqXsTlMd7L25d3JF32zdiMTGt+0mJ4CVQwjjzazdQwBPljjvfCpcW\nkL3VdjBBPi1495hLBJCg4K4GsF9ztqvj/wusNfZkKBwTbko7YPPw5HGTRuVr\nSeGNQQ58liGQKySGq8ocdBIKSc7EABIgUjaumrqg8/pFlLX/Ik2vYjrPmDfU\nh8kj0RfqLxDrutVMs3n0l+21pHa2dplj1UMctXHjT6IwAZ1/IhiCSy9E8Szj\naS9LM9GT/dpch6VmEuMB3bf6eJVTu442l1TYPAHSLTDuvcIZ6aWu4/t2zzOg\nS01IegYCBQAFzd0oQNVf6KkPmdQYMDAuLyFJlGHnVu185/1JUCcg50ynMvam\nC04RcfVvkchk08rhKYGK3sr2phHY11xc77RgDsDWR4FnUOXaom1HnV/uCtSu\nLD3Zx4K+/nFvp6cEv9kyiZ4aTALYeyoq/aptFOVaX4HFmLhZi/bdi+VbKt31\nFL9M3jjLDsB+ef5hwpKb3vSkgCxb7CIwyjV5lySE2ln8y5ZIJQ93pHksigpr\nD94KOC3aCJKQCVEC8zvHOfL8QmrxjKZB5ui0hEvK2ZjJ836lcJflQmmZvrNV\nRzdL\r\n=y9Sr\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIGF6j+pmr0Srr6UUPSpZ1UeH6lCGmF+HROJCJGuucrdTAiBUhn4V14XeiCdujdNQouDjjvHOffrRVwdOaKcN8h8IYw=="}]},"_npmUser":{"name":"emilianobonassi","email":"emiliano@defi-italy.xyz"},"directories":{},"maintainers":[{"name":"emilianobonassi","email":"emiliano@defi-italy.xyz"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/idle-token-helper_1.1.0_1609400576354_0.3011015537357433"},"_hasShrinkwrap":false}},"maintainers":[{"name":"emilianobonassi","email":"emiliano@defi-italy.xyz"}],"description":"Idle Token Helper is a collection of smart contracts to simplify interaction with Idle Protocol","license":"AGPL-3.0","readme":"<h1 align=center><code>Idle Token Helper</code></h1>\n\n**Idle Token Helper** is a collection of smart contracts to simplify interaction with Idle Protocol.\n\n## How it works\n\nIdle Protocol has fees on yield you get which are collected during redeem.\nYou can abstract this concept considering two prices during minting and redeeming, respectively `mintingPrice` and `redeemPrice`.\n\nIdleTokenHelper facilitates your day implementing the formula for `redeemPrice`.\n\n## Usage\n\nYou just need to call `getMintingPrice(address idleYieldToken)` to get minting price and `getRedeemPrice(address idleYieldToken, address user)` for redeemPrice. You can use also `getRedeemPrice(address idleYieldToken)` which provides redeemPrice for `msg.sender`.\n\nFor both, you need to pass the address of the IdleToken you are considering. For redeem, you have to provide the address which holds the tokens because the formula leverages the `avgUserPrice`. \nTechnically, it keeps track of the weighted average of the token minted by the specific address, to calculate the yield needed for applying the fees on top.\n\nYou can version I deployed for you at [0x04Ce60ed10F6D2CfF3AA015fc7b950D13c113be5](https://etherscan.io/address/0x04Ce60ed10F6D2CfF3AA015fc7b950D13c113be5) or embed in your contracts.\n\nThe latter could be more expensive at deploy time but cheaper at runtime, remember to use the internal methods (i.e. `_getMintingPrice(address idleYieldToken)` and `_getRedeemPrice(address idleYieldToken, address user)`).\n\nBelow an example\n\n```\nimport \"@emilianobonassi/idle-token-helper/IdleTokenHelper.sol\";\n\ncontract MyContract is IdleTokenHelper {\n\n...\n\nfunction myMintMethod()\n    external\n    returns (bool) {\n        ...\n        uint256 mintingPrice = _getMintingPrice(idleYieldToken);\n        ...\n    }\n...\n\nfunction myRedeemMethod()\n    external\n    returns (bool) {\n        ...\n        uint256 redeemPrice = _getRedeemPrice(idleYieldToken, address(this));\n        ...\n    }\n...\n\n}\n```\n","readmeFilename":"README.md"}