scaffold-eth 🛠 Getting Started! - Austin Griffith

Metabolism 2022 · 6 Aug 2022 · 58:56

Austin Griffith introduces scaffold-eth, a toolkit for building decentralised apps, and uses it to tinker with Zora contracts. After a quick tour of the deploy loop and a pointer to SpeedRun Ethereum, the workshop builds a prototype curation token that rewards curators of items with finder's fees on Zora's asks module, deployed with a simple front end. The session is a live, exploratory example of hyperstructure-style smart contract design for hackathon builders.

Speakers

Topics

From Metabolism 2022, hosted by ETHGlobal.

Transcript

[Applause] [Music] all right let's get started all right yeah good morning good afternoon good evening everyone um depending on where you're calling from uh we have the lovely austin from the ethereum foundation here uh doing a workshop on scaffolding getting started um questions go into the zoom chat and austin will be more than happy to answer them and with that being said uh feel free to take it from here austin awesome i'm watching the zoom i'll try to do my best to watch for questions we'll see how it goes uh this is an intro to getting started to building on aetherium i'm just gonna dive straight into scaffold eath and then we will

uh basically i'm going to do like a very quick intro to scaffold eath and we're going to drive and dive into messing around with zora i think that's more fun uh the the basic uh introduction could take a lot of time but i want to cut that out and i want to get straight to uh diving into tinkering with sora stuff okay so uh hi hi hearts hearts i'm austin uh you can reach out i'm austin griffith on twitter uh hit me hit me up anytime uh this dude let's see let me pull up that profile there we go i'm gonna throw it into chat wait can i where is chat here we go boom boom boom that's me on twitter give me a follow reach out dm's open hearts hearts hearts okay so metabolism hackathon we're talking about building

on ethereum uh even specifically we're talking about hyper structures love this i love this uh this this idea this idea of smart contract systems that are unstoppable that are free that are valuable that have these expansive fees to them uh permissionless positive sun credibly neutral this is so cool and i want to really lean into this uh but let's back up real quick and let me give you an introduction to scaffold ease so scaffold eath is a adapt building dap is such a weird word a decentralized app building toolkit uh it it's really hard to put together a stack and create an app uh on ethereum because there's so many moving parts and so scaffold eath wants to get you

straight to the part where you're tinkering with your smart contract first and then kind of like teach you out of the onion for all the different weird layers that you have to learn so it does provide you with a lot of stuff out of the box that sometimes feels overwhelming i get it but zoom in on learning how to tinker with solidity first and you'll learn the other things as you go so i've already cloned this down to my local machine i've done a cd in and i did a yarn install that process alone takes a few minutes even even on a good connection on a on a good machine so i wanted to get that out of the way first so once we have that let's see let me tinker with this to get this uh little picturey guy idk idk what do i

want there okay whatever okay so we've got uh a yarn start which will fire up a react app then we have a yarn chain which will fire up your hard hat node and then we do a yarn deploy which deploys a uh template smart contract to a front end that lets you tinker with it and this is kind of the main the main dev loop you get in when you get started with scaffold eve you'll you'll come over here and you'll say you know i want to build a un-256 public counter because that's the first thing we always build right and then i want some kind of function that lets me increment the

counter right and it'll be public and there we go yes just just do that right ship it and what we'll see is this thing auto adapts to that and it sees our new counter and it lets us if we grab some funds from the faucet it lets us increment that counter so this is like the heart of scaffold eth you can tinker with your solidity you can uh poke at it over here and test your assumptions and really what a lot of people do is they'll grab solidity by example and they'll go to primitives and data types and they'll grab one of these primitives and they'll paste it in over here and they'll yarn deploy and they'll see it show up in their app and they'll understand okay this is what an address looks like wait that didn't work where did that address go is it not public

uh address public save it deploy it that should show up over here yeah there it is okay there it is testing our assumptions trying things out making thing making sure things work the way we want them to what you'll do is you'll kind of cover a lot of concepts if you're a decent programmer you can get the syntax of solidity quickly basically using solidity by example and scaffolding in parallel grabbing these concepts and working through each one okay what's a mapping you grab a mapping you throw that mapping in here now you've got a mapping maybe you want to set the my map of some account to let's grab our front-end account and set

it to a hundred for some reason and deploy it right now you've got this new mapping and you can check the mapping and who has what values uh let's see what the mapping says for our account it's a hundred good cool so so uh the the speed run of the speed run of the speed run of scaffolding is you can pull down scaffolding you can edit your smart contracts you can get a feel for how it works you can poke at things uh i i recommend just going through speedrun ethereum if you go to speedruneetherium.com it takes you through exactly the concepts that i want you to cover once you've got the syntax and you've got scaffold eth then you move on to the challenges the first one is just building an nft the second one really shows the power of

