[英]How to sell custom spl-token for sol on my website without the use of a market/exchange
I have made a custom SPL token and minted it to a wallet.我制作了一个自定义 SPL 代币并将其铸造到钱包中。 I have an X amount of this custom-token minted on my phantom wallet.
我在我的幻影钱包上铸造了 X 数量的这种定制代币。
We have a website for the custom-token and we want to launch a presale on our website, user connects wallet and purchase directly from website (its a meme coin).我们有一个自定义令牌的网站,我们希望在我们的网站上启动预售,用户连接钱包并直接从网站购买(它是一个 meme 硬币)。
The process is (user connects wallet, user enters amount of custom-token to buy, sol transferred to our wallet, custom-token transferred from our wallet to user)过程是(用户连接钱包,用户输入要购买的自定义令牌数量,sol转移到我们的钱包,自定义令牌从我们的钱包转移到用户)
How do we go about this?我们该怎么做呢?
Do I have to make my own smart contract for this?我必须为此制定自己的智能合约吗?
Can this be done via web3?这可以通过web3完成吗?
You need some sort of separate smart contract to do the transfers, since you need to have one instruction which moves the user's SOL and your tokens all at once.您需要某种单独的智能合约来进行转移,因为您需要有一条指令可以同时移动用户的 SOL 和您的代币。 With just web3, you won't be able to guarantee these movements.
仅使用 web3,您将无法保证这些动作。
You can look at a few options in the Solana Program Library:您可以查看 Solana 程序库中的一些选项:
stateless-asks
is the simplest program, but requires some knowledge of program-derived addresses on Solana: https://github.com/solana-labs/solana-program-library/tree/master/stateless-asks stateless-asks
是最简单的程序,但需要了解 Solana 上的程序派生地址: https ://github.com/solana-labs/solana-program-library/tree/master/stateless-askstoken-swap
can be used with the ConstantPrice
curve to sell your tokens at a consistent price: https://github.com/solana-labs/solana-program-library/tree/master/token-swap token-swap
可以与ConstantPrice
曲线一起使用,以一致的价格出售您的代币: https ://github.com/solana-labs/solana-program-library/tree/master/token-swap
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.