{"_id":"@emilianobonassi/referral","_rev":"1-0fb32bb62d0fce94eea3d4900a79b48a","name":"@emilianobonassi/referral","dist-tags":{"latest":"1.0.0"},"versions":{"1.0.0":{"name":"@emilianobonassi/referral","version":"1.0.0","description":"Referral is a collection of smart contract and utilities to implement on-chain referral marketing strategies.","license":"MIT","gitHead":"49c513542415dbdba0f5eea7e59eaa1db41598cc","_id":"@emilianobonassi/referral@1.0.0","_nodeVersion":"12.18.1","_npmVersion":"6.14.5","dist":{"integrity":"sha512-d2cybbrf9q9wISiRGV/naV7ECpzHJVqf+8NEW7k6LPAFiyGeTWHkORPzsJEEeNMjvCmdV/O5iNxbAktQ1fo2uA==","shasum":"ee52e3cad9ca972ba6d44e84e1a90094ae42bb3e","tarball":"https://registry.npmjs.org/@emilianobonassi/referral/-/referral-1.0.0.tgz","fileCount":4,"unpackedSize":3309,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfTA4bCRA9TVsSAnZWagAAqSAQAJqcU7EWZTs4zdm+fFAi\niFZusCMJ+SJMZcFqjTCeDdkunawsm6Fa8g2zcCOquxDaS1BmtPrGGGAp/Vj3\n4iu4LC6cxu+tUGeykL2TfOOOTMmD/XwQCNRJ+AZ15Ui2lFyJSpgl8tRJGLp3\nFAX+kCMoUAZ8wVQvfN9bkmnxxjsHSeH0iJUR52q4/nw0dhdDErmehLXOfs02\n2ZPlIJeCK+Ko98ZnUy2Aevr7uhay2RnQm/PwQy/ikgahRL0MlYpQCcBhk4q8\nugvjqwPCOVx5lW1EkzGk7HebOC09Mi+pqBkyLzyfGwOrG98XrUji3AjGdJ35\n801k6HiEDgQnyQZItv0kwnACuB6kMAykZBZ/ZrZXmet7cNJQTTvuitE2fTqk\nHb2rJj2sJT5rM51UQ2Grq135aSWToEVIVM+qBB3r82D19ZT+HFWohMeEIg63\nia/RrpePC0baX0w+vatyRiInOmizxJtU4AMG0tV1TDZNW8agDudfvjCYBRFW\nuk5XkXpmjmYtD945H+IjoOCh+BJDDSsCxE6idW9PzXVRmWG65u+xWv8tDEzo\nDLTmrzqoGEC3xtl0bLJzciVbEVEse+dAv2S7UIiGxGXoGW7KdtKha/M49kYv\n+HAGZcH7NACnubpCaFd6WNaJfxMDvhnjskZngZB5zmnvKL3Kwliu0n/ZVbZC\n6dIZ\r\n=qbWH\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCXiit8cd0ZN78nvHGR2hLkMgXdfFvXbtjICQXsZ73uiAIgKMjyaCBxoQ7S4bqthGRQuUt3qKl10Yk2/M/wmr/4Kk0="}]},"maintainers":[{"name":"emilianobonassi","email":"emiliano@defi-italy.xyz"}],"_npmUser":{"name":"emilianobonassi","email":"emiliano@defi-italy.xyz"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/referral_1.0.0_1598819866738_0.21602207848368082"},"_hasShrinkwrap":false}},"time":{"created":"2020-08-30T20:37:46.702Z","1.0.0":"2020-08-30T20:37:46.848Z","modified":"2022-04-05T07:33:21.416Z"},"maintainers":[{"name":"emilianobonassi","email":"emiliano@defi-italy.xyz"}],"description":"Referral is a collection of smart contract and utilities to implement on-chain referral marketing strategies.","license":"MIT","readme":"<h1 align=center><code>Referral</code></h1>\n\n**Referral** is a collection of smart contracts and utilities to implement on-chain referral marketing strategies.\n\n## How it works\n\nIt defines the modifier `referral` that you can use to track referrals and reward referrers on and off-chain.\n\nWhen a user is advised for the first time by a referrer the event `NewReferral(address indexed referrer, address indexed user)`,\nyou can use this to track to how many user a specific referrer promoted your initiative.\n\nYou can use `_hasReferrer(address user)` to check if the `user` was invited by a referrer.\nTo get the latter, just query `mapping (address => address) referrerForUser` using `user`.\n\nIn some cases, you would like to know if a user was just referred in that specific tx, you can use the boolean field `_justReferred`.\n\n## Usage\n\nSimply add the modifier `referral` to the methods you want, specifying the `user` that is advised and the `referrer`.\n\nBelow an example with SimpleReferral.\n\n```\nimport \"@emilianobonassi/referral/SimpleReferral.sol\";\n\ncontract MyContract is SimpleReferral {\n\n...\n\nfunction subscribe(bytes subscriptionData, address referrer)\n    external\n    referral(msg.sender, referrer)\n    returns (bool) {\n        ...\n    }\n...\n\n}\n```\n\n","readmeFilename":"README.md"}