Skip to content

Commit

Permalink
feat: deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
rhlsthrm committed Dec 17, 2024
1 parent 92abaa7 commit fa39637
Show file tree
Hide file tree
Showing 8 changed files with 320 additions and 118 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ import "../BasePriceOracle.sol";

import { IERC20 } from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";

interface Prices {
interface Prices_Fraxtal {
function getRate(address srcToken, address dstToken, bool useSrcWrappers) external view returns (uint256 weightedRate);
}

contract VelodromePriceOracleFraxtal is BasePriceOracle {
Prices immutable prices;
Prices_Fraxtal immutable prices;

constructor(address _prices) {
prices = Prices(_prices);
prices = Prices_Fraxtal(_prices);
}
/**
* @notice Fetches the token/ETH price, with 18 decimals of precision.
Expand Down
21 changes: 21 additions & 0 deletions packages/contracts/deploy/14-deploy-levered-positions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import { Address, Hash, zeroAddress } from "viem";
import { ChainDeployConfig, chainDeployConfig } from "../chainDeploy";
import { prepareAndLogTransaction } from "../chainDeploy/helpers/logging";

const LIFI_SWAP_ROUTER = "0x1231DEB6f5749EF6cE6943a275A1D3E7486F4EaE";

const func: DeployFunction = async ({ viem, getNamedAccounts, deployments, getChainId }) => {
const { deployer, multisig } = await getNamedAccounts();
const publicClient = await viem.getPublicClient();
Expand Down Expand Up @@ -231,6 +233,25 @@ const func: DeployFunction = async ({ viem, getNamedAccounts, deployments, getCh
console.error("Could not deploy:", error);
}

const factory = await viem.getContractAt("ILeveredPositionFactory", leveredPositionFactory.address);
const isWhitelisted = await factory.read.isSwapRoutersWhitelisted([LIFI_SWAP_ROUTER]);
console.log("isWhitelisted: ", isWhitelisted);
if (!isWhitelisted) {
const owner = await factory.read.owner();
if (owner.toLowerCase() !== deployer.toLowerCase()) {
await prepareAndLogTransaction({
contractInstance: factory,
functionName: "_setWhitelistedSwapRouters",
args: [[LIFI_SWAP_ROUTER]],
description: "Whitelist LIFI Swap Router",
inputs: [{ internalType: "address[]", name: "swapRouters", type: "address[]" }]
});
} else {
tx = await factory.write._setWhitelistedSwapRouters([[LIFI_SWAP_ROUTER]]);
await publicClient.waitForTransactionReceipt({ hash: tx });
console.log("whitelisted the LIFI Swap Router in the LeveredPositionFactory", tx);
}
}
//// AUTHORITIES REGISTRY
try {
await deployments.deploy("AuthoritiesRegistry", {
Expand Down
Loading

0 comments on commit fa39637

Please sign in to comment.