UMA 🛠️ Composable Bridging with Across
ETHGlobal·Wed, Oct 9, 2024, 12:00 AM
Learn Composable Bridging with Across! From November 17-19 2023, ETHGlobal welcomed developers from around the globe to take part in shaping the future of Ethereum at ETHGlobal Istanbul. Over $600,000 USD in prizes were given away at the prestige Istanbul Congress Center... thanks for an amazing weekend hackers! ----------------- Follow us: https://x.com/ETHGlobal?s=20 Check us out: https://ethglobal.com/ Email us at: hello@ethglobal.com
Transcript
[Music] my name's Paul uh I am a contributor to the across protocol uh and uh I'm here today to talk about composable bridging with a cross um so for those of you who don't know what a cross is I'll just give you a little bit of an introduction and then kind of outline some of the use case for for why we would you know why is composable useful what what does it actually do uh I can give some instructions on how to do composable bridging uh it's actually very simple so we don't need to spend too much time there we can also discuss some project ideas and then uh also just you know have some links and references to practicalities and resources that that will be useful if you are building a a project that is using a cross composable bridging so what is a cross uh if you don't know it's extremely fast uh we have uh you know cross-chain transfers occurring usually within seconds uh you know you or or like worst case minutes of of an deposit on On An Origin chain um the fees are extremely low and there's a no slippage model so uh there's no amm involved we only work with the official tokens uh for each chain so it's actually it's quite it's been different from some of the other Bridges we support the major chains and tokens this is ethereum optimism arbitrum polygon ZK sync and Bas at the moment uh there is of course scope for additional chains to be uh to be delivered in future and in terms of the tokens it's also you know an emphasis on on the major tokens so this is ethereum Bitcoin rap Bitcoin usdc D usdt and then there's also some governance tokens that that are that are supported by across as well one of the things that uh is really uh you know popular about AC cross uh is is that we actually have this decentralized Rel Network so when when a user makes a deposit on An Origin network uh the the relayer that makes the fill is is actually permissionless so so any any any individual can can actually operate a relayer and their bot will will kind of start and will be scanning for new deposits and then there's effectively a race to to make a fill on a destination Network and so Relay can there can be custom implementations we have those and uh we have um you know people apply different logic different profitability constraints to their to their transfers uh in order to kind of optimize their profit but also to deliver a good a good experience for the end user we really really try to be friendly to integrate so predominantly this is in the form of of like aggregators cross chain aggregators so we have for example Bungie do exchange jumper. exchange these are two kind of major examples of of aggregators that if you've ever used them to to make a transfer uh they might actually have routed you via across and uh we've actually found that in some cases people are routed via across so much that they actually come directly to us instead and they say like instead of going VI an aggregator we want to just integrate you directly which is which is nice to see and then you know when we have these interactions like we really try to support uh give give good support make sure that that our system is easy to integrate and that that everything's working well and give kind of good ongoing support and the final thing is across has actually spun out of the Uma project and uh it's it's actually across is like kind of a a really good use case of how uma's optimistic Oracle can be used efficiently and effectively and of course um is sponsoring this event that's why I'm here for the word work shop so uh there is of course a $10,000 uh prize uh for for um for the haon so if we get into why composable bridging um across is historically supported uh only bridging tokens so you can Bridge a token from from any of the supported chain to any of the supported chain uh but of course like when someone's bridging uh tokens the question is like well why are they doing that they obviously have something that they want to do on the destination chain uh up until this point it hasn't really been possible with a cross to to to kind of specify what you would like to occur and if you think about it like the cross chain user experience when you have to do every step manually is is actually not very good and I would probably challenge anyone to to actually you know with with an address like Bridge funds and then like interact with a contract on the other on the other chain in probably like less than six steps like there's there's actually a lot of kind of manual steps that you need to take if you're a user who doesn't know like what to do it's like this is a really hard learning curve to to find out uh and then like there's there's kind of all kinds of of traps and gotches like maybe you bridge an esc20 token like usdc but maybe you don't have gas on the destination chain so now you've got the value sitting there but you actually can't do anything with it and so you need to then like figure out how am I going to get gas is there a foret that I can go to do I like need to do another Bridge token where like Bridge transfer where I'm I'm bridging in just you know the native gas token and then like I don't know if you're like me but I have I have like multiple tabs open and there's all kind of daps in the background like fighting over who's who's got the RPC connection this is like not it's not fantastic user experience and you know we think it can be a lot better so what we have done with across is to now say when you're bridging a token you can actually at the time of deposit you can specify what what what do you want to do on the destination chain and so this is a feature that that other protocols can use they can actually integrate this feature to like have contracts on maybe the destination chain that can receive uh the message that gets included with the the token transfer and then to like unpack it and do something further so what we we call this uh composable bridging and the advantages are that uh basically you can the the user doesn't need to do anything on the destination chain everything on the destination chain is handled by the across relayer the user doesn't need to worry about gas the user doesn't need to worry about token approvals it it basically is is is is all facilitated by by The relayer Who is simply executing the the the message that was specified at the deposit time so we can go into how and the how is it's actually pretty simple um you can see up here on the display we have a deposit function here this is how you make a deposit into uh a Spoke pool it's quite simple you specify the recipient uh address you specify the the token that you were bridging On the Origin chain so this is an erc20 address be USD or weth or rap Bitcoin um you specify the destination chain ID where do you want the transfer to go uh you specify a relay a fee percentage here which is actually the fee that you pay to the relayer for completing this task uh there's a quote time stamp which is specifying like what kind of rate you will get you basically would set that to the current time and then I've highlighted green here we have this this message and the message is is just arbitrary data that can be it doesn't mean anything to a cross it's just it's just an array of data that getss passed in to to the deposit and then what happens is the relayer will will supply this on the destination chain and so if we come down here to the destination chain what happens is the depositor will have specified a contract uh as the recipient so so in order to use composable bridging and cross chain messaging with a cross the recipient needs to be a contract uh what happens is that that contract which is the recipient needs to implement this this function called hand across message here and that's like a call back so so this this contract will will kind of asynchronously receive this this uh this it'll be executed uh it receives some information like what is the token that was received how much was received there's also like how much like was the fill completely uh was it completed in in in total because across actually supports at the moment partial fills so you could actually have the transfer could be completed by two different relay in two Fields uh and this will tell you like whether or not you have the complete amount or whether or not you've only received a partial fil uh you also get to know on the recipient side you get to know who the relayer is so this is actually pretty interesting because uh this allows for like gated permissioned transfers so you could actually set up your own protocol and you could be handling your own fills all settled by across uh or you could for instance have a pool of of relay that you have relationships with so maybe have some kind of trust relationship with and then you can specify if I only want to allow my fills to be executed by these people who maybe I have some some agreement with or some kind of trust trust relationship there or maybe for instance you want to like provide some additional incentive to the relayer to give you really good performance like you could you could offer some kind of bribes or incentives in in some other governance token that says like if you know if any reler fills this within some some kind of um time period like within 2 minutes they will get some some of my governance token and this is you know gives a few different possibilities there of course at the end we have the the message here that's that's uh pulled out by the contract and the contract needs to be able to to unpack the message and do whatever it needs to do and it needs to return successfully uh if the contract reverts in this message in this function then the whole fill will cancel and it will not be completed um I will mention we have a tutorial on this on our developer docs site here so we've basically got some different examples of like how can you how can you use messaging uh with a cross you can there's an example there for for like um if you bridge if you bridge WTH like you could have an instruction that says I want to actually unwrap that WTH into eth on the destination chain there's another example of if you've bridged anc20 in uh perhaps you want to then take that to a DEX and swap it for something else so there's like quite simple examples there it's actually surprisingly little code in order to do this and uh I just really want to make make sure that that people are aware that the docs are there and there's there's good good examples like you can you can nearly copy paste it into your project if you are integrating this into agathon project um I'll just briefly talk about some different project ideas um there's we have actually seen an across has some relationships with different projects at the moment uh who are kind of trialing different usage for compos usages of composable bridging and this includes like someone's actually built a cross chain auction so from from from like one chain you can be you can be submitting tokens and bidding on on an on an nft auction on another chain that seems like a pretty pretty interesting use case and in that case when we talked to this project initially they were using the official Bridge uh to the destination chain and they were incurring a penalty of like you know 30 minutes to bridge uh a message in they were already bridging tokens of ir across so they would they had a scenario where the the tokens would arrive very very quickly you know within within you know say seconds or minutes of the initial deposit but then after uh then they would have to wait for this message to arrive after like 20 30 minutes to tell them what were those tokens for the advantage of of like using a cross composable bridging here is actually that the message and the tokens arrive together like by the time that the the Callback function is executing you already have the tokens and you've received them in your contract so you don't have any kind of synchronization to do about like you know did one arrive before the other another example of like what you could what you could build with this is is something like we're we're calling it onboarding internally but it's kind of like deposit automation so say maybe you have some tokens on ethereum and you want to bridge over to arbitrum and you want to like as soon as your tokens arrive you want to go further and deposit them into a lending protocol or something like that uh what you can do if you are that lending protocol uh or if you some kind of service that's sitting in between what you can do is you can integrate a cross composable Bridge and you can allow people to make their deposit directly from ethereum so it saves them a lot of hassle uh they don't have to wait they don't have to you know wait for like first the tokens to arrive and then they can go further and do something something else they basically you know they just bridge in and and the deposit happens automatically and so there's different there's different variations on this uh you can do like maybe you're just providing liquidity uh to a to to a protocol it could be maybe you are uh actually you know borrowing some maybe you're submitting a deposit to actually borrow back against it and that could also be automated by this um we've also kind of speculated that there could be uh you know like interacting with prediction markets uh obviously Uma has has some quite large prediction Market Integrations poly Market being the main one and four is also coming along as well so you know these are on polygon but what happens if you have you know you want to you want to kind of buy a position in a prediction Market from arbitrum or or ethereum or ZK sync it's like you don't need to bridge first and then uh buy you can you can actually bridge and then have the have the you know the purchased executed as soon as the tokens arrive uh and then there's like again like a bunch of different different kind of variations on this um for instance what we've kind of called here is is like zaps I think everyone's familiar with like hey you can zap into some kind of contract or zap into an asset you know there's there's there's a very big opportunity for for saying like offering kind of bespoke uh activity like you know if you want to deposit into some kind of two-sided amm uh then you can you know you can automate you know Bridging the funds across to the destination chain uh swap the right amount and make the deposit happen things like that um just some practicalities as well so we have a a test net up and running like this is actually supported in production this can be used today uh we also have test Nets so all of the girly test test Nets this is ethereum arbitrum optimism Bas uh ZK sync girly test Nets are supported um we also support polygon Mumbai so this is our this is our complete setup uh for test Nets we do prefer if you bridge ether we but we can actually support some other tokens so if you have a specific need for your project then please just get in touch with us you can find us in the big Hall there um another thing to mention is that the fees so the fees that the that the depositor pays uh is a percentage so so if your depositing usdc you'll pay a percentage of your usdc as a fee to the to the relayer and so on test Nets you can set this to 0 1% uh you can copy paste this number here that's that's fine um we also have on production we have an API endpoint that you can query so you collect all of your different uh deposit attributes and then you uh you provide them to our API and it will respond uh with with the fee that you just copy paste directly in uh I should also mention we also have some scripts and Tooling in our one of our repositories so all of our code is public you can you can find it on GitHub uh and basically we have some scripts that help you to make deposits so so you can at the command line you can you can type you know a single command and you can specify your message on the command line so this allows you to test like from from your from your from your command line without having to kind of build a lot of other things you can you as long as you've got a message that you want to send to a recipient contract you can just use this script to do it and then we also have another script that will that will fetch like if you provide it with a transaction hash it will fetch the right information and decode it for you so then you can see like did I submit it correctly or did something go wrong um also mentioned support this is really really important we have the top uh part here this uh notion page tiny url.com across Istanbul this is the place this is like the headquarters for our hackathon here we will make this uh you know we have all our references are from here um we're referring off to all of the necessary contract addresses how to get into our Discord uh how to get in touch with us basically and we will update that running through the through the hackathon so someone ask a question has a use case that we haven't addressed there we will update that so that people can can see that as well um the GitHub is also very important the relay V2 repository and the contracts V2 repositories are the main ones uh and of course our docs here as well uh but it's all referenced from the from the notion page so if you remember one thing that's that's the one to pick and that was my presentation on composable bridging
Automatic transcript — names and jargon may be misspelled.