Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(grc20-launchpad): realms & pkg #1263

Merged
merged 48 commits into from
Sep 12, 2024

Conversation

MikaelVallenet
Copy link
Member

@MikaelVallenet MikaelVallenet commented Sep 2, 2024

Launchpad GRC20 Token Smart Contracts

This PR introduces the following GRC20 token smart contracts for the development of a launchpad on the Gno blockchain. The contracts provide functionalities for token creation, minting, burning, airdrops, and token sales.

Demonstration

https://www.youtube.com/watch?v=76clMWwk_zY

Features

Token Contract

  • Token Creation: Supports token creation with specific parameters like name, symbol, decimals, initial supply, and total supply cap.
  • Minting and Burning: Option to allow or restrict minting and burning of tokens based on the configuration.
  • Transfer Functions: Implements standard GRC20 transfer functions like Transfer, Approve, and TransferFrom.
  • Admin Role: Enforces admin control over certain actions (minting, burning) using the Ownable pattern for access control.

Airdrop Contract

  • Merkle Tree-Based Airdrop: Uses a Merkle root to allow airdrop claimants to prove eligibility and claim tokens.
  • Time-Limited Airdrops: Configurable start and end timestamps for the airdrop duration.
  • Claim Function: Allows eligible addresses to claim tokens via Merkle proofs.

Sale Contract

  • Token Sale: Facilitates time-limited token sales with configurable parameters like price per token, limit per address, minimum and maximum goals.
  • Owner Control: The token owner can set the parameters and finalize the sale when it ends.
  • Refund Mechanism: Automatically refunds buyers if the minimum sale goal is not reached.
  • Merkle Tree Integration: Option to use a Merkle root to limit sale participation to specific addresses.

Key Functions

Token

  • NewToken(name, symbol, image, decimals, initialSupply, totalSupplyCap, allowMint, allowBurn)
  • Mint(name, to, amount)
  • Burn(name, from, amount)
  • Transfer(name, to, amount)
  • Approve(name, spender, amount)
  • TransferFrom(name, from, to, amount)

Airdrop

  • NewAirdrop(tokenName, merkleRoot, amountPerAddr, startTimestamp, endTimestamp)
  • Claim(airdropID, proofs)

Sale

  • NewSale(tokenName, merkleRoot, startTimestamp, endTimestamp, pricePerToken, limitPerAddr, minGoal, maxGoal, mintToken)
  • Buy(saleID, amount, proofs)
  • Finalize(saleID)

⚠️ PR description generated by AI from code files 🤖

Copy link

netlify bot commented Sep 2, 2024

Deploy Preview for testitori ready!

Name Link
🔨 Latest commit 1cfce78
🔍 Latest deploy log https://app.netlify.com/sites/testitori/deploys/66e2f7d12f37a60008e530d5
😎 Deploy Preview https://deploy-preview-1263--testitori.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

netlify bot commented Sep 2, 2024

Deploy Preview for teritori-dapp ready!

Name Link
🔨 Latest commit 1cfce78
🔍 Latest deploy log https://app.netlify.com/sites/teritori-dapp/deploys/66e2f7d14d8dee0008733dc4
😎 Deploy Preview https://deploy-preview-1263--teritori-dapp.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@MikaelVallenet MikaelVallenet changed the title feat(grc20-launchpad): Realms & pkg feat(grc20-launchpad): realms & pkg Sep 2, 2024
Copy link
Collaborator

@n0izn0iz n0izn0iz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add unit tests

gno/r/launchpad_grc20/token_factory_gr20.gno Outdated Show resolved Hide resolved
gno/r/launchpad_grc20/token_factory_gr20.gno Outdated Show resolved Hide resolved
@MikaelVallenet MikaelVallenet marked this pull request as ready for review September 10, 2024 13:24
Copy link
Collaborator

@n0izn0iz n0izn0iz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How do you list all airdrops and sales for a particular token?

I think airdrops and sales should be stored in the Token struct or at least be indexed by token

gno/r/launchpad_grc20/sale_grc20.gno Outdated Show resolved Hide resolved
@n0izn0iz n0izn0iz merged commit 0d3b82f into TERITORI:main Sep 12, 2024
19 of 22 checks passed
@leohhhn
Copy link

leohhhn commented Oct 4, 2024

Sorry for being late to the party; I left some comments. Just a few considerations. Happy to see more complex code being built!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants