what a need to implement in my contract is to changue a value ramdomly betwen 0 and 1, its possible? (btw I'm learning english too)
Apr 16, 2020, 7:40 PM
ok thank you, I will keep searching in google lol
Apr 16, 2020, 9:10 PM
Out of curiosity, what's the need for the random number?
🤔back to figuring out how to mint several tokens to the contract creator, on each transaction... (trying to test out a deflation/inflation system that feeds back into the support of the project, by using a % burn vs static number minted, on transaction. )
I have the burn working at least...
Apr 16, 2020, 10:58 PM
I just need to get 1 or 0 value for a variable, so when the value is 1 do something and when its 0 do nothing, but i cannot say what, hope you underdtand, its a secret lol
Apr 16, 2020, 11:07 PM
You can get a random number in various ways. But what's important is whether or not the result of the randomness would give anyone more or less monetary value...for instance simple randomness based on the previous block hash is easy to do but can also be manipulated by miners. So don't use it for things that could be gamed for someone's benefit.
Apr 16, 2020, 11:32 PM
Yeah, that was the problem I came into as well. In the end it was either somewhat predictable or something that could be manipulated
Apr 16, 2020, 11:47 PM
My favorite solution is to use an oracle like provable.xyz
Apr 16, 2020, 11:51 PM
I undestand your concern, but it wont be a problem in my case
my intention is not to mine more token, my supply is fixed and not mintable
Apr 16, 2020, 11:53 PM
ug... how do I specify the contract creator address? I'm trying to mint several tokens on transfer, to the conntract creator. Am I overthinking this somehow?
I'm using openzep 2.5 branch erc20.sol + erc20detailed for this one, if that helps
Apr 16, 2020, 11:55 PM
its very similar to what STT does, you can check out his contract to see if you can find a hint, but they send the minted tokens to users not to the contract creator
ok, nd how to implement that? should I need to pay?
Apr 17, 2020, 12:05 AM
Ug, STT is why the project that distracted me from finishing this, was obviously a failure (unless I could somehow get enough eth to use it to congest the ethereum network, lol)
only took 1 stt in the contract to make a never ending loop of scattering, lol
🤔well, Icarus wouldn't mind if I ripped some of his code... but how do I at least specify a specific address?
or the contract creator?
Apr 17, 2020, 12:11 AM
Their docs are pretty good
Oh well if truly nothing of value hinges on the randomness...then you can just use the previous block hash
msg.sender in the constructor
Apr 17, 2020, 12:24 AM
wait, that will continue to work?
all I have to do is add _mint(msg.sender, whatever * (10 ** uint256(decimals()))); into the transfer function?
Apr 17, 2020, 12:59 AM
No that would mint to the caller of the transfer function. You'd want to store the contract creator at creation time, which is msg.sender in the constructor
Apr 17, 2020, 1:03 AM
🤔oh, that's what I thought... ug...
Apr 17, 2020, 1:08 AM
Simple to accomplish...just store it
Apr 17, 2020, 1:08 AM
😒I actually saw the code that I need to do this, last night, now that you've mentioned this.
but I didn't bother to save or memorize it, because I was busy with something else... which ironically turned back into the original project.
I will make this work... or get distracted and add some nonsensical feature to replace it
hmmm, it looks like I can use the ownable code from openzep to not just do that, but allow me the ability to transfer where the minted tokens go...
Apr 17, 2020, 1:44 AM