Current location: Current location: Home > swift > Solidity, Blockchain, and Smart Contract Course – Beginner to Expert Python Tutorial - Ep65 Text
Solidity, Blockchain, and Smart Contract Course – Beginner to Expert Python Tutorial - Ep65
[swift] Time: 2025-07-11 11:38:47 Source: AIHackNode Author: php Click: 39 times
that we did it was we actually gotthe contract because we had its contracttype based off of brownie for here we'regoing to have interstellar ambitionsto interact with thecontract getting those two pieces thatwe always need which are going to be theaddress we actually have the ABI fromour Mach V3 aggregator type right hereand we just got the address so we cancreate this new contract type by sayingcontract equalscontract. from ABI and this contractpackage can be imported right fromBrownie and and has this function fromABI that allows us to get a contractfrom its ABI and its address so we'lljust give it a name say contract typeorname you do the contractaddress andthen contract type.AI so these mock V3 aggregators and allthese contracts haveaavi attribute that Returns the AI theyalso have aore name which returns theirname so this is perfect this is howwe'll get the contract otherwise andthen at the end of all this we'll justdoreturn contract awesome so this is anincredibly powerful function for us toget a contract based off of if it'salready deployed as a mock or it's areal true contract I know there's kindof a lot here but definitely check theGitHub repository if you're a little bitconfused on what's going on with thisfunction and let's and let's also justdeploy this to make our lter happy whynot yays code's happy now but now thatwe have this function let's go back toour deploy Lottery now we can do a commaget account now we have a get accountfunction so let's go through this againthis lottery. deploy get account isgoing to get an FUSD price feed if wedon't have a mock deployed it's going todeploy a mock price feed for us andwe're going to return that mock pricefeed however if we're on a test net ifwe're on a real Network we're going tograb its actual address and return mockcontract of it our mock contract herehas all the same functions of a regularcontract so we can just use it as thesame this way we don't have to adjustthis function for whether or not we'redeploying to a test net or to an actualaddress the only additional piece weshould put in here just for clarity sowe should add address here because thisis going to return the actual contractand we really only want the address thisis going to make our coding a lot morerobust for moving between developmentenvironments and test environments andworking with scripts in a reallyeffective manner so now that we havethis incredibly powerful function let'sgo back to the lottery and figure outwhat are the different pieces we need inhere okay great we also need a vrfcoordinator so to do this we're going togo back to our docs. chain. link we'llgo to contract addresses and we could domain net here but let's also just setthis up to work with rink B so we docrlf for rink B vrf coordinator is goingto be this address right here so we'llcopy it we'll go back and we're going tohave to do in our config is we're goingto have to add a new network here forrank B do vrfcoordinator will be that address rightthere and then while we're doing thislet's also get the rink B address forour price feed so price feeds rink bescroll down forFUSD FUSD here we go grab that enterthis will be FUSD pricefeed paste that in here perfect so nowwe can do get Contract vrf coordinator.address of course we are going to haveto go back to our helpful scriptsbecause there's currently no mappingbetween what a vrf coordinator is andwhat its mock needs to be so we'll add acommahere and we'll do VFcoordinator and we need to get a mock VFcoordinator well first of all we don'teven have our mock V3 aggregator solet's go grab that as well so we cangrab both of these again I'm going tohighly recommend going to the chain linkmix going into the contracts here goingto the test folder for these differentmocks because these are already set upto work with the chain link mix howeveryou can definitely go into the chainlink help as well go to contracts SRC0.6tests and then look for the differentmocks in here so mock Oracle VFcoordinator mock Etc so we're just goingto I'm just going to grab it though fromthis chain link mix so let's go to vrfcoordinator Mock and I'm just going tograb this whole thing here so docontracts foldertest file VFfor formockSoul paste it inhere and then while we're in here we'llwant to do a new file mock D3aors we'll grab this aswell from our trainmix again it's got all the functions ofa price feed updateanswer latest round Etc VF coordinatorwalk has different functions foractually working with the VF coordinatorone of the specific ones in particularis this call back with Randomness thatwe're going to use in our tests so ourvrf coordinator is going to get mappedto our vrf for theormock which will also import this frombring great and just to double checkeverything's working we'll want to runover just a quick bring compilemake sure we are importing our mockscorrectly and everything's compiling soit looks like we're good there all rightso now wehave get Contract Bure of coordinator.address perfect what else do we need inhere we need a link token the chain linktoken is of course just another smartcontract so we're going to do the exactsame thing here getContract linktoken. addressof course thismeans in ourconfig for rink B let's add a link tokenaddress we'll go to the chain linkdocumentation go to link tokencontracts we'll look for rinkB we'll grab thisaddress we'll drop it in here perfectnow we have it in our brownie configwe'll also need to add it toour helpfulscripts so we'llneed a mock link token which again wecan just go ahead andgrab from our chain link mix here we goto test and as you can probably see whatI often normally do is literally justcopy this entire test folder project toproject so I'm going to copy this wholething create a new file we're just goingto call thisone link token.Soul contract link token perfect andthen in our helpful scripts we're goingto have
(Editor in charge: go)
Solidity, Blockchain, and Smart Contract Course – Beginner to Expert Python Tutorial - Ep123Learn Blockchain, Solidity, and Full Stack Web3 Development with JavaScript – 32-Hour Course - Ep204
Related content
- Harvard CS50’s Artificial Intelligence with Python – Full University Course - Ep4
- Learn Blockchain, Solidity, and Full Stack Web3 Development with JavaScript – 32-Hour Course - Ep255
- Web3 & Crypto Will Change The World As We Know It! Yat Siu - Ep11
- Learn Blockchain, Solidity, and Full Stack Web3 Development with JavaScript – 32-Hour Course - Ep298
- XRP Ripple LIVE Senate Brad Garlinghouse - FROM WALL STREET TO WEB3 - Martyn Lucas Investor - Ep13
- Learn Blockchain, Solidity, and Full Stack Web3 Development with JavaScript – 32-Hour Course - Ep12
- Web3 Developer in 2024 Roadmap_ Solidity, Smart Contract, and Blockchain Development [Full Course] - Ep8
- Learn Blockchain, Solidity, and Full Stack Web3 Development with JavaScript – 32-Hour Course - Ep34
- GenAI Essentials – Full Course for Beginners - Ep164
- Web3 Developer in 2024 Roadmap_ Solidity, Smart Contract, and Blockchain Development [Full Course] - Ep61
- Web3 Developer in 2024 Roadmap_ Solidity, Smart Contract, and Blockchain Development [Full Course] - Ep38
- Solana Developer Bootcamp 2024 - Learn Blockchain and Full Stack Web3 Development - Projects 1-9 - Ep60
- GenAI Essentials – Full Course for Beginners - Ep75
- Solana Developer Bootcamp 2024 - Learn Blockchain and Full Stack Web3 Development - Projects 1-9 - Ep27
Wonderful recommendations
- GenAI Essentials – Full Course for Beginners - Ep109
- Learn Blockchain, Solidity, and Full Stack Web3 Development with JavaScript – 32-Hour Course - Ep147
- Solana Developer Bootcamp 2024 - Learn Blockchain and Full Stack Web3 Development - Projects 1-9 - Ep74
- Solana Developer Bootcamp 2024 - Learn Blockchain and Full Stack Web3 Development - Projects 1-9 - Ep49
- Solidity, Blockchain, and Smart Contract Course – Beginner to Expert Python Tutorial - Ep122
- Solana Developer Bootcamp 2024 - Learn Blockchain and Full Stack Web3 Development - Projects 1-9 - Ep71
Popular Clicks