Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Rates] Make Rates Work on Any Action in an ADO #530

Open
daniel-wehbe opened this issue Aug 2, 2024 · 1 comment
Open

[Rates] Make Rates Work on Any Action in an ADO #530

daniel-wehbe opened this issue Aug 2, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@daniel-wehbe
Copy link
Contributor

Description

Currently, the rates can be added to specific actions (for example Buy in a marketplace ADO). We want to make it so the rate can be applied to any action. This would probably be added in the call_action call:

let action_response = call_action(
        &mut ctx.deps,
        &ctx.info,
        &ctx.env,
        &ctx.amp_ctx,
        msg.as_ref(),
    )?;

Somewhere here (not sure might be other better way):

pub fn call_action(
    deps: &mut DepsMut,
    info: &MessageInfo,
    env: &Env,
    amp_ctx: &Option<AMPPkt>,
    action: &str,
) -> Result<Response, ContractError> {
    ensure!(
        is_context_permissioned(deps, info, env, amp_ctx, action)?,
        ContractError::Unauthorized {}
    );

    let payee = if let Some(amp_ctx) = amp_ctx.clone() {
        deps.api.addr_validate(amp_ctx.ctx.get_origin().as_str())?
    } else {
        info.sender.clone()
    };

    let fee_msg =
        ADOContract::default().pay_fee(deps.storage, &deps.querier, action.to_owned(), payee)?;

    Ok(Response::default().add_submessage(fee_msg))
}

Note: We should also decide on actions where rates are never applicable hard coded into the ADO.

@daniel-wehbe daniel-wehbe added the enhancement New feature or request label Aug 2, 2024
@joemonem
Copy link
Contributor

joemonem commented Aug 5, 2024

The operation of applying rates can be unique depending on the type of message. Different code is needed for rates on a Claim than a Buy message.
I think that the current approach of enabling rates to the messages we see fit is cleaner.
cc: @crnbarr93

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants