Skip to content

Commit

Permalink
feat(storage): unpin sender on forget
Browse files Browse the repository at this point in the history
  • Loading branch information
bdeneux committed Mar 21, 2023
1 parent 24952a3 commit 9f027ca
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions contracts/cw-storage/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -198,9 +198,13 @@ pub mod execute {

pub fn forget_object(
deps: DepsMut,
_info: MessageInfo,
info: MessageInfo,
object_id: ObjectId,
) -> Result<Response, ContractError> {
if pins().has(deps.storage, (object_id.clone(), info.sender.clone())) {
pins().remove(deps.storage, (object_id.clone(), info.sender))?;
}

if pins()
.idx
.object
Expand Down Expand Up @@ -1589,7 +1593,7 @@ mod tests {
)],
forget_senders: vec![mock_info("bob", &[])], // the sender is the same as the pinner, so forget should work
expected_count: 2,
expected_total_size: Uint128::new(13),
expected_total_size: Uint128::new(9),
expected_error: None,
},
TestForgetCase {
Expand Down

0 comments on commit 9f027ca

Please sign in to comment.