Skip to content

Commit

Permalink
update the dependencies (#72)
Browse files Browse the repository at this point in the history
* update the dependencies based on the relayer chain module
* use ibc-solidity v0.3.13
* use relayer v0.4.8
* update tutorial
---------

Signed-off-by: Ryo Sato <ryo.sato@datachain.jp>
  • Loading branch information
3100 committed Sep 27, 2023
1 parent 6743dc4 commit 48e569c
Show file tree
Hide file tree
Showing 14 changed files with 5,025 additions and 3,138 deletions.
48 changes: 16 additions & 32 deletions contracts/minitoken/solidity/contracts/app/MiniToken.sol
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.9;

import "@hyperledger-labs/yui-ibc-solidity/contracts/core/OwnableIBCHandler.sol";
import "@hyperledger-labs/yui-ibc-solidity/contracts/apps/commons/IBCAppBase.sol";
import "@hyperledger-labs/yui-ibc-solidity/contracts/core/25-handler/IBCHandler.sol";
import "solidity-bytes-utils/contracts/BytesLib.sol";
import "../lib/Packet.sol";

contract MiniToken is IIBCModule {
contract MiniToken is IBCAppBase {
IBCHandler ibcHandler;

using BytesLib for *;

address private owner;

constructor(IBCHandler ibcHandler_) public {
constructor(IBCHandler ibcHandler_) {
owner = msg.sender;

ibcHandler = ibcHandler_;
Expand All @@ -38,12 +39,8 @@ contract MiniToken is IIBCModule {
_;
}

modifier onlyIBC() {
require(
msg.sender == address(ibcHandler),
"MiniToken: caller is not the ibcHandler"
);
_;
function ibcAddress() public view override returns (address) {
return address(ibcHandler);
}

function sendTransfer(
Expand Down Expand Up @@ -128,7 +125,7 @@ contract MiniToken is IIBCModule {

/// Module callbacks ///

function onRecvPacket(Packet.Data calldata packet, address relayer)
function onRecvPacket(Packet.Data calldata packet, address /*relayer*/)
external
virtual
override
Expand All @@ -145,7 +142,7 @@ contract MiniToken is IIBCModule {
function onAcknowledgementPacket(
Packet.Data calldata packet,
bytes calldata acknowledgement,
address relayer
address /*relayer*/
) external virtual override onlyIBC {
if (!_isSuccessAcknowledgement(acknowledgement)) {
_refundTokens(MiniTokenPacketData.decode(packet.data));
Expand Down Expand Up @@ -200,28 +197,15 @@ contract MiniToken is IIBCModule {
string memory sourceChannel,
uint64 timeoutHeight
) internal virtual {
(Channel.Data memory channel, bool found) = ibcHandler.getChannel(
sourcePort,
sourceChannel
);
require(found, "MiniToken: channel not found");
ibcHandler.sendPacket(
Packet.Data({
sequence: ibcHandler.getNextSequenceSend(
sourcePort,
sourceChannel
),
source_port: sourcePort,
source_channel: sourceChannel,
destination_port: channel.counterparty.port_id,
destination_channel: channel.counterparty.channel_id,
data: MiniTokenPacketData.encode(data),
timeout_height: Height.Data({
revision_number: 0,
revision_height: timeoutHeight
}),
timeout_timestamp: 0
})
sourcePort,
sourceChannel,
Height.Data({
revision_number: 0,
revision_height: timeoutHeight
}),
0,
MiniTokenPacketData.encode(data)
);
}

Expand Down
Loading

0 comments on commit 48e569c

Please sign in to comment.