Solidity, Blockchain, and Smart Contract Course – Beginner to Expert Python Tutorial - Ep76

[java] Time: 2025-07-11 11:47:26 Source: MetaScripta Author: kotlin Click: 151 times
Wallet balance or ai tools for developersfrom our currentcollateral yes we could repay with ourcollateral let's go ahead and do fromour Wallet balance we'll hit Maxcontinue and we even get this littlething that says you don't have enoughfunds to repay the full amount well whyis this the case we just borrowed thisamount it's because already sincedepositing we've accured a little bit ofwe've acred a little bit of extra debtremember we hit that variable apy andevery second it's going to tick up justa little bit so let's go ahead and payback what we can with our wallet we'regoing to confirm we're going to approveour do to be spent and then we're goingto go ahead and hit the repay button andgray now if we go back to our dashboardyou can see we've repaid almosteverything here but we have a little bitleft so let's just go ahead hit repaywith our current collateral we'll hitMax continue and this will use our ethto pay back the collateral instead ofthedie then we'll hit repay this way we'llhave no more debt great now if we goback to our dashboard we can see we haveno more debt which is fantastic a is oneof these applications that relies on theChain leag price feeds in order tounderstand and the ratio between howmuch you have deposited as collateraland then how much you can borrow andtake out if we look in our wallet now wecan see we still have some a eth we alsohave some eth and now we have zero diebecause everything's paid back but we'restill gaining interest on the eth wehave deposited let's go ahead justreconnect let's go ahead back to testnet.a.com and let's just withdraw all of ourethnow keep in mind when working with someof this this is a test net right andworking the way we're working right nowis just on a test net so sometimes thetest net doesn't work quite as well as amain net because it's just for testingand doesn't have the exact same supportwe were just working on the test net butif you want to go to a forreal you can go to app.a.com connect your wallet on theethereum main net connect your walletmove to the ethereum main net and andinteract with it exactly the way we justsaw now if we're on the mainnet here wecan see some additional pieces when youdeposit something like die yes you get2.3% back as interest paid to you fordepositing the die you also get a littlebit of what's called a governance tokenyou also get a little bit of a token Iknow it's really small here but this isan additional incentive that a has giventhe users for working with theirprotocol since a is a decentralizedprotocol in order for anything to beimproved or anything to be updated onthe protocol it actually has to gothrough a decentralized vote so thesegovernance tokens actually dictate anddecide how the protocol improves movingforward now that we understand how towork with all of that through the UIlet's actually learn how to interactwith a and interact with defi all fromour scripts learning how to do it thisway will get us one step closer to beinga quantitative defi engineer or defiresearcher this is someone whoprogrammatically does algorithmic tradesalgorithmic modeling and just doeseverything in a programmatic sensemaking them much more efficient andPowerful interacting with di5 now allthe code that we're going to be workingwith here it's in this ay brownie Piapplication and you can always referback to it in the link in thedescription or in the link in the GitHubrepository and see all the code writtenyourself so with that create a newfolder and open up your vs code to thatfolder and let's get into it and a hassome fantastic documentation that we'regoing to use as well link here is alsoin the description let's go ahead andstartwith our our basic brownie setup justwith Brownie and it and we got a newbrownie project we got all our foldersin here and we are good to go now we'reworking with brownie we're actually notgoing to really be deploying anycontracts because all the contracts thatwe're going to work with are alreadydeployed on chain all of them are justgoing to be working right with a herecreate a quick readme.md so we can knowwhat we're doing here number one we'regoing to try to deposit some eth into athen we're going toborrow some asset with the ethcollateral and then if you wanted to Ichallenge you to actuallysell that borrowedasset this is what's known as ShortSelling but we're not going to do thathere and then we're just going to repayeverythingback great and this will be the fullfunctionality of working with a in thisdeployed contract everything that we'regoing to learn here will teach you howto work with other contracts as wellsuch as Paras swap or unit swap or anyother type of swapping contract thatwill allow us to buy and sell so let'sjust go ahead and create a script wecall it ab.p let's go ahead and create a functioncalled def Main and we'll just do passfor now the first thing that we need tofigure out how to do is deposit some Finto a when we actually deposited our Fvia the UI you could actually see whenwe call this deposit function if I hitthis deposit button here oddly enough ifwe go to this contract address on theCoen ether scan we'llsee that this address is actually what'scalled a weGateway what a is doing like I wassaying before and let's go ahead andactually cancel this for now reject whata is actually doing here is swapping ourethereum for we again weth is an ERC 20version of ethereum and this allows itto easily work with all the other ERc20s on the AI protocol like d usdcoinyou know ample forth link Etc so weactually have to do the that as well sothe first thing we're going to need todo actually isn't deposit some of oureth first thing we're going to need todo is going to swap our eth for we solet's even just put this in its ownlittle script we'll call it get W.P sowe're going to have a function defmain

(Editor in charge: go)

Related content
Wonderful recommendations
Popular Clicks
Friendly links