Skip to content
This repository was archived by the owner on Jun 18, 2025. It is now read-only.

Added ERC20 support#15

Open
GabrielCartier wants to merge 6 commits into
mainfrom
feature/dev-339
Open

Added ERC20 support#15
GabrielCartier wants to merge 6 commits into
mainfrom
feature/dev-339

Conversation

@GabrielCartier

Copy link
Copy Markdown
Contributor

No description provided.

@linear

linear Bot commented Jul 10, 2024

Copy link
Copy Markdown

Comment on lines +14 to +21
function _transferERC20(address tokenAddress, uint256 amount, address from, address to) internal {
ERC20 token = ERC20(tokenAddress);
if (address(this) == from) {
token.transfer(to, amount);
} else {
token.transferFrom(from, to, amount);
}
}

Check failure

Code scanning / Slither

Unchecked transfer

EscrowHandler._transferERC20(address,uint256,address,address) (src/escrow/EscrowHandler.sol#14-21) ignores return value by token.transferFrom(from,to,amount) (src/escrow/EscrowHandler.sol#19)
Comment on lines +14 to +21
function _transferERC20(address tokenAddress, uint256 amount, address from, address to) internal {
ERC20 token = ERC20(tokenAddress);
if (address(this) == from) {
token.transfer(to, amount);
} else {
token.transferFrom(from, to, amount);
}
}

Check failure

Code scanning / Slither

Unchecked transfer

EscrowHandler._transferERC20(address,uint256,address,address) (src/escrow/EscrowHandler.sol#14-21) ignores return value by token.transfer(to,amount) (src/escrow/EscrowHandler.sol#17)
@github-actions

github-actions Bot commented Jul 10, 2024

Copy link
Copy Markdown

Changes to gas cost

Generated at commit: 1169f4a8fca179983e799f721893c625dc2e89a5, compared to commit: 4dbf7b0e14f8c1f79b0417139e114fd1336baf0a

🧾 Summary (10% most significant diffs)

Contract Method Avg (+/-) %
Echo cancelOffer
offers
+12,298 ❌
+573 ❌
+18.92%
+18.47%

Full diff report 👇
Contract Deployment Cost (+/-) Method Min (+/-) % Avg (+/-) % Median (+/-) % Max (+/-) % # Calls (+/-)
Echo 2,089,360 (+92,380) acceptOffer
cancelOffer
createOffer
executeOffer
offers
redeemOffer
tradingFee
29,053 (0)
29,076 (0)
31,981 (+258)
29,074 (0)
2,357 (+16)
29,099 (0)
340 (0)
0.00%
0.00%
+0.81%
0.00%
+0.68%
0.00%
0.00%
117,698 (+7,863)
77,294 (+12,298)
314,559 (+25,618)
119,957 (+9,370)
3,675 (+573)
80,823 (+9,173)
1,406 (+42)
+7.16%
+18.92%
+8.87%
+8.47%
+18.47%
+12.80%
+3.08%
120,980 (+263)
55,776 (+252)
328,567 (+1,345)
143,776 (+241)
3,863 (+380)
76,870 (-2,232)
2,340 (0)
+0.22%
+0.45%
+0.41%
+0.17%
+10.91%
-2.82%
0.00%
175,944 (+38,091)
174,148 (+43,317)
549,319 (+123,078)
248,218 (+69,574)
6,877 (+2,253)
176,747 (+78,365)
2,340 (0)
+27.63%
+33.11%
+28.88%
+38.95%
+48.72%
+79.65%
0.00%
39 (+5)
9 (+1)
64 (+7)
15 (+1)
24 (+6)
24 (+2)
45 (+4)

@github-actions

Copy link
Copy Markdown

Coverage after merging feature/dev-339 into feature/blast will be

74.60%

Coverage Report
FileStmtsBranchesFuncsLinesUncovered Lines
src
   Admin.sol100%100%100%100%
   Banker.sol100%100%100%100%
   Echo.sol100%100%100%100%
   EchoBlast.sol0%100%0%0%12, 12–13, 13–14, 14, 18, 18
   EchoState.sol100%100%100%100%
src/escrow
   Escrow.sol100%100%100%100%
   EscrowHandler.sol95%75%100%100%16
src/wormhole
   WormholeGovernance.sol0%0%0%0%100, 100, 12, 12, 12, 12, 12–13, 13, 15, 15, 15, 15–16, 16, 18, 18, 18, 18–19, 19, 21, 21–22, 22–23, 23, 96, 96, 96–97, 97, 97, 99, 99, 99, 99
   WormholeState.sol0%0%0%0%33, 33, 37, 37, 37, 41, 41, 54, 54, 54, 54–55, 55, 57, 57, 57, 57, 57–58, 58, 61, 61, 65, 65, 69, 69, 69
test/mock
   YieldMock.sol0%0%0%0%10, 10, 10, 10, 12, 12–13, 13, 17, 17, 21, 21

@github-actions

Copy link
Copy Markdown

Coverage after merging feature/dev-339 into feature/blast will be

77.50%

Coverage Report
FileStmtsBranchesFuncsLinesUncovered Lines
src
   Admin.sol100%100%100%100%
   Banker.sol100%100%100%100%
   Echo.sol100%100%100%100%
   EchoBlast.sol0%100%0%0%12, 12–13, 13–14, 14, 18, 18
   EchoState.sol100%100%100%100%
src/escrow
   Escrow.sol100%100%100%100%
   EscrowHandler.sol100%100%100%100%
src/wormhole
   WormholeGovernance.sol0%0%0%0%100, 100, 12, 12, 12, 12, 12–13, 13, 15, 15, 15, 15–16, 16, 18, 18, 18, 18–19, 19, 21, 21–22, 22–23, 23, 96, 96, 96–97, 97, 97, 99, 99, 99, 99
   WormholeState.sol0%0%0%0%33, 33, 37, 37, 37, 41, 41, 54, 54, 54, 54–55, 55, 57, 57, 57, 57, 57–58, 58, 61, 61, 65, 65, 69, 69, 69

@github-actions

Copy link
Copy Markdown

Coverage after merging feature/dev-339 into feature/blast will be

79.20%

Coverage Report
FileStmtsBranchesFuncsLinesUncovered Lines
src
   Admin.sol100%100%100%100%
   Banker.sol100%100%100%100%
   Echo.sol100%100%100%100%
   EchoBlast.sol33.33%100%50%25%12, 12–13, 13–14, 14
   EchoState.sol100%100%100%100%
src/escrow
   Escrow.sol100%100%100%100%
   EscrowHandler.sol100%100%100%100%
src/wormhole
   WormholeGovernance.sol0%0%0%0%100, 100, 12, 12, 12, 12, 12–13, 13, 15, 15, 15, 15–16, 16, 18, 18, 18, 18–19, 19, 21, 21–22, 22–23, 23, 96, 96, 96–97, 97, 97, 99, 99, 99, 99
   WormholeState.sol0%0%0%0%33, 33, 37, 37, 37, 41, 41, 54, 54, 54, 54–55, 55, 57, 57, 57, 57, 57–58, 58, 61, 61, 65, 65, 69, 69, 69
test
   BaseTestBlast.t.sol100%100%100%100%

Comment thread src/escrow/EscrowHandler.sol Outdated
Comment thread src/escrow/EscrowHandler.sol
Comment thread src/types/OfferItem.sol Outdated
Comment thread test/CancelOffer.t.sol
Comment thread test/ExecuteOffer.t.sol
Base automatically changed from feature/blast to feature/escrow July 15, 2024 21:30
Base automatically changed from feature/escrow to main July 15, 2024 21:31
@GabrielCartier

Copy link
Copy Markdown
Contributor Author

@0xjohnnycagewins added token type
I didnt add 1155 because it implies a bit more changes and i don't think we need it for now.

@github-actions

Copy link
Copy Markdown

Coverage after merging feature/dev-339 into main will be

77.97%

Coverage Report
FileStmtsBranchesFuncsLinesUncovered Lines
src
   Admin.sol100%100%100%100%
   Banker.sol100%100%100%100%
   Echo.sol100%100%100%100%
   EchoBlast.sol33.33%100%50%25%12–14
   EchoState.sol100%100%100%100%
src/escrow
   Escrow.sol100%100%100%100%
   EscrowHandler.sol100%100%100%100%
src/wormhole
   WormholeGovernance.sol0%0%0%0%100, 12, 12, 12–13, 15, 15, 15–16, 18, 18, 18–19, 21–23, 96–97, 99, 99, 99
   WormholeState.sol0%0%0%0%33, 37, 41, 54, 54, 54–55, 57, 57, 57–58, 61, 65, 69
test
   BaseTestBlast.t.sol100%100%100%100%

@github-actions

Copy link
Copy Markdown

Coverage after merging feature/dev-339 into main will be

77.97%

Coverage Report
FileStmtsBranchesFuncsLinesUncovered Lines
src
   Admin.sol100%100%100%100%
   Banker.sol100%100%100%100%
   Echo.sol100%100%100%100%
   EchoBlast.sol33.33%100%50%25%12–14
   EchoState.sol100%100%100%100%
src/escrow
   Escrow.sol100%100%100%100%
   EscrowHandler.sol100%100%100%100%
src/wormhole
   WormholeGovernance.sol0%0%0%0%100, 12, 12, 12–13, 15, 15, 15–16, 18, 18, 18–19, 21–23, 96–97, 99, 99, 99
   WormholeState.sol0%0%0%0%33, 37, 41, 54, 54, 54–55, 57, 57, 57–58, 61, 65, 69
test
   BaseTestBlast.t.sol100%100%100%100%

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants