Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(ics20): initial version of transfer app #4

Merged
merged 19 commits into from
Jul 31, 2024
Merged
Show file tree
Hide file tree
Changes from 14 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,7 @@ yarn.lock
!broadcast
broadcast/*
broadcast/*/31337/

# ide files
.idea/
*.iml
srdtrk marked this conversation as resolved.
Show resolved Hide resolved
30 changes: 15 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,36 +27,36 @@ Note that OpenZeppelin Contracts is pre-installed, so you can follow that as an

This is a list of the most frequently needed commands.

### Build
### Install Dependencies

Build the contracts:
Install the dependencies:

```sh
$ forge build
$ bun install
```

### Clean
### Build

Delete the build artifacts and cache directories:
Build/compile the contracts:

```sh
$ forge clean
$ forge build
```

### Compile
### Test

Compile the contracts:
Run the tests:

```sh
$ forge build
$ forge test
```

### Coverage
### Clean

Get a test coverage report:
Delete the build artifacts and cache directories:

```sh
$ forge coverage
$ forge clean
```

### Deploy
Expand Down Expand Up @@ -97,12 +97,12 @@ Lint the contracts:
$ bun run lint
```

### Test
### Coverage

Run the tests:
Get a test coverage report:

```sh
$ forge test
$ forge coverage
```

Generate test coverage and output result to the terminal:
Expand Down
2 changes: 1 addition & 1 deletion src/ICS02Client.sol
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ contract ICS02Client is IICS02Client, IICS02ClientErrors, Ownable {
function getCounterparty(string calldata clientId) public view returns (CounterpartyInfo memory) {
CounterpartyInfo memory counterpartyInfo = counterpartyInfos[clientId];
if (bytes(counterpartyInfo.clientId).length == 0) {
revert IBCClientNotFound(clientId);
revert IBCCounterpartyClientNotFound(clientId);
}

return counterpartyInfo;
Expand Down
8 changes: 6 additions & 2 deletions src/ICS26Router.sol
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ contract ICS26Router is IICS26Router, IBCStore, Ownable, IICS26RouterErrors, Ree
/// @param msg_ The message for sending packets
/// @return The sequence number of the packet
function sendPacket(MsgSendPacket calldata msg_) external nonReentrant returns (uint32) {
string memory counterpartyId = ics02Client.getCounterparty(msg_.sourcePort).clientId;
string memory counterpartyId = ics02Client.getCounterparty(msg_.sourceChannel).clientId;
srdtrk marked this conversation as resolved.
Show resolved Hide resolved

// TODO: validate all identifiers
if (msg_.timeoutTimestamp <= block.timestamp) {
Expand All @@ -83,7 +83,11 @@ contract ICS26Router is IICS26Router, IBCStore, Ownable, IICS26RouterErrors, Ree
IIBCAppCallbacks.OnSendPacketCallback memory sendPacketCallback =
IIBCAppCallbacks.OnSendPacketCallback({ packet: packet, sender: msg.sender });

apps[msg_.sourcePort].onSendPacket(sendPacketCallback);
IIBCApp app = apps[msg_.sourcePort];
if (app == IIBCApp(address(0))) {
revert IBCAppNotFound(msg_.sourcePort);
}
app.onSendPacket(sendPacketCallback);

IBCStore.commitPacket(packet);

Expand Down
Loading