canto-deployment-patch.diff 2.8 KB

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