ethereum and kind of starts to teach you you know giving you more context for what works on ethereum and what doesn't and the kinds of things that we're building uh going back to hyperstructures right they need to be unstoppable and free and and permissionless and all this other cool stuff uh but this one really shows you how to how basically to build a coordination mechanism for uh adversarial parties right we have a bunch of jerks that want to coordinate financially to uh stake in on something this smart contract teaches you about it and and the the tldr is you need to align uh incentives and write your rules correctly to make that work and you kind of use it like a state machine where it's in a deposit state at first and

then someone has to poke it right nothing's automatic someone has to switch it over to the next state move it to a a success state or a failure state you'll get in and you'll learn all of that stuff so tldr scabble the speedrun etherium that's a great way to get started uh that could be my own my whole talk and we're done in nine minutes so we can go tinker with some other stuff now i'm gonna close that stuff out i'm not gonna worry about it i'm gonna assume that you can pick up scaffolding and get going uh quickly i could make the whole talk about this but i think it's more uh interesting if we dive in and tinker with like zora contracts right so so first of all i'm going to put on my scaffold e hat i'm going to be a scaffold eat builder first and we're

going to get in and we're going to build a smart contract that eventually is going to be kind of a it's going to be a fake hyper structure basically i want to make something that's sort of like a hyper structure but i'm going to like leave out some details because uh this this would take me far longer than an hour to be able to build something like this but this is where i want to tinker i want to set up let's see let's crush our counter let's crush our my map let's do something with this contract let's do something interesting here so what i'm imagining after looking at the zora contract it has this this asks contract and we'll get to that in a little bit but uh there's this finders fee which is really interesting and my my gut feeling

is that at a hackathon everyone's going to hack around that finder's fee and that finders fee is going to be this really interesting thing but thinking of a hyperstructure and these uh incentives that are expansive uh i want to build a curation tool that helps me curate the items on zora that have finder fees and then reward the people that curated correctly sort of right now that would that system would take a long time to build but i'm going to build like a janky version of it just to tinker around and kind of show you uh just what i'm thinking and also how scaffold eth works so let's go ahead and clean this out okay and i've done a bunch of stuff earlier today where i'm gonna grab a

bunch of copy-paste examples just to be able to fit this into an hour so uh yeah the first thing is let's think of our hyper structure our our smart contract what do we want it to do well i think what we're gonna do is we're going to make it a let's see i have one here we're going to make it a nope that's not it either let's see where is where did i have that one saved i have a contract somewhere that i can copy and paste these things and that will be easier i think it was called zora second that's it okay let's open that one up too there we go okay let's look at this smart contract so packages hard hat contracts your contract so this is my final contract

but i'm going to bring things in kind of one at a time and explain it so the first thing we're going to do is we're going to make this thing a token so we're going to inherit the erc20 standard right and and to do that we'll say this is an is erc20 right and then we do something down here where we call the erc20 constructor and we kind of give it a name this is going gonna be the curator right i don't even know if i spelled that right but and we'll give it a symbol of c r t o o or i i have no idea i don't know what i'm doing okay now let's see if that compiles right we're tinkering

we're learning did we bring that in correctly and do we have a whoa do we have a oh i don't have contracts i need that there we go i don't know did i copy and paste that in how did that not come in correctly idk all right we are in we've got it so we're we are now a token right we we with those three lines we turned this contract into a token i'm gonna take out some of these things let's see i might need some of that for in a little bit let's let's just go ahead and start looking at how we want this curation to work so what i'm thinking is we'll have some kind of curate function okay and that curate function is going to

take in some address and token if you if you mess around or you look at the zora stuff they basically track every item by it's some nft right it's some erc 721 so it's some token address with some token id and the combination of that token address and token id is sort of how they track all these things i think i've looked at i've been looking i want to be like an outside uh like there's so many good resources that have been shown off today like the zdk and uh all the different zora tooling but i'm kind of an outside perspective here we're going to kind of take an outside perspective and just kind of go at this without knowing what we're doing and kind of see what happens so i think they track things by an

address and a token but we'll find out and and then i'm gonna have a like so basically my curate function says give me some uh you know token address and token id and tell me whether or not you like it and if you do curate this i'm going to use a an event right so i'm going to emit some event that's going to help sort on my front page so i'm going to use a website that's basically just listening to the events of this contract to curate uh some some objects uh some some nfts that are for sale so there we go uh no questions in the chat of course because i'm like going a million miles an hour in a million

different directions whoa look at that it wants to fill in all that stuff no way okay so we have a erc20 and it has a curate function and it mints you one way it means you one little token every time you do some kind of curation and so this isn't civil resistant there should be about a million requires on this thing or at least making sure there should be some more economics built into this too right i could basically curate like crazy and i can get a bunch of these tokens but what i want to do is i want to have a claim function okay and that's after some curation process has happened and this contract has earned some eth then i want to have some kind of claim function

