Skip to content

Commit

Permalink
address part 7
Browse files Browse the repository at this point in the history
  • Loading branch information
m30m committed Mar 12, 2024
1 parent b721b16 commit 8fbdaca
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 16 deletions.
9 changes: 5 additions & 4 deletions auction-server/src/auction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,10 @@ pub fn get_simulation_call(
bid_amounts: Vec<BidAmount>,
) -> FunctionCall<Arc<Provider<Http>>, Provider<Http>, Vec<MulticallStatus>> {
let client = Arc::new(provider);
let per_contract = ExpressRelayContract::new(chain_config.express_relay_contract, client);
let express_relay_contract =
ExpressRelayContract::new(chain_config.express_relay_contract, client);

per_contract
express_relay_contract
.multicall(permission, target_contracts, calldata, bid_amounts)
.from(relayer)
}
Expand Down Expand Up @@ -195,9 +196,9 @@ pub async fn submit_bids(
transformer,
));

let per_contract =
let express_relay_contract =
SignableExpressRelayContract::new(chain_config.express_relay_contract, client);
let call = per_contract.multicall(permission, contracts, calldata, bid_amounts);
let call = express_relay_contract.multicall(permission, contracts, calldata, bid_amounts);
let mut gas_estimate = call
.estimate_gas()
.await
Expand Down
10 changes: 5 additions & 5 deletions auction-server/src/liquidation_adapter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ pub async fn verify_opportunity(
let signature = fake_wallet.sign_hash(digest)?;
fake_bid.signature = signature;
let params = make_opportunity_execution_params(opportunity.clone(), fake_bid.clone());
let per_calldata = OpportunityAdapter::new(
let adapter_calldata = OpportunityAdapter::new(
chain_store.config.opportunity_adapter_contract,
client.clone(),
)
Expand All @@ -141,7 +141,7 @@ pub async fn verify_opportunity(
chain_store.config.clone(),
opportunity.permission_key,
vec![chain_store.config.opportunity_adapter_contract],
vec![per_calldata],
vec![adapter_calldata],
vec![fake_bid.amount],
)
.tx;
Expand Down Expand Up @@ -280,7 +280,7 @@ pub fn make_opportunity_execution_params(
}
}

pub async fn make_liquidator_calldata(
pub async fn make_adapter_calldata(
opportunity: OpportunityParamsV1,
bid: OpportunityBid,
provider: Provider<Http>,
Expand Down Expand Up @@ -436,7 +436,7 @@ pub async fn handle_liquidation_bid(
.get(&params.chain_id)
.ok_or(RestError::InvalidChainId)?;

let per_calldata = make_liquidator_calldata(
let adapter_calldata = make_adapter_calldata(
params.clone(),
opportunity_bid.clone(),
chain_store.provider.clone(),
Expand All @@ -450,7 +450,7 @@ pub async fn handle_liquidation_bid(
permission_key: params.permission_key.clone(),
chain_id: params.chain_id.clone(),
contract: chain_store.config.opportunity_adapter_contract,
calldata: per_calldata,
calldata: adapter_calldata,
amount: opportunity_bid.amount,
},
)
Expand Down
2 changes: 1 addition & 1 deletion per_multicall/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# PER
# Express Relay Contracts

## Setup

Expand Down
12 changes: 6 additions & 6 deletions per_multicall/test/ExpressRelayIntegration.sol
Original file line number Diff line number Diff line change
Expand Up @@ -506,8 +506,8 @@ contract ExpressRelayIntegrationTest is
tokensDebt[vaultNumber],
amountsDebt[vaultNumber]
);
TokenAmount[] memory expectedReceiptTokens = new TokenAmount[](1);
expectedReceiptTokens[0] = TokenAmount(
TokenAmount[] memory buyTokens = new TokenAmount[](1);
buyTokens[0] = TokenAmount(
tokensCollateral[vaultNumber],
amountsCollateral[vaultNumber]
);
Expand All @@ -528,17 +528,17 @@ contract ExpressRelayIntegrationTest is
bytes
memory signatureLiquidator = createOpportunityExecutionSignature(
sellTokens,
expectedReceiptTokens,
buyTokens,
contractAddress,
calldataVault,
value,
bidInfos[i].bid,
bidInfos[i].validUntil,
bidInfos[i].liquidatorSk
);
ExecutionParams memory liquidationCallParams = ExecutionParams(
ExecutionParams memory executionParams = ExecutionParams(
sellTokens,
expectedReceiptTokens,
buyTokens,
bidInfos[i].liquidator,
contractAddress,
calldataVault,
Expand All @@ -550,7 +550,7 @@ contract ExpressRelayIntegrationTest is

data[i] = abi.encodeWithSelector(
liquidationAdapter.executeOpportunity.selector,
liquidationCallParams
executionParams
);
}
}
Expand Down

0 comments on commit 8fbdaca

Please sign in to comment.