cryptozombieshq / cryptozombie-lessons Goto Github PK
View Code? Open in Web Editor NEWLesson content for cryptozombies.io
License: Other
Lesson content for cryptozombies.io
License: Other
Hi Good Day! I would like to request to contribute in your project. Please allow me to have translation in Cebuano. Hoping for your positive response!
Thank You!
Hi, i'm Vietnamese and i want to contribute my Vietnamese Translation.
// create a New Person:
Person satoshi = Person(172, "Satoshi");
// Add that person to the Array:
people.push(satoshi);
We can also combine these together and do them in one line of code to keep things clean:
people.push(Person(16, "Vitalik"));
It's not just cleaner, but cheaper (less gas) to do it the second way.
Hello, hope this message finds you well.
I saw the instructions on the README file about creating a new branch to add a new lenguage. Just wanted to make sure this repo would also welcome spanish translation, if so I'll be glad to help.
Thank you!
First a compliment for the incredible lessons, but there was an error in the first chapter of lesson 5, where our ZombieOwnership contract should inherit from ZombieAttack, but that does not exist, so the ZombieOwnership should inherit from ZombieBattle developed by every correct 4th lesson?
In short
pragma solidity ^0.4.19;
import "./zombieattack.sol";
contract ZombieOwnership is ZombieAttack {
}
should be
pragma solidity ^0.4.19;
import "./zombieattack.sol";
contract ZombieOwnership is ZombieBattle {
}
@eduardonunesp can you use a shorter title in https://github.com/loomnetwork/cryptozombie-lessons/blob/master/pt/1/00-overview.md ?
any command line to run this project?
In this chapter, we are instructed to make the user send 0.001 ether using the web3j.utils.toWei function. In the example, the "ether" argument is specified as such :
web3js.utils.toWei("0.001", "ether")
However, inputting this function as is in the exercise returns an error. The corrector actually seems to check for:
web3js.utils.toWei("0.001")
I'm aware that toWei defaults to ether, but perhaps the corrector could accept both?
Also, I did not find it clear that the following had to be included:
.on("error", function(error) {
$("#txStatus").text(error);
});
since there is not mention of it in the instructions. Maybe this should be specified?
I've now completed the course up to level 5, and I really like it.
There is just one thing that is unclear for me: What is the rationale to having a zombieToOwner mapping instead of just adding the owner as a field to the Zombie struct? It is initialized at the same point as the others, and we are updating other fields (so the reason cannot be that they cannot be updated). Also, from other programming languages, I learned it to be a bad idea to have a mapping/hashtable whose keys are consecutive numbers (use an array instead). And since we already have an array here (the array of Zombie
structs) I would probably have added the owner in there.
(And in case somebody complains that this should be discussed via Telegram - I refuse to sign up to any services who do not let me sign up without disclosing my mobile phone number to them, therefore I don't have a Telegram account).
Just few text issues, below:
But in Ethereum, because both the money (Ether), the data (transaction payload), and the contract code itself all live on Ethereum, it's possible for for
you to call a function and pay money to the contract at the same time.
Let's say our game has a feature where users can pay ETH to level up their zombies. The ETH wil
get stored in the contract, which you own โ this a simple example of how you could make money on your games!
The function should first require that msg.value is (are)
equal to levelUpFee.
I tried to use the code in the cryptozombies lessons Chapter 6 and use the web3.min.js (api version 0.20.3). But it's always wrong, even the code to initialize a contract is wrong.
I had to use
new web3.eth.contract(coreABI).at(address);
It's right, but when i tried to call a function in solidity , it's wrong again.
There is a state variable (public string) called symbol in my contract. So i tried to get the value of it via
contract.symbol.call()
It says
inpage.js: 1 Uncaught TypeError: this._eth.call is not a function
So, i dont know if it's the problem of the API version or something.
I used a CDN version of web3.min.js which is
<script src="https://cdn.jsdelivr.net/gh/ethereum/web3.js/dist/web3.min.js"></script>
I want to ask you guys where you can find a good web3.min.js which can use the style in the Chapter 6 lesson. like
new web3js.eth.Contract(coreABI,address);
Can you simply share the right file, please? Thanks in advance!! ๐ฅ ๐ ๐
line 24:
ownerZombieCount[msg.sender] = ownerZombieCountmsg.sender[].sub(1);
it should be:
ownerZombieCount[msg.sender] = ownerZombieCount[msg.sender].sub(1);
Hi!, can I translate this project into spanish ?
First of all, thank you very much for your course, it has really helped me a lot.
in https://cryptozombies.io/zh/lesson/5/chapter/8
if i approval a token to another, but i can transfer it before another take it, is it expected?
Hi guys. Thanks for a great work you are doing!
I have seen that there is a polish translation in the repo (thanks to @piotr-galas) but it's not on the CryptoZombies.io yet.
Is there any more work required? If so I am willing to help.
It seems the PR was merged into master but there's no lesson 5 in Korean: https://cryptozombies.io/ko/course
Is there more to do, or is it not yet reflected?
Chapter 6 does not mention use cases for the public
keyword, only external
. I'm hot on this now after reading Loom's article about the difference. https://medium.com/loom-network/how-to-secure-your-smart-contracts-6-solidity-vulnerabilities-and-how-to-avoid-them-part-1-c33048d4d17d
Some links on the course screen aren't working, maybe is because of some layer.
it says
contract ZombieOwnership is ZombieAttack
it should say
contract ZombieOwnership is ZombieBattle
Hi! Crypto Zombie Team.
The existing sample code in chapter 1 is like this.
<script language="javascript" type="text/javascript" src="web3.min.js"></script>
But, language
attribute is deprecated in HTML5.
Also, as it is possible omit the type
attribute too.
How about removing both?
<script src="web3.min.js"></script>
In Chapter 3 there is this text:
"Lastly, let's instantiate our contract. Set cryptoZombies equal to an new ..."
Should be: "a new"
That's all I found.
Look at the screenshot below where I clicked on "Show Answer" to find out why the answer parser was not accepting my answer for Lesson 6, Chapter 8. As you can see, the answer shows the toWei() call without "ether" as the second argument. I'm assuming that "ether" is the default argument? In any case, I believe most people will duplicate the toWei() call shown in the lesson text like this:
CryptoZombies.methods.levelUp(zombieId)
.send({ from: userAccount, value: web3js.utils.toWei("0.001"**, "ether"**) })
And it looks like the answer parser won't accept it. See below.
It says copy "createRandomZombie" code shown above,
however, the return statement
return CryptoZombies.methods.createRandomZombie(name)...
I think it should be camel case cryptoZombies
instead of pascal case CryptoZombies
.
How to reproduce:
I already started with the first file, others will follow. If someone wants to participate, please let me know.
In Chapter 7: Sending Transactions, a call to feedOnKitty()
for some reason expecting one of the argumets kittyId
to be capitalised:
return CryptoZombies.methods.feedOnKitty(zombieId, KittyId)
Should be lower case.
Recent versions of solidity use the emit
keyword to invoke an Event.
https://solidity.readthedocs.io/en/v0.4.24/structure-of-a-contract.html?highlight=event#events
lessons like https://cryptozombies.io/en/lesson/5/chapter/5 should be updated to use the new syntax as devs may mistakenly use the documentation to try to solve the problem.
Hello,
In your lessons you say that about time stored in uint32 type:
"Note: We chose not to prevent the year 2038 problem... So don't need worry about overflows on readyTime. Our app is screwed in 2038 anyway ;)".
It seems incorrect to me, with a uint32 you're good until february 2106 (2^32 = 4294967296 -> 7th february 2106 at 7:28:16) , isn'it ?
Am I wrong ?
Ciao, Iโd like to translate the course in Italian. Can I work on it? Is someone whoโs already doing it and wants to join forces?
Hi Loom Network,
Glad to see Lesson 6 released! I'll be posting issues as I find them.
In Chapter 1 - if you don't delete the hint HTML comment:
It flags that line as an error. I guess HTML comments are not being ignored by the parser?
In the instructions, the following is written :
In chapter 6 we calculated a random number from 0 to 100. Now let's use that number to determine who wins the fight, and update our stats accordingly.
However, the random number generated is actually from 0 to 99 (since 100 % 100 returns 0). Therefore, the conditional in the function should be "less than" and no "less than or equal to", as the latter gives a 71% (0 to 70 vs 71 to 99) chance of winning to the attacker.
Thanks for the tutorials btw.
In this chapter, when you select any one of your zombies, the count shown under "Your Zombie's Win Count:" is shown as the aggregate win count of all your zombies. If I battle 5 times with one zombie and win each time, and then battle for the first time with my second zombie, my second zombie's win count will show as 6.
Since the win and loss count are specified on the Zombie instance itself, this number should be tracked per-zombie. Obviously, this isn't on the blockchain so you are likely just maintaining a count, but it might mislead people who aren't familiar with solidity.
I would suggest changing the wording, or tracking the number per-zombie to have parity with the contract the lesson implements.
Here is my code for Lesson 6 - Chapter 3. The parser keeps flagging my definition for startApp(). Also, the parser will not tolerate a semi-colon after the call to startApp():
startApp();
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>CryptoZombies front-end</title>
<script language="javascript" type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script language="javascript" type="text/javascript" src="web3.min.js"></script>
<script language="javascript" type="text/javascript" src="cryptozombies_abi.js"></script>
</head>
<body>
<script>
// 2. Start code here
var cryptoZombies;
function startApp(){
var cryptoZombiesAddress = "YOUR_CONTRACT_ADDRESS";
cryptoZombies = new web3js.eth.Contract(cryptoZombiesABI, crytpoZombieAddress);
}
window.addEventListener('load', function()
{
// Checking if Web3 has been injected by the browser (Mist/MetaMask)
if (typeof web3 !== 'undefined') {
// Use Mist/MetaMask's provider
web3js = new Web3(web3.currentProvider);
} else {
// Handle the case where the user doesn't have Metamask installed
// Probably show them a message prompting them to install Metamask
}
// Now you can start your app & access web3 freely:
startApp()
})
</script>
</body>
</html>
Hey @enlight
These lessons are absolutely awesome!
I'd just like to talk about lesson number 5 or the one on NFT (aka ethereum/EIPs#721). The implementation in cryptozombies is influenced by CryptoKitties for obvious reasons, but it is not reflective of the 721 current draft going through the EIP process. I am more than happy to work with you or someone on your team to get lesson 5 to be compliant with the proposed 721 draft. IChanges include things like no takeOwnership
and the addition of transferFrom
and approvals
to be more ERC20 like.
I see your Note that this is a proposal and you're using what is in OpenZeppelin currently. OpenZeppelin are also about to change that interface to be the new proposal.
Even if you finish a chapter succesfully and go to the next one the code changes are not always saved.
What I've noticed:
Hi Cryptozombie team,
I really like your course: simple, clear, fun, and very well-guided. Thanks.
I wanted to point a minor thing (nitpicking): Up to now, when doing a require
on msg.sender
, we always start with require(msg.sender == ...);
(e.g. ownerOf
and onlyOwner
)
The function takeOwnership is expecting msg.sender
to be on the right-hand of the comparison.
Once again, a very minor change that may not be needed after all.
Thanks again for this great course.
In Lesson 6 Chapter 8, step 3 says:
When it calls levelUp on the contract, it should send "0.001" ETH converted toWei, as in the example above"
The contract referenced is:
CryptoZombies.methods.levelUp(zombieId).send({ from: userAccount, value: web3js.utils.toWei("0.001", "ether") })
However, when you check the solution we get:
.send({ from: userAccount, value: web3js.utils.toWei("0.001") })
Functionally this is fine, since "ether" is the default value for the unit argument of toWei. But can we either include "ether" in the solution to make it consistent with the instructions, or include a line explaining why we don't need to specify "ether"?
Hi it seems that in lesson 6 - Chapter 3 there is a string "YOUR_CONTRACT_ADDRESS" instead of actual address of a contract (CryptoKitties and CryptoZombies).
If you recall from Lesson 2, the address of the CryptoKitties contract on Ethereum mainnet is YOUR_CONTRACT_ADDRESS.
... and set it equal to the string "YOUR_CONTRACT_ADDRESS" (this is the address of the CryptoZombies contract on mainnet).
this function should be use _from instead of msg.sender
like:
function _transfer(address _from, address _to, uint256 _tokenId) private {
ownerZombieCount[_to] = ownerZombieCount[_to].add(1);
//ownerZombieCount[msg.sender] = ownerZombieCount[msg.sender].sub(1);
ownerZombieCount[_from] = ownerZombieCount[_from].sub(1);
zombieToOwner[_tokenId] = _to;
Transfer(_from, _to, _tokenId);
}
Hello Loom team,
I like your course very much. Thanks. But I found a security hole in this code which could probably cause fatal problems in an application.
Look at the code in Lesson 5 Chapter 8.
Imagine there are 3 persons: A, B and C. A owned a zombie. First, A approved that zombie to B, and then A transferred it to C in an exchange. What if B executed "takeOwnership" of the same zombie after that? Yes! He/she would succeed and got ownership of it! And poor C lost his/her zombie without knowing why....
We should add some code to cancel the approval of the zombie in the same time it is transferred.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.