that allows a user to get in here and burn some amount of tokens okay and what we'll do is we'll send them some amount of tokens based on the total supply of eth that's in the contract uh and if you can see here like they'll be minted some and then they'll burn some so it's basically this contract is kind of like a it's kind of like when you put reserves into uniswap and you get an lp token in this case there's going to be some curation contract that's going to be earning funds and we're going to have a curation token that uh basically represents you curating now of course we would want to track probably if you liked something and then that thing was popular so then your

curation would like get more points but we're just in a very raw unchecked unsafe way we're basically just gonna minch you some tokens if you say any kind of curation and then let you claim the money from the contract if you were a curator we need more rules here we need more game theory to go into this austin yoloing in an hour is not a good idea but that's that's how we're gonna do this so one thing that i noticed right as uh the call was was starting is uh it gives out the fees when the fees go to a contract or maybe even at all i only got one transaction to go through before i started all this but i

noticed it comes in west so we're going to go ahead or weave if you call it weath if you're a wether or a weather i'm going to grab the weth contract i've got an interface here that lets me withdraw which i'm hoping swaps from weft to eth so let me bring that interface in here i have no idea if this is going to work it's totally untested but i'm going to add a little unwrap function and i'm going to let anyone call it this function this this function unwrap oh wait we need to instantiate the weft contract right okay let's let's let's just go over everything we just did there so we brought in a weft interface we uh

instantiate it here uh when the contract deploys pointing at this which let's just triple check that this is mainnet weft it should be like west nine or something like that right there's the contract there it is okay so i'm gonna assume that works so when the contract deploys we'll have a nice little interface to the weft contract and then if someone calls unwrap it allows our weft to hopefully get converted to eth so then someone can claim it idk if it's going to work we're going to find out but this is this is kind of the process you want to get into a scaffold heath let's see if this thing even compiles we're kind of tinkering around we're throwing solidity at the wall and we're seeing what sticks obviously not great for a long term

project a hyperstructure needs to live forever and you need to understand that when you deploy it it's going to get attacked from every angle for the rest of time this is not that thing this thing is very attackable but it just gives you an idea of how to prototype so this did compile uh we do have a working contract let's go ahead and deploy it locally and tinker around with it real quick just to make sure it does what we think it's going to do okay so here is our contract holy cow a lot more things now right the fact that we made it into a token brings in a whole bunch of other things the fact that we can curate okay so let's say we have some token address which this is just the address of the contract we're

just filling stuff in and we're going to curate right we're going to call some curate function this should mint us one token okay there we go and then and then let's do that again uh uh sum token right uh token three and let's say false basically we're curating some tokens here we're saying this nft i like it this nft i don't like it and it's minting us some uh some tokens that basically represent our cut of whatever money is in the contract now there's not any money in there right now let's go ahead and just since we're on localhost we can send 100 bucks no problem and it doesn't cost us anything now there's a hundred dollars in the contract

what we want to see is when this dude claims his money after after curating let's see where's that claim uh is that claim function public it's there oh wait is it not here oh no did i forget to deploy i think i made maybe forgot to hit save okay we may have all right back it up back it up back it up real quick hopefully this compiles and deploys and it has a claim function there's the claim function okay we just missed the claim function before okay so real quick i gotta re i gotta re-curate let's curate this token true okay and that gives us one okay so now we basically own a hundred percent of

the supply you can imagine a lot of other people could be curating also and then they would own tokens that represent their portion of it basically we own 100 of the supply uh but let's put a hundred dollars into this contract and then let's claim our one right we have our one token this would be two if we curated twice but basically we're redeeming our curation tokens for whatever value has uh accrued in in our contract and if we claim that hopefully this money disappears and goes up here there we go it did it worked okay so our contract sort of does what it needs to do uh if if you uh we're putting this on mainnet and you're not me you should definitely be way more safe have way

more tests you should have way more require statements here uh definitely not just let anybody unwrap it a lot of things that are happening here are not safe but they're good for a good demonstration and showing off how to use scaffold eth to really prototype so if we were going to put our curator token on mainnet and start thinking about the mainnet contract i think the next thing let's see what do we let me check my notes here curator got it basics of scaffolding got it build out a contract that issues a token to curate we got it uh lets them burn when they claim got it right now we should see that the total supply is back to zero now that we've claimed

okay oh let's create some buttons okay so you're tinkering around here you're kind of using this nice contract interface but eventually you're going to need to build your own ui so i've uh already grabbed a couple buttons but let's jump to our app so what's going to happen is we're going to need a button that lets someone say thumbs up or thumbs down on a an nft and when it does that it needs to send a true false cure rate to our curation contract so let's get into our front end real quick and uh tinker with that okay so i've got some here so i'm going super fast here i'm gonna go just steal them out of i think i have some there we go here we go mid mid and busting i love these buttons

they're fantastic okay so i am uh i am not a cool guy but i'm putting in mid and busting like i know what i'm talking about but i am an old dude that does not know anything about gen z cool words but here we go these this basically creates a button that talks to our contract and calls curate and it's just going to curate some random address and some random token right now and it does true for thumbs up and false four thumbs down and let's see if we have oh yeah now we've got mid and busting very cool and if i say oh this one's busting there we go then it actually should uh create yep the total supply goes up

