-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Groundwork for requests to rent something
- Loading branch information
Showing
4 changed files
with
100 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
use crate::{ | ||
amount_as_string, charge_fees_to_account_no_bump_reputation, info, reward_e9s_per_block, warn, | ||
Balance, DccIdentity, ED25519_SIGNATURE_LENGTH, LABEL_NP_OFFERING, MAX_NP_OFFERING_BYTES, | ||
MAX_PUBKEY_BYTES, | ||
}; | ||
|
||
pub struct OfferingRequestPayloadV1 { | ||
requester_pubkey_bytes: Vec<u8>, | ||
requester_ssh_pubkey: String, | ||
requester_contact: String, | ||
provider_pubkey_bytes: Vec<u8>, | ||
offering_id: String, | ||
instance_id: Option<String>, | ||
instance_config: Option<String>, | ||
payment_amount: u64, | ||
rent_period_seconds: u64, | ||
rent_start_timestamp: Option<u64>, | ||
request_memo: String, | ||
signature: Vec<u8>, | ||
} | ||
|
||
pub enum OfferingRequestPayload { | ||
V1(OfferingRequestPayloadV1), | ||
} | ||
|
||
impl OfferingRequestPayload { | ||
fn new( | ||
requester_pubkey_bytes: Vec<u8>, | ||
requester_ssh_pubkey: String, | ||
requester_contact: String, | ||
provider_pubkey_bytes: Vec<u8>, | ||
offering_id: String, | ||
instance_id: Option<String>, | ||
instance_config: Option<String>, | ||
payment_amount: u64, | ||
rent_period_seconds: u64, | ||
rent_start_timestamp: Option<u64>, | ||
request_memo: String, | ||
signature: Vec<u8>, | ||
) -> Self { | ||
OfferingRequestPayload::V1(OfferingRequestPayloadV1 { | ||
requester_pubkey_bytes, | ||
requester_ssh_pubkey, | ||
requester_contact, | ||
provider_pubkey_bytes, | ||
offering_id, | ||
instance_id, | ||
instance_config, | ||
payment_amount, | ||
rent_period_seconds, | ||
rent_start_timestamp, | ||
request_memo, | ||
signature, | ||
}) | ||
} | ||
} |
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