Add Oracle Aggregator and CCIP Integration
- Introduced Aggregator.sol for Chainlink-compatible oracle functionality, including round-based updates and access control. - Added OracleWithCCIP.sol to extend Aggregator with CCIP cross-chain messaging capabilities. - Created .gitmodules to include OpenZeppelin contracts as a submodule. - Developed a comprehensive deployment guide in NEXT_STEPS_COMPLETE_GUIDE.md for Phase 2 and smart contract deployment. - Implemented Vite configuration for the orchestration portal, supporting both Vue and React frameworks. - Added server-side logic for the Multi-Cloud Orchestration Portal, including API endpoints for environment management and monitoring. - Created scripts for resource import and usage validation across non-US regions. - Added tests for CCIP error handling and integration to ensure robust functionality. - Included various new files and directories for the orchestration portal and deployment scripts.
This commit is contained in:
62
contracts/oracle/Proxy.sol
Normal file
62
contracts/oracle/Proxy.sol
Normal file
@@ -0,0 +1,62 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
pragma solidity ^0.8.19;
|
||||
|
||||
/**
|
||||
* @title Transparent Proxy
|
||||
* @notice Transparent proxy pattern for upgradeable oracle contracts
|
||||
* @dev Based on OpenZeppelin's transparent proxy pattern
|
||||
*/
|
||||
contract Proxy {
|
||||
address public implementation;
|
||||
address public admin;
|
||||
|
||||
event Upgraded(address indexed implementation);
|
||||
event AdminChanged(address indexed oldAdmin, address indexed newAdmin);
|
||||
|
||||
modifier onlyAdmin() {
|
||||
require(msg.sender == admin, "Proxy: only admin");
|
||||
_;
|
||||
}
|
||||
|
||||
constructor(address _implementation, address _admin) {
|
||||
implementation = _implementation;
|
||||
admin = _admin;
|
||||
}
|
||||
|
||||
/**
|
||||
* @notice Upgrade the implementation
|
||||
*/
|
||||
function upgrade(address newImplementation) external onlyAdmin {
|
||||
require(newImplementation != address(0), "Proxy: zero address");
|
||||
implementation = newImplementation;
|
||||
emit Upgraded(newImplementation);
|
||||
}
|
||||
|
||||
/**
|
||||
* @notice Change admin
|
||||
*/
|
||||
function changeAdmin(address newAdmin) external onlyAdmin {
|
||||
require(newAdmin != address(0), "Proxy: zero address");
|
||||
address oldAdmin = admin;
|
||||
admin = newAdmin;
|
||||
emit AdminChanged(oldAdmin, newAdmin);
|
||||
}
|
||||
|
||||
/**
|
||||
* @notice Delegate call to implementation
|
||||
*/
|
||||
fallback() external payable {
|
||||
address impl = implementation;
|
||||
assembly {
|
||||
calldatacopy(0, 0, calldatasize())
|
||||
let result := delegatecall(gas(), impl, 0, calldatasize(), 0, 0)
|
||||
returndatacopy(0, 0, returndatasize())
|
||||
switch result
|
||||
case 0 { revert(0, returndatasize()) }
|
||||
default { return(0, returndatasize()) }
|
||||
}
|
||||
}
|
||||
|
||||
receive() external payable {}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user