chore: inline integrity proto types
This commit is contained in:
@@ -1,50 +0,0 @@
|
|||||||
syntax = "proto3";
|
|
||||||
|
|
||||||
package arbiter.integrity;
|
|
||||||
|
|
||||||
import "google/protobuf/timestamp.proto";
|
|
||||||
|
|
||||||
message IntegrityTransactionRateLimit {
|
|
||||||
uint32 count = 1;
|
|
||||||
int64 window_secs = 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
message IntegrityVolumeRateLimit {
|
|
||||||
bytes max_volume = 1; // U256 as fixed-width 32-byte little-endian bytes
|
|
||||||
int64 window_secs = 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
message IntegritySharedGrantSettings {
|
|
||||||
int32 wallet_access_id = 1;
|
|
||||||
uint64 chain_id = 2;
|
|
||||||
optional google.protobuf.Timestamp valid_from = 3;
|
|
||||||
optional google.protobuf.Timestamp valid_until = 4;
|
|
||||||
optional bytes max_gas_fee_per_gas = 5; // U256 as fixed-width 32-byte little-endian bytes
|
|
||||||
optional bytes max_priority_fee_per_gas = 6; // U256 as fixed-width 32-byte little-endian bytes
|
|
||||||
optional IntegrityTransactionRateLimit rate_limit = 7;
|
|
||||||
}
|
|
||||||
|
|
||||||
message IntegrityEtherTransferSettings {
|
|
||||||
repeated bytes targets = 1; // sorted list of 20-byte addresses
|
|
||||||
IntegrityVolumeRateLimit limit = 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
message IntegrityTokenTransferSettings {
|
|
||||||
bytes token_contract = 1; // 20-byte address
|
|
||||||
optional bytes target = 2; // 20-byte address
|
|
||||||
repeated IntegrityVolumeRateLimit volume_limits = 3; // sorted by (window_secs, max_volume)
|
|
||||||
}
|
|
||||||
|
|
||||||
message IntegritySpecificGrant {
|
|
||||||
oneof grant {
|
|
||||||
IntegrityEtherTransferSettings ether_transfer = 1;
|
|
||||||
IntegrityTokenTransferSettings token_transfer = 2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
message IntegrityEvmGrantPayloadV1 {
|
|
||||||
int32 basic_grant_id = 1;
|
|
||||||
IntegritySharedGrantSettings shared = 2;
|
|
||||||
IntegritySpecificGrant specific = 3;
|
|
||||||
optional google.protobuf.Timestamp revoked_at = 4;
|
|
||||||
}
|
|
||||||
@@ -13,7 +13,6 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|||||||
format!("{}/user_agent.proto", PROTOBUF_DIR),
|
format!("{}/user_agent.proto", PROTOBUF_DIR),
|
||||||
format!("{}/client.proto", PROTOBUF_DIR),
|
format!("{}/client.proto", PROTOBUF_DIR),
|
||||||
format!("{}/evm.proto", PROTOBUF_DIR),
|
format!("{}/evm.proto", PROTOBUF_DIR),
|
||||||
format!("{}/integrity.proto", PROTOBUF_DIR),
|
|
||||||
],
|
],
|
||||||
&[PROTOBUF_DIR.to_string()],
|
&[PROTOBUF_DIR.to_string()],
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1,9 +1,4 @@
|
|||||||
use alloy::primitives::Address;
|
use alloy::primitives::Address;
|
||||||
use arbiter_proto::proto::integrity::{
|
|
||||||
IntegrityEtherTransferSettings, IntegrityEvmGrantPayloadV1, IntegritySharedGrantSettings,
|
|
||||||
IntegritySpecificGrant, IntegrityTokenTransferSettings, IntegrityTransactionRateLimit,
|
|
||||||
IntegrityVolumeRateLimit, integrity_specific_grant,
|
|
||||||
};
|
|
||||||
use chrono::{DateTime, Utc};
|
use chrono::{DateTime, Utc};
|
||||||
use diesel::sqlite::Sqlite;
|
use diesel::sqlite::Sqlite;
|
||||||
use diesel::{ExpressionMethods as _, OptionalExtension as _, QueryDsl, SelectableHelper as _};
|
use diesel::{ExpressionMethods as _, OptionalExtension as _, QueryDsl, SelectableHelper as _};
|
||||||
@@ -19,6 +14,88 @@ use crate::{
|
|||||||
|
|
||||||
pub const EVM_GRANT_ENTITY_KIND: &str = "evm_grant";
|
pub const EVM_GRANT_ENTITY_KIND: &str = "evm_grant";
|
||||||
|
|
||||||
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||||
|
pub struct IntegrityVolumeRateLimit {
|
||||||
|
#[prost(bytes, tag = "1")]
|
||||||
|
pub max_volume: Vec<u8>,
|
||||||
|
#[prost(int64, tag = "2")]
|
||||||
|
pub window_secs: i64,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||||
|
pub struct IntegrityTransactionRateLimit {
|
||||||
|
#[prost(uint32, tag = "1")]
|
||||||
|
pub count: u32,
|
||||||
|
#[prost(int64, tag = "2")]
|
||||||
|
pub window_secs: i64,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||||
|
pub struct IntegritySharedGrantSettings {
|
||||||
|
#[prost(int32, tag = "1")]
|
||||||
|
pub wallet_access_id: i32,
|
||||||
|
#[prost(uint64, tag = "2")]
|
||||||
|
pub chain_id: u64,
|
||||||
|
#[prost(message, optional, tag = "3")]
|
||||||
|
pub valid_from: Option<::prost_types::Timestamp>,
|
||||||
|
#[prost(message, optional, tag = "4")]
|
||||||
|
pub valid_until: Option<::prost_types::Timestamp>,
|
||||||
|
#[prost(bytes, optional, tag = "5")]
|
||||||
|
pub max_gas_fee_per_gas: Option<Vec<u8>>,
|
||||||
|
#[prost(bytes, optional, tag = "6")]
|
||||||
|
pub max_priority_fee_per_gas: Option<Vec<u8>>,
|
||||||
|
#[prost(message, optional, tag = "7")]
|
||||||
|
pub rate_limit: Option<IntegrityTransactionRateLimit>,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||||
|
pub struct IntegrityEtherTransferSettings {
|
||||||
|
#[prost(bytes, repeated, tag = "1")]
|
||||||
|
pub targets: Vec<Vec<u8>>,
|
||||||
|
#[prost(message, optional, tag = "2")]
|
||||||
|
pub limit: Option<IntegrityVolumeRateLimit>,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||||
|
pub struct IntegrityTokenTransferSettings {
|
||||||
|
#[prost(bytes, tag = "1")]
|
||||||
|
pub token_contract: Vec<u8>,
|
||||||
|
#[prost(bytes, optional, tag = "2")]
|
||||||
|
pub target: Option<Vec<u8>>,
|
||||||
|
#[prost(message, repeated, tag = "3")]
|
||||||
|
pub volume_limits: Vec<IntegrityVolumeRateLimit>,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||||
|
pub struct IntegritySpecificGrant {
|
||||||
|
#[prost(oneof = "integrity_specific_grant::Grant", tags = "1, 2")]
|
||||||
|
pub grant: Option<integrity_specific_grant::Grant>,
|
||||||
|
}
|
||||||
|
|
||||||
|
pub mod integrity_specific_grant {
|
||||||
|
use super::*;
|
||||||
|
|
||||||
|
#[derive(Clone, PartialEq, ::prost::Oneof)]
|
||||||
|
pub enum Grant {
|
||||||
|
#[prost(message, tag = "1")]
|
||||||
|
EtherTransfer(IntegrityEtherTransferSettings),
|
||||||
|
#[prost(message, tag = "2")]
|
||||||
|
TokenTransfer(IntegrityTokenTransferSettings),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||||
|
pub struct IntegrityEvmGrantPayloadV1 {
|
||||||
|
#[prost(int32, tag = "1")]
|
||||||
|
pub basic_grant_id: i32,
|
||||||
|
#[prost(message, optional, tag = "2")]
|
||||||
|
pub shared: Option<IntegritySharedGrantSettings>,
|
||||||
|
#[prost(message, optional, tag = "3")]
|
||||||
|
pub specific: Option<IntegritySpecificGrant>,
|
||||||
|
#[prost(message, optional, tag = "4")]
|
||||||
|
pub revoked_at: Option<::prost_types::Timestamp>,
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
pub struct SignedEvmGrant {
|
pub struct SignedEvmGrant {
|
||||||
pub basic_grant_id: i32,
|
pub basic_grant_id: i32,
|
||||||
|
|||||||
Reference in New Issue
Block a user