mirror of
https://github.com/darkrenaissance/darkfi.git
synced 2026-04-28 03:00:18 -04:00
contract/deployooor/client: replaced asserts with error returns and added log targets
This commit is contained in:
@@ -16,9 +16,11 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
use darkfi::Result;
|
||||
use darkfi::{ClientFailed, Result};
|
||||
use darkfi_sdk::{crypto::Keypair, deploy::DeployParamsV1};
|
||||
use log::debug;
|
||||
use log::{debug, error};
|
||||
|
||||
use crate::error::DeployError;
|
||||
|
||||
pub struct DeployCallDebris {
|
||||
pub params: DeployParamsV1,
|
||||
@@ -36,8 +38,11 @@ pub struct DeployCallBuilder {
|
||||
|
||||
impl DeployCallBuilder {
|
||||
pub fn build(&self) -> Result<DeployCallDebris> {
|
||||
debug!("Building Deployooor::DeployV1 contract call");
|
||||
assert!(!self.wasm_bincode.is_empty());
|
||||
debug!(target: "contract::deployooor::client::deploy", "Building Deployooor::DeployV1 contract call");
|
||||
if self.wasm_bincode.is_empty() {
|
||||
error!(target: "contract::deployooor::client::deploy", "Provided WASM bincode is empty");
|
||||
return Err(ClientFailed::VerifyError(DeployError::WasmBincodeInvalid.to_string()).into())
|
||||
}
|
||||
|
||||
let params = DeployParamsV1 {
|
||||
wasm_bincode: self.wasm_bincode.clone(),
|
||||
|
||||
@@ -34,7 +34,7 @@ pub struct LockCallBuilder {
|
||||
|
||||
impl LockCallBuilder {
|
||||
pub fn build(&self) -> Result<LockCallDebris> {
|
||||
debug!("Building Deployooor::LockV1 contract call");
|
||||
debug!(target: "contract::deployooor::client::lock", "Building Deployooor::LockV1 contract call");
|
||||
|
||||
let params = LockParamsV1 { public_key: self.deploy_keypair.public };
|
||||
let debris = LockCallDebris { params };
|
||||
|
||||
Reference in New Issue
Block a user