Design pattern for a trustless ICO?

Hi, I’m trying to launch a token via ICO that is trustless. Is there a design pattern to do the following:

  • I launch ICO contract
  • Investors send ETH to ICO contract
  • ICO contract query chainlink price oracle for ETH and saves USD value associated with investor address
  • Payout function that gives me the investor ETH automatically launches an ERC-20 token with rules established by a library contract and distributes the tokens proportionally to the USD value provided by the investors?
2 Likes

Hi @0xswtor,

Welcome to the community :wave:

If you are creating an ERC20 or a crowd sale I suggest looking at Points to consider when creating a fungible token (ERC20, ERC777).

OpenZeppelin Contracts include Crowdsales in v2.x (Please note: Crowdsales were removed in v3.x)

The crowdsale contracts accept Ether and distribute ERC20 tokens.
If you are pricing your tokens in a fiat currency rather than Ether, you could create your own contract based on these concepts that accepts a stable coin as payment instead.

2 Likes

Hi @0xswtor,

Let me know if you have any questions.

1 Like

Thank you very much, I appreciate it. This is my first time writing a smart contract so I will very likely take you up on the offer :slight_smile:

It’s slow going though, so I don’t have any questions yet. The link you provided has given me a good place to continue learning.

2 Likes

Hi @0xswtor,

As you are new to Solidity, I would start with creating an ERC20 using Remix, Truffle, buidler or OpenZeppelin CLI without writing Solidity.

1 Like

2 posts were split to a new topic: Is it still safe to use the v2.0 Crowdsale smart contract?