Questions tagged [defi]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
1
vote
3answers
51 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 ...
0
votes
0answers
22 views

When forking MainNet with ganache-cli and trying to interact with contract -> error thrown

Forked MainNet with Ganache-ClI wrote script to interact with on-chain DAI contract to send some Dai to account Unlocked the DAI contract const Web3 = require('web3'); const daiAbi = require('/Users/...
2
votes
1answer
14 views

MakerDAO Liquidation Mechanism

Could you please explain, what happens when the collateral price goes down(but doesn't hit the liquidation ratio) and the user neither doesn't deposit extra collateral nor doesn't possess enough dai ...
1
vote
0answers
19 views

DeFi stakers / investors: how do you get your information? [closed]

With so many different options, how do you do your information gathering to know where the best rates are? I know you could put a dashboard together yourself in Google Sheets or R, but is that really ...
6
votes
0answers
672 views

SushiSwap - Inner workings?

I've been trying out in the past few days SushiSwap and lately SashimiSwap Contracts & Frontend and while I'm still getting familiar with the code. It turned out to be quite a challenge to make it ...
2
votes
4answers
129 views

Why are lending rates on USD based stable coins so different?

Since DAI is a USD based stable coin along with USDT and USDC, then why are their lending rates so different? In theory, the risks behind owning any of these stable-coins is similar so their lending ...
0
votes
1answer
477 views

How to swap ETH to WETH on Uniswap

I'm trying to swap ETH to WETH tokens within contract, but cannot find any information how to do it. Can anybody help? Thanks!
1
vote
1answer
92 views

Flash loan compile error with function() external payable

I am attempting to compile a flash loan contract. I am having issues with the external payable function. I've tried adding fallback or receive as the error message suggests but I still receive the ...
8
votes
4answers
560 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?
0
votes
1answer
96 views

Must I add WETH conversion descritpion in a contract and how?

I'm confused about how I write a contract about WETH conversion. When we write a smartcontract depositing user funds into a contract, should we necessarily write some codes of converting eth into weth ...
0
votes
1answer
72 views

walletlink and/or walletconnect on mobile browser

I want to use DeFi apps over my mobile or mobile browser. Is there a way to connect to my wallet (Metmask, etc.) to the DeFi apps on my mobile or mobile browser? I don't want to use the DeFi apps on ...
3
votes
1answer
204 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, ...
0
votes
1answer
30 views

Why cast address to address?

In defi contracts, I see codes like this address public constant dai = address(0x6B175474E89094C44Da98b954EedeAC495271d0F); What's the point of casting an address to address? Or is this just messy ...
1
vote
1answer
34 views

Uniswap V1 Calculation of token_amount When Adding Liquidity

In the Exchange contract of Uniswap v1, the addLiquidity function involves calculating token_amount using the formula token_amount: uint256 = msg.value * token_reserve / eth_reserve + 1 Why is there ...
0
votes
0answers
22 views

UniSwapV2Router.sol contract failing - “Gas required exceed allowance / Always failing transaction”

I am trying to recreate the Sushiswap protocol for educational reasons, but I am stumbling into an issue. When I try to run the addLiquidity function inside the UniswapV2Router.sol contract with the ...
2
votes
0answers
23 views

How does the Dai stablize?

I am interested in the Dai stable coin and have seen multiple different explanations of how the coin balances and pegs to the $1. One said it was to do with the increase or decrease in interest rates ...
1
vote
1answer
65 views

Flashloan callFunction being called internally

I had a chance to look at this contract. contract Flashloan is DyDxFlashLoan { uint256 public loan; constructor() public payable { (bool success, ) = WETH.call.value(msg.value)("&...
1
vote
0answers
54 views

Flash minting ether security considerations and attacks

Flash loans enable a class of attacks that have not been possible or observed as much in prior systems. Flash minting ether is a concept that is starting to be implemented. See Example of flash ...
3
votes
0answers
84 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 ...
0
votes
0answers
113 views

What factory (UniswapV2Factory) shoud I use when deploy Sushiswap clone?

Hi I'm forking Sushiswap and about to deploy contract to mainnet. While I'm writing deploy_contract.js in Truffle. Which Factory shoud I use in my migration code? I saw several code example but ...
6
votes
0answers
59 views

How does the Dai peg to dollar?

I am interested in the Dai stable coin and have seen multiple different explanations of how the coin balances and pegs to the $1. One said it was to do with the increase or decrease in interest rates ...
2
votes
1answer
30 views

Bundling two assets in a contract and issuing shares for them

Say you are tasked with coding a smart contract with the following features: Users can deposit token A and receive liquidity shares in return. The contract starts selling token A for token B ...
1
vote
0answers
35 views

Are oracles too slow for DEFI arbitrage?

It seems that a lot of platforms that make you money via 'arbitrage' rely on Oracles to find a profitable spread opportunity. I assume users are competing against other users (on the same platform) ...
0
votes
0answers
47 views

Can we compare bonding curve tokens to a ponzi scheme?

Bonding curve tokens are, unlike ICO, not driven by the market, but priced by a smart contract. They are based on the following two main properties : Limitless supply : Tokens are minted as the ...
0
votes
0answers
38 views

Uniswap Fee or how 180 AMPL tokens suddenly “disappeared” from blockchain

If you look at https://etherscan.io/token/0xd46ba6d942050d489dbd938a2c909a5d5039a161?a=0xfe6c9c5a0d36eba3a767aaf6df2f335e666a74e7, you can notice that there were 3 transactions associated with the ...
0
votes
0answers
24 views

Could there be multiple asset pools In a DAMM liquidity pool?

In a DAMM (dynamic automated market making) DEX (decentralized exchange) the ration between two assets, e.g. DAI/ETH does not have to be 50/50 anymore, like it used to be in a AMM, (automated market ...
1
vote
0answers
14 views

historical quotes on decentralised exchange

Dears, I'm new in Eth programming, just started to learn Solidity, so need advice. I want to see historical prices for certain currency pair (say, USDT/DAI) traded on decentralised exchanges like ...
3
votes
2answers
259 views

How could Compound's interest accruing every block? How's that implemented?

Here I'm referring to https://compound.finance, which is quite an awesome product. One thing inspires me most is that the interests accrued in Compound are updated per block. How's that even possible?...
0
votes
1answer
349 views

What are DeFi tokens ? How to create them in Ethereum?

I found about Defi that; “DeFi is an ecosystem comprised of applications built on top of public distributed ledgers, for the facilitation of permissionless financial services.” Broadly speaking, DeFi ...
1
vote
1answer
41 views

How are decentralised leverage platforms like dydx able to provide leverage to the traders? [closed]

I just started getting along the fundamentals of DeFi and was planning to make a basic decentralised leverage trading platform. I have the confusion as to how the existing platforms(like dydx, DDEX ...
0
votes
0answers
26 views

Uniswap V1: Why does EthToTokenInput not refund overpaid ether?

ethToTokenInput on the Uniswap V1 contract converts all the sent ether to tokens and transfers the tokens to the recipient. Lets assume 1 ether buys you 3.9 tokens according to getInputPrice(). If ...
4
votes
1answer
615 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, ...