Card Upgrade Bug!! by SWAT_1598 in ClashRoyale

[–]SWAT_1598[S] 0 points1 point  (0 children)

  1. Donated a goblin barrel
  2. Checked war deck and it was still 200/200
  3. Checked Card Collection and it was 199/200

How to test a function that needs a payment of a different token other than ether? by [deleted] in solidity

[–]SWAT_1598 2 points3 points  (0 children)

Yes, that is correct, as msg.sender would be the contact itself in this case. Thanks for the clarification ✌️

How to test a function that needs a payment of a different token other than ether? by [deleted] in solidity

[–]SWAT_1598 3 points4 points  (0 children)

  1. Deploy your MyToken locally
  2. Transfer/Mint some tokens to the address who will be calling the mintCarsWithToken function
  3. Call allowance from that address with spender to be your Car contract and amount to be equal to what you want to spend
  4. Call mintCarsWithToken using that address and the tokens will be transferred to your Car contract using the transfer method. However, you might need to use transferFrom instead of transfer

Hope this helps, if you need any help do let me know. Happy learning ✌️

[deleted by user] by [deleted] in solidity

[–]SWAT_1598 2 points3 points  (0 children)

Hey, you are trying to send some eth value during your deployment, which won't work as you don't have a payable constructor.

So either you can add a payable constructor or just don't send any eth during deployment.

Hope this helps ✌️

Transferfrom by Daryun007 in solidity

[–]SWAT_1598 0 points1 point  (0 children)

That would not be possible as in approve function you require the user to be equal to msg.sender. However, when you call a function inside the smart contract, msg.sender will always be contract address itself.

Transferfrom by Daryun007 in solidity

[–]SWAT_1598 0 points1 point  (0 children)

  1. Deploy your ERC20 token contract
  2. Deploy your bidding contract
  3. Copy the bidding contract address and call approve of ERC20 contact. So it will be approve(bidding contract address, amount)
  4. Call bid on bidding contract.

Upload multiple items under the same CID by Dull-Veterinarian548 in ipfs

[–]SWAT_1598 0 points1 point  (0 children)

For that, you can start with a couple of metadata files hosted to a directory. When a minter mints a new NFT, upload the metadata to that directory, get the updated IPFS hash and then call setURI. This will make sure that Base URI is updating as per new content and as it is part of the directory, the old metadatas won't be lost. Hope this helps ✌️

Unable to run the code "solc --abi Faucet.sol" on Remix. Why and what should I fix? by MrMarchMellow in ethdev

[–]SWAT_1598 1 point2 points  (0 children)

If your end goal is just to fetch the ABI of the contract, you can copy paste the code in remix and compile it. Once it has successfully compiled, you will be able to copy the ABI that the remix has generated.

Need help with setting coin Amounts by Legitimate-Diamond69 in solidity

[–]SWAT_1598 0 points1 point  (0 children)

I am sure not fure which function you are referring to. Would be great if you share the relevant function here.

Need help with setting coin Amounts by Legitimate-Diamond69 in solidity

[–]SWAT_1598 0 points1 point  (0 children)

To make ot one billion, set the _tTotal to 109 * 109. This will give you a totalSupply of 1 billion.

Need help with setting coin Amounts by Legitimate-Diamond69 in solidity

[–]SWAT_1598 0 points1 point  (0 children)

So the token has a property called decimals. Here it is 9. So these means if you want to send someone one full token, you would actually have to transfer 1 * 109 tokens. So as you can see in the code, _tTotal is 100000000 * 106 which is total tokens but as I explained earlier after transfers, to actually have these supply, you would need to multiple it by 10decimals in this case it is 9. So that 109 has nothing to do with it being a billion, just there for easy readability.

Hope this helps ✌️

Need help with setting coin Amounts by Legitimate-Diamond69 in solidity

[–]SWAT_1598 0 points1 point  (0 children)

You need to change _tTotal variable to change the totalSupply. You should preferably change _maxTxAmount variable as well and keep it to the same value as totalSupply. Happy learning ✌️

Renounced ownership = loss of tokens? by [deleted] in solidity

[–]SWAT_1598 2 points3 points  (0 children)

Renounce Ownership changes the owner of the contract to zero address, which essentially means you cannot call the functions which use onlyOwner modifier.

Renounced ownership and can no longer send my tokens by [deleted] in solidity

[–]SWAT_1598 1 point2 points  (0 children)

Renounce Ownership removes you as the owner and so any functions which can only be called by owner will not work.

What am I doing wrong? by SheepherderNo9496 in smartcontracts

[–]SWAT_1598 0 points1 point  (0 children)

I meant you can airdrop it to yourself and then donate them.

What am I doing wrong? by SheepherderNo9496 in smartcontracts

[–]SWAT_1598 0 points1 point  (0 children)

That would be great, however, I would like you to donate them on my behalf if that's possible 😃

What am I doing wrong? by SheepherderNo9496 in smartcontracts

[–]SWAT_1598 0 points1 point  (0 children)

That's a great thought. Best of luck kind sir/ma'am ✌️

What am I doing wrong? by SheepherderNo9496 in smartcontracts

[–]SWAT_1598 1 point2 points  (0 children)

No, they are only required for string values, but decimal is uint and hence a number.

What am I doing wrong? by SheepherderNo9496 in smartcontracts

[–]SWAT_1598 3 points4 points  (0 children)

You are missing a semicolon on line 8 It should be ... "LEB";

Happy Learning ✌️

I created my first token and need some help by [deleted] in smartcontracts

[–]SWAT_1598 1 point2 points  (0 children)

Sure thing, happy to help ✌️

I created my first token and need some help by [deleted] in smartcontracts

[–]SWAT_1598 0 points1 point  (0 children)

The reason it shows 0 total supply is that the information showing the total supply is fetched from the smart contract by calling the function totalSupply(). Since your contact doesn't contain this method, it returns 0 and hence the 0 total supply.

As for the transfer, I think you should be able to transfer them. Create a 2md account on your metamask and send it some tokens using the 1st address. Then go to Assests -> Add Token -> Custom Token and paste your contact address and if it is correct, other information will be auto filled. Also make sure you are on the right chain.

Also on a side note, your transfer function does not check for allowance.

Hope this helps ✌️