Please, can someone have a working example of the code?
- Deploy contract using Remix
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.10;
import { IPool } from "@aave/core-v3/contracts/interfaces/IPool.sol";
import { IPoolAddressesProvider } from "@aave/core-v3/contracts/interfaces/IPoolAddressesProvider.sol";
import { IAToken } from "@aave/core-v3/contracts/interfaces/IAToken.sol";
interface IERC20 {
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address from,
address to,
uint256 amount
) external returns (bool);
}
contract Deposit {
constructor() {}
function setDeposit() public returns(uint256) {
IPoolAddressesProvider provider = IPoolAddressesProvider(address(0xc4dCB5126a3AfEd129BC3668Ea19285A9f56D15D));
IPool pool = IPool(provider.getPool());
IERC20(0x326C977E6efc84E512bB9C30f76E30c160eD06FB).transferFrom(msg.sender, address(this), 1*10**10);
IERC20(0x326C977E6efc84E512bB9C30f76E30c160eD06FB).approve(address(pool), type(uint256).max);
pool.deposit(0x326C977E6efc84E512bB9C30f76E30c160eD06FB, 1*10**10, 0x0Bf0Dc06F8F1b6AD19F63CE88066F693FaF18e2B, 0);
return IERC20(0x326C977E6efc84E512bB9C30f76E30c160eD06FB).allowance(address(this), address(pool));
}
}
-
Approve 10000000000 LINK token for contract address
-
Run function setDeposit using Remix
ERROR