Skip to content

Commit

Permalink
bet
Browse files Browse the repository at this point in the history
  • Loading branch information
dlaciport committed Mar 6, 2025
1 parent 7a2e8b9 commit f46aab8
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
15 changes: 9 additions & 6 deletions margin/src/margin.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ pub mod Margin {
};
use margin::{
interface::{
IMargin, IERC20MetadataForPragma, IERC20MetadataForPragmaDispatcher,
,
IMargin, IERC20MetadataForPragma, IERC20MetadataForPragmaDispatcherTrait,
IERC20MetadataForPragmaDispatcher,
},
types::{Position, TokenAmount, PositionParameters},
};
use margin::mocks::erc20_mock::{ERC20Mock, IERC20MetadataForPragmaImpl};
use alexandria_math::{BitShift, shl};
use margin::mocks::erc20_mock::{};
use alexandria_math::{BitShift, U256BitShift};

use openzeppelin::token::erc20::interface::{IERC20Dispatcher};
use margin::pragma::mock_get_data_median;
Expand Down Expand Up @@ -87,9 +87,12 @@ pub mod Margin {
}
.symbol();

let pair_id = shl(token_symbol, 4) + '/USD';
let token_symbol_u256: u256 = token_symbol.into();
let pair_id = BitShift::shl(token_symbol_u256, 4) + '/USD';

return mock_get_data_median(1234, DataType::SpotEntry(pair_id));
return mock_get_data_median(
1234, DataType::SpotEntry(pair_id.try_into().expect('pair id overflows')),
);
}
}
}
3 changes: 2 additions & 1 deletion margin/src/mocks/erc20_mock.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ pub mod ERC20Mock {
self.erc20.mint(recipient, initial_supply);
}

impl IERC20MetadataForPragmaImpl of IERC20MetadataForPragma<ContractState> {
#[embeddable_as(ERC20MetadataForPragmaImpl)]
impl ERC20MetadataForPragma of IERC20MetadataForPragma<ContractState> {
fn name(self: @ContractState) -> ByteArray {
self.erc20.ERC20_name.read()
}
Expand Down

0 comments on commit f46aab8

Please sign in to comment.