Skip to content

Instantly share code, notes, and snippets.

@aeyakovenko
Last active October 23, 2018 14:31
Show Gist options
  • Save aeyakovenko/e84fca53f807b8d293df9f5e8ecd985a to your computer and use it in GitHub Desktop.
Save aeyakovenko/e84fca53f807b8d293df9f5e8ecd985a to your computer and use it in GitHub Desktop.
enum Contract {
/// Promise to sign a valid request within the `time_guarantee`
Promised{promise: Promise, time_guarantee: u64, sol_to_eth: u64},
/// Request has been made, the Promisee need's to sign before `expires`
Requested{promise: Promise, valid_request: Request, expires: u64},
/// Request has been signed
Signed(Vec<u8>),
/// Request has expired
Expired,
}
enum Promise {
/// from address, and maximum value to spend including gas
Ethereum{from: H160, max_value: U256},
}
enum Request {
/// to address and value and gas
Ethereum{to: H160, nonce: U256, value: U256, gas_price: U256, gas_limit: U256},
}
impl Promise {
fn is_valid_request(&self, request: Request) -> bool {
}
fn is_valid_signature(&self, signed: Vec<u8>) -> bool {
}
fn is_expired(&self, time: u64) -> bool {
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment