'brownie-config.yaml TRC20 aave_lending_pool_v2
I'm a programmer new to the blockchain technology.
I've looked for a python cryptotrading bot source code and stumble upon all those uber kewl technologies as blockchain, aave, flashloan, solidity and arbitrage cryptotrading.
I've successfully deployed a flashloan with solidity and some brownie python here is the code:
Flashloan:
pragma solidity ^0.6.6;
import "./aave/FlashLoanReceiverBaseV2.sol";
import "../../interfaces/v2/ILendingPoolAddressesProviderV2.sol";
import "../../interfaces/v2/ILendingPoolV2.sol";
contract FlashloanV2 is FlashLoanReceiverBaseV2, Withdrawable {
constructor(address _addressProvider) FlashLoanReceiverBaseV2(_addressProvider) public {}
/**
* @dev This function must be called only be the LENDING_POOL and takes care of repaying
* active debt positions, migrating collateral and incurring new V2 debt token debt.
*
* @param assets The array of flash loaned assets used to repay debts.
* @param amounts The array of flash loaned asset amounts used to repay debts.
* @param premiums The array of premiums incurred as additional debts.
* @param initiator The address that initiated the flash loan, unused.
* @param params The byte array containing, in this case, the arrays of aTokens and aTokenAmounts.
*/
function executeOperation(
address[] calldata assets,
uint256[] calldata amounts,
uint256[] calldata premiums,
address initiator,
bytes calldata params
)
external
override
returns (bool)
{
//
// This contract now has the funds requested.
// Your logic goes here.
//
// At the end of your logic above, this contract owes
// the flashloaned amounts + premiums.
// Therefore ensure your contract has enough to repay
// these amounts.
// Approve the LendingPool contract allowance to *pull* the owed amount
for (uint i = 0; i < assets.length; i++) {
uint amountOwing = amounts[i].add(premiums[i]);
IERC20(assets[i]).approve(address(LENDING_POOL), amountOwing);
}
return true;
}
function _flashloan(address[] memory assets, uint256[] memory amounts) internal {
address receiverAddress = address(this);
address onBehalfOf = address(this);
bytes memory params = "";
uint16 referralCode = 0;
uint256[] memory modes = new uint256[](assets.length);
// 0 = no debt (flash), 1 = stable, 2 = variable
for (uint256 i = 0; i < assets.length; i++) {
modes[i] = 0;
}
LENDING_POOL.flashLoan(
receiverAddress,
assets,
amounts,
modes,
onBehalfOf,
params,
referralCode
);
}
/*
* Flash multiple assets
*/
function flashloan(address[] memory assets, uint256[] memory amounts) public onlyOwner {
_flashloan(assets, amounts);
}
/*
* Flash loan 1000000000000000000 wei (1 ether) worth of `_asset`
*/
function flashloan(address _asset) public onlyOwner {
bytes memory data = "";
uint amount = 0.0001 ether;
address[] memory assets = new address[](1);
assets[0] = _asset;
uint256[] memory amounts = new uint256[](1);
amounts[0] = amount;
_flashloan(assets, amounts);
}
}
brownie-config.yaml:
dotenv: .env
# use Ganache's forked mainnet mode as the default network
networks:
default: mainnet-fork
# automatically fetch contract sources from Etherscan
autofetch_sources: True
# require OpenZepplin Contracts v3.0.0
dependencies:
- OpenZeppelin/[email protected]
# path remapping to support OpenZepplin imports with NPM-style path
compiler:
solc:
remappings:
- "@openzeppelin=OpenZeppelin/[email protected]"
networks:
ropsten:
aave_lending_pool_v2: "0x88757f2f99175387ab4c6a4b3067c77a695b0349"
weth: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2"
#aave_lending_pool_v2: "0x81b7e08f65bdf5648606c89998a9cc8164397647"
#weth: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2"
# host: https://ropsten.infura.io/v3/$WEB3_INFURA_PROJECT_ID
aave_lending_pool_v2: "0x7d2768dE32b0b80b7a3454c06BdAc94A69DDc7A9"
development:
aave_lending_pool_v2: http://localhost:8545
# weth: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2"
mainnet-fork:
aave_lending_pool_v2: "0xB53C1a33016B2DC2fF3653530bfF1848a515c8c5"
weth: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2"
kovan:
aave_lending_pool_v2: "0x88757f2f99175387ab4c6a4b3067c77a695b0349"
weth: "0xd0a1e359811322d97991e03f863a0c30c2cf029c"
mainnet:
aave_lending_pool_v2: "0xB53C1a33016B2DC2fF3653530bfF1848a515c8c5"
weth: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2"
wallets:
from_key: ${PRIVATE_KEY}
from_mnemonic: ${MNEMONIC}
Those are ERC20 pools, and I need the TRC20. Can someone provide me the aave_lending_pool_v2 and the weth of a TRC20 network?
telegram: @Afterlife_77
edit: or does anyone knows of a technique converting erc20 tokens to trc20? I know binance can do that but it doesn't work with Israel as of lately.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
