Skip to content

Commit

Permalink
fix: lint
Browse files Browse the repository at this point in the history
  • Loading branch information
veeso committed Nov 10, 2023
1 parent ad40279 commit 210362f
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 15 deletions.
12 changes: 6 additions & 6 deletions src/dilazionato/src/app/storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,21 +70,21 @@ fn with_contracts<T, F>(f: F) -> T
where
F: FnOnce(&BTreeMap<StorableNat, Contract, VirtualMemory<DefaultMemoryImpl>>) -> T,
{
CONTRACTS.with_borrow(|contracts| f(&contracts))
CONTRACTS.with_borrow(|contracts| f(contracts))
}

fn with_contracts_mut<T, F>(f: F) -> T
where
F: FnOnce(&mut BTreeMap<StorableNat, Contract, VirtualMemory<DefaultMemoryImpl>>) -> T,
{
CONTRACTS.with_borrow_mut(|mut contracts| f(&mut contracts))
CONTRACTS.with_borrow_mut(|contracts| f(contracts))
}

fn with_tokens<T, F>(f: F) -> T
where
F: FnOnce(&BTreeMap<StorableNat, Token, VirtualMemory<DefaultMemoryImpl>>) -> T,
{
TOKENS.with_borrow(|tokens| f(&tokens))
TOKENS.with_borrow(|tokens| f(tokens))
}

fn with_token<T, F>(id: &TokenIdentifier, f: F) -> SellContractResult<T>
Expand Down Expand Up @@ -125,19 +125,19 @@ fn with_tokens_mut<T, F>(f: F) -> T
where
F: FnOnce(&mut BTreeMap<StorableNat, Token, VirtualMemory<DefaultMemoryImpl>>) -> T,
{
TOKENS.with_borrow_mut(|mut tokens| f(&mut tokens))
TOKENS.with_borrow_mut(|tokens| f(tokens))
}

fn with_tx_history<T, F>(f: F) -> T
where
F: FnOnce(&BTreeMap<StorableNat, StorableTxEvent, VirtualMemory<DefaultMemoryImpl>>) -> T,
{
TX_HISTORY.with_borrow(|tx_history| f(&tx_history))
TX_HISTORY.with_borrow(|tx_history| f(tx_history))
}

fn with_tx_history_mut<T, F>(f: F) -> T
where
F: FnOnce(&mut BTreeMap<StorableNat, StorableTxEvent, VirtualMemory<DefaultMemoryImpl>>) -> T,
{
TX_HISTORY.with_borrow_mut(|mut tx_history| f(&mut tx_history))
TX_HISTORY.with_borrow_mut(|tx_history| f(tx_history))
}
6 changes: 3 additions & 3 deletions src/dilazionato/src/app/storage/contracts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ impl ContractStorage {
token.burned_by = Some(crate::utils::caller());

// register burn
let tx_id = TxHistory::register_token_burn(&token);
let tx_id = TxHistory::register_token_burn(token);

Ok((tx_id, token.clone()))
})?;
Expand Down Expand Up @@ -199,7 +199,7 @@ impl ContractStorage {
token.transferred_by = Some(crate::utils::caller());

// register transfer
let tx_id = TxHistory::register_transfer(&token);
let tx_id = TxHistory::register_transfer(token);

Ok(tx_id)
})
Expand Down Expand Up @@ -941,7 +941,7 @@ mod test {
};

assert!(ContractStorage::insert_contract(contract.clone(), vec![token_1.clone()]).is_ok());
let buyer = seller.clone();
let buyer = seller;
assert!(ContractStorage::update_contract_buyers(
&contract_id,
vec![Principal::anonymous(), buyer]
Expand Down
10 changes: 5 additions & 5 deletions src/dilazionato/src/client/fly_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,18 @@ impl FlyClient {
/// Get contract reward. Returns $mFly
pub async fn get_contract_reward(
&self,
contract_id: ID,
installments: u64,
_contract_id: ID,
_installments: u64,
) -> SellContractResult<u64> {
todo!()
}

/// Send reward to new owner reducing the balance from the pool associated to the contract, for the value of mFly
pub async fn send_reward(
&self,
contract_id: ID,
mfly: u64,
new_owner: Principal,
_contract_id: ID,
_mfly: u64,
_new_owner: Principal,
) -> SellContractResult<()> {
todo!()
}
Expand Down
2 changes: 1 addition & 1 deletion src/dilazionato/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,6 @@ mod test {

#[test]
fn test_should_parse_date() {
assert_eq!(parse_date("2023-11-08").unwrap(), 1699401600_000_000_000);
assert_eq!(parse_date("2023-11-08").unwrap(), 1_699_401_600_000_000_000);
}
}

0 comments on commit 210362f

Please sign in to comment.