Skip to content

Commit b0dc652

Browse files
committed
🔌 Refactor interfaces
1 parent 068f05e commit b0dc652

18 files changed

+57
-215
lines changed

.github/workflows/test.yml

+1-4
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,12 @@ on:
66
pull_request:
77
branches: ["main"]
88

9-
env:
10-
FOUNDRY_PROFILE: ci
11-
129
jobs:
1310
check:
1411
strategy:
1512
fail-fast: true
1613

17-
name: Foundry project
14+
name: KimlikDAO contract interfaces
1815
runs-on: ubuntu-latest
1916
steps:
2017
- uses: actions/checkout@v3

test/avalanche/addresses.t.sol avalanche/test/addresses.t.sol

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ pragma solidity ^0.8.0;
44

55
import {
66
TRYB, TRYB_DEPLOYER, USDC, USDC_DEPLOYER, USDT, USDT_DEPLOYER
7-
} from "avalanche/addresses.sol";
7+
} from "../addresses.sol";
88
import {Test} from "forge-std/Test.sol";
99

1010
contract addressesTest is Test {

testing/MockERC20Permit.sol erc/mock/ERC20Permit.sol

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
pragma solidity ^0.8.0;
44

5-
import {IERC20, IERC20Permit} from "../erc/IERC20Permit.sol";
5+
import {IERC20, IERC20Permit} from "../IERC20Permit.sol";
66

7-
abstract contract MockERC20 is IERC20 {
7+
abstract contract ERC20 is IERC20 {
88
uint256 public override totalSupply;
99
mapping(address => uint256) public override balanceOf;
1010
mapping(address => mapping(address => uint256)) public override allowance;
@@ -44,7 +44,7 @@ abstract contract MockERC20 is IERC20 {
4444
}
4545
}
4646

47-
abstract contract MockERC20Permit is MockERC20, IERC20Permit {
47+
abstract contract ERC20Permit is ERC20, IERC20Permit {
4848
// keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)");
4949
bytes32 public constant PERMIT_TYPEHASH =
5050
0x6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9;

ethereum/mockTokens.sol ethereum/mock/tokens.sol

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22

33
pragma solidity ^0.8.0;
44

5-
import {IERC20Permit} from "../erc/IERC20Permit.sol";
6-
import {MockERC20, MockERC20Permit} from "../testing/MockERC20Permit.sol";
7-
import {USDT} from "./addresses.sol";
5+
import {IERC20Permit} from "../../erc/IERC20Permit.sol";
6+
import {ERC20, ERC20Permit} from "../../erc/mock/ERC20Permit.sol";
7+
import {USDT} from "../addresses.sol";
88
import {Vm} from "forge-std/Vm.sol";
99

10-
contract USDTImpl is MockERC20 {
10+
contract USDTImpl is ERC20 {
1111
function name() public pure returns (string memory) {
1212
return "Tether USD";
1313
}

foundry.toml

+2-6
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,5 @@ sort_imports = true
77
optimizer = true
88
optimizer_runs = 20_000
99
remappings = ['forge-std/=lib/forge-std/src/']
10-
11-
[profile.ethereum]
12-
solc_version = "0.8.25"
13-
14-
[profile.zksync]
15-
solc_version = "0.8.24"
10+
test = "./"
11+
solc_version = "0.8.26"

kimlikdao/IProtocolFund.sol

-28
This file was deleted.

kimlikdao/addresses.sol

+8-38
Original file line numberDiff line numberDiff line change
@@ -2,57 +2,27 @@
22

33
pragma solidity ^0.8.0;
44

5-
//
6-
// The protocol funds on Ethereum L2s forward the funds to Ethereum
7-
// periodically. The redemption happens on Ethereum mainnet using the `redeem()`
8-
// method of KDAO on Ethereum.
9-
//
10-
// The protocol funds on alt L1s stay on its native chain and redeemed in-kind
11-
// on the corresponding chain. The redemption signal is forwarded to the chain
12-
// by the KimlikDAO signer nodes using BLS signatures.
13-
//
14-
// kimlikdao.eth
15-
address payable constant PROTOCOL_FUND = payable(0xcCc0106Dbc0291A0d5C97AAb42052Cb46dE60cCc);
16-
address constant PROTOCOL_FUND_DEPLOYER = 0x0DabB96F2320A170ac0dDc985d105913D937ea9A;
17-
18-
//
19-
// zksync.kimlikdao.eth
20-
//
21-
address payable constant PROTOCOL_FUND_ZKSYNC = payable(0xcCc0f14de126FD0D2707Ad39F1b7698921550cCc);
22-
address constant PROTOCOL_FUND_ZKSYNC_DEPLOYER = 0xadBde24bfC12829b30FaEe9cF5daB0F91AdC9400;
23-
245
// KPASS addresses
256
address constant KPASS = 0xcCc0a9b023177549fcf26c947edb5bfD9B230cCc;
267
address constant KPASS_DEPLOYER = 0x305166299B002a9aDE0e907dEd848878FD2237D7;
278
address constant KPASS_ZKSYNC = 0xcCc053d81e3B85Eac133a5333be4D7cBDd120cCc;
289
address constant KPASS_ZKSYNC_DEPLOYER = 0x1F7766565AaDD753379181678623273A82f8603c;
2910

3011
// KDAO addresses
31-
address constant KDAO_ETHEREUM = 0xcCc0AC04C9251B74b0b30A20Fc7cb26EB62B0cCc;
32-
address constant KDAO_ETHEREUM_DEPLOYER = 0xe7671eb60A45c905387df2b19A3803c6Be0Eb8f9;
33-
address constant KDAO_ZKSYNC = 0xcCc0b95cE2e18223bA8059F2c9Fad9d914450cCc;
34-
address constant KDAO_ZKSYNC_DEPLOYER = 0x0410641e73f261b98EB7aB189F6b4e1052833c2A;
35-
address constant KDAO_ZKSYNC_ALIAS = 0xdDd1AC04c9251B74B0B30A20FC7cb26Eb62b1ddd;
36-
address constant KDAO_PRESALE = 0xcCc07b3e77516A13B6810112E8fA6D2895c31cCc;
37-
address constant KDAO_PRESALE_DEPLOYER = 0x006d0847bad678B2b5116E74C69Da301d7172cfA;
12+
address payable constant KDAO = payable(0xcCc0106Dbc0291A0d5C97AAb42052Cb46dE60cCc);
13+
address constant KDAO_DEPLOYER = 0x0DabB96F2320A170ac0dDc985d105913D937ea9A;
3814

3915
// KDAO-l addresses
40-
address constant KDAO_LOCKED = 0xcCc0948D9e47Ab3932271DA380B3525DD05a1cCc;
41-
address constant KDAO_LOCKED_DEPLOYER = 0xb81bFa6348ACc1Dab88cc2b35d7eEce4A68aE2b2;
16+
address constant KDAO_LOCKED = 0xcCc0c2eED12d517c7bCe777Cf966bFECAEEF2cCc;
17+
address constant KDAO_LOCKED_DEPLOYER = 0x5A0c9eE857D79b9740024127F4a78F8ac0722995;
4218

43-
//
4419
// Voting contract
45-
//
46-
address constant VOTING_EVM = 0xcCc01Ec0E6Fb38Cce8b313c3c8dbfe66efD01cCc;
47-
address constant VOTING_EVM_DEPLOYER = 0xD808C187Ef7D6f9999b6D9538C72E095db8c6df9;
48-
address constant VOTING = 0xcCc0a523f5392AD629EfAA49E71844E61AB81cCc;
49-
address constant VOTING_DEPLOYER = 0x526F38A49130169412B00De254bDafbaAB4E7E91;
20+
address constant VOTING = 0xcCc01Ec0E6Fb38Cce8b313c3c8dbfe66efD01cCc;
21+
address constant VOTING_DEPLOYER = 0xD808C187Ef7D6f9999b6D9538C72E095db8c6df9;
5022

5123
// KPASS Signers
52-
address constant KPASS_SIGNERS_EVM = 0xcCc09aA0d174271259D093C598FCe9Feb2791cCc;
53-
address constant KPASS_SIGNERS_EVM_DEPLOYER = 0x4DeA92Bcb2C22011217C089797A270DfA5A51d53;
54-
address constant KPASS_SIGNERS = 0xcCc0b54E5538fa5B4E0EcE1f2B0ba9C01c8A1cCc;
55-
address constant KPASS_SIGNERS_DEPLOYER = 0x755DDeBf547DD2e9838d16b51525fe8e925a56D0;
24+
address constant KPASS_SIGNERS = 0xcCc09aA0d174271259D093C598FCe9Feb2791cCc;
25+
address constant KPASS_SIGNERS_DEPLOYER = 0x4DeA92Bcb2C22011217C089797A270DfA5A51d53;
5626

5727
// dev.kimlikdao.eth
5828
address constant DEV_FUND = 0xC152e02e54CbeaCB51785C174994c2084bd9EF51;

kimlikdao/test/addresses.t.sol

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
// SPDX-License-Identifier: MIT
2+
3+
pragma solidity ^0.8.0;
4+
5+
import {Test} from "forge-std/Test.sol";
6+
import {
7+
KDAO,
8+
KDAO_DEPLOYER,
9+
KDAO_LOCKED,
10+
KDAO_LOCKED_DEPLOYER,
11+
KPASS,
12+
KPASS_DEPLOYER,
13+
KPASS_ZKSYNC,
14+
KPASS_ZKSYNC_DEPLOYER
15+
} from "../addresses.sol";
16+
import {
17+
applyL1ToL2Alias,
18+
computeCreateAddress as computeZkSyncCreateAddress
19+
} from "../../zksync/IZkSync.sol";
20+
21+
contract addressesTest is Test {
22+
function testDeployerConsistency() public pure {
23+
assertEq(vm.computeCreateAddress(KPASS_DEPLOYER, 0), KPASS);
24+
assertEq(computeZkSyncCreateAddress(KPASS_ZKSYNC_DEPLOYER, 0), KPASS_ZKSYNC);
25+
26+
assertEq(vm.computeCreateAddress(KDAO_DEPLOYER, 0), KDAO);
27+
assertEq(vm.computeCreateAddress(KDAO_LOCKED_DEPLOYER, 0), KDAO_LOCKED);
28+
}
29+
}

test/kimlikdao/IProtocolFund.t.sol

-18
This file was deleted.

test/kimlikdao/addresses.t.sol

-45
This file was deleted.

testing/MockProtocolFund.sol

-24
This file was deleted.

testing/MockProtocolFundV1.sol

-35
This file was deleted.

test/types/amountAddr.t.sol types/test/amountAddr.t.sol

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
pragma solidity ^0.8.0;
44

55
import {Test} from "forge-std/Test.sol";
6-
import {amountAddr, amountAddrFrom} from "types/amountAddr.sol";
6+
import {amountAddr, amountAddrFrom} from "../amountAddr.sol";
77

88
contract amountAddrTest is Test {
99
function testAccessors() external pure {

test/types/uint128x2.t.sol types/test/uint128x2.t.sol

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
pragma solidity ^0.8.0;
44

55
import {Test} from "forge-std/Test.sol";
6-
import {uint128x2, uint128x2From} from "types/uint128x2.sol";
6+
import {uint128x2, uint128x2From} from "../uint128x2.sol";
77

88
contract uint128x2Test is Test {
99
function testAccessors() external pure {

test/types/uint48x2.t.sol types/test/uint48x2.t.sol

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
pragma solidity ^0.8.0;
44

55
import {Test} from "forge-std/Test.sol";
6-
import {uint48x2, uint48x2From} from "types/uint48x2.sol";
6+
import {uint48x2, uint48x2From} from "../uint48x2.sol";
77

88
contract uint48x2Test is Test {
99
function testAccessors() external pure {

zksync/mockTokens.sol zksync/mock/tokens.sol

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22

33
pragma solidity ^0.8.0;
44

5-
import {IERC20Permit} from "../erc/IERC20Permit.sol";
6-
import {MockERC20Permit} from "../testing/MockERC20Permit.sol";
7-
import {USDT} from "./addresses.sol";
5+
import {IERC20Permit} from "../../erc/IERC20Permit.sol";
6+
import {ERC20Permit} from "../../erc/mock/ERC20Permit.sol";
7+
import {USDT} from "../addresses.sol";
88
import {Vm} from "forge-std/Vm.sol";
99

10-
contract USDTImpl is MockERC20Permit {
10+
contract USDTImpl is ERC20Permit {
1111
function DOMAIN_SEPARATOR() public pure override returns (bytes32) {
1212
return keccak256(
1313
abi.encode(

test/zksync/L2Log.t.sol zksync/test/L2Log.t.sol

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
pragma solidity ^0.8.20;
44

55
import {Test} from "forge-std/Test.sol";
6-
import {L2LogLocator, L2LogLocatorFrom} from "zksync/L2Log.sol";
6+
import {L2LogLocator, L2LogLocatorFrom} from "../L2Log.sol";
77

88
contract L2LogLocatorTest is Test {
99
function testAccessors() external pure {

0 commit comments

Comments
 (0)