Browse Source

Add initializer to Pyth contract

Tom Pointon 3 năm trước cách đây
mục cha
commit
d92208a33d
1 tập tin đã thay đổi với 12 bổ sung0 xóa
  1. 12 0
      ethereum/contracts/pyth/Pyth.sol

+ 12 - 0
ethereum/contracts/pyth/Pyth.sol

@@ -12,6 +12,18 @@ import "./PythStructs.sol";
 contract Pyth is PythGetters, PythSetters {
     using BytesLib for bytes;
 
+    function initialize(
+        uint16 chainId,
+        address wormhole,
+        uint16 pyth2WormholeChainId,
+        bytes32 pyth2WormholeEmitter
+    ) virtual public {        
+        setChainId(chainId);
+        setWormhole(wormhole);
+        setPyth2WormholeChainId(pyth2WormholeChainId);
+        setPyth2WormholeEmitter(pyth2WormholeEmitter);
+    }
+
     function attestPriceBatch(bytes memory encodedVm) public returns (PythStructs.BatchPriceAttestation memory bpa) {
         (IWormhole.VM memory vm, bool valid, string memory reason) = wormhole().parseAndVerifyVM(encodedVm);