and if i say no this is just mid tier this uh total supply goes up okay cool so now we have buttons that let us vote on tokens and mint our contract and that's working now what is next so now it's time okay yep now it's time to put on our zora hat and go start tinkering around with zoro we've done enough scaffold eating for now now it's zora time right got this from the zora office when i was there a couple weeks ago for ethan nyc love it great great great hat okay so let's go tinker with this contract let's go look at it uh oh yeah we busting we busting there we go uh i have a question about scaffold if you

have a scaffolding question there's a scaffolding chat you can hit me up in the dms i probably won't be able to answer it right now but if it's easy i will uh what i want to do is go look at this smart contract all right let's imagine i am an adversarial jerk i don't know i am not i am not a uh a person that works at zora right i have my zorah hat on because i'm excited about zora but let's think about this thing as a hyper structure let's think about this thing as credibly neutral as permissionless right any mf in the world can go to this right here and look at this smart contract and look at this look how awesome this is look at these sweet graphs they have that kind of show you what's going to happen when you call these functions

this is a permissionless api that anyone in the world can get to i even have a node running right here that i could be sending my all my transactions to and it's talking peer-to-peer to a whole network so cool okay so what i want to do is i want to tinker with this let's see so we have this create ask function okay and i think i want to call that and i want to create an ask then i'm going to i want to list the asks somehow of course i can grab the zora zdk i could grab the sub graph and i can query the sub graph for a list but what i'm going to do is going to be super raw i'm just going gonna listen for events i'm gonna have my front end just listen for events of this create ask function see this ask created right

here we're gonna listen to those okay but before i even do that let's see do we want to list them first or do we want to yep okay let's bring this contract into scaffolding i think that's the next step so how do i import this whole contract into scaffolding so i could work on it just like just like i have my contract here well it's easy you've got that abi and that address right well if i didn't have so many contracts i had to scroll through here okay there we go uh boop okay so i'm gonna grab this abi and i'm gonna go into the external contracts i'm to paste this bad boy in here so this is the uh asks abi right and it's going to be

equal to that and then we're going to have a new contract called asks and that's the abi and what's the address 617 okay now i've got it built into scaffold eve now i can go uh to my app all right it's time to go to mainnet right i'm going to set my app on mainnet okay and then i'm going to go to that contract object and i'm going to create a new contract interface that talks to the asks contract okay

there we go there we go i think that's just gonna work but let's see so now notice now when i hit reload scaffolding is on main net right and so when i click an address here when it's going to take me to the mainnet ether scan if this was on rinkaby and i clicked this address it would take me to the rinkeby ether scan so scaffolding does this really good job of keeping you on the right network and setting your network up and and urging your users to get on the right network you'll notice that our contract now is not connected because it's not on mainnet yet we'll have to get to that but look at this we've got the asks contract and we can interface with it and i could create an ask if i want very cool okay so

i'm not going to use this though after all that getting this in here okay so i needed to get this in here so i could read the the events from it but i think i'm going to create my ask let's get the events going let's get the events going let's read the events we've got the asks contract in how do we read events from it so you could ask an api for what are the current asks you could ask a sub graph you can also just ask your own machine right we're going to query the blockchain directly and we're going to say just give me the events that came out of this contract we're not going to use the we'll use the api just for fun just to add it in but technically we're the third party we're some disinterested third party just messing around with

this uh so what we need is an event listener okay so i'm going to bring in the event listener for from eath hooks which is just like wag me uh it's an earlier version of what wag me became uh but we're gonna bring in the event listener from eath hooks and then we're going to use this event listener to connect to the asks contract and what it says is it has us set a block basically you you listen for these events uh given some past block i'm just gonna go to the contract normally you would you would definitely build some kind of an

indexing system here and you would uh uh figure out how to show just the right amount i'm gonna basically like back up to about here two hours ago and i'm gonna say don't go any farther than that just look back two hours ago and give me all the asks now let's see if this thing complains oh i don't want to deploy i want to let's see is the front end nope the front end is not happy about what is block on load i don't want that get out of here kitty all right save that okay so it's really mad about the format that i put that into that external file but let's ignore the warnings don't tell me what to do compiler okay now let's see what we got here we should have an inspect and we should

be able to get some asks here there we go oh there's an array of asks look at that okay so this is coming out of this contract itself we're asking the contract itself not talking to zora at all we're asking the contract itself give me all the asks that are created on this permissionless platform by all these adversarial parties and and tell me what i can buy right what what kind of what ask can i feel phil and even can i see here what the no i can't i'm looking for the finders fee i think the finders yeah it's got to be here somewhere i don't know i don't want to dig in there but we've got events now okay so we need to display these events right so i have

