DApps

Ethereum DApps: How to Listen for Events

Using the instance we created in step 2, we can subscribe to listen out for any events that it emits.Figure 4: Subscribe to ‘MyEvent’As stated earlier, the event we want to listen for is called MyEvent, and figure 4 shows us how. Our myContract instance has an accessor called events from which we can target MyEvent. This is an asynchronous function that returns a promise, and it’s called every time MyEvent is emitted.Line 3 defines what happens once data has been returned from the promise. Here we’re simply logging the

Insight on Liquidity from DeFi Protocols

Over the last year and a half, decentralized finance has had an explosion of activity. Lending and borrowing decentralized applications, margin trading, liquidity protocols, stablecoins, insurance and derivatives have all grown in user numbers, in on-chain activity and in product maturity. As DeFi has grown, the need to exchange value from one form to another has grown with it, and multiple liquidity providers have stepped up to service this growing need for liquidity. This is the natural evolution of any system, introducing expanding functionality and connectivity and as it grows. Based