Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
Orlando committed Nov 15, 2023
1 parent 7b1ed41 commit 2d0ee09
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 14 deletions.
12 changes: 11 additions & 1 deletion .github/workflows/test.yml → .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
name: test

on: workflow_dispatch
on:
pull_request:
branches:
- "main"
push:
branches:
- "main"

env:
FOUNDRY_PROFILE: ci
Expand All @@ -22,6 +28,10 @@ jobs:
with:
version: nightly

- name: Formatting
run: |
forge fmt
- name: Run Forge build
run: |
forge --version
Expand Down
4 changes: 1 addition & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,4 @@
[submodule "lib/openzeppelin-contracts"]
path = lib/openzeppelin-contracts
url = /~https://github.com/Openzeppelin/openzeppelin-contracts
[submodule "lib/create3-factory"]
path = lib/create3-factory
url = /~https://github.com/lifinance/create3-factory
branch = v5.0.0
7 changes: 5 additions & 2 deletions script/Deployer.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ pragma solidity ^0.8.21;

import "forge-std/Script.sol";
import "../src/Schnaps.sol";
import "../lib/create3-factory/src/ICREATE3Factory.sol";

interface ICREATE3Factory {
function deploy(bytes32 salt, bytes memory bytecode) external returns (address deployedAddress);
}

contract Deployer is Script {
using stdJson for string;
Expand Down Expand Up @@ -32,4 +35,4 @@ contract Deployer is Script {

vm.stopBroadcast();
}
}
}
7 changes: 4 additions & 3 deletions src/Schnaps.sol
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.21;
import {Ownable} from 'openzeppelin-contracts/contracts/access/Ownable.sol';
import {IERC20} from 'openzeppelin-contracts/contracts/token/ERC20/IERC20.sol';
import {SafeERC20} from 'openzeppelin-contracts/contracts/token/ERC20/utils/SafeERC20.sol';

import {Ownable} from "openzeppelin-contracts/contracts/access/Ownable.sol";
import {IERC20} from "openzeppelin-contracts/contracts/token/ERC20/IERC20.sol";
import {SafeERC20} from "openzeppelin-contracts/contracts/token/ERC20/utils/SafeERC20.sol";

contract Schnaps is Ownable {
using SafeERC20 for IERC20;
Expand Down
6 changes: 3 additions & 3 deletions test/Schnaps.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ pragma solidity ^0.8.21;

import {Test, console2} from "forge-std/Test.sol";
import {Schnaps} from "../src/Schnaps.sol";
import { TestToken } from "./mock.sol";
import {IERC20} from 'openzeppelin-contracts/contracts/token/ERC20/IERC20.sol';
import {TestToken} from "./mock.sol";
import {IERC20} from "openzeppelin-contracts/contracts/token/ERC20/IERC20.sol";

contract SchnapsTest is Test {
Schnaps public schnaps;
Expand All @@ -26,7 +26,7 @@ contract SchnapsTest is Test {
function test_payWithEth() public {
vm.expectEmit(true, true, true, true);
emit PaymentReceived(address(this), address(0), amount, barcode);

uint256 balance = address(this).balance;
schnaps.payWithEth{value: amount}(barcode);
uint256 new_balance = address(this).balance;
Expand Down
4 changes: 2 additions & 2 deletions test/mock.sol
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.21;

import {ERC20} from 'openzeppelin-contracts/contracts/token/ERC20/ERC20.sol';
import {ERC20} from "openzeppelin-contracts/contracts/token/ERC20/ERC20.sol";

contract TestToken is ERC20 {
constructor(uint256 initialSupply) ERC20("Test", "TST") {
_mint(msg.sender, initialSupply);
}
}
}

0 comments on commit 2d0ee09

Please sign in to comment.