this sorry for all the copy pasting of the code i definitely will commit this somewhere but there's no way i could get this done in enough time so i'm kind of speed running this but basically what we're going to create here is a use effect okay and it's going to fire when we get new ask events and it's going to look through all of those asks and it's going to okay this is where we need the zdk so normally what we would do if we were being if we were being very disconnected third party we'd go to the smart contract of each one of these tokens and we'd ask for the metadata and we'd use that to render it but i'm gonna bring in the zdk just for fun just to show that that's another thing that we

can add here so we're gonna need let's see where is that zdk we're going to need the zdk right grab this and bring it into our app really speed running this stuff okay and we're going to need to install it too right let's go ahead and stop this dude and cd into packages react and yarn add our zdk and while that's going i need to bring this stuff in what's that z doing right there don't trust it don't trust it all right all right all right so we bring in the zdk uh we link it up to mainnet

and i don't think i have an api key i'm just gonna do that for now we'll bring in an api key if we need one you can talk to zora engineering the twitter account and hit them up and they will hit it but i i think i think it'll they'll give us enough requests just without a key we instantiate the zdk and then down here at the bottom we do a zdk.token with the args of the token and let's see let's see how happy the front it is with us now if we do a yarn start starting yarn starty hopefully we will get what do we got what do we got what do we got some kind of at least some kind of error message of what i did right wrong i don't think

i got it all right at once but hopefully we will be able to loop through each of the asks query the api for it and then we're going to store an object in the state that gives us basically just a list of all the objects [Music] we may need that uh we may need that api key we'll see here i'm getting some uh there we go so we've got asks uh let's see do we have something printing out ask content let's do that next let's do a console log ask you know what no i'm just going to trust it i think i think we've got the ask content ready i'm going to assume that that use effect is doing what it needs to do and i'm going to take that

ask content oh i did print it out over here i i probably oh it's it's in there it's in the console this is what i want to do though i want to list it out i'm going to steal this list right here okay and i'm going to paste that into my app basically i want to list out all of these objects where do we want to list them out maybe maybe right above right here right here right here okay so so we're asking for all the ask uh uh asking for all the ass we're asking for all of the asks events so anytime anybody asks this hyper structure and ask we want to see that we want to

list it here we want to go get some information for each one and we want to display that information here and that's what we're going to do i'm even going to use the zora uh what is this the zora embed i'm going to try the ins we're trying all sorts of things here we're bringing in the sd the zdk to query token information and we're bringing in the embed to display it uh i think it's going to complain that i need a list here in ant let's see let's see how far we get here let's see if we can get a list of tokens okay no list nothing yet let's see uh let me look at okay let's think through this we've got

the zdk we've got this we've got asks showing up uh hopefully the use effect is happening let's see let's go to that use effect and just troubleshoot it real quick let's check ask content here saving content let's double check this saving content right okay it does save some content okay and this is what the content looks like it's got the ask the markets the token but only one of them does it happen more often i feel like this should happen a few times okay uh well get out of here okay

uh let's see ask content now should be in this list and the list should be rendering if we have some ask content maybe i need to go back farther oh no there's the items oh wait wait oh there they are i just didn't give them enough time come on you gotta be patient gotta be patient okay let's reload and make sure everything's still happening here it just takes it so this is another reason why most people build indexers and don't read events raw in their front end is it take some time you've got to go out to an rpc you got to ask this guy like what are all the events for this contract you got to look through all of them decide which ones you're gonna display that does not

happen on page load right it's a little slower okay so we've got some asks though now let's set it up so we can vote whether or not any one of these is busan or mid so we need to grab our buttons and we'll bring them in probably some div right here right okay and then instead of doing some like auto complete for our token ids we have it now it's the zora item collection address for the token name whoop and it's the zora item token id

okay so now we have voting right if we had our contract deployed we could hit this button and it would vote on this specific specific orb right i think that's a zorb or something right so i could say that zorb is busting and i could click that button and it would send a transaction to our contract which isn't deployed yet and it would give us a curation token and it would help the front end read the events and then sort these items so the more busted ones are up top and the more mid ones are at the bottom man i'm like i'm like i'm way too old to be using this nomenclature but i'm trying kids i'm trying all right so uh we've got our bussin and our mid votes

we've got our contract we've got the zdk in we've got the list uh we've got the buttons generate account and deploy contract okay it's time let's deploy our contract to mainnet oh man oh you know what what i want to do okay okay we'll post an ask after this let's deploy our contract first all right all right all right anybody anybody deploy a contract to mainnet live for their talk yet today i hope so i hope so we're going to do it here i'm going to do a yarn generate that's going to create a local deploy mnemonic then i'm going to fund that deploy pneumonic with some cash money maybe what 60 70 bucks what's what's uh what's gas at

