Skip to content

Commit

Permalink
fix - fix contract binding issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Dvisacker committed Sep 25, 2024
1 parent 74fce75 commit 17b1392
Show file tree
Hide file tree
Showing 25 changed files with 25 additions and 88 deletions.
9 changes: 9 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@ version = "0.1.0"
edition = "2021"

[dependencies]
bindings = { path = "./src/bindings" }
tokio = { version = "1.40.0", features = ["full"] }
alloy = { version = "0.3.3", features = ["full"] }
alloy-primitives = "0.8"
alloy-rpc-types = "0.3.3"
alloy-contract = "0.3.3"
alloy-sol-types = "0.8.3"
alloy-consensus = "0.3.3"
teloxide = { version = "0.13.0", features = ["full"] }
Expand Down
19 changes: 1 addition & 18 deletions aave-pool-abi.json → ILendingPool.json
Original file line number Diff line number Diff line change
Expand Up @@ -2227,21 +2227,4 @@
"stateMutability": "nonpayable",
"type": "function"
}
]


7237005577332262213973187317040823336706252649385398494942757770499441565754,
1032177298231527184190952531,
19134320813521574388905924,
1071435268085129654073234081,
25987092370809719795466300,
0,
1727186935,
4,
0xe50fA9b3c56FfB159cB0FCA61F5c9D750e8128c8,
0xD8Ad37849950903571df17049516a5CD4cbE55F6,
0x0c84331e39d6658Cd6e6b9ba04736cC4c4734351,
0xC2c6DF6a8B6cc79a6F927a1FFAE602c701C374Ea,
315497387612874979,
0,
0
]
7 changes: 0 additions & 7 deletions bindings/Cargo.toml

This file was deleted.

8 changes: 8 additions & 0 deletions src/bindings/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[package]
name = "bindings"
version = "0.1.0"
edition = "2021"

[dependencies]
alloy = { version = "0.3.3", features = ["full"] }
# alloy = { git = "https://github.com/alloy-rs/alloy", rev = "0.3.3", features = ["sol-types", "contract"] }
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
68 changes: 5 additions & 63 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,75 +11,17 @@ use std::sync::Arc;
use std::time::Duration;
use teloxide::prelude::*;
use tokio::time;
use IAAVE::IAAVEInstance;
use ILendingPool::ILendingPoolInstance;
use IERC20::IERC20Instance;

pub mod config;
pub mod provider;

// sol! {

// #[derive(Debug, PartialEq, Eq)]
// #[sol(rpc)]
// struct ReserveConfigurationMap {
// uint256 data;
// }

// #[derive(Debug, PartialEq, Eq)]
// #[sol(rpc)]
// struct ReserveData {
// //stores the reserve configuration
// ReserveConfigurationMap configuration;
// //the liquidity index. Expressed in ray
// uint128 liquidityIndex;
// //the current supply rate. Expressed in ray
// uint128 currentLiquidityRate;
// //variable borrow index. Expressed in ray
// uint128 variableBorrowIndex;
// //the current variable borrow rate. Expressed in ray
// uint128 currentVariableBorrowRate;
// //the current stable borrow rate. Expressed in ray
// uint128 currentStableBorrowRate;
// //timestamp of last update
// uint40 lastUpdateTimestamp;
// //the id of the reserve. Represents the position in the list of the active reserves
// uint16 id;
// //timestamp until when liquidations are not allowed on the reserve, if set to past liquidations will be allowed
// uint40 liquidationGracePeriodUntil;
// //aToken address
// address aTokenAddress;
// //stableDebtToken address
// address stableDebtTokenAddress;
// //variableDebtToken address
// address variableDebtTokenAddress;
// //address of the interest rate strategy
// address interestRateStrategyAddress;
// //the current treasury balance, scaled
// uint128 accruedToTreasury;
// //the outstanding unbacked aTokens minted through the bridging feature
// uint128 unbacked;
// //the outstanding debt borrowed against this asset in isolation mode
// uint128 isolationModeTotalDebt;
// //the amount of underlying accounted for by the protocol
// uint128 virtualUnderlyingBalance;
// }

// #[derive(Debug, PartialEq, Eq)]
// #[sol(rpc)]
// contract IAAVE {
// function supply(address asset, uint256 amount, address onBehalfOf, uint16 referralCode) external;
// function borrow(address asset, uint256 amount, uint256 interestRateMode, uint16 referralCode, address onBehalfOf) external;
// function getUserAccountData(address user) external view returns (uint256 totalCollateralBase, uint256 totalDebtBase, uint256 availableBorrowsBase, uint256 currentLiquidationThreshold, uint256 ltv, uint256 healthFactor);
// function getReserveData(address asset) external view returns (ReserveData);

// }
// }

sol!(
#[sol(rpc)]
#[derive(Debug, PartialEq, Eq)]
IAAVE,
"aave-pool-abi.json"
ILendingPool,
"./ILendingPool.json"
);

sol! {
Expand All @@ -95,7 +37,7 @@ struct AaveLooper {
provider: Arc<SignerProvider>,
signer_address: Address,
asset_address: Address,
aave: IAAVEInstance<BoxTransport, Arc<SignerProvider>>,
aave: ILendingPoolInstance<BoxTransport, Arc<SignerProvider>>,
asset: IERC20Instance<BoxTransport, Arc<SignerProvider>>,
amount: U256,
leverage: u8,
Expand All @@ -115,7 +57,7 @@ impl AaveLooper {
telegram_token: String,
chat_id: i64,
) -> Result<Arc<Self>, Box<dyn Error>> {
let aave = IAAVE::new(aave_address, provider.clone());
let aave = ILendingPool::new(aave_address, provider.clone());
let asset = IERC20::new(asset_address, provider.clone());
let signer_address = provider.default_signer_address();
// let telegram_bot = Bot::new(telegram_token);
Expand Down

0 comments on commit 17b1392

Please sign in to comment.