Skip to content

Commit

Permalink
feat: remove unused constants
Browse files Browse the repository at this point in the history
  • Loading branch information
cosinlink committed Sep 3, 2024
1 parent 246a073 commit 23ab1e2
Show file tree
Hide file tree
Showing 10 changed files with 0 additions and 124 deletions.
5 changes: 0 additions & 5 deletions contracts/BSCValidatorSet.sol
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,6 @@ contract BSCValidatorSet is IBSCValidatorSet, System, IParamSubscriber, IApplica
bytes public constant INIT_VALIDATORSET_BYTES =
hex"f905ec80f905e8f846942a7cdd959bfe8d9487b2a43b33565295a698f7e294b6a7edd747c0554875d3fc531d19ba1497992c5e941ff80f3f7f110ffd8920a3ac38fdef318fe94a3f86048c27395000f846946488aa4d1955ee33403f8ccb1d4de5fb97c7ade294220f003d8bdfaadf52aa1e55ae4cc485e6794875941a87e90e440a39c99aa9cb5cea0ad6a3f0b2407b86048c27395000f846949ef9f4360c606c7ab4db26b016007d3ad0ab86a0946103af86a874b705854033438383c82575f25bc29418e2db06cbff3e3c5f856410a1838649e760175786048c27395000f84694ee01c3b1283aa067c58eab4709f85e99d46de5fe94ee4b9bfb1871c64e2bcabb1dc382dc8b7c4218a29415904ab26ab0e99d70b51c220ccdcccabee6e29786048c27395000f84694685b1ded8013785d6623cc18d214320b6bb6475994a20ef4e5e4e7e36258dbf51f4d905114cb1b34bc9413e39085dc88704f4394d35209a02b1a9520320c86048c27395000f8469478f3adfc719c99674c072166708589033e2d9afe9448a30d5eaa7b64492a160f139e2da2800ec3834e94055838358c29edf4dcc1ba1985ad58aedbb6be2b86048c27395000f84694c2be4ec20253b8642161bc3f444f53679c1f3d479466f50c616d737e60d7ca6311ff0d9c434197898a94d1d678a2506eeaa365056fe565df8bc8659f28b086048c27395000f846942f7be8361c80a4c1e7e9aaf001d0877f1cfde218945f93992ac37f3e61db2ef8a587a436a161fd210b94ecbc4fb1a97861344dad0867ca3cba2b860411f086048c27395000f84694ce2fd7544e0b2cc94692d4a704debef7bcb613289444abc67b4b2fba283c582387f54c9cba7c34bafa948acc2ab395ded08bb75ce85bf0f95ad2abc51ad586048c27395000f84694b8f7166496996a7da21cf1f1b04d9b3e26a3d077946770572763289aac606e4f327c2f6cc1aa3b3e3b94882d745ed97d4422ca8da1c22ec49d880c4c097286048c27395000f846942d4c407bbe49438ed859fe965b140dcf1aab71a9943ad0939e120f33518fbba04631afe7a3ed6327b194b2bbb170ca4e499a2b0f3cc85ebfa6e8c4dfcbea86048c27395000f846946bbad7cf34b5fa511d8e963dbba288b1960e75d694853b0f6c324d1f4e76c8266942337ac1b0af1a229442498946a51ca5924552ead6fc2af08b94fcba648601d1a94a2000f846944430b3230294d12c6ab2aac5c2cd68e80b16b581947b107f4976a252a6939b771202c28e64e03f52d694795811a7f214084116949fc4f53cedbf189eeab28601d1a94a2000f84694ea0a6e3c511bbd10f4519ece37dc24887e11b55d946811ca77acfb221a49393c193f3a22db829fcc8e9464feb7c04830dd9ace164fc5c52b3f5a29e5018a8601d1a94a2000f846947ae2f5b9e386cd1b50a4550696d957cb4900f03a94e83bcc5077e6b873995c24bac871b5ad856047e19464e48d4057a90b233e026c1041e6012ada897fe88601d1a94a2000f8469482012708dafc9e1b880fd083b32182b869be8e09948e5adc73a2d233a1b496ed3115464dd6c7b887509428b383d324bc9a37f4e276190796ba5a8947f5ed8601d1a94a2000f8469422b81f8e175ffde54d797fe11eb03f9e3bf75f1d94a1c3ef7ca38d8ba80cce3bfc53ebd2903ed21658942767f7447f7b9b70313d4147b795414aecea54718601d1a94a2000f8469468bf0b8b6fb4e317a0f9d6f03eaf8ce6675bc60d94675cfe570b7902623f47e7f59c9664b5f5065dcf94d84f0d2e50bcf00f2fc476e1c57f5ca2d57f625b8601d1a94a2000f846948c4d90829ce8f72d0163c1d5cf348a862d5506309485c42a7b34309bee2ed6a235f86d16f059deec5894cc2cedc53f0fa6d376336efb67e43d167169f3b78601d1a94a2000f8469435e7a025f4da968de7e4d7e4004197917f4070f194b1182abaeeb3b4d8eba7e6a4162eac7ace23d57394c4fd0d870da52e73de2dd8ded19fe3d26f43a1138601d1a94a2000f84694d6caa02bbebaebb5d7e581e4b66559e635f805ff94c07335cf083c1c46a487f0325769d88e163b653694efaff03b42e41f953a925fc43720e45fb61a19938601d1a94a2000";

