-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
3,030 additions
and
311 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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,28 @@ | ||
use cw_orch::{interface, prelude::*}; | ||
|
||
use warp_funding_account::contract; | ||
pub use funding_account::{ExecuteMsg, InstantiateMsg, QueryMsg}; | ||
|
||
|
||
#[interface(InstantiateMsg, ExecuteMsg, QueryMsg, Empty)] | ||
pub struct WarpFundingAccount; | ||
|
||
impl<Chain: CwEnv> Uploadable for WarpFundingAccount<Chain> { | ||
// Return the path to the wasm file | ||
fn wasm(&self) -> WasmPath { | ||
artifacts_dir_from_workspace!() | ||
.find_wasm_path("warp_funding_account.wasm") | ||
.unwrap() | ||
} | ||
// Return a CosmWasm contract wrapper | ||
fn wrapper(&self) -> Box<dyn MockContract<Empty>> { | ||
Box::new( | ||
ContractWrapper::new_with_empty( | ||
contract::execute, | ||
contract::instantiate, | ||
contract::query, | ||
) | ||
.with_migrate(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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
use std::io::Error; | ||
use cosmwasm_std::Uint64; | ||
use cw_orch::anyhow; | ||
use cw_orch::prelude::*; | ||
use tokio::runtime::Runtime; | ||
use controller::InstantiateMsg; | ||
use interface::warp_controller::WarpController; | ||
use interface::warp_funding_account::WarpFundingAccount; | ||
use interface::warp_job_account::WarpJobAccount; | ||
use interface::warp_job_account_tracker::WarpJobAccountTracker; | ||
use interface::warp_legacy_account::WarpLegacyAccount; | ||
use interface::warp_resolver::WarpResolver; | ||
use interface::warp_templates::WarpTemplates; | ||
// We start by creating a runtime, which is required for a sync daemon. | ||
|
||
pub fn deploy() -> anyhow::Result<()>{ | ||
dotenv::dotenv().ok(); // Used to load the `.env` file if any | ||
pretty_env_logger::init(); // Used to log contract and chain interactions | ||
|
||
let rt = Runtime::new()?; | ||
let network = networks::PHOENIX_1; | ||
let chain = DaemonBuilder::default() | ||
.handle(rt.handle()) | ||
.chain(network) | ||
.build()?; | ||
|
||
let funding_account = WarpFundingAccount::new("warp_funding_account", chain.clone()); | ||
funding_account.upload()?; | ||
|
||
let job_account = WarpJobAccount::new("warp_job_account", chain.clone()); | ||
job_account.upload()?; | ||
|
||
let job_account_tracker = WarpJobAccountTracker::new("warp_job_account_tracker", chain.clone()); | ||
job_account_tracker.upload()?; | ||
job_account_tracker.instantiate(&job_account_tracker::InstantiateMsg { | ||
admin: chain.wallet().address()?.to_string(), | ||
warp_addr: "".to_string(), | ||
}, Some(&Addr::unchecked(chain.wallet().address()?.to_string())), None)?; | ||
|
||
let legacy_account = WarpLegacyAccount::new("warp_legacy_account", chain.clone()) | ||
legacy_account.upload()?; | ||
|
||
let resolver = WarpResolver::new("warp_resolver", chain.clone()); | ||
resolver.upload()?; | ||
resolver.instantiate(&resolver::InstantiateMsg {}, None, None)?; | ||
|
||
let templates = WarpTemplates::new("warp_templates", chain.clone()); | ||
templates.upload()?; | ||
templates.instantiate(&templates::InstantiateMsg { | ||
owner: chain.wallet().address()?.to_string(), | ||
fee_denom: "uluna".to_string(), | ||
fee_collector: chain.wallet().address()?.to_string(), | ||
templates: vec![], | ||
}, Some(&Addr::unchecked(chain.wallet().address()?.to_string())), None)?; | ||
|
||
let controller = WarpController::new("warp_controller", chain); | ||
|
||
controller.upload()?; | ||
controller.instantiate(&controller::InstantiateMsg { | ||
owner: Some(chain.wallet().address()?.to_string()), | ||
fee_denom: "".to_string(), | ||
fee_collector: Some(chain.wallet().address()?.to_string()), | ||
warp_account_code_id: Uint64::from(templates.code_id()?), | ||
minimum_reward: Default::default(), | ||
creation_fee: Default::default(), | ||
cancellation_fee: Default::default(), | ||
resolver_address: resolver.address()?.to_string(), | ||
job_account_tracker_address: job_account_tracker.address()?.to_string(), | ||
t_max: Default::default(), | ||
t_min: Default::default(), | ||
a_max: Default::default(), | ||
a_min: Default::default(), | ||
q_max: Default::default(), | ||
creation_fee_min: Default::default(), | ||
creation_fee_max: Default::default(), | ||
burn_fee_min: Default::default(), | ||
maintenance_fee_min: Default::default(), | ||
maintenance_fee_max: Default::default(), | ||
duration_days_left: Default::default(), | ||
duration_days_right: Default::default(), | ||
queue_size_left: Default::default(), | ||
queue_size_right: Default::default(), | ||
burn_fee_rate: Default::default(), | ||
}, Some(&Addr::unchecked(chain.wallet().address()?.to_string())), None)?; | ||
|
||
Ok(()) | ||
} |
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 |
---|---|---|
@@ -1,5 +1,7 @@ | ||
mod deploy; | ||
mod migrate; | ||
|
||
fn main() { | ||
println!("Hello, world!"); | ||
let _ = deploy::deploy(); | ||
// let _ = migrate::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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
use cw_orch::anyhow; | ||
|
||
pub fn migrate() -> anyhow::Result<()>{ | ||
Ok(()) | ||
} |
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,8 @@ | ||
{ | ||
"terra2": { | ||
"phoenix-1": { | ||
"code_ids": {}, | ||
"default": {} | ||
} | ||
} | ||
} |