Skip to content

Commit

Permalink
Merge pull request #7 from oraichain/feat/update-event
Browse files Browse the repository at this point in the history
add pool key to event
  • Loading branch information
trung2891 authored Sep 17, 2024
2 parents 82cb4ea + ad2795e commit 19c319b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
4 changes: 2 additions & 2 deletions contracts/oraiswap-v3/src/entrypoints/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,7 @@ pub fn transfer_nft(
info: &MessageInfo,
recipient: &Addr,
token_id: u64,
) -> Result<(), ContractError> {
) -> Result<Position, ContractError> {
let (owner_raw, index) = state::POSITION_KEYS_BY_TOKEN_ID.load(deps.storage, token_id)?;
let account_id = Addr::unchecked(String::from_utf8(owner_raw.to_vec())?);
let mut pos = state::get_position(deps.storage, &account_id, index)?;
Expand All @@ -481,5 +481,5 @@ pub fn transfer_nft(
pos.approvals = vec![];
state::add_position(deps.storage, recipient, &pos)?;

Ok(())
Ok(pos)
}
7 changes: 5 additions & 2 deletions contracts/oraiswap-v3/src/entrypoints/execute.rs
Original file line number Diff line number Diff line change
Expand Up @@ -451,6 +451,7 @@ pub fn transfer_position(
attr("sender", info.sender.as_str()),
attr("receiver", receiver),
attr("position_token_id", position.token_id.to_string()),
attr("pool_key", position.pool_key.to_string()),
];

Ok(Response::new().add_attributes(event_attributes))
Expand Down Expand Up @@ -996,7 +997,7 @@ pub fn handle_transfer_nft(
recipient: Addr,
token_id: u64,
) -> Result<Response, ContractError> {
transfer_nft(deps, &env, &info, &recipient, token_id)?;
let pos = transfer_nft(deps, &env, &info, &recipient, token_id)?;

// need transfer_payout as well

Expand All @@ -1005,6 +1006,7 @@ pub fn handle_transfer_nft(
attr("token_id", token_id.to_string()),
attr("sender", info.sender),
attr("recipient", recipient),
attr("pool_key", pos.pool_key.to_string()),
]))
}

Expand Down Expand Up @@ -1034,7 +1036,7 @@ pub fn handle_send_nft(
msg: Option<Binary>,
) -> Result<Response, ContractError> {
// Transfer token
transfer_nft(deps, &env, &info, &contract, token_id)?;
let pos = transfer_nft(deps, &env, &info, &contract, token_id)?;

let send = Cw721ReceiveMsg {
sender: info.sender.clone(),
Expand All @@ -1050,6 +1052,7 @@ pub fn handle_send_nft(
attr("token_id", token_id.to_string()),
attr("sender", info.sender),
attr("recipient", contract),
attr("pool_key", pos.pool_key.to_string()),
]))
}

Expand Down

0 comments on commit 19c319b

Please sign in to comment.