Skip to main content

flashloan_rs/
errors.rs

1use thiserror::Error;
2
3/// A Flashloan Builder Error
4#[derive(Error, Debug, Clone)]
5pub enum FlashloanError {
6    /// Failed to create the contract deployer
7    #[error("Failed to create flashloan borrower contract deployer!")]
8    ContractDeployError,
9    /// Failed to deploy the contract
10    #[error("Failed to deploy flashloan borrower contract!")]
11    ContractDeployFailed,
12    /// Missing the flashloan borrower contract
13    #[error("Missing flashloan borrower contract definition. Use the `FlashloanBuilder::with_borrower` method to set the contract address or deploy a new instance with `FlashloanBuilder::deploy`")]
14    MissingBorrower,
15    /// Failed to construct call
16    #[error("Failed to construct call: {0}")]
17    CallConstructionError(String),
18    /// Missing token address
19    #[error("Missing token address to borrow. Use the `FlashloanBuilder::with_token` method to set the token address")]
20    MissingToken,
21    /// Missing amount
22    #[error("Missing amount to borrow. Use the `FlashloanBuilder::with_amount` method to set the amount to borrow")]
23    MissingAmount,
24    /// Failed to execute contract call
25    #[error("Failed to execute contract call: {0}")]
26    ContractError(String),
27    /// Failed to get accounts from web3 provider
28    #[error("Failed to get accounts from client. Error: {0}")]
29    ClientFailure(String),
30    /// Missing the flashloan borrower owner account
31    #[error("Missing owner account. Use the `FlashloanBuilder::with_owner` method to set the owner account")]
32    MissingOwner,
33}