#36922 [SC-Insight] the function claim_collateral in borrowOperation have read only attribute while
PreviousFluid ProtocolNext#37056 [SC-Insight] `require_at_least_min_net_debt` did not emit correct error message
Last updated
Was this helpful?
Last updated
Was this helpful?
Was this helpful?
// Claim collateral from liquidations
#[storage(read)]
fn claim_collateral(asset: AssetId) {
let coll_surplus = abi(CollSurplusPool, storage.coll_surplus_pool_contract.read().bits());
coll_surplus.claim_coll(msg_sender().unwrap(), asset);
}
#[storage(read, write)]
fn claim_coll(account: Identity, asset: AssetId) {
require_is_borrow_operations_contract();
require_is_valid_asset_id(asset);
let balance = storage.balances.get((account, asset)).try_read().unwrap_or(0);
if balance > 0 {
storage.balances.insert((account, asset), 0);
let asset_amount = storage.asset_amount.get(asset).read();
storage.asset_amount.insert(asset, asset_amount - balance);
transfer(account, asset, balance);
}
}
#[storage(write ,read)]
fn claim_collateral(asset: AssetId) {
let coll_surplus = abi(CollSurplusPool, storage.coll_surplus_pool_contract.read().bits());
coll_surplus.claim_coll(msg_sender().unwrap(), asset);
}
contract;
abi ContractA {
#[storage(read)] //NOTICE: change this to read and write in abi and impl the the test won't revert
fn receive() -> u64;
}
impl ContractA for Contract {
#[storage(read)]
fn receive() -> u64 {
return return_45();
}
}
#[storage(read, write)] // call revert here because of pure calling impure
fn return_45() -> u64 {
45
}
``