diff --git a/auction-server/src/auction.rs b/auction-server/src/auction.rs index 1f6b4883..63d8e24e 100644 --- a/auction-server/src/auction.rs +++ b/auction-server/src/auction.rs @@ -255,8 +255,8 @@ pub async fn run_submission_loop(store: Arc) -> Result<()> { chain_store.config.clone(), chain_store.network_id, permission_key.clone(), - winner_bids.iter().map(|b| b.contract).collect(), - winner_bids.iter().map(|b| b.calldata.clone()).collect(), + winner_bids.iter().map(|b| b.target_contract).collect(), + winner_bids.iter().map(|b| b.target_calldata.clone()).collect(), winner_bids.iter().map(|b| b.bid_amount).collect(), ) .await; @@ -297,20 +297,20 @@ pub async fn run_submission_loop(store: Arc) -> Result<()> { pub struct Bid { /// The permission key to bid on. #[schema(example = "0xdeadbeef", value_type=String)] - pub permission_key: Bytes, + pub permission_key: Bytes, /// The chain id to bid on. #[schema(example = "sepolia", value_type=String)] - pub chain_id: String, + pub chain_id: String, /// The contract address to call. #[schema(example = "0xcA11bde05977b3631167028862bE2a173976CA11",value_type = String)] - pub contract: abi::Address, + pub target_contract: abi::Address, /// Calldata for the contract call. #[schema(example = "0xdeadbeef", value_type=String)] - pub calldata: Bytes, + pub target_calldata: Bytes, /// Amount of bid in wei. #[schema(example = "10", value_type=String)] #[serde(with = "crate::serde::u256")] - pub amount: BidAmount, + pub amount: BidAmount, } pub async fn handle_bid(store: Arc, bid: Bid) -> result::Result { @@ -323,8 +323,8 @@ pub async fn handle_bid(store: Arc, bid: Bid) -> result::Result, bid: Bid) -> result::Result Result { params.buy_tokens.into_token(), params.target_contract.into_token(), params.target_calldata.into_token(), - params.value.into_token(), + params.target_call_value.into_token(), params.bid_amount.into_token(), params.valid_until.into_token(), ])); @@ -260,23 +260,23 @@ pub fn make_opportunity_execution_params( bid: OpportunityBid, ) -> ExecutionParams { ExecutionParams { - sell_tokens: opportunity + sell_tokens: opportunity .sell_tokens .into_iter() .map(TokenAmount::from) .collect(), - buy_tokens: opportunity + buy_tokens: opportunity .buy_tokens .into_iter() .map(TokenAmount::from) .collect(), - executor: bid.executor, - target_contract: opportunity.target_contract, - target_calldata: opportunity.target_calldata, - value: opportunity.value, - valid_until: bid.valid_until, - bid_amount: bid.amount, - signature: bid.signature.to_vec().into(), + executor: bid.executor, + target_contract: opportunity.target_contract, + target_calldata: opportunity.target_calldata, + target_call_value: opportunity.target_call_value, + valid_until: bid.valid_until, + bid_amount: bid.amount, + signature: bid.signature.to_vec().into(), } } @@ -447,11 +447,11 @@ pub async fn handle_opportunity_bid( match handle_bid( store.clone(), Bid { - permission_key: params.permission_key.clone(), - chain_id: params.chain_id.clone(), - contract: chain_store.config.opportunity_adapter_contract, - calldata: adapter_calldata, - amount: opportunity_bid.amount, + permission_key: params.permission_key.clone(), + chain_id: params.chain_id.clone(), + target_contract: chain_store.config.opportunity_adapter_contract, + target_calldata: adapter_calldata, + amount: opportunity_bid.amount, }, ) .await diff --git a/auction-server/src/state.rs b/auction-server/src/state.rs index d82b0b7c..f9ecae19 100644 --- a/auction-server/src/state.rs +++ b/auction-server/src/state.rs @@ -47,10 +47,10 @@ pub type BidAmount = U256; #[derive(Clone)] pub struct SimulatedBid { - pub id: BidId, - pub contract: Address, - pub calldata: Bytes, - pub bid_amount: BidAmount, + pub id: BidId, + pub target_contract: Address, + pub target_calldata: Bytes, + pub bid_amount: BidAmount, // simulation_time: } @@ -75,20 +75,20 @@ pub struct TokenAmount { pub struct OpportunityParamsV1 { /// The permission key required for successful execution of the opportunity. #[schema(example = "0xdeadbeefcafe", value_type=String)] - pub permission_key: Bytes, + pub permission_key: Bytes, /// The chain id where the opportunity will be executed. #[schema(example = "sepolia", value_type=String)] - pub chain_id: ChainId, + pub chain_id: ChainId, /// The contract address to call for execution of the opportunity. #[schema(example = "0xcA11bde05977b3631167028862bE2a173976CA11", value_type=String)] - pub target_contract: ethers::abi::Address, + pub target_contract: ethers::abi::Address, /// Calldata for the target contract call. #[schema(example = "0xdeadbeef", value_type=String)] - pub target_calldata: Bytes, + pub target_calldata: Bytes, /// The value to send with the contract call. #[schema(example = "1", value_type=String)] #[serde(with = "crate::serde::u256")] - pub value: U256, + pub target_call_value: U256, pub sell_tokens: Vec, pub buy_tokens: Vec, diff --git a/per_multicall/src/OpportunityAdapter.sol b/per_multicall/src/OpportunityAdapter.sol index 8c61195c..7de86d1c 100644 --- a/per_multicall/src/OpportunityAdapter.sol +++ b/per_multicall/src/OpportunityAdapter.sol @@ -67,7 +67,7 @@ contract OpportunityAdapter is SigVerify { params.buyTokens, params.targetContract, params.targetCalldata, - params.value, + params.targetCallValue, params.bidAmount, params.validUntil ), @@ -101,10 +101,10 @@ contract OpportunityAdapter is SigVerify { // approve contract to spend sell tokens uint256 approveAmount = params.sellTokens[i].amount; if (params.sellTokens[i].token == weth) { - if (approveAmount >= params.value) { - // we need `parmas.value` of to be sent to the contract directly + if (approveAmount >= params.targetCallValue) { + // we need `parmas.targetCallValue` of to be sent to the contract directly // so this amount should be subtracted from the approveAmount - approveAmount = approveAmount - params.value; + approveAmount = approveAmount - params.targetCallValue; } else { revert InsufficientWETHForMsgValue(); } @@ -119,14 +119,14 @@ contract OpportunityAdapter is SigVerify { balancesBuyTokens[i] = token.balanceOf(address(this)) + amount; } - if (params.value > 0) { + if (params.targetCallValue > 0) { // unwrap weth to eth to use in call // TODO: Wrap in try catch and throw a revert with a better error since WETH9 reverts do not return a reason - WETH9(payable(weth)).withdraw(params.value); + WETH9(payable(weth)).withdraw(params.targetCallValue); } (bool success, bytes memory reason) = params.targetContract.call{ - value: params.value + value: params.targetCallValue }(params.targetCalldata); if (!success) { diff --git a/per_multicall/src/Structs.sol b/per_multicall/src/Structs.sol index 4dd11283..415ebe86 100644 --- a/per_multicall/src/Structs.sol +++ b/per_multicall/src/Structs.sol @@ -34,7 +34,7 @@ struct ExecutionParams { address executor; address targetContract; bytes targetCalldata; - uint256 value; + uint256 targetCallValue; uint256 validUntil; uint256 bidAmount; bytes signature; diff --git a/per_sdk/protocols/token_vault_monitor.py b/per_sdk/protocols/token_vault_monitor.py index bafdd2c1..6a6cada7 100644 --- a/per_sdk/protocols/token_vault_monitor.py +++ b/per_sdk/protocols/token_vault_monitor.py @@ -180,7 +180,7 @@ def create_liquidation_opp( "target_calldata": calldata, "permission_key": permission, "account": str(account["account_number"]), - "value": str(call_value), + "target_call_value": str(call_value), "sell_tokens": sell_tokens, "buy_tokens": [ (account["token_address_collateral"], str(account["amount_collateral"])) diff --git a/per_sdk/searcher/simple_searcher.py b/per_sdk/searcher/simple_searcher.py index 1a4b4bcb..4e955307 100644 --- a/per_sdk/searcher/simple_searcher.py +++ b/per_sdk/searcher/simple_searcher.py @@ -71,7 +71,7 @@ def create_liquidation_transaction( buy_tokens, opp["target_contract"], liq_calldata, - int(opp["value"]), + int(opp["target_call_value"]), bid_info, sk_liquidator, ) diff --git a/per_sdk/utils/types_liquidation_adapter.py b/per_sdk/utils/types_liquidation_adapter.py index 125ba3e7..130d396a 100644 --- a/per_sdk/utils/types_liquidation_adapter.py +++ b/per_sdk/utils/types_liquidation_adapter.py @@ -16,7 +16,7 @@ class Opportunity(TypedDict): # The calldata that needs to be passed in with the liquidation method call target_calldata: str # The value that needs to be passed in with the liquidation method call - value: str + target_call_value: str # The permission key necessary to call the liquidation method permission_key: str # A list of tokens that can be used to repay this account's debt.