these days it's not too hot that would be the worst if i was trying to do a main net demo and like gas shoots up to like 400 right now that would not be good okay so we're going to fund our deployer account uh let's take one last look at our contract idk if this is going to work i'm especially unsure about this unwrap function that anyone can call i mean someone could just start calling curate on this thing please don't do it at home please don't attack my contract you could definitely attack it give me give me 20 minutes and you can do whatever you want please please oh and by the way in a world of hyper structures you don't please please please you assume everyone is adversarial and you write the rules

correctly so no matter what they can't mess with things but we're going wild here and we're doing things that are not the best all right yarn deploy dash dash network main net please work first try here we go here we go there it goes and it actually should show up uh here when it gets deployed too let's see okay then once we have our contract deployed we have it in our app we need to post and ask that's going to be the next step okay and i'm going to use i could use this interface to post and ask it's pretty good but i'm gonna just kind of show off a little bit of cool composability from the ecosystem

my buddy carlos has built or is building this thing called abi ninja and it's really cool because what you can do is i can go to look at this i'm just going to copy and paste the ether scan link of this contract this asks contract right into abi ninja which will be at abi.ninja one day and i'm gonna hit load contract and there we go we have the same kind of contract but it's a nice little nicer interface right we can kind of see what's going on oh man this is taking a long time to deploy oh man i might need to speed it up let's see uh uh let's let's get our ask in and maybe gas will go down gas is like shot up a little bit since like well like 10 way or something okay i'm going to assume

that gets deployed let's create our ask we need to get an ask into the pool so it shows up here right we need to be able to see our ask oh you know what we're missing some display information here let's get let's get that a little bit better too uh here we need another div that shows more information because because what i want to do is sell an svg in ft to really show the permissionlessness of this and it turns out that zora doesn't uh render or respect hardcore svg at fts so this is going to be something cool i'm going to put an nft through the hyperstructure that their front end does not f with at all it's like no i don't want anything to do

with that it won't show up on the zora side but i'm using the hyperstructure permissionlessly as me as a guy that wants to sell an nft as long as the nft match matches the standard so weird weird little thing we're going to do here let's get some a little bit more display i want to see like the token name where do i have that stuff saved here i think let's see something like this okay where's this extra render come in do we have that yet oh we do okay what's this extra render doing oh cool it's checking to see if there is an image url and if there is it's rendering it here uh what's this going to do oh throws an error we need balance okay so the balance component is a handy little

component that you get out of scaffold eath that will display an eth balance using the current price of each yeah so this is that balance component instead of showing .224 it shows you three thousand dollars right and that's just a lot nicer it's a little easier okay and this is a loogie that i already sold but this is what we want to see we want to see that the loogie is here we want to see ooh did our contract deploy our contract is live there it is boop live on mainnet please don't please don't please don't attack it okay uh we have just 15 minutes left to finish this all up we need to create an ask and we need to get it to show up here okay so let's get that ask created

back that ask up huh no i don't know i'm old okay here we go let's get a token contract so we need the loogies all right so i'm going to my svg nft contract we're waiting for it to load it takes a little second it's doing the same thing it's getting all those events you watch his console it's parsing way too many events and then there we go there are our lugies and a loogie is just an svg and ft it renders it in the contract itself check out svg and ft's uh it's it's a lot of fun uh but this this chubby boy right here this chubby green boy is number 1695 so i'm going to create the ask with token number 1695 and the token address

contract here and let's see now there's an approval process that needs to happen here you need to do two approvals you need to use i would need to use abi ninja in another window and i would need to have it go talk to the lugie contract okay so let's just grab let's see can i just go to the loogie contract on ether scan yes i can grab that and paste it in here okay we would need to use this and we would need to do an is uh no not a is a proof for all we would need to do a set approve for all and we would need to approve this dog right here this erc 721 helper

okay and then there's a second one you need to do on the modules contract uh let me go find it let me go find it i think max sent it to me earlier where would that be uh [Music] there's a second you have to approve this address with a true on the modules contract dang it let me just go find it it's not like we're crushed for time or anything uh let's see let's see where is it max i'm going to our chat uh no you sent me no no i have in my notes i have it in my notes it is right here here we go here's all the addresses we're looking for the module manager right then take that throw it into ether

scan then grab that ether scan link and go to this how what do i return ether scan url there we go then there is an uh module approved somewhere here yep set approval for module and at that point you paste in uh this dog's address oh i lost it yeah there and true and you fire that off okay so you approve the module you approve the token to go into the module and then this create ask will work so of course you wouldn't want to do this all like this

you would want to have a button for your user that just does it but we're we're hacking away here trying to figure stuff out okay price what are we going to charge let's charge 0.01 take that times 10 to the 18. my ask currency is going to be zeros right zero address oh man what if i just start typing 0x00 yes it does i love that all right so we got zeros in here for our ask currency okay the seller fund like who this would be like to me right who's going to get the money it's just going to be me oh i'm going to test out carlos here does this do e s resolution carlos if i put in atg.eth

