update for the latest contracts

This commit is contained in:
Bryan Stitt 2023-07-26 16:34:21 -07:00
parent 2b14842879
commit 9bc1e5a783
6 changed files with 133 additions and 3 deletions

View File

@ -41,6 +41,7 @@ mod m20230713_144446_stripe_default_date_created;
mod m20230713_210511_deposit_add_date_created;
mod m20230726_072845_default_premium_user_tier;
mod m20230726_162138_drop_rpc_accounting_v2_fk;
mod m20230726_225124_reduce_out_of_funds_tier_limits;
pub struct Migrator;
@ -89,6 +90,7 @@ impl MigratorTrait for Migrator {
Box::new(m20230713_210511_deposit_add_date_created::Migration),
Box::new(m20230726_072845_default_premium_user_tier::Migration),
Box::new(m20230726_162138_drop_rpc_accounting_v2_fk::Migration),
Box::new(m20230726_225124_reduce_out_of_funds_tier_limits::Migration),
]
}
}

View File

@ -0,0 +1,35 @@
use sea_orm_migration::prelude::*;
#[derive(DeriveMigrationName)]
pub struct Migration;
#[async_trait::async_trait]
impl MigrationTrait for Migration {
async fn up(&self, manager: &SchemaManager) -> Result<(), DbErr> {
let update_out_of_funds_tier = Query::update()
.table(UserTier::Table)
.values([
(UserTier::MaxRequestsPerPeriod, Some("3000").into()),
(UserTier::MaxConcurrentRequests, Some("3").into()),
])
.and_where(Expr::col((UserTier::Title).eq("Premium Out Of Funds")))
.to_owned();
manager.exec_stmt(update_out_of_funds_tier).await?;
Ok(())
}
async fn down(&self, manager: &SchemaManager) -> Result<(), DbErr> {
Ok(())
}
}
#[derive(Iden)]
enum UserTier {
Table,
Id,
Title,
MaxRequestsPerPeriod,
MaxConcurrentRequests,
}

View File

@ -22,7 +22,7 @@
{
"name": "account",
"type": "address",
"indexed": false
"indexed": true
},
{
"name": "token",

View File

@ -1,4 +1,26 @@
[
{
"name": "TokenBalanceRecovered",
"inputs": [
{
"name": "receiver",
"type": "address",
"indexed": false
},
{
"name": "token",
"type": "address",
"indexed": false
},
{
"name": "amount",
"type": "uint256",
"indexed": false
}
],
"anonymous": false,
"type": "event"
},
{
"stateMutability": "nonpayable",
"type": "constructor",

View File

@ -714,7 +714,7 @@ pub mod payment_factory {
::ethers::core::abi::ethabi::EventParam {
name: ::std::borrow::ToOwned::to_owned("account"),
kind: ::ethers::core::abi::ethabi::ParamType::Address,
indexed: false,
indexed: true,
},
::ethers::core::abi::ethabi::EventParam {
name: ::std::borrow::ToOwned::to_owned("token"),
@ -1244,6 +1244,7 @@ pub mod payment_factory {
abi = "PaymentReceived(address,address,uint256)"
)]
pub struct PaymentReceivedFilter {
#[ethevent(indexed)]
pub account: ::ethers::core::types::Address,
pub token: ::ethers::core::types::Address,
pub amount: ::ethers::core::types::U256,

View File

@ -107,7 +107,38 @@ pub mod payment_sweeper {
],
),
]),
events: ::std::collections::BTreeMap::new(),
events: ::core::convert::From::from([
(
::std::borrow::ToOwned::to_owned("TokenBalanceRecovered"),
::std::vec![
::ethers::core::abi::ethabi::Event {
name: ::std::borrow::ToOwned::to_owned(
"TokenBalanceRecovered",
),
inputs: ::std::vec![
::ethers::core::abi::ethabi::EventParam {
name: ::std::borrow::ToOwned::to_owned("receiver"),
kind: ::ethers::core::abi::ethabi::ParamType::Address,
indexed: false,
},
::ethers::core::abi::ethabi::EventParam {
name: ::std::borrow::ToOwned::to_owned("token"),
kind: ::ethers::core::abi::ethabi::ParamType::Address,
indexed: false,
},
::ethers::core::abi::ethabi::EventParam {
name: ::std::borrow::ToOwned::to_owned("amount"),
kind: ::ethers::core::abi::ethabi::ParamType::Uint(
256usize,
),
indexed: false,
},
],
anonymous: false,
},
],
),
]),
errors: ::std::collections::BTreeMap::new(),
receive: false,
fallback: false,
@ -195,6 +226,26 @@ pub mod payment_sweeper {
.method_hash([13, 124, 148, 161], token)
.expect("method not found (this should never happen)")
}
///Gets the contract's `TokenBalanceRecovered` event
pub fn token_balance_recovered_filter(
&self,
) -> ::ethers::contract::builders::Event<
::std::sync::Arc<M>,
M,
TokenBalanceRecoveredFilter,
> {
self.0.event()
}
/// Returns an `Event` builder for all the events of this contract.
pub fn events(
&self,
) -> ::ethers::contract::builders::Event<
::std::sync::Arc<M>,
M,
TokenBalanceRecoveredFilter,
> {
self.0.event_with_filter(::core::default::Default::default())
}
}
impl<M: ::ethers::providers::Middleware> From<::ethers::contract::Contract<M>>
for PaymentSweeper<M> {
@ -202,6 +253,25 @@ pub mod payment_sweeper {
Self::new(contract.address(), contract.client())
}
}
#[derive(
Clone,
::ethers::contract::EthEvent,
::ethers::contract::EthDisplay,
Default,
Debug,
PartialEq,
Eq,
Hash
)]
#[ethevent(
name = "TokenBalanceRecovered",
abi = "TokenBalanceRecovered(address,address,uint256)"
)]
pub struct TokenBalanceRecoveredFilter {
pub receiver: ::ethers::core::types::Address,
pub token: ::ethers::core::types::Address,
pub amount: ::ethers::core::types::U256,
}
///Container type for all input parameters for the `FACTORY` function with signature `FACTORY()` and selector `0x2dd31000`
#[derive(
Clone,