{"id":24307069,"url":"https://github.com/fulldecent/spend-erc20-create-erc721","last_synced_at":"2025-09-26T12:31:25.819Z","repository":{"id":42519941,"uuid":"154044070","full_name":"fulldecent/spend-ERC20-create-ERC721","owner":"fulldecent","description":"Tech demo: customers spend your ERC-20 tokens to create their ERC-721 certificates","archived":false,"fork":false,"pushed_at":"2023-03-07T07:03:37.000Z","size":184,"stargazers_count":49,"open_issues_count":6,"forks_count":20,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-01-14T22:01:48.931Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://fulldecent.github.io/spend-ERC20-create-ERC721/","language":"Solidity","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fulldecent.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"github":["fulldecent"],"custom":["https://www.paypal.me/fulldecent","https://amazon.com/hz/wishlist/ls/EE78A23EEGQB"]}},"created_at":"2018-10-21T19:22:27.000Z","updated_at":"2024-07-27T08:45:58.000Z","dependencies_parsed_at":"2023-02-18T14:15:17.007Z","dependency_job_id":null,"html_url":"https://github.com/fulldecent/spend-ERC20-create-ERC721","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fulldecent%2Fspend-ERC20-create-ERC721","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fulldecent%2Fspend-ERC20-create-ERC721/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fulldecent%2Fspend-ERC20-create-ERC721/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fulldecent%2Fspend-ERC20-create-ERC721/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fulldecent","download_url":"https://codeload.github.com/fulldecent/spend-ERC20-create-ERC721/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":234309719,"owners_count":18811949,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-01-17T03:53:02.708Z","updated_at":"2025-09-26T12:31:20.532Z","avatar_url":"https://github.com/fulldecent.png","language":"Solidity","funding_links":["https://github.com/sponsors/fulldecent","https://www.paypal.me/fulldecent","https://amazon.com/hz/wishlist/ls/EE78A23EEGQB"],"categories":[],"sub_categories":[],"readme":"# Spend ERC-20 Create ERC-721\n\nThis is a technology demonstration showing a simple token usage scenario.\n\n1. You sell utility tokens to your customers (ICO)\n2. Your customers spend these tokens and create certificates\n3. Anybody can verify the certificates\n\n## Try the demo\n\nInstall MetaMask or other Web3-compatible browser setup, get a few Ether from a free faucet and load the demonstration website.\n\n**Demo website: https://fulldecent.github.io/spend-ERC20-create-ERC721/**\n\n## How does it work\n\n**ERC-721 certificate contract** — This is a standard ERC-721 contract implemented using the [0xcert template](https://github.com/0xcert/ethereum-erc721/tree/master/contracts/tokens) with additional functions:\n\n* `create(bytes32 dataHash) returns (uint256)` — Allows anybody to create a certificate (NFT). Causes the side effect of deducting a certain amount of money from the user, payable in ERC-20 tokens. The return value is a serial number.\n* `hashForToken(uint256 tokenId) view` — Allows anybody to find the data hash for a given serial number.\n* `mintingPrice() view` — Returns the price.\n* `mintingCurrency() view` — Returns the currency (ERC-20)\n* `setMintingPrice(uint256)` — Allows owner (see [0xcert ownable contract](https://github.com/0xcert/ethereum-utils/blob/master/contracts/ownership/Ownable.sol)) to set price\n* `setMintingCurrency(ERC20 contract)`  — Allows owner (see [0xcert ownable contract](https://github.com/0xcert/ethereum-utils/blob/master/contracts/ownership/Ownable.sol)) to set currency\n\n**ERC-20 token contract** — This is a standard ERC-721 contract implemented using the [OpenZeppelin template](https://github.com/OpenZeppelin/openzeppelin-solidity/tree/master/contracts/token/ERC20) for ERC-20 including Minter extension also with additional functions:\n\n* `isSpender(address) view`, `addSpender(address)`, `renounceSpender()` — A new role for tracking who may spend these tokens, see [OpenZeppelin roles library](https://github.com/OpenZeppelin/openzeppelin-solidity/blob/master/contracts/access/Roles.sol)\n* `spend(account from, uint256 value)` — Allows an authorized spender to deduct money from a specific account's balance\n* `mint(address to, uint256 value)`  — **FOR DEMO PURPOSES ONLY.** This implements the Minter role to allow ANYBODY to create tokens for free. This allows the demo to be used for anybody free of cost.\n\n## Deployment\n\nWhen you deploy the certificate and token contracts then you will be the owner with permissions to finish the deployment.\n\n* Authorize the certificate contract as a spender for the tokens\n* Set the tokens as the spendable currency for the certificate\n\n**Watch deployment: https://www.youtube.com/watch?v=3SiMPZbwlR0**\n\n## Contract development\n\nI recommend saving these files on localhost and then developing using [Remix IDE](http://remix.ethereum.org). Follow this process using the command line:\n\n1. Install remixd and smart contract dependencies\n\n   ```sh\n   npm install\n   ```\n\n2. Switch into the project folder and run `remixd -s .`\n\n3. Open Remix IDE and click the connect button\n\n4. Develop and run the contract from Remix IDE\n\n## Attribution\n\nThis project was created by William Entriken. Thank you to Arianee for funding the development of this technology demonstration.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffulldecent%2Fspend-erc20-create-erc721","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffulldecent%2Fspend-erc20-create-erc721","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffulldecent%2Fspend-erc20-create-erc721/lists"}