Skip to content

Commit

Permalink
fix(evm): ucs00 upgradeable and deployed on devnet (#3302)
Browse files Browse the repository at this point in the history
  • Loading branch information
PoisonPhang authored Nov 25, 2024
2 parents 395a768 + bb7304c commit c4838e7
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 10 deletions.
11 changes: 6 additions & 5 deletions evm/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,12 @@ The combination `(deployer_source, deployer_source_nonce, deployer, sender, salt

This links are working if you run a local devnet on a x86 machine only (Blockscout is currently unsupported on arm64).

- IBCHandler: [0xed2af2ad7fe0d92011b26a2e5d1b4dc7d12a47c5](http://localhost/address/0x524D4d28fc90dc5A257162abE37081f52681C7D6)
- CometblsClient: [0xc4f27a952faba4174ce0ee6d9d0c6f4c41524d49](http://localhost/address/0xc4f27a952faba4174ce0ee6d9d0c6f4c41524d49)
- UCS01: [0xa9d03ba6e27b43c69a64c87f845485b73a8e5d46](http://localhost/address/0xa9d03ba6e27b43c69a64c87f845485b73a8e5d46)
- UCS02: [0x524d4d28fc90dc5a257162abe37081f52681c7d6](http://localhost/address/0x524d4d28fc90dc5a257162abe37081f52681c7d6)
- Multicall: [0x9fd9D9528c8373D990a1380B9414bDE179007A35](http://localhost/address/0x9fd9D9528c8373D990a1380B9414bDE179007A35?tab=contract)
- IBCHandler: [0xed2af2aD7FE0D92011b26A2e5D1B4dC7D12A47C5](http://localhost/address/0xed2af2aD7FE0D92011b26A2e5D1B4dC7D12A47C5)
- CometblsClient: [0xc4f27a952faBa4174ce0Ee6D9d0c6F4c41524d49](http://localhost/address/0xc4f27a952faBa4174ce0Ee6D9d0c6F4c41524d49)
- UCS00: [0x21bd17aec8CEb789D3145a606968Dcc428c1e4F4](http://localhost/address/0x21bd17aec8CEb789D3145a606968Dcc428c1e4F4)
- UCS01: [0xa9d03ba6E27B43c69a64C87F845485b73A8e5d46](http://localhost/address/0xa9d03ba6E27B43c69a64C87F845485b73A8e5d46)
- UCS02: [0x524D4d28fc90dc5A257162abE37081f52681C7D6](http://localhost/address/0x524D4d28fc90dc5A257162abE37081f52681C7D6)
- Multicall: [0x9fd9D9528c8373D990a1380B9414bDE179007A35](http://localhost/address/0x9fd9D9528c8373D990a1380B9414bDE179007A35)

## Testnet 8

Expand Down
30 changes: 27 additions & 3 deletions evm/contracts/apps/ucs/00-pingpong/PingPong.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
pragma solidity ^0.8.27;

import "@openzeppelin-upgradeable/proxy/utils/Initializable.sol";
import "@openzeppelin-upgradeable/proxy/utils/UUPSUpgradeable.sol";
import "@openzeppelin-upgradeable/access/OwnableUpgradeable.sol";
import "@openzeppelin-upgradeable/utils/PausableUpgradeable.sol";

import "../../Base.sol";
import "../../../core/25-handler/IBCHandler.sol";

Expand Down Expand Up @@ -39,14 +44,29 @@ library PingPongLib {
}
}

contract PingPong is IBCAppBase {
contract PingPong is
IBCAppBase,
Initializable,
UUPSUpgradeable,
OwnableUpgradeable,
PausableUpgradeable
{
using PingPongLib for *;

IBCHandler private ibcHandler;
IIBCPacket private ibcHandler;
uint32 private srcChannelId;
uint64 private timeout;

constructor(IBCHandler _ibcHandler, uint64 _timeout) {
constructor() {
_disableInitializers();
}

function initialize(
IIBCPacket _ibcHandler,
address admin,
uint64 _timeout
) public initializer {
__Ownable_init(admin);
ibcHandler = _ibcHandler;
timeout = _timeout;
}
Expand Down Expand Up @@ -189,4 +209,8 @@ contract PingPong is IBCAppBase {
// Symmetric to onChanCloseInit
revert PingPongLib.ErrInfiniteGame();
}

function _authorizeUpgrade(
address newImplementation
) internal override onlyOwner {}
}
34 changes: 32 additions & 2 deletions evm/scripts/Deploy.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,24 @@ abstract contract UnionScript is UnionBase {
);
}

function deployUCS00(
IBCHandler handler,
address owner,
uint64 timeout
) internal returns (PingPong) {
return PingPong(
deploy(
Protocols.make(Protocols.UCS00),
abi.encode(
address(new PingPong()),
abi.encodeCall(
PingPong.initialize, (handler, owner, timeout)
)
)
)
);
}

function deployUCS01(
IBCHandler handler,
address owner
Expand Down Expand Up @@ -168,14 +186,22 @@ abstract contract UnionScript is UnionBase {
address owner
)
internal
returns (IBCHandler, CometblsClient, UCS01Relay, UCS02NFT, Multicall)
returns (
IBCHandler,
CometblsClient,
PingPong,
UCS01Relay,
UCS02NFT,
Multicall
)
{
IBCHandler handler = deployIBCHandler(owner);
CometblsClient client = deployCometbls(handler, owner);
PingPong pingpong = deployUCS00(handler, owner, 100000000000);
UCS01Relay relay = deployUCS01(handler, owner);
UCS02NFT nft = deployUCS02(handler, owner);
Multicall multicall = deployMulticall();
return (handler, client, relay, nft, multicall);
return (handler, client, pingpong, relay, nft, multicall);
}
}

Expand Down Expand Up @@ -229,6 +255,7 @@ contract DeployIBC is UnionScript {
(
IBCHandler handler,
CometblsClient client,
PingPong pingpong,
UCS01Relay relay,
UCS02NFT nft,
Multicall multicall
Expand All @@ -241,6 +268,7 @@ contract DeployIBC is UnionScript {
console.log("Sender: ", vm.addr(privateKey));
console.log("IBCHandler: ", address(handler));
console.log("CometblsClient: ", address(client));
console.log("UCS00: ", address(pingpong));
console.log("UCS01: ", address(relay));
console.log("UCS02: ", address(nft));
console.log("Multicall: ", address(multicall));
Expand All @@ -264,6 +292,7 @@ contract DeployDeployerAndIBC is UnionScript {
(
IBCHandler handler,
CometblsClient client,
PingPong pingpong,
UCS01Relay relay,
UCS02NFT nft,
Multicall multicall
Expand All @@ -276,6 +305,7 @@ contract DeployDeployerAndIBC is UnionScript {
console.log("Sender: ", vm.addr(privateKey));
console.log("IBCHandler: ", address(handler));
console.log("CometblsClient: ", address(client));
console.log("UCS00: ", address(pingpong));
console.log("UCS01: ", address(relay));
console.log("UCS02: ", address(nft));
console.log("Multicall: ", address(multicall));
Expand Down

0 comments on commit c4838e7

Please sign in to comment.