okay it didn't work all right finder speed this was a tricky one i actually had to go into the zora docs to understand this this is not intuitive it needs to be intuitive you guys it even like right here in this contract when we go look at this right here and it says finder's fee bps where is that bps yes okay so i i could see it here it's dividing by ten thousand okay so i could see it by looking at the code but right here this should be there should be an example here that says uh what like 100 equals one percent that's what it should say 100 equals one percent right here i need that i need that in those comments but you can always go look at the zora docks the zora docks are wonderful they

have tons of stuff you can get way too much information there but uh that was one thing that i had to look up i couldn't figure that out just by staring at the contract but i could have now that i think about i could have went and looked at that like math but oh man no one wants to eff around with that so uh let's see back to abi ninja i'm gonna give out i'm gonna give out a 10 so i'm gonna put this at a thousand so that's ten percent finders fee so i'm gonna charge like something like 160 bucks for this thing i'm going to give a 10 finder speed to whoever uh fills the ask whoever creates the curation mechanism that fills the ask send it yeah okay yeah let's go ship it all right four

dollars main net here we go gas you cool down over there all right 13 way i like that now we should have an ask this should there it goes this should show up here yes there's our big green boy right there 1695 big old green boy not rendering correctly in zora because zora doesn't want to eff around with svg and ft's or maybe they do like i do not speak for zora i only wear the hat i i don't know exactly their stance on svg fts i think they're working on it but what you can do is you can make really really heavy svg and ft's and that can f with the view go look at snakes on chain if you want to see a heavy nft that's svg that's rendered in the smart contract anyways we got to get this boy uh purchased okay so we don't what we

don't have here is uh some kind of fill ask button i need to find that that's this one okay here's another button in the front end and and the reason why i'm copy pasting all this is if i tried to write this front end live it would take me hours you'll find with scaffolding you spend about 30 minutes writing some solidity and then you spend like three and a half hours trying to get the right user interface user experience to interface with that that contract okay let's see here right here right here right here whoa this is going to be ugly ugly ugly code but here is our fill ask button okay so we're going to build this in to our curated front end we're going to let anyone click this button to

buy one of these nfts and we're going to fill in the ask information right the contract address token the ask currency the ask price the same thing i just did over there but this would be filling it now there's this thing right here this right here needs to be our token our our contract right what we want is for the finders fee to go to read contracts asks dot address boy i hope i got that right because word don't have time to not get it right and it's going to send in the ask price so theoretically this button should sell you this nft and should send the

proceeds the finders fee to this contract okay so one little thing we need to do here is we need to do a quick uh uh side quest what i could do is do a yarn build and i could put this out as a normal url that anybody can get to let's pretend i did that let's pretend i deployed this thing so so let's go over now to uh over here so this is this is curator land right okay so here is our app let's pretend it's deployed somewhere i'm going to create a wallet and this wallet is going to be our curator okay this is a burner wallet the uh actually let's make a brain wallet even even worse uh

there we go curator this is our curator i i used a seed oh no it didn't work oh wait wait let's see if i can reproduce it nope okay i'm just going with it there's our curator that's gonna be our pneumonic i'm creating an account with that mnemonic don't make brain wallets don't deploy things randomly to mainnet this is all a bad idea but it shows you how uh it could work uh there's there is our account okay so our curator needs a little bit of gas to

do some curation so let's send our curator maybe like 20 bucks of usd ooh our app went okay yarn surge what are we going to call this thing you're a tor how many o's do we need plenty of bows all right send this thing to search hot damn here we go all right so our app is actually live and we could go now speed up send them let's get aggressive yeah go okay now over here in curator land we're not in debug

mode anymore let's go to curator dot surge please work please work now any of you at home can do this please don't do this please don't go front run me and jack up my stuff give me ten more minutes give me eight more minutes okay so uh debug okay what i'm gonna do is i'm gonna connect with wallet connect i'm gonna connect in this punk wallet built with scaffolding uh what do i need to do copy that paste it here now we should be logged into our front end oh what happened there wallet connect wallet connect shakespist at wallet connect servers let's try it one more time and then i'll do it differently if i can't get this to

work i want to connect wallet connect my wallet wallet connect okay i guess we're not going to do that wow that that works every time i do it before oh it's not it's https ah here we go of course wallet connect is not going to let us go through non-https there we go there we go quick solution here we go now we're on https make sure you go to https at home if you're uh attacking my system here okay here we go here we go here we go uh let's see connect wallet connect bring in this dude

there we go we're connected okay so notice cb cb1 yeah we're connected as this person we're gonna do some curation right we're gonna say ooh this thick green boy right here is busting and we're going to send that in okay so now we've we've paid and we're going to see that this token supply is going to go up we have curated this this uh a set of nfts maybe it pushes this up to the top something happens in which this curator now has a token hopefully now the total supply is one a token that basically represents all the money in the contract of course a good hyper structure has you know thousands of participants right keeping everything