uint32 public constant ERROR_UNKNOWN_PACKAGE_TYPE = 101; // @dev deprecated
uint32 public constant ERROR_FAIL_CHECK_VALIDATORS = 102; // @dev deprecated
uint32 public constant ERROR_LEN_OF_VAL_MISMATCH = 103; // @dev deprecated
uint32 public constant ERROR_RELAYFEE_TOO_LARGE = 104; // @dev deprecated

uint256 public constant INIT_NUM_OF_CABINETS = 21;
uint256 public constant EPOCH = 200;

Expand Down
2 changes: 0 additions & 2 deletions contracts/GovHub.sol
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ import "./interface/0.6.x/IParamSubscriber.sol";
import "./interface/0.6.x/IApplication.sol";

contract GovHub is System, IApplication {
uint8 public constant PARAM_UPDATE_MESSAGE_TYPE = 0;

uint32 public constant ERROR_TARGET_NOT_CONTRACT = 101;
uint32 public constant ERROR_TARGET_CONTRACT_FAIL = 102;

Expand Down
8 changes: 0 additions & 8 deletions contracts/System.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,8 @@ contract System {
bool public alreadyInit;

uint32 public constant CODE_OK = 0;
uint32 public constant ERROR_FAIL_DECODE = 100;

uint8 public constant BIND_CHANNELID = 0x01;
uint8 public constant TRANSFER_IN_CHANNELID = 0x02;
uint8 public constant TRANSFER_OUT_CHANNELID = 0x03;
uint8 public constant STAKING_CHANNELID = 0x08;
uint8 public constant GOV_CHANNELID = 0x09;
uint8 public constant SLASH_CHANNELID = 0x0b;
uint8 public constant CROSS_STAKE_CHANNELID = 0x10;
uint8 public constant BC_FUSION_CHANNELID = 0x11; // new channel id for cross-chain redelegate from Beacon Chain to Smart Chain after Feynman upgrade
uint16 public constant bscChainID = 0x0038;

address public constant VALIDATOR_CONTRACT_ADDR = 0x0000000000000000000000000000000000001000;
Expand Down
3 changes: 0 additions & 3 deletions contracts/SystemV2.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@ pragma solidity 0.8.17;

contract SystemV2 {
/*----------------- constants -----------------*/
uint8 public constant STAKING_CHANNELID = 0x08;
uint8 public constant BC_FUSION_CHANNELID = 0x11; // new channel id for cross-chain redelegate from Beacon Chain to Smart Chain after Feynman upgrade

address internal constant VALIDATOR_CONTRACT_ADDR = 0x0000000000000000000000000000000000001000;
address internal constant SLASH_CONTRACT_ADDR = 0x0000000000000000000000000000000000001001;
address internal constant SYSTEM_REWARD_ADDR = 0x0000000000000000000000000000000000001002;
Expand Down
14 changes: 0 additions & 14 deletions contracts/TokenHub.sol
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,10 @@ contract TokenHub is ITokenHub, System, IParamSubscriber, IApplication, ISystemR
uint256 unlockAt;
}

// transfer in channel
uint8 public constant TRANSFER_IN_SUCCESS = 0;
uint8 public constant TRANSFER_IN_FAILURE_TIMEOUT = 1;
uint8 public constant TRANSFER_IN_FAILURE_UNBOUND_TOKEN = 2;
uint8 public constant TRANSFER_IN_FAILURE_INSUFFICIENT_BALANCE = 3;
uint8 public constant TRANSFER_IN_FAILURE_NON_PAYABLE_RECIPIENT = 4;
uint8 public constant TRANSFER_IN_FAILURE_UNKNOWN = 5;

uint256 public constant MAX_BEP2_TOTAL_SUPPLY = 9000000000000000000;
uint8 public constant MINIMUM_BEP20_SYMBOL_LEN = 2;
uint8 public constant MAXIMUM_BEP20_SYMBOL_LEN = 8;
uint8 public constant BEP2_TOKEN_DECIMALS = 8;
bytes32 public constant BEP2_TOKEN_SYMBOL_FOR_BNB =
0x424E420000000000000000000000000000000000000000000000000000000000; // "BNB"
uint256 public constant MAX_GAS_FOR_CALLING_BEP20 = 50000;
uint256 public constant MAX_GAS_FOR_TRANSFER_BNB = 10000;

uint256 public constant INIT_MINIMUM_RELAY_FEE = 2e15;
uint256 public constant REWARD_UPPER_LIMIT = 1e18;
Expand All @@ -45,8 +33,6 @@ contract TokenHub is ITokenHub, System, IParamSubscriber, IApplication, ISystemR
mapping(bytes32 => address) private bep2SymbolToContractAddr;

// BEP-171: Security Enhancement for Cross-Chain Module
uint256 public constant INIT_BNB_LARGE_TRANSFER_LIMIT = 10000 ether;
uint256 public constant INIT_LOCK_PERIOD = 12 hours;
// the lock period for large cross-chain transfer
uint256 public lockPeriod; // @dev deprecated
// the lock Period for token recover
Expand Down
20 changes: 0 additions & 20 deletions contracts/deprecated/CrossChain.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,6 @@ import "../interface/0.6.x/IParamSubscriber.sol";
import "../System.sol";

contract CrossChain is System, ICrossChain, IParamSubscriber {
// constant variables
string public constant STORE_NAME = "ibc";
uint256 public constant CROSS_CHAIN_KEY_PREFIX = 0x01003800; // last 6 bytes
uint8 public constant SYN_PACKAGE = 0x00;
uint8 public constant ACK_PACKAGE = 0x01;
uint8 public constant FAIL_ACK_PACKAGE = 0x02;
uint256 public constant INIT_BATCH_SIZE = 50;

// governable parameters
Expand All @@ -32,20 +26,6 @@ contract CrossChain is System, ICrossChain, IParamSubscriber {
// to prevent the utilization of ancient block header
mapping(uint8 => uint64) public channelSyncedHeaderMap;

// BEP-171: Security Enhancement for Cross-Chain Module
// 0xebbda044f67428d7e9b472f9124983082bcda4f84f5148ca0a9ccbe06350f196
bytes32 public constant SUSPEND_PROPOSAL = keccak256("SUSPEND_PROPOSAL");
// 0xcf82004e82990eca84a75e16ba08aa620238e076e0bc7fc4c641df44bbf5b55a
bytes32 public constant REOPEN_PROPOSAL = keccak256("REOPEN_PROPOSAL");
// 0x605b57daa79220f76a5cdc8f5ee40e59093f21a4e1cec30b9b99c555e94c75b9
bytes32 public constant CANCEL_TRANSFER_PROPOSAL = keccak256("CANCEL_TRANSFER_PROPOSAL");
// 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470
bytes32 public constant EMPTY_CONTENT_HASH = keccak256("");
uint16 public constant INIT_SUSPEND_QUORUM = 1;
uint16 public constant INIT_REOPEN_QUORUM = 2;
uint16 public constant INIT_CANCEL_TRANSFER_QUORUM = 2;
uint256 public constant EMERGENCY_PROPOSAL_EXPIRE_PERIOD = 1 hours;

bool public isSuspended;
// proposal type hash => latest emergency proposal
mapping(bytes32 => EmergencyProposal) public emergencyProposals; // @dev deprecated
Expand Down
3 changes: 0 additions & 3 deletions contracts/deprecated/RelayerHub.sol
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@ contract RelayerHub is IRelayerHub, System, IParamSubscriber {
uint256 public constant INIT_REQUIRED_DEPOSIT = 1e20;
uint256 public constant INIT_DUES = 1e17;

address public constant WHITELIST_1 = 0xb005741528b86F5952469d80A8614591E3c5B632;
address public constant WHITELIST_2 = 0x446AA6E0DC65690403dF3F127750da1322941F3e;

uint256 internal requiredDeposit; // have to keep it to not break the storage layout
uint256 internal dues;

Expand Down
23 changes: 0 additions & 23 deletions contracts/deprecated/RelayerIncentivize.sol
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@ import "../interface/0.6.x/ISystemReward.sol";
contract RelayerIncentivize is IRelayerIncentivize, System, IParamSubscriber {
using SafeMath for uint256;

uint256 public constant ROUND_SIZE = 100;
uint256 public constant MAXIMUM_WEIGHT = 40;

uint256 public constant HEADER_RELAYER_REWARD_RATE_MOLECULE = 1;
uint256 public constant HEADER_RELAYER_REWARD_RATE_DENOMINATOR = 5;
uint256 public constant CALLER_COMPENSATION_MOLECULE = 1;
Expand Down Expand Up @@ -81,26 +78,6 @@ contract RelayerIncentivize is IRelayerIncentivize, System, IParamSubscriber {
emit rewardToRelayer(relayerAddr, reward);
}

function calculateTransferRelayerWeight(uint256 count) public pure returns (uint256) {
if (count <= MAXIMUM_WEIGHT) {
return count;
} else if (MAXIMUM_WEIGHT < count && count <= 2 * MAXIMUM_WEIGHT) {
return MAXIMUM_WEIGHT;
} else if (2 * MAXIMUM_WEIGHT < count && count <= (2 * MAXIMUM_WEIGHT + 3 * MAXIMUM_WEIGHT / 4)) {
return 3 * MAXIMUM_WEIGHT - count;
} else {
return count / 4;
}
}

function calculateHeaderRelayerWeight(uint256 count) public pure returns (uint256) {
if (count <= MAXIMUM_WEIGHT) {
return count;
} else {
return MAXIMUM_WEIGHT;
}
}

function updateParam(string calldata key, bytes calldata value) external override onlyGov {
revert("deprecated");
}
Expand Down
15 changes: 0 additions & 15 deletions contracts/deprecated/Staking.sol
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,7 @@ import "../lib/0.6.x/SafeMath.sol";
contract Staking is IStaking, System, IParamSubscriber, IApplication {
using SafeMath for uint256;

// Cross Stake Event type
uint8 public constant EVENT_DELEGATE = 0x01;
uint8 public constant EVENT_UNDELEGATE = 0x02;
uint8 public constant EVENT_REDELEGATE = 0x03;
uint8 public constant EVENT_DISTRIBUTE_REWARD = 0x04;
uint8 public constant EVENT_DISTRIBUTE_UNDELEGATED = 0x05;

// ack package status code
uint8 public constant CODE_FAILED = 0;
uint8 public constant CODE_SUCCESS = 1;

// Error code
uint32 public constant ERROR_WITHDRAW_BNB = 101;

uint256 public constant TEN_DECIMALS = 1e10;
uint256 public constant LOCK_TIME = 8 days; // 8*24*3600 second

uint256 public constant INIT_RELAYER_FEE = 16 * 1e15;
uint256 public constant INIT_BSC_RELAYER_FEE = 1 * 1e16;
Expand Down
31 changes: 0 additions & 31 deletions contracts/deprecated/TokenManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -20,37 +20,6 @@ contract TokenManager is System, IApplication, IParamSubscriber {
uint64 expireTime;
}

uint8 public constant BIND_PACKAGE = 0;
uint8 public constant UNBIND_PACKAGE = 1;

// bind status
uint8 public constant BIND_STATUS_TIMEOUT = 1;
uint8 public constant BIND_STATUS_SYMBOL_MISMATCH = 2;
uint8 public constant BIND_STATUS_TOO_MUCH_TOKENHUB_BALANCE = 3;
uint8 public constant BIND_STATUS_TOTAL_SUPPLY_MISMATCH = 4;
uint8 public constant BIND_STATUS_DECIMALS_MISMATCH = 5;
uint8 public constant BIND_STATUS_ALREADY_BOUND_TOKEN = 6;
uint8 public constant BIND_STATUS_REJECTED = 7;

uint8 public constant MIRROR_CHANNELID = 0x04;
uint8 public constant SYNC_CHANNELID = 0x05;
uint8 public constant BEP2_TOKEN_DECIMALS = 8;
uint256 public constant MAX_GAS_FOR_TRANSFER_BNB = 10000;
uint256 public constant MAX_BEP2_TOTAL_SUPPLY = 9000000000000000000;
uint256 public constant LOG_MAX_UINT256 = 77;
// mirror status
uint8 public constant MIRROR_STATUS_TIMEOUT = 1;
uint8 public constant MIRROR_STATUS_DUPLICATED_BEP2_SYMBOL = 2;
uint8 public constant MIRROR_STATUS_ALREADY_BOUND = 3;
// sync status
uint8 public constant SYNC_STATUS_TIMEOUT = 1;
uint8 public constant SYNC_STATUS_NOT_BOUND_MIRROR = 2;

uint8 public constant MINIMUM_BEP20_SYMBOL_LEN = 2;
uint8 public constant MAXIMUM_BEP20_SYMBOL_LEN = 8;

uint256 public constant TEN_DECIMALS = 1e10;

mapping(bytes32 => BindSynPackage) public bindPackageRecord;

mapping(address => bool) public mirrorPendingRecord; // @dev deprecated
Expand Down

0 comments on commit 23ab1e2

Please sign in to comment.