pub fn distribute<S: Storage, A: Api, Q: Querier>(
    deps: &mut Extern<S, A, Q>,
    env: Env,
) -> HandleResult<TerraMsgWrapper> {
    let config: Config = read_config(&deps.storage)?;
    let amount = query_token_balance(
        &deps,
        &deps.api.human_address(&config.mirror_token)?,
        &env.contract.address,
    )?;

    Ok(HandleResponse {
        messages: vec![CosmosMsg::Wasm(WasmMsg::Execute {
            contract_addr: deps.api.human_address(&config.mirror_token)?,
            msg: to_binary(&Cw20HandleMsg::Send {
                contract: deps.api.human_address(&config.distribution_contract)?,
                amount,
                msg: Some(to_binary(&DepositReward {})?),
            })?,
            send: vec![],
        })],
        log: vec![
            log("action", "distribute"),
            log("amount", amount.to_string()),
        ],
        data: None,
    })
}
// Anyone can execute send function to receive staking token rewards
Anyone can execute send function to receive staking token rewards
Anyone can execute send function to receive staking token rewards
pub fn distribute<S: Storage, A: Api, Q: Querier>(
    deps: &mut Extern<S, A, Q>,
    env: Env,
) -> HandleResult<TerraMsgWrapper> {
    let config: Config = read_config(&deps.storage)?;
    let amount = query_token_balance(
        &deps,
        &deps.api.human_address(&config.mirror_token)?,
        &env.contract.address,
    )?;
    Ok(HandleResponse {
        messages: vec![CosmosMsg::Wasm(WasmMsg::Execute {
            contract_addr: deps.api.human_address(&config.mirror_token)?,
            msg: to_binary(&Cw20HandleMsg::Send {
                contract: deps.api.human_address(&config.distribution_contract)?,
                amount,
                msg: Some(to_binary(&DepositReward {})?),
            })?,
            send: vec![],
        })],
        log: vec![
            log("action", "distribute"),
            log("amount", amount.to_string()),
        ],
        data: None,
    })
}
pub fn distribute < S : Storage , A : Api , Q : Querier > ( deps : & mut Extern < S , A , Q > , env : Env , ) -> HandleResult < TerraMsgWrapper > { let config : Config = read_config ( & deps . storage ) ? ; let amount = query_token_balance ( & deps , & deps . api . human_address ( & config . mirror_token ) ? , & env . contract . address , ) ? ; Ok ( HandleResponse { messages : vec ! [ CosmosMsg Wasm ( WasmMsg Execute { contract_addr deps api human_address ( config mirror_token ) msg to_binary ( Cw20HandleMsg Send { contract deps api human_address ( config distribution_contract ) amount msg Some ( to_binary ( DepositReward { } ) ) } ) send vec [ ] } ) ] , log : vec ! [ log ( " " " " ) log ( " " amount to_string ( ) ) ] , data : None , } ) }
Anyone can execute send function to receive staking token rewards
Anyone can execute send function to receive staking token rewards
deps
&mut Extern<S, A, Q>
env
Env