-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added cw-plus contracts and Uploadable from distant sources
- Loading branch information
Showing
36 changed files
with
1,869 additions
and
266 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
use cosmwasm_std::Uint128; | ||
use cw20::{Cw20Coin, Cw20ExecuteMsg}; | ||
use cw_orch::contract::{GithubWasmPath, GithubWasmPathLocation}; | ||
use cw_orch::prelude::*; | ||
use cw_plus_orch::cw20_base::{Cw20Base, InstantiateMsg}; | ||
use cw_plus_orch::cw20_base::{QueryMsg, QueryMsgInterfaceFns}; | ||
use networks::LOCAL_JUNO; | ||
|
||
pub const INITIAL_AMOUNT: u128 = 567; | ||
|
||
pub fn main() -> anyhow::Result<()> { | ||
dotenv::dotenv()?; | ||
env_logger::init(); | ||
|
||
let daemon = Daemon::builder(LOCAL_JUNO).build()?; | ||
|
||
let release_cw20 = Cw20Base::new("cw20-test-release", daemon.clone()); | ||
execution(release_cw20, &daemon.sender_addr())?; | ||
|
||
let file_cw20 = FileCw20Base::new("cw20-test-file", daemon.clone()); | ||
execution(file_cw20, &daemon.sender_addr())?; | ||
|
||
Ok(()) | ||
} | ||
|
||
fn execution<T>(cw20: T, sender: &Addr) -> anyhow::Result<()> | ||
where | ||
T: Uploadable | ||
+ CwOrchUpload<Daemon> | ||
+ ContractInstance<Daemon> | ||
+ CwOrchInstantiate<Daemon> | ||
+ CwOrchExecute<Daemon> | ||
+ InstantiableContract<InstantiateMsg = InstantiateMsg> | ||
+ ExecutableContract<ExecuteMsg = Cw20ExecuteMsg> | ||
+ QueryMsgInterfaceFns<Daemon, QueryMsg>, | ||
{ | ||
cw20.upload()?; | ||
cw20.instantiate( | ||
&InstantiateMsg { | ||
name: "cw20".to_string(), | ||
symbol: "CWTEST".to_string(), | ||
decimals: 6, | ||
initial_balances: vec![Cw20Coin { | ||
address: sender.to_string(), | ||
amount: Uint128::from(INITIAL_AMOUNT), | ||
}], | ||
mint: None, | ||
marketing: None, | ||
}, | ||
None, | ||
&[], | ||
)?; | ||
|
||
let balance = cw20.balance(sender)?; | ||
|
||
assert_eq!(balance.balance.u128(), INITIAL_AMOUNT); | ||
Ok(()) | ||
} | ||
|
||
#[cw_orch::interface(InstantiateMsg, Cw20ExecuteMsg, QueryMsg, cosmwasm_std::Empty)] | ||
pub struct FileCw20Base; | ||
|
||
impl<Chain: CwEnv> Uploadable for FileCw20Base<Chain> { | ||
// Return the path to the wasm file | ||
fn wasm(_chain: &ChainInfoOwned) -> WasmPath { | ||
WasmPath::Github(GithubWasmPath { | ||
owner: "Abstractsdk".to_string(), | ||
repo_name: "cw-plus".to_string(), | ||
location: GithubWasmPathLocation::File { | ||
reference: "abstract_versions".to_string(), | ||
file_path: "artifacts/abstract_cw20_base.wasm".to_string(), | ||
}, | ||
}) | ||
} | ||
// Return a CosmWasm contract wrapper | ||
fn wrapper() -> Box<dyn MockContract<Empty>> { | ||
Box::new( | ||
ContractWrapper::new_with_empty( | ||
cw20_base::contract::execute, | ||
cw20_base::contract::instantiate, | ||
cw20_base::contract::query, | ||
) | ||
.with_migrate(cw20_base::contract::migrate), | ||
) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.