This directory contains the EVM (Solidity) contracts for the Oracle Proxy, built with Hardhat.
oracle-proxy-evm/
├── contracts/
│ └── OracleProxy.sol # Main oracle proxy contract
├── scripts/
│ ├── deploy.ts # Deployment script
│ ├── get-oracle-result.ts # Script to retrieve oracle results
│ └── utils/
│ └── wallet.ts # Wallet utilities
├── test/ # Test files (to be added)
├── hardhat.config.ts # Hardhat configuration
├── package.json # Node.js dependencies
└── tsconfig.json # TypeScript configuration
- Install dependencies:
npm install- Compile contracts:
npm run compile- Bridge contracts must be deployed (see main project README)
- Update
scripts/deploy.tswith correct bridge addresses or set environment variables:BRIDGE_ADDRESS: Native bridge contract addressMESSAGE_BRIDGE_ADDRESS: Message bridge contract address
npm run deployOr with Hardhat directly:
npx hardhat run scripts/deploy.ts --network neoxDevnetDeployment addresses will be saved to deployment-addresses.json.
OracleProxy contract deployed address by network:
| Network | OracleProxy Address |
|---|---|
| testnet | 0xce6138E61e5727a318D0DebEaD99Aff24B929131 |
| mainnet | 0xce6138E61e5727a318D0DebEaD99Aff24B929131 |
The Hardhat configuration supports the following environment variables:
NEOX_DEVNET_RPC_URL: RPC URL (default: http://localhost:8562)NEOX_DEVNET_CHAIN_ID: Chain ID (default: 2312051126)NEOX_DEVNET_GAS_PRICE: Gas price (default: 4000000000)NEOX_DEVNET_PRIVATE_KEY: Private key for deployment
npm testMain contract that demonstrates:
- Bridging GAS from NeoX to N3
- Sending Oracle calls via message bridge
- Receiving and storing Oracle results
Key Functions:
initiateOracleCall(): Initiates the full bridge flowonOracleResult(): Receives oracle results from the message bridgegetOracleResult(): Retrieves stored Oracle resulthasOracleResult(): Checks if result exists
This project includes copies of the necessary interface and library files from bridge-evm-contracts:
contracts/interfaces/INativeBridge.solcontracts/interfaces/INativeBridgeExtended.solcontracts/interfaces/IBridgeManagement.solcontracts/messageBridge/interfaces/IMessageBridge.solcontracts/messageBridge/interfaces/IExecutionManager.solcontracts/messageBridge/AMBStorage.solcontracts/libraries/AMBTypes.solcontracts/libraries/BridgeLib.solcontracts/libraries/NeoSerializerLib.solcontracts/libraries/NeoTypes.solcontracts/libraries/StorageTypes.solcontracts/libraries/VarInt.sol
These files are copied from the bridge-evm-contracts submodule to allow Hardhat to compile the contracts. If the bridge contracts are updated, these files may need to be updated as well.
Deploy the OracleProxy contract:
npm run deployRetrieve an oracle result by request ID:
npx hardhat run scripts/get-oracle-result.ts --network neoxDevnetNote: Update the contract address and request ID in get-oracle-result.ts before running.