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

load contract bytes at runtime in deploy_native_contracts #267

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions src/validator/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,23 +50,28 @@ pub async fn deploy_native_contracts(overlay: &BlockchainOverlayPtr) -> Result<(
// The Deployooor contract uses an empty payload to deploy itself.
let deployooor_contract_deploy_payload = vec![];

let manifest_dir = std::env::var("CARGO_MANIFEST_DIR").expect("CARGO_MANIFEST_DIR must be set");
let money_contract_bytes = std::fs::read(format!("{manifest_dir}/src/contract/money/darkfi_money_contract.wasm"))?;
let dao_contract_bytes = std::fs::read(format!("{manifest_dir}/src/contract/dao/darkfi_dao_contract.wasm"))?;
let deployooor_contract_bytes = std::fs::read(format!("{manifest_dir}/src/contract/deployooor/darkfi_deployooor_contract.wasm"))?;

let native_contracts = vec![
(
"Money Contract",
*MONEY_CONTRACT_ID,
include_bytes!("../contract/money/darkfi_money_contract.wasm").to_vec(),
money_contract_bytes,
money_contract_deploy_payload,
),
(
"DAO Contract",
*DAO_CONTRACT_ID,
include_bytes!("../contract/dao/darkfi_dao_contract.wasm").to_vec(),
dao_contract_bytes,
dao_contract_deploy_payload,
),
(
"Deployooor Contract",
*DEPLOYOOOR_CONTRACT_ID,
include_bytes!("../contract/deployooor/darkfi_deployooor_contract.wasm").to_vec(),
deployooor_contract_bytes,
deployooor_contract_deploy_payload,
),
];
Expand Down