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:
TAMARA LIPOWSKI
2025-01-21 16:31:18 -05:00
parent 7b4bf0205d
commit cc979880e2
3 changed files with 4 additions and 5 deletions

View File

@@ -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