Solidity Workshop: Building the Next Generation of Tokens & NFTs on LUKSO | Jean Cavallera - Lukso
Ethereum Denver·Wed, Oct 9, 2024, 12:00 AM
The goal of this workshop is to demonstrate how we can use the latest LUKSO Standard Proposals (LSPs) for Tokens & NFTs - namely LSP7 & LSP8 - to build a next generation of tokens & communities with enhance features and experience for users and developers. We will show how we can set metadata for the token, notify sender and recipients on transfers and transfer assets securely leveraging the core features of both LUKSO Token standards. We will have an overview of different types of compositions available to create dynamic of NFTs, from simple to complex. APPLICATIONS FOR ETHDenver 2024: #YearOfTheSpork ARE OPEN APPLY NOW https://ethdenver.com/apply
Transcript
[Music] hello everyone uh yeah and welcome and thanks for joining my presentation so uh today I'm going to um do a little solidity workshop on how to build the next generation of token and nft on lxo using the LSP standard so a bit of int about myself so my name is Jean I'm the lead smart contract engineer Luxo and uh um aside of Luxo I'm also the author of all about solidity article series and really passionate about smart contract so this is basically the repo that I work uh on a daily basis there hasp smart contract and the set of that I um oh sorry I uh publish articles on medium uh called all about uh solidity so today uh the agenda is that we're going to have a overview of the LSP 7 and8 standards uh the token standard on luo and the benefits and we're going to build a basic very basic um uh proof of attendance nft as a proof that you attend to this talk and we'll look at the solidity C and uh I advise you to use the universal profile browser extension available at this link so um so what are the benefits of the Luxo standards um so basically they are multiples uh first they are uh more adaptable for different use case you can use them to do things like uh dynamic nfts or collection of sub collection so you can create more complex application that are more tied to the real world uh they can hold a little amount of metadata their interface you will see uh is more unified compared to the other standards and they have safety and notification feature but uh yeah as the code say says uh let's look at the Cod and uh stop talking so if you go to uh this link uh it's available also uh here on the this QR code you will get head into the the the GitHub repository so so if you go there we you just have to click on uh on remix of the the remix link here and you will have all magically the whole uh code uh loaded um yeah and so I'm just going to give a a quick overview on U on the slide uh so first of all we going to so as you can see this um this um this contract use the LSP smart contract oh I think I'm going to do it like that uh the from the npm package and first of all we're going to look at the deployment parameter so I think I do it here sorry yeah okay yeah so if you look at the deployment parameter of an LS sp8 uh identifiable digital asset we can see uh several things so first we have the type of token we can represent token nfts in and token multiple ways uh and second uh we can represent each nft also in even more multiple ways like uh basically a number or we can have more unique identifier or we can have more complex use case like collection of uh subcollection so now we're going to see how we can set uh metadata so uh basically the way it work is that uh in the Constructor here uh we are uh setting what we call the token metadata the way it work is that uh uh LS sp8 use a flexible key Value Store that you can see as a a mapping but U uh we are Developer not smart contract and as you know smart contract understand B but uh for us we are more uh oriented toward um a more unan readable uh form of how to read this metadata so uh this metadata can be represented at with these schemas and um the you can see you can stor things like the metadata of the nft or like who created the the nft a list of creators so the way things like uh array data Keys work is that we have one entry for the number of creators like for the length of the array and then each index is accessible through uh the first the next 16 parts of the of the of the key so a bit of a walk through um to to the code here so the way it works is that first uh I set up Prett fine uh metadata here at the top then uh we are going to set the list of creators so there is only one Creator then I have set up my uh the address of my up as a the uh as a Creator uh here and we have utility libraries like lsp2 utils in our package to make all of that uh heavy lifting easier for you and uh then we basically set which type type of Creator so he is an ec725 account and it's at index zero and all of that is available in our DU uh is just that in 20 minutes I cannot cover all the in a detail so yeah um so what's the second benefit we saw that there is a unified interface and functionality so if you look at of the standards like rc20 and 721 each of them have their own way to uh do removals and to token transfer in comparison uh uh LSP 7 and 8 have the same uh function interface the only differen is uh the parameter for what you are transferring LS sp7 you transfer an amount of tokens LS sp8 you transfer a token ID and nft uh but yeah so let's see a bit that in action how does that actually work so I uh I built a little uh D app for the purpose of a workshop um oh yeah with internet that will be better Okay cool so yeah so the way it works is that as you going to uh see we're going to first uh deploy our uh nft so we're going to go in remix I'm going to connect uh my uh account so this is our Universal profile brow browser extension I'm going to connect uh this account and this is connected and I'm going to deploy so you you going to have a a popup window appearing okay I don't know what's [Music] happening yeah I think it's my internet connection that's not working great okay well I will just carry on with uh the slide so the way it works with um with um uh with ls sp8 is that assets are automatically registered so here's a basic question if I send token to someone on an nft uh but I won't tell you how do you know that you have uh received it and the answer is that basically you you don't uh you don't that the only way you uh you uh you know is by adding the address on metamask by importing it but how do you know the address of a token that you have received if uh you don't know actually that you have received a token and uh the way we have built that as at luo is by uh using uh a common uh interface function called universal receiver where you have a type ID to specify uh the type of uh token or nft or information you are receiving and the data that was sent alongside the notification and the way it works is that let's simulate a token transfer scenario where you have two Universal profiles one is trans transferring uh uh the token to another uh the token contract is going to notify both the sender and the recipient and what will happen is the uh we have a what we call an lsp1 delegate contract that is going to uh handle the registration of the asset on the uh on the token contract so I'm going to I have 9 minutes left I'm going to try again to uh connect to the to reload the page and show the demo no e which one sorry thank you okay so I'm going to now deploy the contract so this is the bite code of the contract you can see the browser extension in action here after fighting against Wi-Fi so you can see if I open the browser extension there is like the transaction in progress we can go on the advance View and we can look at the transaction hash yeah so the contract is basically uh here so yeah this is the contract that we just uh deployed and if I go into the sample app that I uh created for the purpose of this talk you can see this is basically the uh like the metadata that I've preset beforehand um so yeah let's uh do a bit of a uh a demo if uh so the way it works is I will connect another user I want going to call it Alice to the to the to the D app and uh the way the the code is built is uh that there is a claim function that uh basically create the token ID as the hash of the um of the um of the of the caller and we're going to Mint and the way the parameter works is that we are minting for the claimer the token ID uh true is a parameter called uh the force in uh the LSP 7 and8 standard so this is for by default everything is false because um a recipient of token need a way to register uh the assets but here uh like I put it as true in case for if anyone want to try it out uh with a metam mask or an EA so I'm going to claim the nft with Alys uh so you can see the bu extension here so yeah we have like different tabs in our browser extension like the who who has access to the smart contract base account like the activity you can see there a transaction coming in right now let's have a look if it has already been uh validated yeah it looks like it went through okay cool yeah and if I go to uh the if I connect with Alice and I go to her wallet we can see that Alys has this collectible but one interesting thing is that we can see that the the asset is unverified so the way we it works witho for verifying the asset is that to make sure that you're actually uh interacting with an asset that is uh that genuine is that uh as me as the Creator I have to register this asset in my list of uh issued assets so I'm going to just do that uh right now I'm going to disconnect and I'm going to reconnect with my actual account and I am going to to click on registered issued assets and what I'm going to do here uh basically under the hood is that I'm setting the entries in the storage of my up for the uh LSP 12 issu asset the list of asset that I've created yeah it's probably a bit slow to to update but uh yeah basically if I go now and I refresh the page you can see it already appeared uh live you can see now that that because I registered the asset now the asset is verified um and yeah uh this is the proof that we have a cross uh linking between the list of creators in the asset contract and the list of uh issued assets uh in my uh in my my metadata contract and um yeah that's basically uh it for the uh for the demo have 30 second left and uh was a bit of a bum with a Wi-Fi but hope you liked it and if you have any more question feel free to ping me I will be uh around in if for the whole week in 20 minutes I cannot go into the whole detail of the code and the standard uh but yeah you can learn more by uh going to do at. Tech or you can just feel free to ask us in the team uh for more detail um yeah and thank you everyone for attending to my [Applause] presentation
Automatic transcript — names and jargon may be misspelled.