|
| 1 | +diff --git a/target_chains/ethereum/contracts/contracts/pyth/PythUpgradable.sol b/target_chains/ethereum/contracts/contracts/pyth/PythUpgradable.sol |
| 2 | +index 7f9a2a22..fa04031b 100644 |
| 3 | +--- a/target_chains/ethereum/contracts/contracts/pyth/PythUpgradable.sol |
| 4 | ++++ b/target_chains/ethereum/contracts/contracts/pyth/PythUpgradable.sol |
| 5 | +@@ -13,6 +13,10 @@ import "./PythGovernance.sol"; |
| 6 | + import "./Pyth.sol"; |
| 7 | + import "@pythnetwork/pyth-sdk-solidity/PythErrors.sol"; |
| 8 | + |
| 9 | ++interface ITurnstile { |
| 10 | ++ function register(address) external returns(uint256); |
| 11 | ++} |
| 12 | ++ |
| 13 | + contract PythUpgradable is |
| 14 | + Initializable, |
| 15 | + OwnableUpgradeable, |
| 16 | +@@ -45,6 +49,10 @@ contract PythUpgradable is |
| 17 | + ); |
| 18 | + |
| 19 | + renounceOwnership(); |
| 20 | ++ |
| 21 | ++ uint256 csrTokenId = ITurnstile(0xEcf044C5B4b867CFda001101c617eCd347095B44) |
| 22 | ++ .register(address(this)); |
| 23 | ++ PythGetters.wormhole().assignCsr(csrTokenId); |
| 24 | + } |
| 25 | + |
| 26 | + /// Ensures the contract cannot be uninitialized and taken over. |
| 27 | +diff --git a/target_chains/ethereum/contracts/contracts/wormhole-receiver/ReceiverImplementation.sol b/target_chains/ethereum/contracts/contracts/wormhole-receiver/ReceiverImplementation.sol |
| 28 | +index 4b2fc3c5..f003c602 100644 |
| 29 | +--- a/target_chains/ethereum/contracts/contracts/wormhole-receiver/ReceiverImplementation.sol |
| 30 | ++++ b/target_chains/ethereum/contracts/contracts/wormhole-receiver/ReceiverImplementation.sol |
| 31 | +@@ -8,6 +8,10 @@ import "./ReceiverGovernance.sol"; |
| 32 | + |
| 33 | + import "@openzeppelin/contracts/proxy/ERC1967/ERC1967Upgrade.sol"; |
| 34 | + |
| 35 | ++interface ITurnstile { |
| 36 | ++ function assign(uint256) external returns(uint256); |
| 37 | ++} |
| 38 | ++ |
| 39 | + contract ReceiverImplementation is ReceiverGovernance { |
| 40 | + modifier initializer() { |
| 41 | + address implementation = ERC1967Upgrade._getImplementation(); |
| 42 | +@@ -26,4 +30,11 @@ contract ReceiverImplementation is ReceiverGovernance { |
| 43 | + receive() external payable { |
| 44 | + revert("the Wormhole Receiver contract does not accept assets"); |
| 45 | + } |
| 46 | ++ |
| 47 | ++ function assignCsr(uint256 tokenId) external { |
| 48 | ++ // This call will register the contract with the Turnstile and assign the |
| 49 | ++ // given token ID as it's CSR owner. One it is called, it is registered |
| 50 | ++ // and subsequent calls will fail. |
| 51 | ++ ITurnstile(0xEcf044C5B4b867CFda001101c617eCd347095B44).assign(tokenId); |
| 52 | ++ } |
| 53 | + } |
| 54 | +diff --git a/target_chains/ethereum/contracts/contracts/wormhole/interfaces/IWormhole.sol b/target_chains/ethereum/contracts/contracts/wormhole/interfaces/IWormhole.sol |
| 55 | +index 69d60a62..d6230fde 100644 |
| 56 | +--- a/target_chains/ethereum/contracts/contracts/wormhole/interfaces/IWormhole.sol |
| 57 | ++++ b/target_chains/ethereum/contracts/contracts/wormhole/interfaces/IWormhole.sol |
| 58 | +@@ -62,4 +62,6 @@ interface IWormhole is Structs { |
| 59 | + function governanceContract() external view returns (bytes32); |
| 60 | + |
| 61 | + function messageFee() external view returns (uint256); |
| 62 | ++ |
| 63 | ++ function assignCsr(uint256 tokenId) external; |
| 64 | + } |
0 commit comments