Skip to content

Commit

Permalink
feat(nft): update deps and solc version, add ERC721 and ERC1155 suppo…
Browse files Browse the repository at this point in the history
…rt (#2)

This commit does the following:
* updates deps
* updates solidity version from ^0.5.0 to ^0.8.20
* implements ERC721 functions for EtomicSwap contract
* adds ERC721 tests
* implements ERC1155 functions for EtomicSwap contract
* adds ERC1155 tests
  • Loading branch information
laruh authored Jan 22, 2024
1 parent 330275d commit 3242f0c
Show file tree
Hide file tree
Showing 13 changed files with 1,826 additions and 2,278 deletions.
27 changes: 22 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Etomic Swap Smart Contracts for BarterDex platform.
# Etomic Swap Smart Contracts for Komodo SDK.
[![Build Status](https://travis-ci.org/artemii235/etomic-swap.svg?branch=master)](https://travis-ci.org/artemii235/etomic-swap)
Etomic swap Smart Contract is implemented to support ETH and ERC20 atomic swaps on BarterDex platform.
Etomic swap Smart Contract is implemented to support ETH and ERC20 atomic swaps on Komodo SDK.
Please note that this project is not production ready yet!

## Swap workflow
Expand All @@ -17,13 +17,14 @@ Despite example shows swap of ETH/ERC20 this approach will work also for ETH/ERC
## Project structure

1. `contracts` - Smart Contracts source code.
1. `migrations` - Deployment scripts.
1. `test` - Smart contracts unit tests.

## How to setup dev environment?

1. Install docker.
1. Run `docker-compose build`.
1. `cp .env.empty .env`.
1. Run `docker-compose build`.
1. Start containers `docker-compose up -d`.
1. Install project dependencies: `docker-compose exec workspace yarn`.
1. To run tests: `docker-compose exec workspace truffle test`.
Expand All @@ -35,5 +36,21 @@ Despite example shows swap of ETH/ERC20 this approach will work also for ETH/ERC
## Useful links for smart contracts development

1. Truffle suite - https://github.com/trufflesuite/truffle
1. Ganache-cli (EthereumJS Testrpc) - https://github.com/trufflesuite/ganache-cli
1. Zeppelin Solidity - https://github.com/OpenZeppelin/zeppelin-solidity
1. Ganache (EthereumJS Testrpc) - https://github.com/trufflesuite/ganache
1. OpenZeppelin Contracts - https://github.com/OpenZeppelin/openzeppelin-contracts

## Contribution Guide

- Run Docker tests to ensure that the project is set up successfully.
- Write tests for new contracts and functionalities.
- Run tests to confirm that new implementations work correctly.
- Format Solidity code before opening a pull request (PR). For formatting, you can use Remix Online IDE - https://remix.ethereum.org/

## Where Can I Write Solidity Code?

### Notes for Those Without an IDE:
Using Remix Online IDE is sufficient. There's no need to install anything locally.

### Notes for JetBrains or Visual Studio Code (VSCode) Users:
- These IDEs offer Solidity plugins, which can simplify your workflow. However, Remix Online IDE is also a viable option.
- To index JavaScript code, execute the Docker commands as mentioned. Necessary dependencies will be downloaded, enabling the IDE to index the rest of the code.
12 changes: 12 additions & 0 deletions contracts/Erc1155Token.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.20;
import "@openzeppelin/contracts/token/ERC1155/ERC1155.sol";

contract Erc1155Token is ERC1155 {
constructor(string memory tokenUri) ERC1155(tokenUri) {
uint256 tokenId = 1;
uint256 amount = 3;
_mint(msg.sender, tokenId, amount, "");
}
}
13 changes: 13 additions & 0 deletions contracts/Erc721Token.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.20;
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";

contract Erc721Token is ERC721 {
constructor(string memory tokenName, string memory tokenSymbol)
ERC721(tokenName, tokenSymbol)
{
uint256 tokenId = 1;
_mint(msg.sender, tokenId);
}
}
Loading

0 comments on commit 3242f0c

Please sign in to comment.