Coder Social home page Coder Social logo

Comments (3)

epanchee avatar epanchee commented on June 16, 2024

What are the tokens/denoms you are trying to use for a new pool? Which pool type do you want to create?
Does your wallet balance is >0 and you ever made any transaction on injective testnet before?

from astroport-core.

Jcaster99 avatar Jcaster99 commented on June 16, 2024

@epanchee Thanks for answer
i have solved the problem now i need to automatic create pair and store pair info to storage but not succeess
here is code


use astroport::asset::AssetInfo;
use astroport::factory::{PairType, ExecuteMsg};
use astroport::factory::ExecuteMsg::CreatePair;
use cosmwasm_std::{Addr, attr, Response, to_binary, WasmMsg, DepsMut, Env, MessageInfo};
use cw20_base::ContractError;

const FACTORY: &str = "inj1c4e2787cwawlqslph0yzn62wq4xpzzq9y9kjwj";

pub fn try_create_pair(
    deps: DepsMut,
    env: Env,
    info: MessageInfo,
    token_code_id: u64,
) -> Result<Response, ContractError> {

    let assets: Vec<AssetInfo> = vec![
        AssetInfo::NativeToken {
            denom: "inj".to_string(),
        },
        AssetInfo::Token {
            contract_addr: env.contract.address,
        },
    ];

    let create_pair_msg = to_binary(&CreatePair {
        pair_type: PairType::Xyk {},
        asset_infos:assets,
        init_params: None,
    })?;

    let msg = WasmMsg::Execute {
        contract_addr: FACTORY.to_string(),
        msg: create_pair_msg,
        funds: vec![],
    };

//create error
failed to execute message; message index: 0: dispatch: submessages: Error parsing into type astroport::factory::ExecuteMsg: unknown variant `asset_infos`, expected one of `update_config`, `update_pair_config`, `create_pair`, `deregister`, `propose_new_owner`, `drop_ownership_proposal`, `claim_ownership`, `mark_as_migrated`: execute wasm contract failed

//get pair address and store to storage

  Ok(Response::new()
          .add_message(msg)
          .add_attributes(vec![
              attr("action", "create_pair"),
          ]))
  }
}


from astroport-core.

epanchee avatar epanchee commented on June 16, 2024

Hi,

Sorry for the long reply.

Are you using test-tube? Please note that Astroport doesn't provide test-tube support and you have to figure out it yourself.
The error denotes that you're trying to send wrong execute message on factory. Consult with factory execute messages here.

from astroport-core.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.