Skip to content

Commit

Permalink
Merge pull request #29 from zama-ai/feat/update-ethermint
Browse files Browse the repository at this point in the history
feat: updated ethermint and added CI
  • Loading branch information
jatZama authored Mar 6, 2024
2 parents fe0f841 + b36b31d commit 3e97eb6
Show file tree
Hide file tree
Showing 13 changed files with 9,740 additions and 49 deletions.
30 changes: 30 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Pull request tests
on:
pull_request:
branches:
- main
jobs:
build:
runs-on: large_ubuntu_16
strategy:
matrix:
node-version:
- 18.x
steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: pnpm/action-setup@v3
with:
version: 8
- run: cp .env.example .env
- run: pnpm install
- run: pnpm prettier:check
- name: pnpm CI test
run: |
# sometimes not created and is not tailed
touch fhevm.log
pnpm fhevm:start &> fhevm.log &
tail -f fhevm.log | sed '/Starting JSON WebSocket server/ q'
pnpm fhevm:faucet
pnpm test
pnpm fhevm:stop || true
23 changes: 23 additions & 0 deletions .github/workflows/testmock.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Pull request tests with mocks
on:
pull_request:
branches:
- main
jobs:
build:
runs-on: large_ubuntu_16
strategy:
matrix:
node-version:
- 18.x
steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: pnpm/action-setup@v3
with:
version: 8
- run: cp .env.example .env
- run: pnpm install
- run: pnpm prettier:check
- name: pnpm CI test:mock
run: pnpm test:mock
2 changes: 1 addition & 1 deletion .prettierrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ trailingComma: "all"
overrides:
- files: "*.sol"
options:
compiler: "0.8.17"
compiler: "0.8.22"
parser: "solidity-parse"
tabWidth: 4
- files: "*.ts"
Expand Down
2 changes: 1 addition & 1 deletion contracts/DAO/Comp.sol
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ contract Comp is EncryptedERC20, Ownable2Step {
* @notice Construct a new Comp token
*/
constructor() EncryptedERC20("Compound", "COMP") Ownable(msg.sender) {
_mint(1000000);
_mint(1000000, msg.sender);
}

/**
Expand Down
6 changes: 3 additions & 3 deletions contracts/token/ERC20/EncryptedERC20.sol
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,10 @@ abstract contract EncryptedERC20 is Reencrypt, EncryptedErrors {
}

// Increase sender's balance by the given `amount`.
function _mint(uint64 amount) internal virtual {
balances[msg.sender] = TFHE.add(balances[msg.sender], amount); // overflow impossible because of next line
function _mint(uint64 amount, address to) internal virtual {
balances[to] = TFHE.add(balances[to], amount); // overflow impossible because of next line
_totalSupply = _totalSupply + amount;
emit Mint(msg.sender, amount);
emit Mint(to, amount);
}

// Transfers an encrypted amount from the message sender address to the `to` address.
Expand Down
4 changes: 2 additions & 2 deletions contracts/token/ERC20/extensions/EncryptedERC20Mintable.sol
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ contract EncryptedERC20Mintable is Ownable2Step, EncryptedERC20 {
) Ownable(owner) EncryptedERC20(name_, symbol_) {}

// Increase owner's balance by the given `mintedAmount`.
function mint(uint64 mintedAmount) public virtual onlyOwner {
_mint(mintedAmount);
function mint(uint64 mintedAmount, address to) public virtual onlyOwner {
_mint(mintedAmount, to);
}
}
Loading

0 comments on commit 3e97eb6

Please sign in to comment.