chore: Rename address_for_approvals -> router_address
When will this not be the router address that we use for approvals? It will always be the router address. address_for_approvals sounds to me very vague (which approvals?).
This commit is contained in:
@@ -65,7 +65,7 @@ impl StrategyEncoder for StraightToPoolStrategyEncoder {
|
||||
let encoding_context = EncodingContext {
|
||||
receiver: solution.receiver,
|
||||
exact_out: solution.exact_out,
|
||||
address_for_approvals: router_address,
|
||||
router_address,
|
||||
};
|
||||
let protocol_data = swap_encoder.encode_swap(swap.clone(), encoding_context)?;
|
||||
// TODO: here we need to pass also the address of the executor to be used
|
||||
|
||||
@@ -90,7 +90,7 @@ impl SwapEncoder for BalancerV2SwapEncoder {
|
||||
) -> Result<Vec<u8>, EncodingError> {
|
||||
let token_approvals_manager = ProtocolApprovalsManager::new();
|
||||
let token = bytes_to_address(&swap.token_in)?;
|
||||
let router_address = bytes_to_address(&encoding_context.address_for_approvals)?;
|
||||
let router_address = bytes_to_address(&encoding_context.router_address)?;
|
||||
let approval_needed =
|
||||
token_approvals_manager.approval_needed(token, router_address, self.vault_address)?;
|
||||
// should we return gas estimation here too?? if there is an approval needed, gas will be
|
||||
@@ -133,7 +133,7 @@ mod tests {
|
||||
let encoding_context = EncodingContext {
|
||||
receiver: Bytes::from("0x0000000000000000000000000000000000000001"),
|
||||
exact_out: false,
|
||||
address_for_approvals: Bytes::zero(20),
|
||||
router_address: Bytes::zero(20),
|
||||
};
|
||||
let encoder = super::UniswapV2SwapEncoder::new(String::from("0x"));
|
||||
let encoded_swap = encoder
|
||||
|
||||
@@ -76,6 +76,5 @@ pub struct Transaction {
|
||||
pub struct EncodingContext {
|
||||
pub receiver: Bytes,
|
||||
pub exact_out: bool,
|
||||
// TODO I don't like this - what does this mean?
|
||||
pub address_for_approvals: Bytes,
|
||||
pub router_address: Bytes,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user