working uh but now let's go buy this thing okay so i'm gonna grab another account i'm gonna go to curator.search.sh please don't go buy this please don't don't uh uh there's so many ways you can grief me right now uh let's make sure i'm logged in as this dude and i want to fill the ask oh no oh no uh wait what am i missing here did i connect i didn't connect connect my wallet connect in or connect my wallet yes go hurry we have five six minutes fill the ask please yes here we go buy it buy that loogie buy that lugi 173 it's worth it's a heck of a deal it's

worth that at twice the price with this thick boy how could you not all right so speed up my transaction i i don't have time to wait let's go okay there it goes it did it went it went okay okay now let's go let's go check that transaction out right we want to see what actually happened there if we go view on a block explorer we see that yeah dang it 0.01 turns into wrapped ether and 0.09 went to me so i got paid my 0.09 and then the 0.01 finders fee uh i guess maybe it detects i don't know how they do the finders fee but instead of sending eth directly to the contract they sent wrapped eth okay let's go can we see internal

transactions i'm looking for where that wrapped eth went right uh where do we see it deposit transfer approve well it's one of these hopefully hopefully now that this nft has sold right let's go back here the the ask has been filled my uh my account uh has got paid right it got paid the money and then hopefully this account has some wealth in it right and let's see what happens if we do a well let's see we need to get our where's the wet contract we need to go we need to go check and see if this

worked did the finders feed land in our fake little hyper structure here and if so let's see so here is the weth contract nope that's not the left that's our contract uh we need to go to oh let's do an abi ninja yeah yeah let's do an abi ninja of the weath contract okay go to west we're trying to check to see if we have an us in this contract and we might and we might and we might not to be honest seriously i can't search for west all right west contract address hurry hurry is this the same one hopefully that's left nine yeah it is okay grab this

paste it into here load it does not like that maybe i need to go here hurry there we go okay here's west we're looking for balance of we want to know the balance of our fake hyperstructure contract please please have a balance oh no oh no okay dang it dang it dang it okay so no weth went to our contract i wonder i wonder what i did wrong i was assuming that our [Music] yes we got three minutes left i'm

assuming that i did something wrong i have to go look at this transaction uh i was sure that that was gonna send let's go back to that where did it send that point zero where is this in that point one west where does that go it doesn't just go into the contract uh let's look at it one last time let's pretend let's do it's pretend time it's pretend time i'm gonna send i'm gonna send a point one weft to that and someone could definitely attack this contract let's pretend like that eth landed in our contract like i thought it was supposed to i have no idea maybe there's some claim where you have to go claim your finders fee it can't be right this contract should have wep in it uh but it didn't work so i'm gonna send some fake fake eth just to

show this last little piece that it'd be .01 each should be sitting in this contract right i don't know what i did wrong i don't know why i did it wrong uh there's probably something i'm not understanding quite correctly about the finders fee but uh let's just pretend that this money is in there and let's let our our curator over here claim their funds so here is our contract we're waiting for money to be in there uh i'm i'm so confused about where that weft went uh i guess we could see it here right where the heck did the weath go

uh uh we don't have time we don't have time dang it dang it that's what happens when you draw a prototype onto mainnet uh let's see last piece there we go the 1697 is there let's pretend like that money came in from a finder's fee let's pretend like there's all sorts of curators curating and those curator rules are correct and it's helping to uh curate this website and show that you know green boy if green boy was bussing and this dude was mid then maybe green boy would be at the top of this or something basically we create a site that is its own thing and the site can go up and down it's not up all the time it's the smart contract that is the hyper structure uh we have 1697 in there let's let this

dude claim [Music] their one token which should be one percent if the total supply is still one and no one has briefed me they should be able to claim their one and it will be it's basically a hundred percent of the share of this 1697 so if that con if that transaction goes through this address should be uh you know like 20 some dollars 20 30 some dollars all right last last hat i know it's two we gotta stop it's all over i want to tell you about the build guild and speedrun ethereum if you like playing with this stuff if you like tinkering around go to speedrunatherium.com speedrun ethereum will get you through not just the syntax of scaffolding but the mental model of

what you can build and what is powerful what is what what it works for and what it doesn't work for you'll be building your own decks you'll be building your own signature based multi-sig but you'll have to learn the basics and the ropes first but this helps you with the mental model the syntax is easy it's the mental model that's that's hard once you get through speedrun ethereum check out the build guild the build guild is a curated set of builders and we're building all sorts of random cool prototypes like this thank you thank you thank you happy bow tie friday hearts hearts hearts hearts i can't believe where did our west go where did our west go i don't know no one knows mark tarts thank you for having me eat global thank you zora thank you thank

you thank you thanks so much austin for that really really engaging and fun workshop i know everyone learned a lot and was that was really awesome thanks for your time um doing this and happy birthday friday um for the rest of you there's another workshop happening right now so feel free to head over or check out some of the other workshops happening today and this weekend but other than that have a great great day everyone thank you you

Related talks