pub struct FlamingoContract<'a, P: JsonRpcProvider> { /* private fields */ }
Expand description
Flamingo Finance contract interface for Neo N3
Flamingo Finance is a DeFi platform on Neo N3 offering trading, earning, and borrowing services. This contract interface provides methods to interact with the Flamingo Finance smart contract.
Implementations§
Source§impl<'a, P: JsonRpcProvider + 'static> FlamingoContract<'a, P>
impl<'a, P: JsonRpcProvider + 'static> FlamingoContract<'a, P>
Sourcepub const CONTRACT_HASH: &'static str = "f970f4cddcd087ab5d8a5697a32b3cfd32c8b465"
pub const CONTRACT_HASH: &'static str = "f970f4cddcd087ab5d8a5697a32b3cfd32c8b465"
The script hash of the Flamingo Finance contract on Neo N3 MainNet
Sourcepub const ADD_LIQUIDITY: &'static str = "addLiquidity"
pub const ADD_LIQUIDITY: &'static str = "addLiquidity"
Method name for adding liquidity
Sourcepub const REMOVE_LIQUIDITY: &'static str = "removeLiquidity"
pub const REMOVE_LIQUIDITY: &'static str = "removeLiquidity"
Method name for removing liquidity
Sourcepub const CLAIM_REWARDS: &'static str = "claimRewards"
pub const CLAIM_REWARDS: &'static str = "claimRewards"
Method name for claiming rewards
Sourcepub fn with_script_hash(
script_hash: ScriptHash,
provider: Option<&'a RpcClient<P>>,
) -> Self
pub fn with_script_hash( script_hash: ScriptHash, provider: Option<&'a RpcClient<P>>, ) -> Self
Sourcepub async fn swap(
&self,
from_token: &ScriptHash,
to_token: &ScriptHash,
amount: i64,
min_return: i64,
account: &Account,
) -> Result<TransactionBuilder<'_, P>, ContractError>
pub async fn swap( &self, from_token: &ScriptHash, to_token: &ScriptHash, amount: i64, min_return: i64, account: &Account, ) -> Result<TransactionBuilder<'_, P>, ContractError>
Swaps tokens on Flamingo Finance
§Arguments
from_token
- The script hash of the token to swap fromto_token
- The script hash of the token to swap toamount
- The amount of tokens to swapmin_return
- The minimum amount of tokens to receiveaccount
- The account that will sign the transaction
§Returns
A transaction builder that can be used to build and sign the transaction
Sourcepub async fn add_liquidity(
&self,
token_a: &ScriptHash,
token_b: &ScriptHash,
amount_a: i64,
amount_b: i64,
account: &Account,
) -> Result<TransactionBuilder<'_, P>, ContractError>
pub async fn add_liquidity( &self, token_a: &ScriptHash, token_b: &ScriptHash, amount_a: i64, amount_b: i64, account: &Account, ) -> Result<TransactionBuilder<'_, P>, ContractError>
Adds liquidity to a Flamingo Finance liquidity pool
§Arguments
token_a
- The script hash of the first tokentoken_b
- The script hash of the second tokenamount_a
- The amount of the first token to addamount_b
- The amount of the second token to addaccount
- The account that will sign the transaction
§Returns
A transaction builder that can be used to build and sign the transaction
Sourcepub async fn remove_liquidity(
&self,
token_a: &ScriptHash,
token_b: &ScriptHash,
liquidity: i64,
account: &Account,
) -> Result<TransactionBuilder<'_, P>, ContractError>
pub async fn remove_liquidity( &self, token_a: &ScriptHash, token_b: &ScriptHash, liquidity: i64, account: &Account, ) -> Result<TransactionBuilder<'_, P>, ContractError>
Removes liquidity from a Flamingo Finance liquidity pool
§Arguments
token_a
- The script hash of the first tokentoken_b
- The script hash of the second tokenliquidity
- The amount of liquidity tokens to removeaccount
- The account that will sign the transaction
§Returns
A transaction builder that can be used to build and sign the transaction
Sourcepub async fn stake(
&self,
token: &ScriptHash,
amount: i64,
account: &Account,
) -> Result<TransactionBuilder<'_, P>, ContractError>
pub async fn stake( &self, token: &ScriptHash, amount: i64, account: &Account, ) -> Result<TransactionBuilder<'_, P>, ContractError>
Sourcepub async fn claim_rewards(
&self,
account: &Account,
) -> Result<TransactionBuilder<'_, P>, ContractError>
pub async fn claim_rewards( &self, account: &Account, ) -> Result<TransactionBuilder<'_, P>, ContractError>
Trait Implementations§
Source§impl<'a, P: Clone + JsonRpcProvider> Clone for FlamingoContract<'a, P>
impl<'a, P: Clone + JsonRpcProvider> Clone for FlamingoContract<'a, P>
Source§fn clone(&self) -> FlamingoContract<'a, P>
fn clone(&self) -> FlamingoContract<'a, P>
1.0.0 · Source§const fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl<'a, P: Debug + JsonRpcProvider> Debug for FlamingoContract<'a, P>
impl<'a, P: Debug + JsonRpcProvider> Debug for FlamingoContract<'a, P>
Source§impl<'de, 'a, P> Deserialize<'de> for FlamingoContract<'a, P>where
P: Default + JsonRpcProvider,
impl<'de, 'a, P> Deserialize<'de> for FlamingoContract<'a, P>where
P: Default + JsonRpcProvider,
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl<'a, P: JsonRpcProvider> Serialize for FlamingoContract<'a, P>
impl<'a, P: JsonRpcProvider> Serialize for FlamingoContract<'a, P>
Source§impl<'a, P: JsonRpcProvider> SmartContractTrait<'a> for FlamingoContract<'a, P>
impl<'a, P: JsonRpcProvider> SmartContractTrait<'a> for FlamingoContract<'a, P>
type P = P
fn script_hash(&self) -> H160
fn set_script_hash(&mut self, script_hash: H160)
fn provider(&self) -> Option<&RpcClient<P>>
const DEFAULT_ITERATOR_COUNT: usize = 100usize
fn name<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = String> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn set_name(&mut self, _name: String)
fn invoke_function<'life0, 'life1, 'async_trait>(
&'life0 self,
function: &'life1 str,
params: Vec<ContractParameter>,
) -> Pin<Box<dyn Future<Output = Result<TransactionBuilder<'_, Self::P>, ContractError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn build_invoke_function_script<'life0, 'life1, 'async_trait>(
&'life0 self,
function: &'life1 str,
params: Vec<ContractParameter>,
) -> Pin<Box<dyn Future<Output = Result<Bytes, ContractError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn call_function_returning_string<'life0, 'life1, 'async_trait>(
&'life0 self,
function: &'life1 str,
params: Vec<ContractParameter>,
) -> Pin<Box<dyn Future<Output = Result<String, ContractError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn call_function_returning_int<'life0, 'life1, 'async_trait>(
&'life0 self,
function: &'life1 str,
params: Vec<ContractParameter>,
) -> Pin<Box<dyn Future<Output = Result<i32, ContractError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn call_function_returning_bool<'life0, 'life1, 'async_trait>(
&'life0 self,
function: &'life1 str,
params: Vec<ContractParameter>,
) -> Pin<Box<dyn Future<Output = Result<bool, ContractError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn call_invoke_function<'life0, 'life1, 'async_trait>(
&'life0 self,
function: &'life1 str,
params: Vec<ContractParameter>,
signers: Vec<Signer>,
) -> Pin<Box<dyn Future<Output = Result<InvocationResult, ContractError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn throw_if_fault_state( &self, output: &InvocationResult, ) -> Result<(), ContractError>
fn call_function_returning_script_hash<'life0, 'life1, 'async_trait>(
&'life0 self,
function: &'life1 str,
params: Vec<ContractParameter>,
) -> Pin<Box<dyn Future<Output = Result<H160, ContractError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn call_function_returning_iterator<'life0, 'life1, 'async_trait, U>( &'life0 self, function: &'life1 str, params: Vec<ContractParameter>, mapper: Arc<dyn Fn(StackItem) -> U + Send + Sync>, ) -> Pin<Box<dyn Future<Output = Result<NeoIterator<'_, U, Self::P>, ContractError>> + Send + 'async_trait>>
fn call_function_and_unwrap_iterator<'life0, 'life1, 'async_trait, U>(
&'life0 self,
function: &'life1 str,
params: Vec<ContractParameter>,
_max_items: usize,
mapper: impl 'async_trait + Fn(StackItem) -> U + Send,
) -> Pin<Box<dyn Future<Output = Result<Vec<U>, ContractError>> + Send + 'async_trait>>where
U: 'async_trait,
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn calc_native_contract_hash(contract_name: &str) -> Result<H160, ContractError>
fn calc_contract_hash( sender: H160, nef_checksum: u32, contract_name: &str, ) -> Result<H160, ContractError>
fn get_manifest<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = ContractManifest> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Auto Trait Implementations§
impl<'a, P> Freeze for FlamingoContract<'a, P>
impl<'a, P> !RefUnwindSafe for FlamingoContract<'a, P>
impl<'a, P> Send for FlamingoContract<'a, P>
impl<'a, P> Sync for FlamingoContract<'a, P>
impl<'a, P> Unpin for FlamingoContract<'a, P>
impl<'a, P> !UnwindSafe for FlamingoContract<'a, P>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more