This repository was archived by the owner on Jun 18, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Added ERC20 support #15
Open
GabrielCartier
wants to merge
6
commits into
main
Choose a base branch
from
feature/dev-339
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
066ea12
added testing script
GabrielCartier 8b3b1f6
Added ERC20 support
GabrielCartier d7d6579
removed edge case testing for now, not really useful
GabrielCartier 244d4a1
added safe transfer for erc20
GabrielCartier 5515087
added blast testing, not complete
GabrielCartier 04e8936
added token type
GabrielCartier File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| // SPDX-License-Identifier: UNLICENSED | ||
| pragma solidity ^0.8.18; | ||
|
|
||
| import "forge-std/Script.sol"; | ||
| import "../../src/EchoBlast.sol"; | ||
|
|
||
| contract CancelTestOffer is Script { | ||
| // Exclude from coverage report | ||
| function test() public {} | ||
|
|
||
| function run() external { | ||
| uint256 deployerPrivateKey = vm.envUint("PRIVATE_KEY"); | ||
| vm.startBroadcast(deployerPrivateKey); | ||
| bytes32 offerId = 0x16CBC4D75FA829A5524573F169FCAC91FC8935F41F58B705F0B9E624FEC0A9CB; | ||
| EchoBlast echo = EchoBlast(0xF37c2C531a6ffEBb8d3EdCF34e54b0E26047dA4C); | ||
| echo.cancelOffer(offerId); | ||
|
|
||
| vm.stopBroadcast(); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| // SPDX-License-Identifier: UNLICENSED | ||
| pragma solidity ^0.8.18; | ||
|
|
||
| import "forge-std/Script.sol"; | ||
| import "../../src/EchoBlast.sol"; | ||
| import "../../test/utils/OfferUtils.sol"; | ||
|
|
||
| contract CreateTestOffer is Script, OfferUtils { | ||
| // Exclude from coverage report | ||
| function test() public override {} | ||
|
|
||
| function run() external { | ||
| uint256 deployerPrivateKey = vm.envUint("PRIVATE_KEY"); | ||
| vm.startBroadcast(deployerPrivateKey); | ||
| EchoBlast echo = EchoBlast(0xF37c2C531a6ffEBb8d3EdCF34e54b0E26047dA4C); | ||
|
|
||
| address sender = address(0x213bE2f484Ab480db4f18b0Fe4C38e1C25877f09); | ||
| address receiver = address(0x20F039821DE7Db6f543c7C07D419800Eb9Bd01Af); | ||
| address NFT = address(0x43bE93945E168A205D708F1A41A124fA302e1f76); | ||
| uint256 expiration = 1818917576; | ||
| address[] memory senderTokenAddresses = new address[](1); | ||
| senderTokenAddresses[0] = NFT; | ||
| uint256[] memory senderTokenIds = new uint256[](1); | ||
| senderTokenIds[0] = 2; | ||
| uint256[] memory senderTokenAmounts = new uint256[](1); | ||
| senderTokenAmounts[0] = 0; | ||
| address[] memory receiverTokenAddresses = new address[](1); | ||
| receiverTokenAddresses[0] = NFT; | ||
| uint256[] memory receiverTokenIds = new uint256[](1); | ||
| receiverTokenIds[0] = 1; | ||
| uint256[] memory receiverTokenAmounts = new uint256[](1); | ||
| receiverTokenAmounts[0] = 0; | ||
|
|
||
| OfferItems memory senderItems = | ||
| generateOfferItems(senderTokenAddresses, senderTokenIds, senderTokenAmounts, block.chainid); | ||
| OfferItems memory receiverItems = | ||
| generateOfferItems(receiverTokenAddresses, receiverTokenIds, receiverTokenAmounts, block.chainid); | ||
|
|
||
| Offer memory offer = generateOffer(sender, senderItems, receiver, receiverItems, expiration, OfferState.OPEN); | ||
| echo.createOffer(offer); | ||
|
|
||
| vm.stopBroadcast(); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,9 +1,15 @@ | ||
| // SPDX-License-Identifier: MIT | ||
| pragma solidity ^0.8.18; | ||
|
|
||
| // @dev Struct representing an offer item (a token) | ||
| // @dev We only support ERC721 on EVM chains for now | ||
| enum TokenType { | ||
| ERC20, | ||
| ERC721 | ||
| } | ||
|
|
||
| // @dev Struct representing an offer item | ||
| // @dev We support ERC721 and ERC20 | ||
| struct OfferItem { | ||
| address tokenAddress; | ||
| uint256 tokenId; | ||
| TokenType tokenType; | ||
| uint256 tokenIdOrAmount; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| // SPDX-License-Identifier: UNLICENSED | ||
| pragma solidity ^0.8.18; | ||
|
|
||
| import "forge-std/Test.sol"; | ||
| import "./BaseTestBlast.t.sol"; | ||
|
|
||
| contract AdminBlastTest is BaseTestBlast { | ||
| function testCannotClaimGasIfNotOwner() public { | ||
| vm.prank(account1); | ||
| vm.expectRevert("UNAUTHORIZED"); | ||
| echoBlast.claimGas(); | ||
| } | ||
|
|
||
| // TODO Should be able to test that properly | ||
| function testCanClaimGasIfNotOwner() public { | ||
| vm.prank(owner); | ||
| vm.expectRevert(bytes("must withdraw non-zero amount")); | ||
| echoBlast.claimGas(); | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.