wormhole/ethereum/contracts/bridge/BridgeSetters.sol

68 lines
2.0 KiB
Solidity

// contracts/Setters.sol
// SPDX-License-Identifier: Apache 2
pragma solidity ^0.8.0;
import "./BridgeState.sol";
contract BridgeSetters is BridgeState {
function setInitialized(address implementatiom) internal {
_state.initializedImplementations[implementatiom] = true;
}
function setGovernanceActionConsumed(bytes32 hash) internal {
_state.consumedGovernanceActions[hash] = true;
}
function setTransferCompleted(bytes32 hash) internal {
_state.completedTransfers[hash] = true;
}
function setChainId(uint16 chainId) internal {
_state.provider.chainId = chainId;
}
function setGovernanceChainId(uint16 chainId) internal {
_state.provider.governanceChainId = chainId;
}
function setGovernanceContract(bytes32 governanceContract) internal {
_state.provider.governanceContract = governanceContract;
}
function setBridgeImplementation(uint16 chainId, bytes32 bridgeContract) internal {
_state.bridgeImplementations[chainId] = bridgeContract;
}
function setTokenImplementation(address impl) internal {
require(impl != address(0), "invalid implementation address");
_state.tokenImplementation = impl;
}
function setWETH(address weth) internal {
_state.provider.WETH = weth;
}
function setWormhole(address wh) internal {
_state.wormhole = payable(wh);
}
function setWrappedAsset(uint16 tokenChainId, bytes32 tokenAddress, address wrapper) internal {
_state.wrappedAssets[tokenChainId][tokenAddress] = wrapper;
_state.isWrappedAsset[wrapper] = true;
}
function setOutstandingBridged(address token, uint256 outstanding) internal {
_state.outstandingBridged[token] = outstanding;
}
function setFinality(uint8 finality) internal {
_state.provider.finality = finality;
}
function setEvmChainId(uint256 evmChainId) internal {
require(evmChainId == block.chainid, "invalid evmChainId");
_state.evmChainId = evmChainId;
}
}