@reality.eth/contracts 3.0.45 → 3.0.47
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.prettierrc +16 -0
- package/abi/solc-0.8.20/RealityETH-4.0.abi.json +1 -0
- package/abi/solc-0.8.20/RealityETH_ERC20-4.0.abi.json +1 -0
- package/bytecode/Arbitrator.bin +1 -1
- package/bytecode/RealityETH-3.0.bin +1 -1
- package/bytecode/RealityETH-4.0.bin +1 -0
- package/bytecode/RealityETH_ERC20-3.0.bin +1 -1
- package/bytecode/RealityETH_ERC20-4.0.bin +1 -0
- package/chains/chainid.network.json +5033 -431
- package/chains/deployments/300/ETH/RealityETH-3.0.json +7 -0
- package/chains/supported.json +3 -0
- package/development/contracts/.solhint.json +9 -0
- package/development/contracts/Arbitrator.sol +32 -81
- package/development/contracts/BalanceHolder.sol +4 -10
- package/development/contracts/BalanceHolder_ERC20.sol +5 -11
- package/development/contracts/CallbackClient.sol +3 -10
- package/development/contracts/ERC20Token.sol +29 -30
- package/development/contracts/ExplodingCallbackClient.sol +1 -4
- package/development/contracts/IArbitrator.sol +23 -23
- package/development/contracts/IArbitratorCore.sol +14 -0
- package/development/contracts/IArbitratorCrowdFundable.sol +8 -0
- package/development/contracts/IArbitratorErrors.sol +10 -0
- package/development/contracts/IArbitratorForeignProxy.sol +15 -7
- package/development/contracts/IArbitratorLegacy.sol +9 -0
- package/development/contracts/IArbitratorManagement.sol +25 -0
- package/development/contracts/IBalanceHolder.sol +3 -3
- package/development/contracts/IBalanceHolder_ERC20.sol +5 -5
- package/development/contracts/IERC20.sol +4 -5
- package/development/contracts/IOwned.sol +3 -3
- package/development/contracts/IRealityETH.sol +5 -58
- package/development/contracts/IRealityETHCommitReveal.sol +17 -0
- package/development/contracts/IRealityETHCommitReveal_ERC20.sol +16 -0
- package/development/contracts/IRealityETHCore.sol +135 -0
- package/development/contracts/IRealityETHCore_ERC20.sol +149 -0
- package/development/contracts/IRealityETHErrors.sol +86 -0
- package/development/contracts/IRealityETHErrors_ERC20.sol +13 -0
- package/development/contracts/IRealityETH_ERC20.sol +5 -62
- package/development/contracts/Owned.sol +4 -6
- package/development/contracts/{RealityETH-3.0.sol → RealityETH-4.0.sol} +221 -383
- package/development/contracts/{RealityETH_ERC20-3.0.sol → RealityETH_ERC20-4.0.sol} +238 -474
- package/development/contracts/RealityETH_ERC20_Factory.sol +47 -42
- package/development/contracts/RegisteredWalletArbitrator.sol +8 -15
- package/development/contracts/compile.py +3 -0
- package/development/scripts/string_to_error.py +111 -0
- package/development/version_checksums/check_matches_flat.sh +20 -0
- package/development/version_checksums/check_matches_last.sh +37 -0
- package/development/version_checksums/log_bytecode_history.sh +41 -0
- package/generated/chains.json +33 -5
- package/generated/tokens.json +1 -0
- package/non_standard_deployments/zksync/LICENSE +21 -0
- package/non_standard_deployments/zksync/README.md +51 -0
- package/non_standard_deployments/zksync/deploy/deploy.ts +11 -0
- package/non_standard_deployments/zksync/deploy/utils.ts +168 -0
- package/non_standard_deployments/zksync/hardhat.config.ts +55 -0
- package/non_standard_deployments/zksync/package-lock.json +6295 -0
- package/non_standard_deployments/zksync/package.json +34 -0
- package/package.json +7 -3
- package/scripts/transfer_arbitrator.js +60 -0
- package/tests/python/requirements.txt +55 -54
- package/tests/python/test.py +150 -50
- package/tests/python/test_erc20.py +15 -14
- package/tokens/ETH.json +3 -2
- package/non_standard_deployments/zksync2/README +0 -21
- package/non_standard_deployments/zksync2/contracts/RealityETH_ERC20-3.0.sol +0 -1096
- package/non_standard_deployments/zksync2/deploy/deploy.ts +0 -62
- package/non_standard_deployments/zksync2/deploy/deploy_erc20.ts +0 -56
- package/non_standard_deployments/zksync2/deploy/deploy_mainnet.ts +0 -46
- package/non_standard_deployments/zksync2/hardhat.config.ts +0 -27
- package/non_standard_deployments/zksync2/package.json +0 -15
- package/non_standard_deployments/zksync2/yarn.lock +0 -2898
- /package/non_standard_deployments/{zksync2 → zksync}/contracts/RealityETH-3.0.sol +0 -0
|
@@ -1,48 +1,53 @@
|
|
|
1
1
|
// SPDX-License-Identifier: GPL-3.0-only
|
|
2
2
|
|
|
3
|
-
pragma solidity ^0.8.
|
|
3
|
+
pragma solidity ^0.8.20;
|
|
4
4
|
|
|
5
|
-
import "./IRealityETH_ERC20.sol";
|
|
6
|
-
import "./IERC20.sol";
|
|
5
|
+
import {IRealityETH_ERC20} from "./IRealityETH_ERC20.sol";
|
|
6
|
+
import {IERC20} from "./IERC20.sol";
|
|
7
7
|
|
|
8
|
+
// solhint-disable-next-line contract-name-camelcase
|
|
8
9
|
contract RealityETH_ERC20_Factory {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
10
|
+
/// @notice There should only be one deployment per version per token
|
|
11
|
+
error ThereShouldOnlyBeOneDeploymentPerVersionPerToken();
|
|
12
|
+
|
|
13
|
+
address public libraryAddress;
|
|
14
|
+
mapping(address => address) public deployments;
|
|
15
|
+
|
|
16
|
+
// solhint-disable-next-line event-name-camelcase
|
|
17
|
+
event RealityETH_ERC20_deployed(address reality_eth, address token, uint8 decimals, string token_ticker);
|
|
18
|
+
|
|
19
|
+
constructor(address _libraryAddress) {
|
|
20
|
+
libraryAddress = _libraryAddress;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/// @notice Returns the address of a proxy based on the specified address
|
|
24
|
+
/// @dev based on https://github.com/optionality/clone-factory
|
|
25
|
+
function _deployProxy(address _target) internal returns (address result) {
|
|
26
|
+
bytes20 targetBytes = bytes20(_target);
|
|
27
|
+
// solhint-disable-next-line no-inline-assembly
|
|
28
|
+
assembly {
|
|
29
|
+
let clone := mload(0x40)
|
|
30
|
+
mstore(clone, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000000000000000000000)
|
|
31
|
+
mstore(add(clone, 0x14), targetBytes)
|
|
32
|
+
mstore(add(clone, 0x28), 0x5af43d82803e903d91602b57fd5bf30000000000000000000000000000000000)
|
|
33
|
+
result := create(0, clone, 0x37)
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function createInstance(address _token) external {
|
|
38
|
+
if (deployments[_token] != address(0)) revert ThereShouldOnlyBeOneDeploymentPerVersionPerToken();
|
|
39
|
+
uint8 decimals = IERC20(_token).decimals();
|
|
40
|
+
string memory ticker = IERC20(_token).symbol();
|
|
41
|
+
address clone = _deployProxy(libraryAddress);
|
|
42
|
+
IRealityETH_ERC20(clone).setToken(IERC20(_token));
|
|
43
|
+
/* solhint-disable quotes */
|
|
44
|
+
IRealityETH_ERC20(clone).createTemplate('{"title": "%s", "type": "bool", "category": "%s", "lang": "%s"}');
|
|
45
|
+
IRealityETH_ERC20(clone).createTemplate('{"title": "%s", "type": "uint", "decimals": 18, "category": "%s", "lang": "%s"}');
|
|
46
|
+
IRealityETH_ERC20(clone).createTemplate('{"title": "%s", "type": "single-select", "outcomes": [%s], "category": "%s", "lang": "%s"}');
|
|
47
|
+
IRealityETH_ERC20(clone).createTemplate('{"title": "%s", "type": "multiple-select", "outcomes": [%s], "category": "%s", "lang": "%s"}');
|
|
48
|
+
IRealityETH_ERC20(clone).createTemplate('{"title": "%s", "type": "datetime", "category": "%s", "lang": "%s"}');
|
|
49
|
+
/* solhint-enable quotes */
|
|
50
|
+
deployments[_token] = clone;
|
|
51
|
+
emit RealityETH_ERC20_deployed(clone, _token, decimals, ticker);
|
|
52
|
+
}
|
|
48
53
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
pragma solidity ^0.4.25;
|
|
2
2
|
|
|
3
|
-
import
|
|
4
|
-
import
|
|
3
|
+
import "./Arbitrator.sol";
|
|
4
|
+
import "./IERC20.sol";
|
|
5
5
|
|
|
6
6
|
/*
|
|
7
7
|
This contract extends the standard Arbitrator contract to make it possible to make routine fund withdrawals to an address pre-registered by the owner without actually being the owner.
|
|
@@ -10,28 +10,24 @@ We do this to facilitate controlling Arbitrator contracts using multisig wallets
|
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
12
|
contract RegisteredWalletArbitrator is Arbitrator {
|
|
13
|
-
|
|
14
13
|
address registered_wallet;
|
|
15
14
|
|
|
16
15
|
/// @notice Withdraw any accumulated question fees from the specified address into this contract
|
|
17
16
|
/// @dev Funds can then be liberated from this contract with our withdraw() function
|
|
18
17
|
/// @dev Usually the arbitrator calls this, but if someone else does that's OK too
|
|
19
|
-
function callWithdraw()
|
|
20
|
-
|
|
21
|
-
realitio.withdraw();
|
|
18
|
+
function callWithdraw() public {
|
|
19
|
+
realitio.withdraw();
|
|
22
20
|
}
|
|
23
21
|
|
|
24
22
|
/// @notice Withdraw money from the arbitrator contract to our registered wallet
|
|
25
|
-
function withdrawToRegisteredWalletERC20(IERC20 _token)
|
|
26
|
-
external {
|
|
23
|
+
function withdrawToRegisteredWalletERC20(IERC20 _token) external {
|
|
27
24
|
require(registered_wallet != 0x0, "No wallet is registered");
|
|
28
25
|
uint256 bal = _token.balanceOf(address(this));
|
|
29
26
|
_token.transfer(registered_wallet, bal);
|
|
30
27
|
}
|
|
31
28
|
|
|
32
29
|
/// @notice Withdraw money from the arbitrator contract to our registered wallet
|
|
33
|
-
function withdrawToRegisteredWallet()
|
|
34
|
-
external {
|
|
30
|
+
function withdrawToRegisteredWallet() external {
|
|
35
31
|
require(registered_wallet != 0x0, "No wallet is registered");
|
|
36
32
|
registered_wallet.transfer(address(this).balance);
|
|
37
33
|
}
|
|
@@ -39,10 +35,7 @@ contract RegisteredWalletArbitrator is Arbitrator {
|
|
|
39
35
|
/// @notice Change the address of our registered wallet
|
|
40
36
|
/// @param addr The address of the new wallet
|
|
41
37
|
/// @dev Set to 0x0 to not use the registered wallet
|
|
42
|
-
function updateRegisteredWallet(address addr)
|
|
43
|
-
|
|
44
|
-
external {
|
|
45
|
-
registered_wallet= addr;
|
|
38
|
+
function updateRegisteredWallet(address addr) external onlyOwner {
|
|
39
|
+
registered_wallet = addr;
|
|
46
40
|
}
|
|
47
|
-
|
|
48
41
|
}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import sys
|
|
2
|
+
import re
|
|
3
|
+
|
|
4
|
+
def camelcase(s):
|
|
5
|
+
return ''.join(t.title() for t in s.split())
|
|
6
|
+
|
|
7
|
+
def stringToError(s):
|
|
8
|
+
s = s.replace(".", " ")
|
|
9
|
+
s = s.replace("-", " ")
|
|
10
|
+
s = s.replace(",", " ")
|
|
11
|
+
s = s.replace("?", "")
|
|
12
|
+
return camelcase(s)
|
|
13
|
+
|
|
14
|
+
def invert_sign(expr):
|
|
15
|
+
inversions = {
|
|
16
|
+
'> 0': '== 0',
|
|
17
|
+
'==': '!=',
|
|
18
|
+
'!=': '==',
|
|
19
|
+
'>=': '<',
|
|
20
|
+
'<=': '>',
|
|
21
|
+
'<': '>=',
|
|
22
|
+
'>': '<='
|
|
23
|
+
}
|
|
24
|
+
for before in inversions:
|
|
25
|
+
after = inversions[before]
|
|
26
|
+
new_expr = expr.replace(before, after)
|
|
27
|
+
if new_expr != expr:
|
|
28
|
+
return new_expr
|
|
29
|
+
|
|
30
|
+
if expr.startswith("!"):
|
|
31
|
+
return expr[1:]
|
|
32
|
+
else:
|
|
33
|
+
return "!"+expr
|
|
34
|
+
|
|
35
|
+
return expr
|
|
36
|
+
|
|
37
|
+
require_pattern = '(.*?)require\((.*?)\,\s+\"(.*?)\"\);'
|
|
38
|
+
revert_pattern = '^(.*?revert)\(\"(.*?)\"\);'
|
|
39
|
+
|
|
40
|
+
error_list = {}
|
|
41
|
+
|
|
42
|
+
source_in = sys.argv[1]
|
|
43
|
+
interface_out = None
|
|
44
|
+
if len(sys.argv) > 2:
|
|
45
|
+
interface_out = sys.argv[2]
|
|
46
|
+
|
|
47
|
+
with open(source_in) as f:
|
|
48
|
+
for line in f:
|
|
49
|
+
l = line.rstrip()
|
|
50
|
+
require_result = re.match(require_pattern, l)
|
|
51
|
+
revert_result = re.match(revert_pattern, l)
|
|
52
|
+
|
|
53
|
+
if require_result is not None:
|
|
54
|
+
bits = list(require_result.groups())
|
|
55
|
+
# Should be padding, then the condition, then the revert string.
|
|
56
|
+
if len(bits) != 3:
|
|
57
|
+
out = l + " // TODO FIX ERROR MANUALLY"
|
|
58
|
+
#print(l)
|
|
59
|
+
else:
|
|
60
|
+
err_text = bits.pop()
|
|
61
|
+
condstr = bits.pop()
|
|
62
|
+
if "&&" in condstr:
|
|
63
|
+
out = l + " // TODO FIX ERROR MANUALLY"
|
|
64
|
+
else:
|
|
65
|
+
# We don't do && because don't have them in our code in require
|
|
66
|
+
conds = condstr.split(" || ")
|
|
67
|
+
new_conds = []
|
|
68
|
+
for cond in conds:
|
|
69
|
+
new_conds.append(invert_sign(cond))
|
|
70
|
+
new_condstr = " && ".join(new_conds)
|
|
71
|
+
|
|
72
|
+
err_name = stringToError(err_text)
|
|
73
|
+
error_list[err_name] = err_text
|
|
74
|
+
out = "".join(bits)
|
|
75
|
+
out = out + "if ("
|
|
76
|
+
out = out + new_condstr
|
|
77
|
+
out = out + ") revert "
|
|
78
|
+
out = out + err_name
|
|
79
|
+
out = out + "();"
|
|
80
|
+
print(out)
|
|
81
|
+
|
|
82
|
+
elif revert_result is not None:
|
|
83
|
+
bits = list(revert_result.groups())
|
|
84
|
+
# Should be padding, then the revert string.
|
|
85
|
+
if len(bits) != 2:
|
|
86
|
+
out = l + " // TODO FIX ERROR MANUALLY"
|
|
87
|
+
else:
|
|
88
|
+
err_text = bits.pop()
|
|
89
|
+
err_name = camelcase(err_text)
|
|
90
|
+
error_list[err_name] = err_text
|
|
91
|
+
start = bits.pop()
|
|
92
|
+
out = start
|
|
93
|
+
out = out + " "
|
|
94
|
+
out = out + err_name
|
|
95
|
+
out = out + "();"
|
|
96
|
+
print(out)
|
|
97
|
+
else:
|
|
98
|
+
print(l)
|
|
99
|
+
pass
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
if interface_out is not None:
|
|
103
|
+
out_fh = open(interface_out+'.sol', 'w')
|
|
104
|
+
for err_name in error_list:
|
|
105
|
+
out_fh.write(" /// @notice "+error_list[err_name]+"\n")
|
|
106
|
+
out_fh.write(" error "+err_name+"();"+"\n")
|
|
107
|
+
#print(result.groups())
|
|
108
|
+
#require(questions[question_id].timeout == 0, "question must not exist");
|
|
109
|
+
#if (!(questions[question_id].timeout == 0)) revert("question must not exist");
|
|
110
|
+
out_fh.close()
|
|
111
|
+
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
# This script checks that we didn't change our audited code when refactoring.
|
|
4
|
+
# It will compare the binary code generated with the code created by compiling the flat files in flat/ which we do not regenerate.
|
|
5
|
+
# It runs solc with the --no-cbor-metadata flag to prevent solc from appending ipfs metadata, which includes a hash of the source code.
|
|
6
|
+
# It stores the hashes it finds along with the current commit hash.
|
|
7
|
+
|
|
8
|
+
DIR=`dirname "$0"`
|
|
9
|
+
COMMIT=`git rev-parse HEAD`
|
|
10
|
+
|
|
11
|
+
for contract in "RealityETH-3.0.sol" "RealityETH_ERC20-3.0.sol"; do
|
|
12
|
+
HASH=`solc-0.8.20 --no-cbor-metadata --bin "$DIR/../contracts/$contract" | tail -n1 | sha256sum | head -c64`
|
|
13
|
+
ORIG_HASH=`solc-0.8.20 --no-cbor-metadata --bin "$DIR/../../flat/$contract" | tail -n1 | sha256sum | head -c64`
|
|
14
|
+
if [ "$HASH" != "$ORIG_HASH" ]; then
|
|
15
|
+
echo "Hash mismatch"
|
|
16
|
+
exit 1
|
|
17
|
+
fi
|
|
18
|
+
echo "$contract: $HASH" >> $COMMIT
|
|
19
|
+
done
|
|
20
|
+
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
# This script checks that we didn't change our audited code when refactoring.
|
|
4
|
+
# It runs solc with the --no-cbor-metadata flag to prevent solc from appending ipfs metadata, which includes a hash of the source code.
|
|
5
|
+
# It stores the hashes it finds along with the current commit hash.
|
|
6
|
+
# If it has already been run on that commit with a different hash, it will exit with an error.
|
|
7
|
+
|
|
8
|
+
DIR=`dirname "$0"`
|
|
9
|
+
COMMIT=`git rev-parse HEAD`
|
|
10
|
+
SOLC="solc-0.8.20"
|
|
11
|
+
|
|
12
|
+
for contract in "RealityETH-3.0.sol" "RealityETH_ERC20-3.0.sol" "RealityETH-4.0.sol" "RealityETH_ERC20-4.0.sol"; do
|
|
13
|
+
if [ ! -f "$DIR/../contracts/$contract" ]; then
|
|
14
|
+
continue
|
|
15
|
+
fi
|
|
16
|
+
|
|
17
|
+
BIN_HEX=`${SOLC} --no-cbor-metadata --bin "$DIR/../contracts/$contract" | grep -A2 "${contract}:" | tail -n1`
|
|
18
|
+
if [ -n "$BIN_HEX" ]; then
|
|
19
|
+
NEW_HASH=`echo "$BIN_HEX" | sha256sum | head -c64`
|
|
20
|
+
FILE="${contract}-${COMMIT}"
|
|
21
|
+
if test -f "$FILE"; then
|
|
22
|
+
ORIG_HASH=`cat $FILE`
|
|
23
|
+
if [ "$NEW_HASH" != "$ORIG_HASH" ]; then
|
|
24
|
+
echo "Hash mismatch"
|
|
25
|
+
exit 1
|
|
26
|
+
fi
|
|
27
|
+
else
|
|
28
|
+
echo "logging $contract for the first time"
|
|
29
|
+
echo "$NEW_HASH" > $FILE
|
|
30
|
+
fi
|
|
31
|
+
else
|
|
32
|
+
echo "Compile of ${contract} failed"
|
|
33
|
+
exit 1
|
|
34
|
+
fi
|
|
35
|
+
done
|
|
36
|
+
|
|
37
|
+
echo "OK"
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
# This script helps us checks that we didn't change our audited code when refactoring unless we intended to.
|
|
4
|
+
# It runs solc with the --no-cbor-metadata flag to prevent solc from appending ipfs metadata, which includes a hash of the source code.
|
|
5
|
+
# It will run back through the history up to the specified number of commits.
|
|
6
|
+
# It assumes they all use solc 0.8.20. You need that binary installed. Adjust the SOLC variable if it's installed but not called "solc-0.8.20"
|
|
7
|
+
# It will output a file for each version with the commit, the hash of the compiled code and whether we put in a comment to claim we didn't change it from the previous commit (on the next line)
|
|
8
|
+
# It should put you back at the head of the original branch once it's finished.
|
|
9
|
+
|
|
10
|
+
if [[ "$1" -lt "1" ]]; then
|
|
11
|
+
echo "Usage: ./log_bytecode_history.sh <number of commits to go back>"
|
|
12
|
+
exit 1
|
|
13
|
+
fi
|
|
14
|
+
|
|
15
|
+
DIR=`dirname "$0"`
|
|
16
|
+
COUNT=$1
|
|
17
|
+
ORIG_BRANCH=`git rev-parse --abbrev-ref HEAD`
|
|
18
|
+
SOLC="solc-0.8.20"
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
for i in $(seq $COUNT); do
|
|
22
|
+
sleep 1
|
|
23
|
+
git checkout HEAD^
|
|
24
|
+
SAME_BYTECODE=`git log HEAD^..HEAD --oneline | grep -c "no bytecode change"`
|
|
25
|
+
COMMIT=`git rev-parse HEAD`
|
|
26
|
+
for contract in "RealityETH-3.0.sol" "RealityETH_ERC20-3.0.sol" "RealityETH-4.0.sol" "RealityETH_ERC20-4.0.sol"; do
|
|
27
|
+
if [ ! -f "$DIR/../contracts/$contract" ]; then
|
|
28
|
+
continue
|
|
29
|
+
fi
|
|
30
|
+
BIN_HEX=`${SOLC} --no-cbor-metadata --bin "$DIR/../contracts/$contract" | grep -A2 "${contract}:" | tail -n1`
|
|
31
|
+
if [ -n "$BIN_HEX" ]; then
|
|
32
|
+
NEW_HASH=`echo "$BIN_HEX" | sha256sum | head -c64`
|
|
33
|
+
else
|
|
34
|
+
NEW_HASH="COMPILE_FAILED"
|
|
35
|
+
fi
|
|
36
|
+
LOG="COMMIT_LOG_${contract}.log"
|
|
37
|
+
echo "${COMMIT}:${NEW_HASH}:${SAME_BYTECODE}" >> $LOG
|
|
38
|
+
done
|
|
39
|
+
done
|
|
40
|
+
|
|
41
|
+
git checkout $ORIG_BRANCH
|
package/generated/chains.json
CHANGED
|
@@ -15,13 +15,20 @@
|
|
|
15
15
|
"wss://ethereum.publicnode.com",
|
|
16
16
|
"https://mainnet.gateway.tenderly.co",
|
|
17
17
|
"wss://mainnet.gateway.tenderly.co",
|
|
18
|
-
"https://rpc.blocknative.com/boost"
|
|
18
|
+
"https://rpc.blocknative.com/boost",
|
|
19
|
+
"https://rpc.flashbots.net",
|
|
20
|
+
"https://rpc.flashbots.net/fast",
|
|
21
|
+
"https://rpc.mevblocker.io",
|
|
22
|
+
"https://rpc.mevblocker.io/fast",
|
|
23
|
+
"https://rpc.mevblocker.io/noreverts",
|
|
24
|
+
"https://rpc.mevblocker.io/fullprivacy"
|
|
19
25
|
],
|
|
20
26
|
"hostedRPC": "https://eth-mainnet.alchemyapi.io/v2/c9uS--nIxEOjVjh0AJlNttMaqUXQy8gR",
|
|
21
27
|
"graphURL": "https://api.thegraph.com/subgraphs/name/realityeth/realityeth",
|
|
22
28
|
"blockExplorerUrls": [
|
|
23
29
|
"https://etherscan.io",
|
|
24
|
-
"https://eth.blockscout.com"
|
|
30
|
+
"https://eth.blockscout.com",
|
|
31
|
+
"https://ethereum.dex.guru"
|
|
25
32
|
]
|
|
26
33
|
},
|
|
27
34
|
"3": {
|
|
@@ -116,7 +123,8 @@
|
|
|
116
123
|
"graphURL": "https://api.thegraph.com/subgraphs/name/realityeth/realityeth-optimism",
|
|
117
124
|
"blockExplorerUrls": [
|
|
118
125
|
"https://optimistic.etherscan.io",
|
|
119
|
-
"https://optimism.blockscout.com"
|
|
126
|
+
"https://optimism.blockscout.com",
|
|
127
|
+
"https://optimism.dex.guru"
|
|
120
128
|
]
|
|
121
129
|
},
|
|
122
130
|
"40": {
|
|
@@ -166,6 +174,7 @@
|
|
|
166
174
|
"graphURL": "https://api.thegraph.com/subgraphs/name/realityeth/realityeth-bsc",
|
|
167
175
|
"blockExplorerUrls": [
|
|
168
176
|
"https://bscscan.com",
|
|
177
|
+
"https://bnb.dex.guru",
|
|
169
178
|
"https://www.bscscan.com"
|
|
170
179
|
]
|
|
171
180
|
},
|
|
@@ -258,7 +267,8 @@
|
|
|
258
267
|
"graphURL": "https://api.thegraph.com/subgraphs/name/realityeth/realityeth-gnosis",
|
|
259
268
|
"blockExplorerUrls": [
|
|
260
269
|
"https://gnosisscan.io",
|
|
261
|
-
"https://gnosis.blockscout.com"
|
|
270
|
+
"https://gnosis.blockscout.com",
|
|
271
|
+
"https://gnosis.dex.guru"
|
|
262
272
|
]
|
|
263
273
|
},
|
|
264
274
|
"137": {
|
|
@@ -286,6 +296,7 @@
|
|
|
286
296
|
"graphURL": "https://gateway-arbitrum.network.thegraph.com/api/73380b22a17017c081123ec9c0e34677/subgraphs/id/AWx6jkeKZ3xKRzkrzgfCAMPT7d6Jc3AMcqB8koN3QEqE",
|
|
287
297
|
"blockExplorerUrls": [
|
|
288
298
|
"https://polygonscan.com",
|
|
299
|
+
"https://polygon.dex.guru",
|
|
289
300
|
"https://polygonscan.com/"
|
|
290
301
|
]
|
|
291
302
|
},
|
|
@@ -308,9 +319,26 @@
|
|
|
308
319
|
"https://zksync2-testnet.zkscan.io"
|
|
309
320
|
]
|
|
310
321
|
},
|
|
322
|
+
"300": {
|
|
323
|
+
"chainId": "0x12c",
|
|
324
|
+
"chainName": "zkSync Sepolia Testnet",
|
|
325
|
+
"nativeCurrency": {
|
|
326
|
+
"name": "Ether",
|
|
327
|
+
"symbol": "ETH",
|
|
328
|
+
"decimals": 18
|
|
329
|
+
},
|
|
330
|
+
"network_name": "zksync-era-sepolia",
|
|
331
|
+
"rpcUrls": [
|
|
332
|
+
"https://sepolia.era.zksync.dev"
|
|
333
|
+
],
|
|
334
|
+
"hostedRPC": "https://sepolia.era.zksync.dev",
|
|
335
|
+
"blockExplorerUrls": [
|
|
336
|
+
"https://sepolia.explorer.zksync.io"
|
|
337
|
+
]
|
|
338
|
+
},
|
|
311
339
|
"324": {
|
|
312
340
|
"chainId": "0x144",
|
|
313
|
-
"chainName": "zkSync
|
|
341
|
+
"chainName": "zkSync Mainnet",
|
|
314
342
|
"nativeCurrency": {
|
|
315
343
|
"name": "Ether",
|
|
316
344
|
"symbol": "ETH",
|
package/generated/tokens.json
CHANGED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023 Matter Labs
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# zkSync Hardhat project template
|
|
2
|
+
|
|
3
|
+
This project was scaffolded with [zksync-cli](https://github.com/matter-labs/zksync-cli).
|
|
4
|
+
|
|
5
|
+
## Project Layout
|
|
6
|
+
|
|
7
|
+
- `/contracts`: Contains solidity smart contracts.
|
|
8
|
+
- `/deploy`: Scripts for contract deployment and interaction.
|
|
9
|
+
- `/test`: Test files.
|
|
10
|
+
- `hardhat.config.ts`: Configuration settings.
|
|
11
|
+
|
|
12
|
+
## How to Use
|
|
13
|
+
|
|
14
|
+
- `npm run compile`: Compiles contracts.
|
|
15
|
+
- `npm run deploy`: Deploys using script `/deploy/deploy.ts`.
|
|
16
|
+
- `npm run interact`: Interacts with the deployed contract using `/deploy/interact.ts`.
|
|
17
|
+
- `npm run test`: Tests the contracts.
|
|
18
|
+
|
|
19
|
+
Note: Both `npm run deploy` and `npm run interact` are set in the `package.json`. You can also run your files directly, for example: `npx hardhat deploy-zksync --script deploy.ts`
|
|
20
|
+
|
|
21
|
+
### Environment Settings
|
|
22
|
+
|
|
23
|
+
To keep private keys safe, this project pulls in environment variables from `.env` files. Primarily, it fetches the wallet's private key.
|
|
24
|
+
|
|
25
|
+
Rename `.env.example` to `.env` and fill in your private key:
|
|
26
|
+
|
|
27
|
+
```
|
|
28
|
+
WALLET_PRIVATE_KEY=your_private_key_here...
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
### Network Support
|
|
32
|
+
|
|
33
|
+
`hardhat.config.ts` comes with a list of networks to deploy and test contracts. Add more by adjusting the `networks` section in the `hardhat.config.ts`. To make a network the default, set the `defaultNetwork` to its name. You can also override the default using the `--network` option, like: `hardhat test --network dockerizedNode`.
|
|
34
|
+
|
|
35
|
+
### Local Tests
|
|
36
|
+
|
|
37
|
+
Running `npm run test` by default runs the [zkSync In-memory Node](https://era.zksync.io/docs/tools/testing/era-test-node.html) provided by the [@matterlabs/hardhat-zksync-node](https://era.zksync.io/docs/tools/hardhat/hardhat-zksync-node.html) tool.
|
|
38
|
+
|
|
39
|
+
Important: zkSync In-memory Node currently supports only the L2 node. If contracts also need L1, use another testing environment like Dockerized Node. Refer to [test documentation](https://era.zksync.io/docs/tools/testing/) for details.
|
|
40
|
+
|
|
41
|
+
## Useful Links
|
|
42
|
+
|
|
43
|
+
- [Docs](https://era.zksync.io/docs/dev/)
|
|
44
|
+
- [Official Site](https://zksync.io/)
|
|
45
|
+
- [GitHub](https://github.com/matter-labs)
|
|
46
|
+
- [Twitter](https://twitter.com/zksync)
|
|
47
|
+
- [Discord](https://join.zksync.dev/)
|
|
48
|
+
|
|
49
|
+
## License
|
|
50
|
+
|
|
51
|
+
This project is under the [MIT](./LICENSE) license.
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { deployContract } from "./utils";
|
|
2
|
+
|
|
3
|
+
// An example of a basic deploy script
|
|
4
|
+
// It will deploy a Greeter contract to selected network
|
|
5
|
+
// as well as verify it on Block Explorer if possible for the network
|
|
6
|
+
export default async function () {
|
|
7
|
+
const contractArtifactName = "RealityETH_zksync_v3_0";
|
|
8
|
+
const constructorArguments = [];
|
|
9
|
+
await deployContract(contractArtifactName, constructorArguments);
|
|
10
|
+
}
|
|
11
|
+
|