A (Erc20) token contract is should typically be quite straightforward and you wouldn't need to consider how it is used as the functionality is mostly standardized.
A dapp doesn't require a token in any way, most dapps don't use any specific token but may be mostly used for interacting with any token.
You are correct that once a token contract is deployed it can't be modified or deleted.
Aug 7, 2020, 4:13 AM
Thank you
I'm curious to know how tokens have use cases. I get you can exchange them for other tokens but what other uses do they have.
Aug 7, 2020, 4:43 AM
That's a rather wide topic :)
Google would probably give you a lot more ideas but here's some:
- virtual asset which may or may not represent a real-world asset. For example a stablecoin (pegged to some fiat) or a token which singifies real-life share or security or a physical asset such as a car
- a governance token: anyone who has 1 token can vote on changes on the token's platform (or the more more tokens you have the more votes you have)
- a token signifying something, for example identification (if you have this token you are this person) or memorabilia (if you have this token you participated in thing X in the past)
- a scam or a vehicle of pure speculation
An important difference is the difference between fungible and non-fungible tokens - I used them both in the above examples. Check google for the meaning
Google would probably give you a lot more ideas but here's some:
- virtual asset which may or may not represent a real-world asset. For example a stablecoin (pegged to some fiat) or a token which singifies real-life share or security or a physical asset such as a car
- a governance token: anyone who has 1 token can vote on changes on the token's platform (or the more more tokens you have the more votes you have)
- a token signifying something, for example identification (if you have this token you are this person) or memorabilia (if you have this token you participated in thing X in the past)
- a scam or a vehicle of pure speculation
An important difference is the difference between fungible and non-fungible tokens - I used them both in the above examples. Check google for the meaning
Aug 7, 2020, 4:58 AM
I just was sorry about that. i have one more question if it's ok. The root of why I've been asking the question about the contracts is because I've been under the impression that when you open a smart contract or create a token you are creating an IEO.
It seams that when they are tied to an underlying asset they would be considered a derivative but they do have other uses so not all tokens would be derivatives
Aug 7, 2020, 5:16 AM
well that's more about legislation (under which legislation is a decentralized asset?) and a whole different, complicated topic. I doubt you would have legislative issues just by deploying a contract, I'd imagine it's more about how it's used
Aug 7, 2020, 5:34 AM
Thanks do you happen to know of a token that has assets in it. I'd like to take a look at one to see how they work.
I'll probably try deploying one tomorrow on the test network
for fun
Aug 7, 2020, 5:54 AM
I'm not sure what you mean. Tokens don't "have" things inside them - they represent something
Aug 7, 2020, 6:13 AM
You’d probably want to understand what smart contracts are as well as what the evm is, as a solid foundation for undertaking learning about how these programs issue stores of value between different users. For instance, a token is exactly a single smart contract which only stores the balances of various addresses on the blockchain.
Aug 7, 2020, 7:03 AM
So basically they're separate from the dapp
Got it will do thanks
Aug 7, 2020, 3:46 PM
oh yeah thats right
estimateJoinRound(account, amount) {
return new Promise(async (resolve, reject) => {
_web3.eth.getGasPrice((error, gp) => {
const gasPrice = Number(gp);
const BN = _web3.utils.BN;
const deposit = new BN(amount);
Whackd.methods.approveAndCall(whackersAddress, deposit, utilities.toUTF8Array("Play Whackers!")).estimateGas(
{from: account, gasPrice: gasPrice})
.then((g) => {
const gas = Number(g);
const calc = gas * gasPrice;
const BN = _web3.utils.BN;
const price = new BN(calc);
resolve({gas: gas, gasPrice: gasPrice, totalWei: calc, totalEth: _web3.utils.fromWei(price)})
})
.catch((error) => {
// gas required exceeds allowance (8000029) or always failing transaction
reject(error);
})
})
});
}
return new Promise(async (resolve, reject) => {
_web3.eth.getGasPrice((error, gp) => {
const gasPrice = Number(gp);
const BN = _web3.utils.BN;
const deposit = new BN(amount);
Whackd.methods.approveAndCall(whackersAddress, deposit, utilities.toUTF8Array("Play Whackers!")).estimateGas(
{from: account, gasPrice: gasPrice})
.then((g) => {
const gas = Number(g);
const calc = gas * gasPrice;
const BN = _web3.utils.BN;
const price = new BN(calc);
resolve({gas: gas, gasPrice: gasPrice, totalWei: calc, totalEth: _web3.utils.fromWei(price)})
})
.catch((error) => {
// gas required exceeds allowance (8000029) or always failing transaction
reject(error);
})
})
});
}
Thats what I've been doing
In Python, how do you deal with asynchronous calls?
definitely a lot of ornery conversion tidbits in that function. I am sure there are a hundred ways to do it better...
Aug 7, 2020, 4:12 PM
can you be a bit more specific?
Aug 7, 2020, 4:13 PM
like, say you wanted to await some block confirmations after you sent a transaction
in web3js, you just subscribe to a callback function
Aug 7, 2020, 4:15 PM
in brownie, you add required_confs=n in the transactions kwargs, and the action is blocking until you get the requested number of confirmations
or you mean you want to be waiting on the confs and also doing other things? then you'd have to use threading.
import threading
t = threading.Thread(accounts[0].transfer, args=(...))
t.start()
...
t.join()
t = threading.Thread(accounts[0].transfer, args=(...))
t.start()
...
t.join()
Aug 7, 2020, 4:18 PM
Web.py dosent have a callback function. That really sucks, we may have to spin our own thread
Aug 7, 2020, 4:19 PM
I never delved into python but it seems like brownie might be where it's at https://eth-brownie.readthedocs.io/
Aug 7, 2020, 4:20 PM
https://eth-brownie.readthedocs.io/en/stable/core-accounts.html#broadcasting-multiple-transactions
Aug 7, 2020, 4:20 PM
I will look into brownie. Thanks
Aug 7, 2020, 4:20 PM
if you set required_confs=0 it's nonblocking. you get back a transaction object immediately while it's still unconfirmed. you can then later call tx.wait() if you need to wait for it to confirm
required_confs=10 will block until it gets 10 confirmations.. etc
Aug 7, 2020, 4:21 PM
is it me or is that server dead slow
Aug 7, 2020, 4:21 PM
🙏
Aug 7, 2020, 4:22 PM
So am I gathering it right that brownie is basically some sort of truffle sort of thing?
but actually works on a production environment
Aug 7, 2020, 4:23 PM
production or a local dev environment
it uses ganache for dev environment, same as truffle
so yeah, this is accurate
Aug 7, 2020, 4:24 PM
I dont really care much for truffle, a necessary evil
Aug 7, 2020, 4:25 PM
neither did i.. it's why i built brownie :)))
Aug 7, 2020, 4:25 PM
cant get it to run on > Node 10
Aug 7, 2020, 4:25 PM
tho my distaste is more for JS in general
Aug 7, 2020, 4:25 PM
yeah i agree, if i were to do it again id learn rust
I'm just an entrepreneur looking for various businesses to start so Javascript is really hacky, it kind of matches my personality
I did a bunch of iPhone apps before, it was nice being strongly typed
Aug 7, 2020, 4:26 PM
Well yes, one can often exist without the other. Dapp just may utilize some token(s)
Aug 7, 2020, 4:28 PM
Are any of you all building on Layer 2?
Aug 7, 2020, 4:31 PM
You created brownie?
Aug 7, 2020, 4:34 PM