# Contract Validation Checklist

**Date**: $(date)  
**Purpose**: Comprehensive checklist for validating all deployed smart contracts  
**Status**: ⏳ **Pending Validation**

---

## 📋 Contracts to Validate

### 1. Oracle Contracts

#### Oracle Proxy (`0x3304b747e565a97ec8ac220b0b6a1f6ffdb837e6`)

- [ ] **Verification Status**
  - [ ] Verified on Blockscout: `https://explorer.d-bis.org/address/0x3304b747e565a97ec8ac220b0b6a1f6ffdb837e6`
  - [ ] Source code visible and matches deployment
  - [ ] Compiler version matches deployment

- [ ] **Functional Validation**
  - [ ] Contract has bytecode (not empty)
  - [ ] Contract responds to function calls
  - [ ] Can query latest price feed
  - [ ] Events emit correctly

- [ ] **Integration Validation**
  - [ ] Oracle Publisher service can update prices
  - [ ] MetaMask can read price feed
  - [ ] Price updates reflect correctly

#### Oracle Aggregator (`0x99b3511a2d315a497c8112c1fdd8d508d4b1e506`)

- [ ] **Verification Status**
  - [ ] Verified on Blockscout
  - [ ] Source code visible
  - [ ] Compiler version matches

- [ ] **Functional Validation**
  - [ ] Contract has bytecode
  - [ ] Can aggregate price data
  - [ ] Deviation detection works
  - [ ] Heartbeat mechanism works

- [ ] **Integration Validation**
  - [ ] Oracle Publisher can update aggregator
  - [ ] Proxy reads from aggregator correctly

---

### 2. CCIP Infrastructure

#### CCIP Router (`0x8078A09637e47Fa5Ed34F626046Ea2094a5CDE5e`)

- [ ] **Verification Status**
  - [ ] Verified on Blockscout (if custom contract)
  - [ ] Source code visible (if custom)
  - [ ] Note: May be Chainlink official contract

- [ ] **Functional Validation**
  - [ ] Contract has bytecode
  - [ ] Can query router configuration
  - [ ] Can calculate fees
  - [ ] Events emit correctly (MessageSent, MessageExecuted)

- [ ] **Integration Validation**
  - [ ] CCIP Monitor can read events
  - [ ] Bridge contracts can send messages
  - [ ] Fee calculation works correctly

#### CCIP Sender (`0x105F8A15b819948a89153505762444Ee9f324684`)

- [ ] **Verification Status**
  - [ ] Verified on Blockscout
  - [ ] Source code visible
  - [ ] Constructor parameters documented

- [ ] **Functional Validation**
  - [ ] Contract has bytecode
  - [ ] Can send CCIP messages
  - [ ] Router address configured correctly
  - [ ] Events emit correctly

- [ ] **Integration Validation**
  - [ ] Can send messages through router
  - [ ] Message tracking works
  - [ ] Fee payment works

---

### 3. Bridge Contracts

#### CCIPWETH9Bridge (`0x89dd12025bfCD38A168455A44B400e913ED33BE2`)

- [ ] **Verification Status**
  - [ ] Verified on Blockscout
  - [ ] Source code visible
  - [ ] Constructor arguments verified

- [ ] **Functional Validation**
  - [ ] Contract has bytecode
  - [ ] WETH9 address configured correctly
  - [ ] Router address configured correctly
  - [ ] Can initiate cross-chain transfers
  - [ ] Fee calculation works

- [ ] **Integration Validation**
  - [ ] Can wrap ETH to WETH9
  - [ ] Can approve bridge to spend WETH9
  - [ ] Can initiate transfer to destination chains
  - [ ] CCIP events trigger correctly
  - [ ] All 6 destination chains configured

#### CCIPWETH10Bridge (`0xe0E93247376aa097dB308B92e6Ba36bA015535D0`)

- [ ] **Verification Status**
  - [ ] Verified on Blockscout
  - [ ] Source code visible
  - [ ] Constructor arguments verified

- [ ] **Functional Validation**
  - [ ] Contract has bytecode
  - [ ] WETH10 address configured correctly
  - [ ] Router address configured correctly
  - [ ] Can initiate cross-chain transfers
  - [ ] Fee calculation works

- [ ] **Integration Validation**
  - [ ] Can wrap ETH to WETH10
  - [ ] Can approve bridge to spend WETH10
  - [ ] Can initiate transfer to destination chains
  - [ ] CCIP events trigger correctly
  - [ ] All 6 destination chains configured

---

### 4. Keeper Contract

#### Price Feed Keeper (`0xD3AD6831aacB5386B8A25BB8D8176a6C8a026f04`)

