Skip to content

Commit

Permalink
refactor: make use erc20 from oz
Browse files Browse the repository at this point in the history
  • Loading branch information
JhChoy committed Aug 2, 2024
1 parent 6f40a10 commit 49e88a8
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 27 deletions.
4 changes: 2 additions & 2 deletions src/book_manager.cairo
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
#[starknet::contract]
pub mod BookManager {
use openzeppelin::introspection::src5::SRC5Component;
use openzeppelin::token::erc20::interface::{IERC20Dispatcher, IERC20DispatcherTrait};
use openzeppelin::token::erc721::{ERC721Component, ERC721HooksEmptyImpl};
use openzeppelin::access::ownable::OwnableComponent;
use core::num::traits::zero::Zero;
use starknet::storage::Map;
use starknet::{ContractAddress, get_caller_address, get_contract_address};
use clober_cairo::interfaces::book_manager::IBookManager;
use clober_cairo::interfaces::locker::{ILockerDispatcher, ILockerDispatcherTrait};
use clober_cairo::interfaces::erc20::{IERC20Dispatcher, IERC20DispatcherTrait};
use clober_cairo::interfaces::params::{MakeParams, TakeParams, CancelParams};
use clober_cairo::components::currency_delta::CurrencyDeltaComponent;
use clober_cairo::components::hook_caller::HookCallerComponent;
Expand Down Expand Up @@ -535,7 +535,7 @@ pub mod BookManager {

let reserves_before = self.reserves_of.read(currency);
let erc20_dispatcher = IERC20Dispatcher { contract_address: currency };
let balance_of_self = erc20_dispatcher.balanceOf(get_contract_address());
let balance_of_self = erc20_dispatcher.balance_of(get_contract_address());
self.reserves_of.write(currency, balance_of_self);
let paid = balance_of_self - reserves_before;
// subtraction must be safe
Expand Down
24 changes: 0 additions & 24 deletions src/interfaces/erc20.cairo

This file was deleted.

1 change: 0 additions & 1 deletion src/lib.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ pub mod components {
pub mod interfaces {
pub mod book_manager;
pub mod currency_delta;
pub mod erc20;
pub mod hook_caller;
pub mod locker;
pub mod lockers;
Expand Down

0 comments on commit 49e88a8

Please sign in to comment.