I am trying to write a foundry script that deposits the asset token into a newly deployed EIP4626 Yearn vault. However, when I try to call the EIP4626 "deposit(uint256)" function on the vault, I get the error message "SafeERC20: low-level call failed". I approve the vault and deposit amount before calling the deposit function, so I don't understand why the transfer is failing. I have attached an image of the logs. And the relevant code is here and here:
uint256 initialDepositAmount = 1e18;
console.log("Deployer asset balance before deposit: ", asset.balanceOf(deployer)); // 1000000000000000000
console.log("making initial Vault deposit");
asset.approve(address(vault), initialDepositAmount);
// Error: "SafeERC20: low-level call failed"
uint256 shares = vault.deposit(initialDepositAmount);
if (shares > 0) {[![enter image description here][2]][2]
console.log("initial Vault deposit complete");
console.log("Deployer Vault shares: ", shares);
console.log("Deployer asset balance after deposit complete: ", asset.balanceOf(deployer)); // 0
console.log("Vault asset balance after deposit complete: ", asset.balanceOf(address(vault))); // 0
} else if (shares == 0) {
console.log("initial Vault deposit failed");
}