Project - Building a DEX

in this other case happens this …



1 Like

hey @LELUK911. yeah i see what you mean by the amoint not updating. Can you push your code to github and ill have a look for you and identify the fix. its probably an issue with your makrket order logic

1 Like

this is my github, i push all files.

https://github.com/LELUK911/DEX-exercise

1 Like

lovely its 9:25 here now. im going to clone it now but i propbs wont debug now tonight. i might just skim through. But tomorrow morning i will an di will get back to you asap with the fix and a detailed explaination

1 Like

good! thank for your time . in italy is 22:26
I’m Sure my error is must litle experience…

1 Like

just one thing im curious of is you are calling transferfrom directly from the marketorder function.

1 Like

i think this is the cause of the unexpected behavouir. especially since your updating the built in wallet mapping also. this will actually be excting to debug this is a very unique way of trying to do it although i dont think transferfrom will work the way you have it set up because you transferingFrom from msg.sender to the dex address which doesnt really make sense becaus the funds will never make it to the person on the other side of the trade. now this is me just thinking ill know better when i start debugging but dont worry ill be back asap. FYI I really like your unique approach ill try keep it this way however if not ill have to get rid of the transferfrom

1 Like

mmm … in effetti non capisco come il “trasferimento da” possa influenzare il codice successivo … suppongo sia dovuto alla mia inesperienza … inoltre uso Defi tutti i giorni e quando scrivo il codice sono più utente che sviluppatore, in questo momento…scrivo ciò che mi aspetto che faccia un protocollo defi

1 Like

ahhhh now I understand … I would like “DAI” to go to the wallet balance user, because they can use “DAI” for other orders without pickup. in level 2 economic transaction, but it still costs.
but User can whitrowl in every moment.

Good evening and thnak for help.

1 Like

no worries ill be in touch tomorrow

1 Like

Hey @mcgrane5 thanks so much, I fixed the problem. I seem to make silly mistakes with the syntax or forget to go back to double check, I guess this is something I got to work on! I also run into so many challenges with my compiler version, but thank goodness is all working now :cold_sweat: “No one said it would be easy” - Ivan :smile:

1 Like

thats so great to hear. and dont worry the more you code the more syntax will just become an afterthought. please keep up the good work your on the right path

1 Like

Hey @mcgrane5
So sorry to keep bugging you:see_no_evil:
Getting this error message:
BTW first time seeing this fromUtf8, what does this mean?

ReferenceError: fromUtf8 is not defined
    at module.exports (/Users/hermevillaparedes/Ethereum-201/DEX/migrations/3_token_migration.js:11:32)
    at processTicksAndRejections (internal/process/task_queues.js:88:5)
- Blocks: 0            Seconds: 0
- Saving migration to chain.
- Blocks: 0            Seconds: 0
- Saving migration to chain.
- Blocks: 0            Seconds: 0

Code:

const Link = artifacts.require("Link");
const Wallet = artifacts.require("Wallet");


module.exports = async function(deployer, network, accounts) {
await deployer.deploy(Link);
let wallet = await Wallet.deployed()
let link = await Link.deployed()
await link.approve(wallet.address, 500)
wallet.addToken(web3.utils.fromUtf8("Link"), link.address)
await wallet.deposit(100, web3.utils,fromUtf8("LINK"))
let balanceofLink = await wallet.balances(accounts[0], web3.utils.fromUtf8("Link"));
console.log(balanceofLink);
}; 
1 Like

I think the error is just a misspelling on the utils, you typed a comma instead of a dot. :nerd_face:

Carlos Z

2 Likes

Thank you both @thecil and @mcgrane5 :upside_down_face:

1 Like

Hi guys!
Does anyone know how to set the Avalanche testnet in the truffle?
I have almost finished my DEX project by the end of the course, but first I want to try some features on the tesnet.

1 Like

you just need to change your network configuration in truffle config. for example this is the one for kovan below

kovan: {
    provider: () => new HDWalletProvider(mnemonic, `https://kovan.infura.io/v3/${projectKey}`),
    network_id: 42,       // kovan's id
    gas: 5500000,        // kovan has a lower block limit than mainnet
    confirmations: 2,    // # of confs to wait between deployments. (default: 0)
    timeoutBlocks: 300,  // # of blocks before a deployment times out  (minimum/default: 50)
    skipDryRun: true     // Skip dry run before migrations? (default: false for public nets )
    },
``
just modify this above for the avalance fuji testnetwork ej go onto infura or alchemy and get an rpc endpoint for avalanche then change the network id for fuji its 43114 i think.

Another alternqative which is easier is to take your conracts into remix and deploy there with the provider as injected web3 where you change your network to fuji in your metamask
1 Like

man for some reason whenever i try to download something like openzeppeling i got thousands or error codes, last week i had problem with npm, then truffle and now zeppeling, i think i will just look at youtube what he did on dex, since i kind of dont like when teacher tells me to do it myself and then he will correct me.

1 Like

ok. what version of npm do you have. this seems lik eit could be an npm issue. some versions of npm do clas with particular versions of truffle. but as for openzeppelin you shouldnt be getting any errors it could definitley the way you downloaded node. when you npm the OZ contracts are you using

npm install @openzeppelin/contracts

also one thing i can suggest is to download yarn which is a different package manager. most production codes actually use yarn so you could try this and yarn install instead of npm install the OZ contracts.

One thing i will say is you hsould deffo look into the above. these things hapen when you could and you should not be discouraged. a lot of your time in programming will be spent fixing bugs and trying to get things to work so you should not give up eventually if you work at the problem long enough youll get a solution.

also im here on standby to help so try yarn and let me know if this works. else try uninstalling node and getting v14 its the one i use it works with truffle with no problems

i have the latest since i did npm last week, i had issue so i had to erase npm folder so it would work with project i did with udemy course. and now i have issue ever since i tried to install yarn, and now zeppelin which is kind of annoying. Not one programmin school that i didnt have issue with coding. i tried eattheblocks, thendappunivercity, and now this. also some udemy courses too. not really sure if i want to continue with solidity too many bugs

1 Like