Skip to main content

Questions tagged [defi]

Decentralized finance offers financial instruments without relying on intermediaries such as brokerages, exchanges, or banks by using smart contracts on a blockchain.

Filter by
Sorted by
Tagged with
10 votes
3 answers
2k views

Flash loan security considerations and attacks

What do developers need to be aware of to make their contracts and systems safe against flash loans? What do they have to think about and protect against?
eth's user avatar
  • 86.5k
4 votes
5 answers
7k views

Error: contract runner does not support sending transactions (operation="sendTransaction", code=UNSUPPORTED_OPERATION, version=6.6.3)

I got this error when tried to deposit eth to weth contact from mainnet, using hardhat forking, does anyone know how to fix this error ? const { getNamedAccounts, ethers, } = require("hardhat&...
sohd9's user avatar
  • 325
3 votes
5 answers
5k views

UniSwap V3 API : How to track **unclaimed fees** programmatically?

I have invested in UniSwap-V3 Liquidity Pool. And how to track unclaimed fees programmatically? I plan to have server-backend API fetch data to track unclaimed fees ($27.92 in picture) I have tried ...
riseres's user avatar
  • 133
1 vote
1 answer
668 views

ETH-Brownie How can I import from github when the version number includes letters and numbers?

Normally you can import npm style via a brownie-config.yaml file like so: dependencies: - uniswap/[email protected] compiler: solc: remappings: - 'uniswap=uniswap/[email protected]....
Pickinanameainteasy's user avatar
0 votes
2 answers
3k views

How to get the virtual and real reserves from a Uniswap V3 pair?

I need help with math of Uniswap V3 virtual and real reserves. Need to find the true reserves of a pair. Example: let's say we have this DAI/WETH pair: 0x60594a405d53811d3BC4766596EFD80fd545A270 ...
Chenky's user avatar
  • 21
10 votes
4 answers
11k views

What is INIT_CODE_HASH and how is it calculated / used in DeFi smart contracts

I am forking the Sushiswap Exchange code for educational purposes, and I have come across a variable in the code called INIT_CODE_HASH. I am struggling to understand exactly how this variable works, ...
Dev Oskii's user avatar
  • 870
7 votes
3 answers
1k views

What is DeFi decentralized finance?

What is DeFi? What are its core components? How to think about or picture "it"? Some of the parts are tokens, stablecoins (tokens with specific properties to reduce its volatility), and exchanges, ...
eth's user avatar
  • 86.5k
4 votes
2 answers
989 views

Why do we grant access to our funds instead of just sending them to the smart contract?

In DeFi I have seen that users are prompted to give access to their funds. Why not just send those funds to the smart contract instead? What is the advantage of this design?
YulePale's user avatar
  • 1,853
3 votes
0 answers
397 views

Example of flash minting ether

The WETH10 project offers a flash minting feature. This contract allows to flashMint an arbitrary amount of Wrapped Ether, unbacked by real Ether, with the condition that it is burned before the end ...
eth's user avatar
  • 86.5k
2 votes
0 answers
357 views

How to deal with funds lost to rounding errors in DeFi protocols?

What are the different methods that DeFi protocols use to handle rounding errors? For example say I have an ICO contract that returns 1/1e10 of the ICO token per ETH, so if you deposit 1 ETH(1e18 wei) ...
MShakeG's user avatar
  • 1,855
2 votes
3 answers
2k views

What are the risks of DeFi lending?

The interest rates for lending stable-coins on some of these platforms can be extremely high...I'm old enough to know that with returns like this there has to be a catch :) I'm trying to understand ...
jkp's user avatar
  • 121
1 vote
3 answers
2k views

what is math for uniswap calculates the amountout and amountin why 997 and 1000

function getAmountOut(uint amountIn, uint reserveIn, uint reserveOut) internal pure returns (uint amountOut) {//the amount of user,amount in pool,output token amount in pool require(amountIn > ...
shiva sai's user avatar
1 vote
1 answer
294 views

How are Uniswap fees distributed equally factoring in both proportion and duration pooled?

A similar question has already been asked, however a satisfactory answer has not yet been provided. The Uniswap V2 Pools docs states: If the provider is minting a new pool, the number of liquidity ...
MShakeG's user avatar
  • 1,855
1 vote
0 answers
1k views

"VM Exception while processing transaction: revert" in DeFi tutorial app

I get this error while trying to use stakingBalance method. I think it has something to do with approval but I am not sure here is the full error : Uncaught (in promise) Error: Internal JSON-RPC error....
ajkatom's user avatar
  • 11
1 vote
1 answer
557 views

How Etherscan calculate Transaction actions?

I would like to know If anyone knows how Etherscan calculates the "Transaction actions". For example: https://etherscan.io/tx/...
G Sco's user avatar
  • 11
0 votes
1 answer
1k views

How to create a Payable function that only accepts a customer token?

I've got a question that I cannot seem to find an answer for, hoping the community can help (and this is my first post here so my apologies if this is the wrong question to ask in the first place). I ...
nukalov's user avatar
  • 103