This is an implimentation of a paywall using Metamask. On subsribing to the website, you will get a "SUB" non fungible token for 0.0001 Ether. This token is coded in the standard ERC 721 standard and is therefore non transferable.
Clone the repository. Ensure you have node and npm installed. Install the Metamask Chrome Extension. Install web3 using the command:
npm install web3 --save
Install Express to run the server:
npm install express --save
Finally, use this command to start on localhost:3300:
node server.js
The smart contract is deployed using Remix IDE on the Goerli Test Network. If you are deploying your own contract instance change the following parameters in the index.js file:
var contractAddress = '0x2f9B0A57C01fb9bd3CF29D4D0e16F5f71aCEDb18'; //Enter your deployed contract address here
var abi = [...] //Enter your abi here
Checks whether or not you have metamask installed.
Connects to your account
Approving a transaction to the mint function to give the msg.sender a SUB token, with which he can "access" the content on the website at any later time
Contains two smart contracts. One is to integrate DAI stablecoin into the system and use it as an ERC 20 token for payments, instead of an exceptionally volatile currency like ether. Further the second smart contract leverages all the DAI stored and gives it to the compound protocol, where one can invest DAI.