Skip to content

Commit ce22d3a

Browse files
authored
Bump bsc node and yui-ibc-solidity (#74)
2 parents 9aa9680 + 6b92714 commit ce22d3a

File tree

10 files changed

+58
-52
lines changed

10 files changed

+58
-52
lines changed

e2e/chains/bsc/Dockerfile.bsc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM golang:1.23
1+
FROM golang:1.24-bookworm
22

33
ARG GIT_SOURCE
44
ARG GIT_CHECKOUT_BRANCH

e2e/chains/bsc/docker-compose.bsc.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@ services:
55
dockerfile: Dockerfile.bsc
66
args:
77
GIT_SOURCE: https://github.com/bnb-chain/bsc
8-
GIT_CHECKOUT_BRANCH: v1.5.16
8+
GIT_CHECKOUT_BRANCH: v1.5.19-feature-SI
99
image: bsc-geth:docker-local

e2e/contracts/Makefile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@ deploy:
77
.PHONY:test
88
test:
99
npx hardhat run ./scripts/send.js --network bsc_local2
10-
sleep 60
10+
sleep 10
1111
../testrly tx relay ibc01 --home ../.testrly
12-
sleep 20
12+
sleep 10
1313
npx hardhat run ./scripts/recv.js --network bsc_local1
14-
sleep 20
14+
sleep 10
1515
../testrly query unrelayed-packets ibc01 --home ../.testrly | grep '{"src":\[\],"dst":\[\]}'
1616
../testrly tx relay-acknowledgements ibc01 --home ../.testrly
17-
sleep 20
17+
sleep 10
1818
../testrly query unrelayed-acknowledgements ibc01 --home ../.testrly | grep '{"src":\[\],"dst":\[\]}'

e2e/contracts/contracts/Dependencies.sol

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,5 @@ import {
1616
import {IIBCHandler} from "@hyperledger-labs/yui-ibc-solidity/contracts/core/25-handler/IIBCHandler.sol";
1717
import {OwnableIBCHandler} from "@hyperledger-labs/yui-ibc-solidity/contracts/core/25-handler/OwnableIBCHandler.sol";
1818
import {ERC20Token} from "@hyperledger-labs/yui-ibc-solidity/contracts/apps/20-transfer/ERC20Token.sol";
19-
import {ICS20TransferBank} from "@hyperledger-labs/yui-ibc-solidity/contracts/apps/20-transfer/ICS20TransferBank.sol";
20-
import {ICS20Bank} from "@hyperledger-labs/yui-ibc-solidity/contracts/apps/20-transfer/ICS20Bank.sol";
19+
import {ICS20Transfer} from "@hyperledger-labs/yui-ibc-solidity/contracts/apps/20-transfer/ICS20Transfer.sol";
2120

e2e/contracts/package-lock.json

Lines changed: 15 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

e2e/contracts/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"author": "",
1010
"license": "ISC",
1111
"dependencies": {
12-
"@hyperledger-labs/yui-ibc-solidity": "git+https://github.com/hyperledger-labs/yui-ibc-solidity.git#v0.3.35"
12+
"@hyperledger-labs/yui-ibc-solidity": "git+https://github.com/hyperledger-labs/yui-ibc-solidity.git#semver:v0.3.39"
1313
},
1414
"devDependencies": {
1515
"@nomicfoundation/hardhat-toolbox": "^4.0.0",

e2e/contracts/scripts/deploy.js

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -69,12 +69,8 @@ async function main() {
6969

7070
// deploy ERC20 token
7171
await deploy(deployer, "ERC20Token", ["simple_erc_20_token_for_test", "simple_erc_20_token_for_test", 1000000]);
72-
const ibc20Bank = await deploy(deployer, "ICS20Bank");
73-
const ics20TransferBank = await deploy(deployer, "ICS20TransferBank", [ibcHandler.target, ibc20Bank.target]);
74-
await ibcHandler.bindPort(PortTransfer, ics20TransferBank.target).then(tx => tx.wait());
75-
const accounts = await hre.ethers.getSigners();
76-
await ibc20Bank.setOperator(ics20TransferBank.target).then(tx => tx.wait());
77-
await ibc20Bank.setOperator(accounts[0].address).then(tx => tx.wait());
72+
const ics20Transfer = await deploy(deployer, "ICS20Transfer", [ibcHandler.target, PortTransfer]);
73+
await ibcHandler.bindPort(PortTransfer, ics20Transfer.target).then(tx => tx.wait());
7874
}
7975

8076
if (require.main === module) {

e2e/contracts/scripts/recv.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,14 @@ const util = require("./util");
33
async function main() {
44
const accounts = await hre.ethers.getSigners();
55
const bob = accounts[1]
6-
76
try {
87

9-
const bank = await util.readContract("ICS20Bank");
10-
const bobAmount = await bank.balanceOf(bob, `transfer/channel-0/simple_erc_20_token_for_test`)
8+
const token= await util.readContract("ERC20Token");
9+
const baseDenom = token.target.toLowerCase();
10+
const transfer = await util.readContract("ICS20Transfer");
11+
const bobAmount = await transfer.balanceOf(bob, `transfer/${util.config.channel}/${baseDenom}`)
1112
console.log("received = ", bobAmount.toString())
12-
if (parseInt(bobAmount.toString(), 10) !== 20) {
13+
if (parseInt(bobAmount.toString(), 10) !== util.config.amount) {
1314
throw new Error("bob amount error");
1415
}
1516

e2e/contracts/scripts/send.js

Lines changed: 21 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -4,41 +4,36 @@ async function main() {
44
const accounts = await hre.ethers.getSigners();
55
const alice = accounts[0].address;
66
const bob = accounts[1].address;
7+
const timeoutHeight = [[1, 10000000],0];
8+
try {
9+
const token = await util.readContract("ERC20Token");
10+
const transfer = await util.readContract("ICS20Transfer");
711

8-
const port = "transfer";
9-
const channel = "channel-0";
10-
const timeoutHeight = 10000000;
11-
const mintAmount = 100;
12-
const sendingAmount = 20
12+
const before= await token.balanceOf(alice)
13+
console.log("before = ", before.toString())
1314

14-
try {
15-
// Mint
16-
const bank = await util.readContract("ICS20Bank");
17-
const mintResult = await bank.mint(alice, "simple_erc_20_token_for_test", mintAmount, {
15+
const escrowBefore= await token.balanceOf(transfer.target)
16+
console.log("escrow before = ", escrowBefore.toString())
17+
18+
// Deposit and SendTransfer
19+
await token.approve(transfer.target, util.config.amount, { from: alice }).then(tx => tx.wait());
20+
const depositResult = await transfer.depositSendTransfer(util.config.channel, token.target, util.config.amount, bob, timeoutHeight, {
1821
from: alice
19-
});
20-
const mintReceipt = await mintResult.wait()
21-
console.log("mint success", mintReceipt.hash);
22-
23-
// Send to counterparty chain
24-
const transfer = await util.readContract("ICS20TransferBank");
25-
const transferResult = await transfer.sendTransfer("simple_erc_20_token_for_test", sendingAmount, bob, port, channel, timeoutHeight, {
26-
from: alice,
27-
});
28-
const transferReceipt = await transferResult.wait()
29-
console.log("send success", transferReceipt.hash);
22+
})
23+
const depositReceipt = await depositResult.wait()
24+
console.log("depositSendTransfer success", depositReceipt.hash);
3025

3126
// Check reduced amount
32-
const aliceAmount = await bank.balanceOf(alice, "simple_erc_20_token_for_test")
33-
console.log("after = ", aliceAmount.toString())
34-
if (parseInt(aliceAmount.toString(), 10) !== mintAmount - sendingAmount) {
27+
const after= await token.balanceOf(alice)
28+
console.log("after = ", after.toString())
29+
if (parseInt(after.toString(), 10) !== Number(before) - util.config.amount) {
3530
throw new Error("alice amount error");
3631
}
3732

3833
// Check escrow balance
39-
const escrowAmount = await bank.balanceOf(transfer.target, "simple_erc_20_token_for_test")
40-
console.log("escrow = ", escrowAmount.toString())
41-
if (parseInt(escrowAmount.toString(), 10) !== sendingAmount) {
34+
const escrowAfter= await token.balanceOf(transfer.target)
35+
console.log("escrow after = ", escrowAfter.toString())
36+
if (parseInt(escrowAfter.toString(), 10) !== Number(escrowBefore) + util.config.amount) {
4237
throw new Error("escrow amount error");
4338
}
4439

e2e/contracts/scripts/util.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@ async function readContract(contractName) {
77
return await hre.ethers.getContractAt(contractName, address);
88
}
99

10+
const config = {
11+
channel:"channel-0",
12+
amount: 20
13+
}
14+
1015
module.exports = {
11-
readContract
16+
readContract,
17+
config
1218
};

0 commit comments

Comments
 (0)