Current location: Home > swift > Solidity, Blockchain, and Smart Contract Course – Beginner to Expert Python Tutorial - Ep79 Text
Solidity, Blockchain, and Smart Contract Course – Beginner to Expert Python Tutorial - Ep79
Time: 2025-07-11 11:23:46 Source: Codora.ai Author: article Reading: 140 times
withdrawing and eminem 2024 newsdepositing soas you probably guessed deposit is thefunction that we're going to work onright now and since this is the contractthat we're going to work with as alwaysthe two things you need when workingwith a contract are going to be the ABIand the address so we're going to getthis lending pool contract we're goingto say lendingpool equals and we're actually going toeven make a function called get lendingpool so down below we're going to do defget lendingpool lending pool not poll and we'regoing to get the lending pool addressand the lending pool contract so we caninteract with it down here now somethingabout this lending pool is that thelending pool address can actually changea little bit depend depending on a lotof different pieces so there's actuallythis address provider which gives us theaddress of a specific or particularMarket if we go back to this a UIthere's actually different markets sothere's different types of ways we caninteract with a we're just going to workwith the basic a V2 because it's easilythe most used on mainnet as well theaddress provider registry will give usso this address provider will give usthe address of the lending pool for ourMarket if we want to go across differentmarkets we'll have to to go to theaddress provider registry to find it butthe addresses in here don't change andthe addresses in here don't change it'sjust the lending pool address itselfmight change so we just have to go tothis address provider here and there'sjust one function that we need to workwith it's this get lending pool whichwill give us the address of the actuallending pool so don't let this confuseyou too much basically all we're tryingto do is we're saying hey where is alocated right now and a has a contractthat will always tell us where the maina contracts are and that's thisaddresses provider right here so this isanother contract that we have to workwith and again when we have a contractwhat do we need we need anNai and we need an address so we canabsolutely once again we could go aheadand and you know copy paste like ABequals whatever the ABI is but we'rejust going to use an interface becausebecause life is great with an interfaceso a couple of great things aboutinterfaces to if we know we're onlygoing to work with one or two functionswe can actually just make the interfacesourself so in interface we could do newfile we could do I lendingpool address provider. soul and we canjust add it in here oursel so we'llfirst dospdxlicenseidentifier we'll do like MIT orsomething do pragma solidity0.6.0 or whatever we want to do and thenwe'll do dointerfaceI lending pool addressesprovider EXC me this should be lendingpooladdressesprovider and we know that there's onlyonefunction called get lendingpool and we're not exactly sure what getlending pool is defined as but what wecando so we can go toether scan ether scan a lending pooladdresses you can see here this isactually the lending pool but what wecan look at is the a protocol we can goright to the GitHub we go tocontracts you can see they have aninterfacessection and they have this lending pooladdresses provider get lending pool andkind of as we expected it's an externalView and a returns and address so we canliterally just copy paste this and hereand we could run with this and thiswould work perfectly fine but this leadsus to the next point we might as welljust grab the whole thing this way weknow for a fact we're not gettinganything wrong but yes if we wanted toour interface could be this rightbecause this is going to compile ohcould be this because this interface isgoing to compile down to an ABI and theABI is going to say hey there's afunction here and that's all the ABI isreally doing it's just telling us how wecan interact with contract but let'sjust go go ahead and add everything sothat if we want to interact with morethings we can so now we have the ABI wealso now need an address which we candefinitely find from the a documentationwe can go to their deployed contractsection we can find lending pooladdresses provider is going to be righthere we're going to copythat and where are we going to put thiswell as you know we're going to put thisin our brownie config we're going to dolendingpool address isprovider going to paste that right thereand since we know we're also going to doCoen we can also grab from Coen here solending pool addressesprovider we're going to copy thisheredo and we're going to add this addressesprovider for Coen aswell boom now we have it for both kovenand for Main Fort awesome so so we cankeep going now now that we have an AIand we have an address for both Coen andfor our mainit mainit Fork what we cando now is we first get the lendingpool addressesprovider it's going to be from ourinterface which again we're going tograb frombrownie interface. I lendingpool address isprovider which the address of that isgoing to beconfignetworks network. showactivelendingpool addresses provider and then we'rejust going to say lending pool addressit's going to be equal to lending poolgoing to copy and paste it instead oftyping the whole thing add addressdivider provider. get lendingpool right because again this addressprovider has this get lending pool whichreturns this address which is theaddress of the lending pool then nowthat we have this address we canactually return the lending poolcontract by once again getting theABI and theaddress of the ual lending pool so wehave the address check we just now needthe API which once again we can workwith our wonderful interfaces here donew file I lending pool so and there'sonly going to be a couple of functionswe're going to work with here but aactually gives us the interface righthere and uh a actually even gives us theinterface The Lending pool addressprovider for us so we can go ahead andcopy this pop it over into here now wedo need to actually change change onething in here as well this interfaceImports locally with this slash so
(Editor in charge: java)
Latest content
- ·GenAI Essentials – Full Course for Beginners - Ep15
- ·Solidity, Blockchain, and Smart Contract Course – Beginner to Expert Python Tutorial - Ep119
- ·Godfather of AI_ I Tried to Warn Them, But We’ve Already Lost Control! Geoffrey Hinton - Ep15
- ·GenAI Essentials – Full Course for Beginners - Ep123
- ·Web3 Developer in 2024 Roadmap_ Solidity, Smart Contract, and Blockchain Development [Full Course] - Ep49
- ·GenAI Essentials – Full Course for Beginners - Ep20
- ·GenAI Essentials – Full Course for Beginners - Ep54
- ·Harvard CS50’s Artificial Intelligence with Python – Full University Course - Ep20
- ·GenAI Essentials – Full Course for Beginners - Ep12
- ·Solidity, Blockchain, and Smart Contract Course – Beginner to Expert Python Tutorial - Ep111
Hot content
- ·GenAI Essentials – Full Course for Beginners - Ep202
- ·Solidity, Blockchain, and Smart Contract Course – Beginner to Expert Python Tutorial - Ep118
- ·Solidity, Blockchain, and Smart Contract Course – Beginner to Expert Python Tutorial - Ep112
- ·Solidity, Blockchain, and Smart Contract Course – Beginner to Expert Python Tutorial - Ep20
- ·GenAI Essentials – Full Course for Beginners - Ep80
- ·GenAI Essentials – Full Course for Beginners - Ep62
- ·Solana Developer Bootcamp 2024 - Learn Blockchain and Full Stack Web3 Development - Projects 1-9 - Ep8
- ·GenAI Essentials – Full Course for Beginners - Ep48
- ·Learn Blockchain, Solidity, and Full Stack Web3 Development with JavaScript – 32-Hour Course - Ep279
- ·GenAI Essentials – Full Course for Beginners - Ep181