Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion contracts/contracts/governance/Strategizable.sol
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ contract Strategizable is Governable {
/**
* @dev Verifies that the caller is either Governor or Strategist.
*/
modifier onlyGovernorOrStrategist() {
modifier onlyGovernorOrStrategist() virtual {
require(
msg.sender == strategistAddr || isGovernor(),
"Caller is not the Strategist or Governor"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ abstract contract AbstractCCTPIntegrator is Governable, IMessageHandlerV2 {
* Can be 1000 (safe, after 1 epoch) or 2000 (finalized, after 2 epochs).
* Ref: https://developers.circle.com/cctp/technical-guide#finality-thresholds
* @dev When configuring the contract for fast transfer we should check the available
* allowance of USDC that can be bridged using fast mode:
* allowance of USDC that can be bridged using fast mode:
* wget https://iris-api.circle.com/v2/fastBurn/USDC/allowance
*/
uint16 public minFinalityThreshold;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,26 +17,19 @@ import { Generalized4626Strategy } from "../Generalized4626Strategy.sol";
import { AbstractCCTPIntegrator } from "./AbstractCCTPIntegrator.sol";
import { CrossChainStrategyHelper } from "./CrossChainStrategyHelper.sol";
import { InitializableAbstractStrategy } from "../../utils/InitializableAbstractStrategy.sol";
import { Strategizable } from "../../governance/Strategizable.sol";

contract CrossChainRemoteStrategy is
AbstractCCTPIntegrator,
Generalized4626Strategy
Generalized4626Strategy,
Strategizable
{
using SafeERC20 for IERC20;
using CrossChainStrategyHelper for bytes;

event DepositUnderlyingFailed(string reason);
event WithdrawalFailed(uint256 amountRequested, uint256 amountAvailable);
event WithdrawUnderlyingFailed(string reason);
event StrategistUpdated(address _address);

/**
* @notice Address of the strategist.
* This is important to have the variable name same as in IVault.
* Because the parent contract (Generalized4626Strategy) uses this
* function to get the strategist address.
*/
address public strategistAddr;

modifier onlyOperatorOrStrategistOrGovernor() {
require(
Expand All @@ -48,6 +41,24 @@ contract CrossChainRemoteStrategy is
_;
}

/**
* @dev Overriding this modifier is important because the parent
* contract`Generalized4626Strategy` uses `IVault.strategistAddr()`
* in its implementation and there's no Vault on the remote strategy.
* So, we set the Vault address of remote to be the proxy address and
* inherit from Strategizable to get the same function signature.
* Essentially, any calls to `IVault.strategistAddr()` will be equal to
* calling `address(this).strategistAddr()`.
*/
modifier onlyGovernorOrStrategist()
override(InitializableAbstractStrategy, Strategizable) {
require(
msg.sender == strategistAddr || isGovernor(),
"Caller is not the Strategist or Governor"
);
_;
}

constructor(
BaseStrategyConfig memory _baseConfig,
CCTPIntegrationConfig memory _cctpConfig
Expand Down Expand Up @@ -91,26 +102,6 @@ contract CrossChainRemoteStrategy is
);
}

/**
* @notice Set address of Strategist.
* This is important to have the function name same as IVault.
* Because the parent contract (Generalized4626Strategy) uses this
* function to get/set the strategist address.
* @param _address Address of Strategist
*/
function setStrategistAddr(address _address) external onlyGovernor {
_setStrategistAddr(_address);
}

/**
* @dev Set the strategist address
* @param _address Address of the strategist
*/
function _setStrategistAddr(address _address) internal {
strategistAddr = _address;
emit StrategistUpdated(_address);
}

/// @inheritdoc Generalized4626Strategy
function deposit(address _asset, uint256 _amount)
external
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ abstract contract InitializableAbstractStrategy is Initializable, Governable {
/**
* @dev Verifies that the caller is the Governor or Strategist.
*/
modifier onlyGovernorOrStrategist() {
modifier onlyGovernorOrStrategist() virtual {
require(
isGovernor() || msg.sender == IVault(vaultAddress).strategistAddr(),
"Caller is not the Strategist or Governor"
Expand Down
Loading