- [ ] **Verification Status**
  - [ ] Verified on Blockscout
  - [ ] Source code visible
  - [ ] Constructor arguments verified

- [ ] **Functional Validation**
  - [ ] Contract has bytecode
  - [ ] Can check upkeep needed
  - [ ] Can perform upkeep
  - [ ] Oracle integration works

- [ ] **Integration Validation**
  - [ ] Keeper service can execute upkeep
  - [ ] Triggers Oracle updates correctly
  - [ ] Automation works as expected

---

## 🔍 Validation Methods

### 1. On-chain Bytecode Check

```bash
# Check contract has bytecode
cast code <ADDRESS> --rpc-url https://rpc-core.d-bis.org

# Expected: Non-empty hex string (not "0x")
```

### 2. Function Call Validation

```bash
# Example: Check Oracle latest price
cast call 0x3304b747e565a97ec8ac220b0b6a1f6ffdb837e6 \
  "latestRoundData()(uint80,int256,uint256,uint256,uint80)" \
  --rpc-url https://rpc-core.d-bis.org

# Example: Check CCIP Router fee
cast call 0x8078A09637e47Fa5Ed34F626046Ea2094a5CDE5e \
  "getFee(uint64,bytes)" \
  <chain_selector> <data> \
  --rpc-url https://rpc-core.d-bis.org
```

### 3. Event Validation

```bash
# Check for recent events
cast logs --from-block latest --address <CONTRACT_ADDRESS> \
  --rpc-url https://rpc-core.d-bis.org
```

### 4. Blockscout Verification

```bash
# Check verification status via API
curl -s "https://explorer.d-bis.org/api/v2/smart-contracts/<ADDRESS>" | \
  jq '{address: .address, verified: .is_verified, name: .name}'
```

---

## ✅ Validation Status Summary

### Deployment Status
- ✅ All contracts deployed
- ✅ All addresses documented
- ✅ Services configured with addresses

### Verification Status
- ⏳ **0/7 contracts verified on Blockscout**
- ⏳ Oracle Proxy: Pending
- ⏳ Oracle Aggregator: Pending
- ⏳ CCIP Router: Pending (may be Chainlink official)
- ⏳ CCIP Sender: Pending
- ⏳ CCIPWETH9Bridge: Pending
- ⏳ CCIPWETH10Bridge: Pending
- ⏳ Price Feed Keeper: Pending

### Functional Validation Status
- ⏳ **Pending validation**
- [ ] Oracle contracts tested
- [ ] CCIP infrastructure tested
- [ ] Bridge contracts tested
- [ ] Keeper contract tested

### Integration Validation Status
- ⏳ **Pending validation**
- [x] CCIP Monitor service: ✅ Running
- [ ] Oracle Publisher service: Pending
- [ ] Bridge integrations: Pending
- [ ] Keeper service: Pending

---

## 🚀 Next Actions

### Immediate (High Priority)

1. **Verify All Contracts on Blockscout**
   ```bash
   ./scripts/verify-all-contracts.sh
   ```

2. **Check Contract Bytecode**
   ```bash
   for addr in \
     0x3304b747e565a97ec8ac220b0b6a1f6ffdb837e6 \
     0x99b3511a2d315a497c8112c1fdd8d508d4b1e506 \
     0x8078A09637e47Fa5Ed34F626046Ea2094a5CDE5e \
     0x105F8A15b819948a89153505762444Ee9f324684 \
     0x89dd12025bfCD38A168455A44B400e913ED33BE2 \
     0xe0E93247376aa097dB308B92e6Ba36bA015535D0 \
     0xD3AD6831aacB5386B8A25BB8D8176a6C8a026f04; do
     echo "Checking $addr..."
     cast code $addr --rpc-url https://rpc-core.d-bis.org | head -c 20
     echo ""
   done
   ```

### Short-term (Medium Priority)

3. **Functional Testing**
   - Test each contract's core functionality
   - Verify constructor parameters
   - Test event emission

4. **Integration Testing**
   - Test service-to-contract interactions
   - Verify event monitoring
   - Test cross-chain message flow

### Documentation

5. **Update Documentation**
   - Update verification status
   - Document any issues found
   - Create validation report

---

## 📚 Related Documentation

- **Verification Guide**: `docs/BLOCKSCOUT_VERIFICATION_GUIDE.md`
- **Verification Status**: `docs/CONTRACT_VERIFICATION_STATUS.md`
- **Remaining Steps**: `docs/REMAINING_STEPS_AND_VALIDATION.md`
- **Contract Addresses**: `docs/FINAL_CONTRACT_ADDRESSES.md`

---

**Last Updated**: $(date)  
**Next Review**: After verification completion

