/contracts

✨Syns/Contracts - A suite of smart contracts, written in Solidity, that are deployed on the Polygon network. This collection of smart contracts serves as the backbone for the platform's decentralized functionality and enables secure, transparent, and immutable transactions.

Primary LanguageSolidity


Syns Platform | Spark Your Noble Story

✨ The platform is currently open for beta testing at https://syns-platform.com

🪜 Work In Progress... 🪜

Overview

SYNS/contracts, a suite of smart contracts, written in Solidity, that are deployed on the Polygon network. This collection of smart contracts serves as the backbone for the platform's decentralized functionality and enables secure, transparent, and immutable transactions.

Hightlighted features

  • SynsERC721 - includes all the standard features of an NFT industry, as defined by the ERC721 specification from OpenZeppelin, as well as additional custom logic developed by SYNS to automatically set the default royalty fee for new NFTs as soon as they are minted.
  • SynsERC1155 - includes all the standard features of the NFT industry as defined by the ERC1155 specification, as well as additional custom logic developed by SYNS.

  • SynsDonation - allows users to make donations to other users using any type of cryptocurrency. All transactions are transparently recorded on the blockchain for full transparency.

  • SynsMarketPlace - combination of various safe, gas-optimizing, and well-tested features from the Thirdweb Marketplace and a range of complex custom logic developed by SYNS. SynsMarketplace is able to:

    • Enable token owners to create, update, and cancel NFT listings for sale on the blockchain

    • Safely facilitate the buying and transfer of NFTs on behalf of the seller, automatically transferring the sale price from the buyer's to the seller's crypto wallet address

    • automatically calculates and transfers royties to original creator

  • SynsClub - most honored and complex out of the five contracts, powers all the complex Syns membership logic. SynsClub is able to:

    • Allow potential club owners to create a SYNS Club and add multiple membership plans, known as SYNS Tiers, where the owner can configure their desired membership fee and limit the number of members in each tier, as well as update the metadata at any time.

    • Enable club owners to easily track the total and active members in each SYNS Tier and periodically request to remove inactive members.

    • Allow potential subscribers to subscribe or unsubscribe to any SYNS Tier in any SYNS Club on the platform. The SYNS Club automatically calculates the next payment in 30 days for followers, records the date they started following the club, and increases the SYNS Royalty Stars (an honor system based on how long a follower has been following the club).

Get Started

Requirement

Quickstart

git clone https://github.com/syns-platform/contracts.git
cd contracts
yarn

Running the project

1. Set environment variables

  • create a .env file using the .example.env as the template and fill out the variables.

    • SYNS_SERVICE_PRIVATE_KEY: The private key of your metamask account. See Helpers.PRIVATE-KEY on how to export your PRIVATE KEY. NOTE: FOR DEVELOPMENT, PLEASE USE A KEY THAT DOESN'T HAVE ANY REAL FUNDS ASSOCIATED WITH IT AND DO NOT SHARE YOUR PRIVATE KEY.
    • MUMBAI_RPC_URL: This is url of the Mumbai testnet node you're working with then deploy the smart contracts to. Setup with one for free from Alchemy. See Helpers.MUMBAI-RPC-URL on how to export a MUMBAI_RPC_URL from Alchemy.
    • COINMARKETCAP_API_KEY: This is mainly for the hardhat-gas-report pluggin so this is optional. If you want to play with hardhat-gas-report pluggin, first go to hardhat.config.ts, toggle the gasReporter.enabled to true. Then see Helpers.COINMARKETCAP_API_KEY on how to export your COINMARKETCAP_API_KEY (deprecated)

    2. Get testnet MUMBAI MATIC

  • Head to Mumbai Faucet

  • Sign into the site using the Alchemy account you've created for the MUMBAI_RPC_URL

  • Paste your metamask PUBLIC_KEY a.k.a account's address (not PRIVATE_KEY)

  • Hit Send Me MATIC to get free MUMBAI MATIC

3. Compile smart contracts

3.1 Using make command + hardhat
make compile
3.2 Using yarn + hardhat
yarn hardhat compile

4. Deploy smart contracts to Mumbai Testnet

4.1 Using make command + hardhat
make deploy
4.2 Using yarn + hardhat
yarn hardhat run ./deploy-scripts/v1/ --network mumbai

5. Verify smart contracts on etherscan

5.1 Using make command + hardhat
make verify
5.2 Using yarn + hardhat

5.2.a. verify SynsClub Smart Contract

yarn hardhat verify --network mumbai ${SYNSCLUB_CONTRACT_ADDRESS_FROM_DEPLOY_PHASE} ${NATIVE_TOKEN_WRAPPER_ADDRESS}

5.2.b. verify SynsDonation Smart Contract

yarn hardhat verify --network mumbai ${SYNSDONATION_CONTRACT_ADDRESS_FROM_DEPLOY_PHASE} ${NATIVE_TOKEN_WRAPPER_ADDRESS}

5.2.a. verify Club Smart Contract

yarn hardhat verify --network mumbai ${SYNSERC721_CONTRACT_ADDRESS_FROM_DEPLOY_PHASE}

5.2.a. verify Club Smart Contract

yarn hardhat verify --network mumbai ${SYNSERC1155_CONTRACT_ADDRESS_FROM_DEPLOY_PHASE}

5.2.a. verify Club Smart Contract

yarn hardhat verify --network mumbai ${SYNSMARKETPLACE_CONTRACT_ADDRESS_FROM_DEPLOY_PHASE} ${NATIVE_TOKEN_WRAPPER_ADDRESS} ${PLATFORM_FEE_SERVICE_RECIPIENT} ${PLATFORM_FEE_BPS(%)}

Helpers

1. How to export PRIVATE_KEY from your metamask

How to export an account's private key

2. How to export a MUMBAI_RPC_URL from Alchemy.

  • Go to Alchemy => Signup => Signin
  • Hit CREATE APP => fill out the form
      {
        NAME: 'ANY',
        DESCRIPTION: 'ANY',
        CHAIN: 'Polygon',
        NETWORK: 'Mumbai`
      }
    
  • Now, go to the app you just created. Find and click on the VIEW KEY button top-right.
  • The URL under HTTPS is the MUMBAI_RPC_URL you want.
  • Copy the URL and paste it to your .env file under MUMBAI_RPC_URL

3. How to export a COINMARKETCAP_API_KEY from coinmarketcap

  • Go here and pick the first plan-GET FREE API KEY.
  • Signup with your email then sign into coinmarketcap
  • Now copy the API Key there and paste it to your .env file under COINMARKETCAP_API_KEY

Verified on Etherscan