Just want you guys to know that your making a real developer out of me.Ive been studying outside the course about node js and im starting to understand the front and backend of development and how we use the javascript runtime environment to run the blockchain. Or at least Im gussing that much from the fact that we call miners nodes and node js gives us the asynchronous i/o that we can use to modify they state of a block. I still dont see where the sha 256 would come in but im guessing that that is a synchronus process that operates within the mining rigs separate from the api that actually acceses the chain. Still have about 20 more hours of additional research before i feel comfortable enough to take on the final project but i can definitely say that ive come a long way. It feels like that with open zepplin being a developer will be kinda easy once i get this truffle ande node js stuff down because we wonât actually have to write much code but instead will be combining pre written code into programs and handling compatibility issues and other errors. I kinda feel like i got most of the hard stuff over with. Hope im not speaking to soonâŚ
nevermind I figured it out.
Thanks Dani, I forgot that.
Hmm I donât know what I have done wrong mate, but I restarted, used this: await instance.createTransfer(10000, â0xEA1AFdB05fd89c2C61186b28665085F214D25A39â , {from:accounts[0]})
and it worked!
Unfortunately I do not remember what was the error message 2 days ago, should be good to know for more knowledge but guess next time.
Ah I found what was the error:
hijackedStack: 'Error: Returned error: VM Exception while processing transaction: revert\n' +
' at Object.ErrorResponse (C:\\Users\\Judit\\AppData\\Roaming\\npm\\node_modules\\truffle\\build\\webpack:\\node_modules\\web3-core-helpers\\lib\\errors.js:28:1)\n' +
' at C:\\Users\\Judit\\AppData\\Roaming\\npm\\node_modules\\truffle\\build\\webpack:\\node_modules\\web3\\node_modules\\web3-core-requestmanager\\lib\\index.js:303:1\n' +
' at C:\\Users\\Judit\\AppData\\Roaming\\npm\\node_modules\\truffle\\build\\webpack:\\packages\\provider\\wrapper.js:107:1\n' +
' at XMLHttpRequest.request.onreadystatechange (C:\\Users\\Judit\\AppData\\Roaming\\npm\\node_modules\\truffle\\build\\webpack:\\node_modules\\web3\\node_modules\\web3-providers-http\\lib\\index.js:98:1)\n' +
' at XMLHttpRequestEventTarget.dispatchEvent (C:\\Users\\Judit\\AppData\\Roaming\\npm\\node_modules\\truffle\\build\\webpack:\\node_modules\\xhr2-cookies\\dist\\xml-http-request-event-target.js:34:1)\n' +
' at XMLHttpRequest.exports.modules.996763.XMLHttpRequest._setReadyState (C:\\Users\\Judit\\AppData\\Roaming\\npm\\node_modules\\truffle\\build\\webpack:\\node_modules\\xhr2-cookies\\dist\\xml-http-request.js:208:1)\n' +
' at XMLHttpRequest.exports.modules.996763.XMLHttpRequest._onHttpResponseEnd (C:\\Users\\Judit\\AppData\\Roaming\\npm\\node_modules\\truffle\\build\\webpack:\\node_modules\\xhr2-cookies\\dist\\xml-http-request.js:318:1)\n' +
' at IncomingMessage.<anonymous> (C:\\Users\\Judit\\AppData\\Roaming\\npm\\node_modules\\truffle\\build\\webpack:\\node_modules\\xhr2-cookies\\dist\\xml-http-request.js:289:47)\n' +
' at IncomingMessage.emit (events.js:327:22)\n' +
' at IncomingMessage.EventEmitter.emit (domain.js:529:15)\n' +
' at endReadableNT (internal/streams/readable.js:1327:12)\n' +
' at processTicksAndRejections (internal/process/task_queues.js:80:21)'
Hi guys. why is it my compiler doesnât throw an error when I follow the code of Filip?
->
pragma solidity 0.8.3;
contract Helloworld {
function hello() pure returns (string memory) {
return "Hello world";
}
}
The code was intended to not have a âpublicâ and I save it many times and enter the command truffle compile and it doesnât throw an error, my compiler has this always ->
Thank you in advance.
No need to bother, I already fixed the issue, I just went back from the beginning of the truffle introduction and installation and do it all over again, and its all fine now.
Thanks
Is truffle the the business standard for creating smart contract? What is the differences of remix and truffle?
Hey @Riki
hijackedStack: âError: Returned error: VM Exception while processing transaction: revert\nâ +`
This is most likely a require statement that did not pass therefore your function throw.
Happy anyway to see that youâve fixed the issue.
Cheers,
Dani
Remix is basically a testing playground nothing more.
Truffle allows you to specify the migration rules and to write tests which are fundamental features for a smart contract developer.
Cheers,
Dani
Not very user Friendly lol.
Hi,
I have a problem with installing Truffle. I installed latest node.js 16.0.0.
However my cmd does not work. It jut flashes and then quit. I tried some forums but nothing worked.
So I tried Windows Powershell instead, and it does nothing. I enter ânpm install truffle -gâ into Powershell and hit enter.
And this is what happens, it just opens new window instead and it does nothing.
Can you help me please?
Hi @Tomahawk
Open powershell as administrator;
Run npm i truffle
Run truffle -v
and check the version.
Cheers,
Dani
I run npm i truffle -> new window instead of old one -> I run truffle -v and this happens
I run truffle -v again and this happens
Really simple problem: Iâve managed to compile the Helloworld example contract just fine, so I duplicated it and made a Helloworld2 contract for the expanded functions, and I made a duplicated migrations file as well following the same instructions, and now compiling it doesnât actually save any artifacts to the build>contracts folder. I went through and copy-pasted the contract name into the migrations file to make sure it is correct. It should work, but it doesnât.
Truffle doesnât throw any errors when I compile it either, it says it successfully saves the artifacts, but the artifacts arenât there. When I go to migrate the contract it throws the error saying the artifacts arenât there. So, Truffle thinks itâs saving the artifacts, but somehow itâs not.
I tried using 2_hello2_migrations.js and also 3_hello2_migrations.js, and neither works. Whenever I migrate the files I get this error:
Atom doesnât show any new files in the build>contracts folder either:
Any idea what might be causing this?
Itâs an error in the migration.
Please share the hello2 contract and migration.
Cheers,
Dani
I enter this
And this happens
Hi Dani,
Iâm following Filip his steps to build the Dex wallet but I get two error messages in the below code:
I canât see where I missed the semicolon, can you help me out?
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "../node_modules/@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "../node_modules/@openzeppelin/contracts/utils/math/SafeMath.sol";
import "../node_modules/@openzeppelin/contracts/access/Ownable.sol";
contract Wallet is Ownable{
using SafeMath for uint256;
struct Token {
bytes32 ticker;
address tokenAddress;
}
mapping(bytes32 => Token) public tokenMapping;
bytes32[] public tokenList;
mapping(address => mapping(bytes32 => uint256)) public balances;
modifier tokenExist(bytes32 ticker){
require(tokenMapping[ticker].tokenAddress != address(0), "Token does not exist");
_;
}
function addToken(bytes32 ticker, address tokenAddress) onlyOwner external {
tokenMapping[ticker] = Token(ticker, tokenAddress);
tokenList.push(ticker);
}
function deposit(uint amount, bytes32 ticker) tokenExist(ticker) external{
IERC20(tokenMapping[ticker].tokenAddress.transferFrom(msg.sender, address(this), amount);
balances[msg.sender][ticker] = traderBalances[msg.sender][ticker].add(amount);
}
function withdraw(uint amount, bytes32 ticker) tokenExist(ticker) external{
require(balances[msg.sender][ticker] >= amount, "Balance not sufficient");
balances[msg.sender][ticker] = balances[msg.sender][ticker].sub(amount);
IERC20(tokenMapping[ticker].tokenAddress).transfer(msg.sender, amount);
}
}