I’m working on a security token for a tokenized hedge fund and I need help in how to structure the project.
My background is in algorithmic trading and I’ve developed and tested an algorithm for trading cryptos. My goal is to turn this into a token to democratize the kind of investment usually only restricted to accredited investors. And of course, I would charge a small management fee.
My idea was to create a BEP-20 token, sell a number of tokens in an STO, burn whatever is not sold initially, and start trading with the funds from the STO. My management fee would be charged by minting new tokens periodically (daily or weekly).
A couple of questions:
I want to do the STO on a DEX (for regulatory reasons). I was thinking Pancakeswap, pairing my token with BUSD or USDT, but how can I control the price with their AMM algo? Is there a way to automatically adjust liquidity with a smart contract?
The value of the token will be linked to the underlying assets in the funds (10 different cryptos + 1 or more stablecoins depending on the size of the fund). Assuming you have the addresses where the 10 cryptos (plus the stablecoin) are held, how do you know how much is held in each and therefore are able to determine the total value of the fund?
And once you have determined the value of the token (total value of the fund divided by number of tokens in circulation), can you control the price on Pancakeswap with a smart contract? Or is this done separately?
In the end, the goal is to create a security token which value is guaranteed and linked to the underlying assets in the fund.
Am I approaching the problem the wrong way? If so, how would you do it?
You could theoretically "adjust" smart contract liquidity by using the router in Uniswap which would give you methods to add liquidity to a ERC-20 token.
Having a token linked to underlying assets could be achieved by having the token go through a defi protocol like avve, your token would have a value and by making your asset the collateral you could achieve purchasing power for other currencies.
The first price is given by the rate you make in the liquidity pool, if you were to create the token with a LP of 50 ETH then your token starting price would be 1/2 ETH. It's up to the market to determine the price after that.
Related
I'm trying to figure out what's purpose of permit function from the Uniswap core
I know that ecrecover function ensures, that messages was signed by some address, but that's not clear for me -- why we can use permit function?
The owner can sign a structured message which produces a signature (separated into variables v, r, and s).
Meaning of the message could be described like "I, the owner, am approving the spender to operate value of my LP tokens of this specific Uniswap pair. This approval needs to be recorded onchain before deadline."
The owner then passes the signature and the values offchain to anyone else (e.g. to the spender), who executes the permit() function. By executing the permit() function, the approval becomes valid since now it's recorded onchain.
This is useful in cases when the owner has LP tokens - but doesn't have sufficient native balance to pay for gas fees for their transfer or approval.
Or when the owner is a user of your app and you have some kind of an agreement that your app will pay gas fees for the user. E.g. because they compensate you for the gas fees using another way - stablecoins, monthly fee, etc.
In Erc20, transferFrom allows decentralized exchange (DEX) to transfer funds from your account. But before calling this function, you have to call approve function, to allow the DEX how much fund it can use. So you are calling 2 functions and each will cost you a gas fee. Those gas fees are high and If you are trading often on DEX, you will be paying a lot of gas fees.
With permit function, you do not need to call the approve function. You are approving the transaction by signing the transaction. This transaction is signed off-chain so you are not paying any gas fees. Fron-end developers handle this part and then they derive the v,r,s of the signature. If you look at the args of the permit function, it expects v,r,s arguments.
permit() function allows anyone to authorize and swap a token in one transaction instead of two transactions. But this does not mean that you are saving half the gas fees. For example, if you were paying 10 wei gas fees for two transactions now it is not going to be 5 wei because permit function has more logic to implement. So the total gas fee will be between 5-10 wei. permit is not about just saving the gas fee but delegating the transaction to another wallet so that the wallet will pay the transaction. that is called gasless transaction.
I found this API that can give the the list of 'normal' transactions for a smart contract given the address for example Shiba Inu token:
https://api.etherscan.io/api?module=account&action=txlist&address=0x95ad61b0a150d79219dcf64e1e6cc01f0b64c4ce&startblock=0&endblock=99999999&sort=asc&apikey=YOURAPIKEY
Is there a way to get the # of buys and sells within a specific time frame? I need this for an app I'm building similar to how PooCoin or other sites can build a chart and have a panel that has buy and sell orders for that specific token.
Is there a way to get this data from an API call?
For each token in a list of tokens, I want to (programatically) get a list of all historical trades of that token on Uniswap or Pancakeswap, with accompanying information such as block number, trade quantity, gas price, token reserves, etc... What is the best way to do this?
I checked out etherscan.io, but its web interface only allows users to export the most recent DEX trades, not all of them, and its API doesn't seem to be able to solve my problem.
I am trying to learn how blockchain works. I know that blockchain is nothing but list of blocks containing transactions, what I cannot understand is how do we then know how much money is contained in each account, since we are only maintaining list of transactions?
In distributed platforms, 2 models of accounting for account balances are most commonly used:
a state model, when each of the nodes, after the execution (or reception) of the transaction, accordingly changes the account state record in its local database (Ethereum, Hyperleger Fabric)
model of unspent remainings (UTXO), when the account balance is formed from the sum of the balances of "unused" transactions (Bitcoin, Corda)
I have a website, and I need each user of the site to have their own unique bitcoin address. Any funds sent to these addresses I need to be automatically transferred to a master wallet for me.
Any ideas on how I can set this up easily? The first stage is to generate bitcoin wallet addresses with code. I have no idea how to do this. The second question is then how do I access those funds and withdraw the money.
You can use the Bitcoin Core Api getaccountaddress with the account parameter as the user Unique ID from your Database. It will generate addresses that belongs to specific user but with a single Private Key that you own.
You can spend the funds with just normal transaction on Bitcoin Core Wallet.