Feature Tip: Add private address tag to any address under My Name Tag !
Source Code
Latest 25 from a total of 29,605 transactions
| Transaction Hash |
Method
|
Block
|
From
|
|
To
|
||||
|---|---|---|---|---|---|---|---|---|---|
| Deposit | 23766573 | 5 hrs ago | IN | 0 ETH | 0.00001176 | ||||
| Deposit | 23766563 | 5 hrs ago | IN | 0 ETH | 0.00001469 | ||||
| Deposit | 23765195 | 10 hrs ago | IN | 0 ETH | 0.00009411 | ||||
| Deposit | 23762356 | 19 hrs ago | IN | 0 ETH | 0.00043109 | ||||
| Deposit | 23762354 | 19 hrs ago | IN | 0 ETH | 0.00010563 | ||||
| Deposit | 23762342 | 19 hrs ago | IN | 0 ETH | 0.00044011 | ||||
| Withdraw | 23746043 | 3 days ago | IN | 0.003 ETH | 0.00005001 | ||||
| Bridge | 23746040 | 3 days ago | IN | 0 ETH | 0.00010161 | ||||
| Withdraw | 23746003 | 3 days ago | IN | 0.003 ETH | 0.00004081 | ||||
| Bridge | 23746000 | 3 days ago | IN | 0 ETH | 0.00008117 | ||||
| Deposit | 23742580 | 3 days ago | IN | 0 ETH | 0.00008369 | ||||
| Deposit | 23741081 | 3 days ago | IN | 0 ETH | 0.00125242 | ||||
| Deposit | 23740688 | 3 days ago | IN | 0 ETH | 0.00122475 | ||||
| Deposit | 23740654 | 3 days ago | IN | 0 ETH | 0.00098236 | ||||
| Deposit | 23740523 | 3 days ago | IN | 0 ETH | 0.0003963 | ||||
| Deposit | 23740477 | 3 days ago | IN | 0 ETH | 0.0002216 | ||||
| Deposit | 23740448 | 3 days ago | IN | 0 ETH | 0.00020716 | ||||
| Deposit | 23740367 | 3 days ago | IN | 0 ETH | 0.00024321 | ||||
| Deposit | 23740314 | 3 days ago | IN | 0 ETH | 0.00020436 | ||||
| Deposit | 23740230 | 3 days ago | IN | 0 ETH | 0.00019671 | ||||
| Deposit | 23740046 | 3 days ago | IN | 0 ETH | 0.00018724 | ||||
| Deposit | 23740027 | 3 days ago | IN | 0 ETH | 0.00015667 | ||||
| Deposit | 23740020 | 3 days ago | IN | 0 ETH | 0.00016432 | ||||
| Deposit | 23739784 | 3 days ago | IN | 0 ETH | 0.00012069 | ||||
| Deposit | 23739664 | 3 days ago | IN | 0 ETH | 0.0001299 |
Latest 25 internal transactions (View All)
Advanced mode:
| Parent Transaction Hash | Method | Block |
From
|
|
To
|
||
|---|---|---|---|---|---|---|---|
| Transfer | 23746043 | 3 days ago | 0.003 ETH | ||||
| Transfer | 23746003 | 3 days ago | 0.003 ETH | ||||
| Transfer | 23735041 | 4 days ago | 0.003 ETH | ||||
| Transfer | 23706774 | 8 days ago | 0.003 ETH | ||||
| Transfer | 23706767 | 8 days ago | 0.003 ETH | ||||
| Transfer | 23706743 | 8 days ago | 0.003 ETH | ||||
| Transfer | 23706679 | 8 days ago | 0.003 ETH | ||||
| Transfer | 23706676 | 8 days ago | 0.003 ETH | ||||
| Transfer | 23706669 | 8 days ago | 0.003 ETH | ||||
| Transfer | 23706646 | 8 days ago | 0.003 ETH | ||||
| Transfer | 23684005 | 11 days ago | 0.003 ETH | ||||
| Transfer | 23683959 | 11 days ago | 0.003 ETH | ||||
| Transfer | 23676642 | 12 days ago | 0.003 ETH | ||||
| Transfer | 23676450 | 12 days ago | 0.003 ETH | ||||
| Transfer | 23670276 | 13 days ago | 0.003 ETH | ||||
| Transfer | 23670233 | 13 days ago | 0.003 ETH | ||||
| Transfer | 23667951 | 14 days ago | 0.003 ETH | ||||
| Transfer | 23667490 | 14 days ago | 0.003 ETH | ||||
| Transfer | 23664556 | 14 days ago | 0.003 ETH | ||||
| Transfer | 23664547 | 14 days ago | 0.003 ETH | ||||
| Transfer | 23663012 | 14 days ago | 0.003 ETH | ||||
| Transfer | 23662038 | 14 days ago | 0.003 ETH | ||||
| Transfer | 23661117 | 14 days ago | 0.003 ETH | ||||
| Transfer | 23653545 | 16 days ago | 0.003 ETH | ||||
| Transfer | 23649492 | 16 days ago | 0.003 ETH |
Loading...
Loading
Cross-Chain Transactions
Loading...
Loading
Contract Name:
DBridge
Compiler Version
v0.8.20+commit.a1b79de6
Optimization Enabled:
Yes with 200 runs
Other Settings:
paris EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
import "@openzeppelin/contracts/access/AccessControl.sol";
import "@openzeppelin/contracts/utils/Pausable.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";
import "./interface/IDToken.sol";
/// @title DBridge: A decentralized bridge contract for token transfers
/// @notice This contract facilitates token transfers between different chains using a decentralized approach.
contract DBridge is Pausable, AccessControl {
using SafeERC20 for IERC20;
bytes32 public constant GOVERNOR_ROLE = keccak256("GOVERNOR_ROLE");
bytes32 public constant RELAYER_ROLE = keccak256("RELAYER_ROLE");
bytes32 public immutable domainHash;
address payable immutable exchangePool;
uint256 private _bridgeIdCounter = 0;
IDToken private rewardToken;
uint256 private baseVoteFee;
uint256 private rewardFee;
/// @dev Enum representing the types of transactions (Deposit or Withdraw).
enum TxnType {
DEPOSIT,
WITHDRAW
}
struct TokenDetails {
mapping(uint256 => address) bridgeTokenAddress;
uint256 platformFee;
bool isAvailable;
bool isMintableBurnable;
}
struct BridgeTxn {
uint256 bridgeIndex;
TxnType txnType;
address sender;
uint256 chainId;
address tokenAddress;
uint256 amount;
bool isWithdrawed;
bool isVerifiedByRelayer;
address[] confirmations;
mapping(address => uint256) reward;
}
struct VoteData {
bytes32 bridgeId;
uint256 bridgeIndex;
address sender;
uint256 chainId;
uint256 sourceChainId;
address sourceBridgeAddress;
address tokenAddress;
uint256 amount;
}
struct WithdrawData {
bytes32 bridgeId;
uint256 bridgeIndex;
address sender;
uint256 chainId;
uint256 sourceChainId;
address sourceBridgeAddress;
address tokenAddress;
uint256 amount;
bytes[] signatures;
}
mapping(address => TokenDetails) public supportedTokens;
mapping(bytes32 => BridgeTxn) public bridgeTxn;
event Deposit(
bytes32 indexed bridgeId,
uint256 indexed bridgeIndex,
address sender,
uint256 chainId,
address tokenAddress,
uint256 amount
);
event Bridge(
bytes32 indexed bridgeId,
uint256 sourceChainId,
address receiver,
address tokenAddress,
uint256 amount,
address[] validators
);
event Confirmation(
bytes32 indexed bridgeId,
uint256 sourceChainId,
address receiver,
address tokenAddress,
uint256 amount,
address confirmer
);
event Withdraw(
bytes32 indexed bridgeId,
address indexed receiver,
address bridgeTokenAddress,
uint256 amount
);
/// @notice Deploy the DBridge contract with the provided parameters.
/// @param name The name of the contract.
/// @param version The version of the contract.
/// @param exchangePoolAddress The address of the exchange pool.
/// @param rewarTokenAddress The address of the reward token.
/// @param _baseVoteFee The base vote fee.
/// @param _rewardFee The reward fee.
constructor(
string memory name,
string memory version,
address payable exchangePoolAddress,
IDToken rewarTokenAddress,
uint256 _baseVoteFee,
uint256 _rewardFee
) {
_grantRole(DEFAULT_ADMIN_ROLE, msg.sender);
_grantRole(GOVERNOR_ROLE, msg.sender);
exchangePool = exchangePoolAddress;
rewardToken = rewarTokenAddress;
baseVoteFee = _baseVoteFee;
rewardFee = _rewardFee;
domainHash = keccak256(
abi.encode(
keccak256(
abi.encodePacked(
"EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"
)
),
keccak256(abi.encodePacked(name)),
keccak256(abi.encodePacked(version)),
block.chainid,
address(this)
)
);
}
/// @notice Pause the contract, preventing new transactions.
function pause() public onlyRole(DEFAULT_ADMIN_ROLE) {
_pause();
}
/// @notice Unpause the contract, allowing transactions to continue.
function unpause() public onlyRole(DEFAULT_ADMIN_ROLE) {
_unpause();
}
/// @notice Add a new token to the supported tokens list.
/// @param tokenAddress The address of the token to be added.
/// @param tokenPlatformFee The platform fee associated with the token.
/// @param isMintableBurnableToken A flag indicating if the token is mintable/burnable.
function addToken(
address tokenAddress,
uint256 tokenPlatformFee,
bool isMintableBurnableToken
) external onlyRole(GOVERNOR_ROLE) whenNotPaused {
try IDToken(tokenAddress).totalSupply() returns (uint256) {
try IDToken(tokenAddress).name() returns (string memory) {
TokenDetails storage token = supportedTokens[tokenAddress];
token.isAvailable = true;
token.platformFee = tokenPlatformFee;
token.isMintableBurnable = isMintableBurnableToken;
} catch {
revert("Address not token");
}
} catch {
revert("Address not token");
}
}
/// @notice Add support for a new chain for a specific token.
/// @param tokenAddress The address of the token.
/// @param chainId The ID of the supported chain.
/// @param bridgeTokenAddress The address of the corresponding bridge token.
function addSupportedChain(
address tokenAddress,
uint256 chainId,
address bridgeTokenAddress
) external onlyRole(GOVERNOR_ROLE) whenNotPaused {
supportedTokens[tokenAddress].bridgeTokenAddress[
chainId
] = bridgeTokenAddress;
}
/// @notice Enable or disable a token for transfers.
/// @param tokenAddress The address of the token.
/// @param isEnable Set to true to enable the token, or false to disable it.
function enableDisableToken(
address tokenAddress,
bool isEnable
) external onlyRole(GOVERNOR_ROLE) whenNotPaused {
supportedTokens[tokenAddress].isAvailable = isEnable;
}
/// @notice Edit the platform fee of an existing token.
/// @param tokenAddress The address of the token.
/// @param newPlatformFee The updated platform fee for the token.
function updateTokenPlatformFee(
address tokenAddress,
uint256 newPlatformFee
) external onlyRole(GOVERNOR_ROLE) {
require(
supportedTokens[tokenAddress].isAvailable,
"Token is not supported"
);
supportedTokens[tokenAddress].platformFee = newPlatformFee;
}
/// @notice Get the bridge token address for a specific token on a given chain.
/// @param tokenAddress The address of the token.
/// @param chainId The ID of the chain.
/// @return bridgeTokenAddress The bridge token address for the token on the specified chain.
function getBridgeTokenAddress(
address tokenAddress,
uint256 chainId
) external view whenNotPaused returns (address bridgeTokenAddress) {
return supportedTokens[tokenAddress].bridgeTokenAddress[chainId];
}
/// @notice Deposit tokens into the bridge for cross-chain transfer.
/// @param chainId The ID of the target chain.
/// @param tokenAddress The address of the token being deposited.
/// @param amount The amount of tokens to deposit.
/// @return bridgeId The unique ID for the bridge transaction.
function deposit(
uint256 chainId,
address tokenAddress,
uint256 amount
) external whenNotPaused returns (bytes32 bridgeId) {
require(
supportedTokens[tokenAddress].isAvailable,
"Token is not supported"
);
require(
supportedTokens[tokenAddress].bridgeTokenAddress[chainId] !=
address(0),
"Chain ID is not supported"
);
_bridgeIdCounter += 1;
bridgeId = keccak256(
abi.encodePacked(
_msgSender(),
address(this),
chainId,
supportedTokens[tokenAddress].bridgeTokenAddress[chainId],
amount,
_bridgeIdCounter
)
);
require(
bridgeTxn[bridgeId].sender == address(0),
"Bridge already exists"
);
if (supportedTokens[tokenAddress].isMintableBurnable) {
IDToken(tokenAddress).burnFrom(_msgSender(), amount);
} else {
IERC20(tokenAddress).safeTransferFrom(
_msgSender(),
address(this),
amount
);
}
BridgeTxn storage txn = bridgeTxn[bridgeId];
txn.txnType = TxnType.DEPOSIT;
txn.sender = _msgSender();
txn.chainId = chainId;
txn.tokenAddress = tokenAddress;
txn.amount = amount;
txn.isWithdrawed = false;
txn.isVerifiedByRelayer = false;
emit Deposit(
bridgeId,
_bridgeIdCounter,
_msgSender(),
chainId,
supportedTokens[tokenAddress].bridgeTokenAddress[chainId],
amount
);
}
/// @notice Bridge a withdrawal request initiated on another chain.
/// @param withdrawData The data for the withdrawal request.
function bridge(WithdrawData calldata withdrawData) external whenNotPaused {
require(hasRole(RELAYER_ROLE, _msgSender()), "Not a relayer");
BridgeTxn storage txn = bridgeTxn[withdrawData.bridgeId];
require(!txn.isVerifiedByRelayer, "Bridge already verified");
bytes32 bridgeId_ = keccak256(
abi.encodePacked(
withdrawData.sender,
withdrawData.sourceBridgeAddress,
block.chainid,
withdrawData.tokenAddress,
withdrawData.amount,
withdrawData.bridgeIndex
)
);
require(withdrawData.bridgeId == bridgeId_, "Invalid bridge id");
require(
withdrawData.signatures.length >= 3,
"should have 3 or more signatures"
);
address[] memory signers = _verifyWithdraw(withdrawData);
for (uint256 i = 0; i < signers.length; i++) {
require(
hasRole(RELAYER_ROLE, signers[i]),
"Unauthorized signature"
);
}
if (txn.sender == address(0)) {
txn.bridgeIndex = withdrawData.bridgeIndex;
txn.txnType = TxnType.WITHDRAW;
txn.sender = withdrawData.sender;
txn.chainId = withdrawData.sourceChainId;
txn.tokenAddress = withdrawData.tokenAddress;
txn.amount = withdrawData.amount;
txn.isWithdrawed = false;
} else {
require(
txn.txnType == TxnType.WITHDRAW,
"Not a withdrawal transaction"
);
}
txn.isVerifiedByRelayer = true;
emit Bridge(
withdrawData.bridgeId,
withdrawData.sourceChainId,
withdrawData.sender,
withdrawData.tokenAddress,
withdrawData.amount,
signers
);
}
/// @notice Add a new bridge transaction initiated on another chain.
/// @param voteData The data for the bridge transaction.
function addBridge(VoteData calldata voteData) external payable whenNotPaused {
require(
supportedTokens[voteData.tokenAddress].isAvailable,
"Token is not supported"
);
bytes32 bridgeId_ = keccak256(
abi.encodePacked(
voteData.sender,
voteData.sourceBridgeAddress,
block.chainid,
voteData.tokenAddress,
voteData.amount,
voteData.bridgeIndex
)
);
require(voteData.bridgeId == bridgeId_, "Invalid bridge id");
require(voteData.sender != _msgSender(), "Cannot vote for self");
BridgeTxn storage txn = bridgeTxn[voteData.bridgeId];
require(txn.sender == address(0), "Bridge already exists");
uint256 rewardMultiple = msg.value / baseVoteFee;
require(rewardMultiple > 0, "Insufficient fee");
exchangePool.transfer(msg.value);
txn.bridgeIndex = voteData.bridgeIndex;
txn.txnType = TxnType.WITHDRAW;
txn.sender = voteData.sender;
txn.chainId = voteData.sourceChainId;
txn.tokenAddress = voteData.tokenAddress;
txn.amount = voteData.amount;
txn.isWithdrawed = false;
txn.isVerifiedByRelayer = false;
txn.confirmations.push(_msgSender());
txn.reward[_msgSender()] = rewardMultiple * rewardFee;
emit Confirmation(
voteData.bridgeId,
voteData.sourceChainId,
voteData.sender,
voteData.tokenAddress,
voteData.amount,
_msgSender()
);
}
/// @notice Confirm a previously initiated bridge transaction.
/// @param voteData The data for confirming the bridge transaction.
function confirmBridge(VoteData calldata voteData) external payable whenNotPaused {
bytes32 bridgeId_ = keccak256(
abi.encodePacked(
voteData.sender,
voteData.sourceBridgeAddress,
voteData.chainId,
voteData.tokenAddress,
voteData.amount,
voteData.bridgeIndex
)
);
require(voteData.bridgeId == bridgeId_, "Invalid bridge id");
require(voteData.sender != _msgSender(), "Cannot vote for self");
BridgeTxn storage txn = bridgeTxn[voteData.bridgeId];
require(txn.sender != address(0), "Bridge doesn't exist");
require(!txn.isWithdrawed, "Bridge already withdrawn");
require(txn.txnType == TxnType.WITHDRAW, "Not a withdrawal type");
require(
txn.bridgeIndex == voteData.bridgeIndex &&
txn.sender == voteData.sender &&
txn.chainId == voteData.sourceChainId &&
txn.tokenAddress == voteData.tokenAddress &&
txn.amount == voteData.amount,
"Data verification failed"
);
uint256 rewardMultiple = msg.value / baseVoteFee;
require(rewardMultiple > 0, "Insufficient fee");
exchangePool.transfer(msg.value);
txn.confirmations.push(_msgSender());
txn.reward[_msgSender()] = rewardMultiple * rewardFee;
}
/// @notice Withdraw tokens from the bridge after all confirmations are received.
/// @param bridgeId The ID of the bridge transaction to withdraw from.
function withdraw(bytes32 bridgeId) external payable whenNotPaused {
BridgeTxn storage txn = bridgeTxn[bridgeId];
require(txn.sender != address(0), "Bridge doesn't exist");
require(!txn.isWithdrawed, "Bridge already withdrawn");
require(txn.txnType == TxnType.WITHDRAW, "Not a withdrawal type");
require(txn.isVerifiedByRelayer, "Bridge not verified");
require(
supportedTokens[txn.tokenAddress].platformFee == msg.value,
"Not Platform fee"
);
if (supportedTokens[txn.tokenAddress].platformFee > 0) {
exchangePool.transfer(msg.value);
}
txn.isWithdrawed = true;
if (supportedTokens[txn.tokenAddress].isMintableBurnable) {
IDToken(txn.tokenAddress).mint(txn.sender, txn.amount);
} else {
IERC20(txn.tokenAddress).safeTransfer(txn.sender, txn.amount);
}
for (uint256 i = 0; i < txn.confirmations.length; i++) {
IDToken(rewardToken).mint(
txn.confirmations[i],
txn.reward[txn.confirmations[i]]
);
}
emit Withdraw(bridgeId, txn.sender, txn.tokenAddress, txn.amount);
}
/**
* @dev Verifies the withdrawal request by recovering the signers from provided ECDSA signatures.
*
* @param withdrawData_ The withdrawal data including the bridge ID, sender, chain ID, token address, amount, and signatures.
* @return signers An array of addresses representing the verified signers of the withdrawal request.
*/
function _verifyWithdraw(
WithdrawData calldata withdrawData_
) internal view returns (address[] memory) {
bytes32 hash = keccak256(
abi.encodePacked(
"\x19\x01",
domainHash,
keccak256(
abi.encode(
keccak256(
abi.encodePacked(
"BridgeToken(bytes32 bridgeId,address sender,uint256 chainId,address tokenAddress,uint256 amount)"
)
),
withdrawData_.bridgeId,
withdrawData_.sender,
block.chainid,
withdrawData_.tokenAddress,
withdrawData_.amount
)
)
)
);
// Create an array of addresses to store the recovered signers.
address[] memory signers = new address[](
withdrawData_.signatures.length
);
// Recover signers from the provided ECDSA signatures.
for (uint256 i = 0; i < withdrawData_.signatures.length; i++) {
bytes memory _signature = withdrawData_.signatures[i];
signers[i] = ECDSA.recover(hash, _signature);
}
return signers;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (access/AccessControl.sol)
pragma solidity ^0.8.20;
import {IAccessControl} from "./IAccessControl.sol";
import {Context} from "../utils/Context.sol";
import {ERC165} from "../utils/introspection/ERC165.sol";
/**
* @dev Contract module that allows children to implement role-based access
* control mechanisms. This is a lightweight version that doesn't allow enumerating role
* members except through off-chain means by accessing the contract event logs. Some
* applications may benefit from on-chain enumerability, for those cases see
* {AccessControlEnumerable}.
*
* Roles are referred to by their `bytes32` identifier. These should be exposed
* in the external API and be unique. The best way to achieve this is by
* using `public constant` hash digests:
*
* ```solidity
* bytes32 public constant MY_ROLE = keccak256("MY_ROLE");
* ```
*
* Roles can be used to represent a set of permissions. To restrict access to a
* function call, use {hasRole}:
*
* ```solidity
* function foo() public {
* require(hasRole(MY_ROLE, msg.sender));
* ...
* }
* ```
*
* Roles can be granted and revoked dynamically via the {grantRole} and
* {revokeRole} functions. Each role has an associated admin role, and only
* accounts that have a role's admin role can call {grantRole} and {revokeRole}.
*
* By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means
* that only accounts with this role will be able to grant or revoke other
* roles. More complex role relationships can be created by using
* {_setRoleAdmin}.
*
* WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to
* grant and revoke this role. Extra precautions should be taken to secure
* accounts that have been granted it. We recommend using {AccessControlDefaultAdminRules}
* to enforce additional security measures for this role.
*/
abstract contract AccessControl is Context, IAccessControl, ERC165 {
struct RoleData {
mapping(address account => bool) hasRole;
bytes32 adminRole;
}
mapping(bytes32 role => RoleData) private _roles;
bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;
/**
* @dev Modifier that checks that an account has a specific role. Reverts
* with an {AccessControlUnauthorizedAccount} error including the required role.
*/
modifier onlyRole(bytes32 role) {
_checkRole(role);
_;
}
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId);
}
/**
* @dev Returns `true` if `account` has been granted `role`.
*/
function hasRole(bytes32 role, address account) public view virtual returns (bool) {
return _roles[role].hasRole[account];
}
/**
* @dev Reverts with an {AccessControlUnauthorizedAccount} error if `_msgSender()`
* is missing `role`. Overriding this function changes the behavior of the {onlyRole} modifier.
*/
function _checkRole(bytes32 role) internal view virtual {
_checkRole(role, _msgSender());
}
/**
* @dev Reverts with an {AccessControlUnauthorizedAccount} error if `account`
* is missing `role`.
*/
function _checkRole(bytes32 role, address account) internal view virtual {
if (!hasRole(role, account)) {
revert AccessControlUnauthorizedAccount(account, role);
}
}
/**
* @dev Returns the admin role that controls `role`. See {grantRole} and
* {revokeRole}.
*
* To change a role's admin, use {_setRoleAdmin}.
*/
function getRoleAdmin(bytes32 role) public view virtual returns (bytes32) {
return _roles[role].adminRole;
}
/**
* @dev Grants `role` to `account`.
*
* If `account` had not been already granted `role`, emits a {RoleGranted}
* event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*
* May emit a {RoleGranted} event.
*/
function grantRole(bytes32 role, address account) public virtual onlyRole(getRoleAdmin(role)) {
_grantRole(role, account);
}
/**
* @dev Revokes `role` from `account`.
*
* If `account` had been granted `role`, emits a {RoleRevoked} event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*
* May emit a {RoleRevoked} event.
*/
function revokeRole(bytes32 role, address account) public virtual onlyRole(getRoleAdmin(role)) {
_revokeRole(role, account);
}
/**
* @dev Revokes `role` from the calling account.
*
* Roles are often managed via {grantRole} and {revokeRole}: this function's
* purpose is to provide a mechanism for accounts to lose their privileges
* if they are compromised (such as when a trusted device is misplaced).
*
* If the calling account had been revoked `role`, emits a {RoleRevoked}
* event.
*
* Requirements:
*
* - the caller must be `callerConfirmation`.
*
* May emit a {RoleRevoked} event.
*/
function renounceRole(bytes32 role, address callerConfirmation) public virtual {
if (callerConfirmation != _msgSender()) {
revert AccessControlBadConfirmation();
}
_revokeRole(role, callerConfirmation);
}
/**
* @dev Sets `adminRole` as ``role``'s admin role.
*
* Emits a {RoleAdminChanged} event.
*/
function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {
bytes32 previousAdminRole = getRoleAdmin(role);
_roles[role].adminRole = adminRole;
emit RoleAdminChanged(role, previousAdminRole, adminRole);
}
/**
* @dev Attempts to grant `role` to `account` and returns a boolean indicating if `role` was granted.
*
* Internal function without access restriction.
*
* May emit a {RoleGranted} event.
*/
function _grantRole(bytes32 role, address account) internal virtual returns (bool) {
if (!hasRole(role, account)) {
_roles[role].hasRole[account] = true;
emit RoleGranted(role, account, _msgSender());
return true;
} else {
return false;
}
}
/**
* @dev Attempts to revoke `role` to `account` and returns a boolean indicating if `role` was revoked.
*
* Internal function without access restriction.
*
* May emit a {RoleRevoked} event.
*/
function _revokeRole(bytes32 role, address account) internal virtual returns (bool) {
if (hasRole(role, account)) {
_roles[role].hasRole[account] = false;
emit RoleRevoked(role, account, _msgSender());
return true;
} else {
return false;
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (access/IAccessControl.sol)
pragma solidity ^0.8.20;
/**
* @dev External interface of AccessControl declared to support ERC165 detection.
*/
interface IAccessControl {
/**
* @dev The `account` is missing a role.
*/
error AccessControlUnauthorizedAccount(address account, bytes32 neededRole);
/**
* @dev The caller of a function is not the expected one.
*
* NOTE: Don't confuse with {AccessControlUnauthorizedAccount}.
*/
error AccessControlBadConfirmation();
/**
* @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`
*
* `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite
* {RoleAdminChanged} not being emitted signaling this.
*/
event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);
/**
* @dev Emitted when `account` is granted `role`.
*
* `sender` is the account that originated the contract call, an admin role
* bearer except when using {AccessControl-_setupRole}.
*/
event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);
/**
* @dev Emitted when `account` is revoked `role`.
*
* `sender` is the account that originated the contract call:
* - if using `revokeRole`, it is the admin role bearer
* - if using `renounceRole`, it is the role bearer (i.e. `account`)
*/
event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);
/**
* @dev Returns `true` if `account` has been granted `role`.
*/
function hasRole(bytes32 role, address account) external view returns (bool);
/**
* @dev Returns the admin role that controls `role`. See {grantRole} and
* {revokeRole}.
*
* To change a role's admin, use {AccessControl-_setRoleAdmin}.
*/
function getRoleAdmin(bytes32 role) external view returns (bytes32);
/**
* @dev Grants `role` to `account`.
*
* If `account` had not been already granted `role`, emits a {RoleGranted}
* event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*/
function grantRole(bytes32 role, address account) external;
/**
* @dev Revokes `role` from `account`.
*
* If `account` had been granted `role`, emits a {RoleRevoked} event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*/
function revokeRole(bytes32 role, address account) external;
/**
* @dev Revokes `role` from the calling account.
*
* Roles are often managed via {grantRole} and {revokeRole}: this function's
* purpose is to provide a mechanism for accounts to lose their privileges
* if they are compromised (such as when a trusted device is misplaced).
*
* If the calling account had been granted `role`, emits a {RoleRevoked}
* event.
*
* Requirements:
*
* - the caller must be `callerConfirmation`.
*/
function renounceRole(bytes32 role, address callerConfirmation) external;
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Permit.sol)
pragma solidity ^0.8.20;
/**
* @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
* https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
*
* Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by
* presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't
* need to send a transaction, and thus is not required to hold Ether at all.
*
* ==== Security Considerations
*
* There are two important considerations concerning the use of `permit`. The first is that a valid permit signature
* expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be
* considered as an intention to spend the allowance in any specific way. The second is that because permits have
* built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should
* take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be
* generally recommended is:
*
* ```solidity
* function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public {
* try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {}
* doThing(..., value);
* }
*
* function doThing(..., uint256 value) public {
* token.safeTransferFrom(msg.sender, address(this), value);
* ...
* }
* ```
*
* Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of
* `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also
* {SafeERC20-safeTransferFrom}).
*
* Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so
* contracts should have entry points that don't rely on permit.
*/
interface IERC20Permit {
/**
* @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,
* given ``owner``'s signed approval.
*
* IMPORTANT: The same issues {IERC20-approve} has related to transaction
* ordering also apply here.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `deadline` must be a timestamp in the future.
* - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`
* over the EIP712-formatted function arguments.
* - the signature must use ``owner``'s current nonce (see {nonces}).
*
* For more information on the signature format, see the
* https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP
* section].
*
* CAUTION: See Security Considerations above.
*/
function permit(
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) external;
/**
* @dev Returns the current nonce for `owner`. This value must be
* included whenever a signature is generated for {permit}.
*
* Every successful call to {permit} increases ``owner``'s nonce by one. This
* prevents a signature from being used multiple times.
*/
function nonces(address owner) external view returns (uint256);
/**
* @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.
*/
// solhint-disable-next-line func-name-mixedcase
function DOMAIN_SEPARATOR() external view returns (bytes32);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol)
pragma solidity ^0.8.20;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
/**
* @dev Returns the value of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the value of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves a `value` amount of tokens from the caller's account to `to`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address to, uint256 value) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets a `value` amount of tokens as the allowance of `spender` over the
* caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 value) external returns (bool);
/**
* @dev Moves a `value` amount of tokens from `from` to `to` using the
* allowance mechanism. `value` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address from, address to, uint256 value) external returns (bool);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/utils/SafeERC20.sol)
pragma solidity ^0.8.20;
import {IERC20} from "../IERC20.sol";
import {IERC20Permit} from "../extensions/IERC20Permit.sol";
import {Address} from "../../../utils/Address.sol";
/**
* @title SafeERC20
* @dev Wrappers around ERC20 operations that throw on failure (when the token
* contract returns false). Tokens that return no value (and instead revert or
* throw on failure) are also supported, non-reverting calls are assumed to be
* successful.
* To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
* which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
*/
library SafeERC20 {
using Address for address;
/**
* @dev An operation with an ERC20 token failed.
*/
error SafeERC20FailedOperation(address token);
/**
* @dev Indicates a failed `decreaseAllowance` request.
*/
error SafeERC20FailedDecreaseAllowance(address spender, uint256 currentAllowance, uint256 requestedDecrease);
/**
* @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,
* non-reverting calls are assumed to be successful.
*/
function safeTransfer(IERC20 token, address to, uint256 value) internal {
_callOptionalReturn(token, abi.encodeCall(token.transfer, (to, value)));
}
/**
* @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the
* calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.
*/
function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
_callOptionalReturn(token, abi.encodeCall(token.transferFrom, (from, to, value)));
}
/**
* @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
* non-reverting calls are assumed to be successful.
*/
function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
uint256 oldAllowance = token.allowance(address(this), spender);
forceApprove(token, spender, oldAllowance + value);
}
/**
* @dev Decrease the calling contract's allowance toward `spender` by `requestedDecrease`. If `token` returns no
* value, non-reverting calls are assumed to be successful.
*/
function safeDecreaseAllowance(IERC20 token, address spender, uint256 requestedDecrease) internal {
unchecked {
uint256 currentAllowance = token.allowance(address(this), spender);
if (currentAllowance < requestedDecrease) {
revert SafeERC20FailedDecreaseAllowance(spender, currentAllowance, requestedDecrease);
}
forceApprove(token, spender, currentAllowance - requestedDecrease);
}
}
/**
* @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,
* non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval
* to be set to zero before setting it to a non-zero value, such as USDT.
*/
function forceApprove(IERC20 token, address spender, uint256 value) internal {
bytes memory approvalCall = abi.encodeCall(token.approve, (spender, value));
if (!_callOptionalReturnBool(token, approvalCall)) {
_callOptionalReturn(token, abi.encodeCall(token.approve, (spender, 0)));
_callOptionalReturn(token, approvalCall);
}
}
/**
* @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
* on the return value: the return value is optional (but if data is returned, it must not be false).
* @param token The token targeted by the call.
* @param data The call data (encoded using abi.encode or one of its variants).
*/
function _callOptionalReturn(IERC20 token, bytes memory data) private {
// We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
// we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that
// the target address contains contract code and also asserts for success in the low-level call.
bytes memory returndata = address(token).functionCall(data);
if (returndata.length != 0 && !abi.decode(returndata, (bool))) {
revert SafeERC20FailedOperation(address(token));
}
}
/**
* @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
* on the return value: the return value is optional (but if data is returned, it must not be false).
* @param token The token targeted by the call.
* @param data The call data (encoded using abi.encode or one of its variants).
*
* This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.
*/
function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {
// We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
// we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false
// and not revert is the subcall reverts.
(bool success, bytes memory returndata) = address(token).call(data);
return success && (returndata.length == 0 || abi.decode(returndata, (bool))) && address(token).code.length > 0;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/Address.sol)
pragma solidity ^0.8.20;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev The ETH balance of the account is not enough to perform the operation.
*/
error AddressInsufficientBalance(address account);
/**
* @dev There's no code at `target` (it is not a contract).
*/
error AddressEmptyCode(address target);
/**
* @dev A call to an address target failed. The target may have reverted.
*/
error FailedInnerCall();
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.8.20/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
if (address(this).balance < amount) {
revert AddressInsufficientBalance(address(this));
}
(bool success, ) = recipient.call{value: amount}("");
if (!success) {
revert FailedInnerCall();
}
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain `call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason or custom error, it is bubbled
* up by this function (like regular Solidity function calls). However, if
* the call reverted with no returned reason, this function reverts with a
* {FailedInnerCall} error.
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*/
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
if (address(this).balance < value) {
revert AddressInsufficientBalance(address(this));
}
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResultFromTarget(target, success, returndata);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResultFromTarget(target, success, returndata);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResultFromTarget(target, success, returndata);
}
/**
* @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target
* was not a contract or bubbling up the revert reason (falling back to {FailedInnerCall}) in case of an
* unsuccessful call.
*/
function verifyCallResultFromTarget(
address target,
bool success,
bytes memory returndata
) internal view returns (bytes memory) {
if (!success) {
_revert(returndata);
} else {
// only check if target is a contract if the call was successful and the return data is empty
// otherwise we already know that it was a contract
if (returndata.length == 0 && target.code.length == 0) {
revert AddressEmptyCode(target);
}
return returndata;
}
}
/**
* @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the
* revert reason or with a default {FailedInnerCall} error.
*/
function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) {
if (!success) {
_revert(returndata);
} else {
return returndata;
}
}
/**
* @dev Reverts with returndata if present. Otherwise reverts with {FailedInnerCall}.
*/
function _revert(bytes memory returndata) private pure {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
/// @solidity memory-safe-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert FailedInnerCall();
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/Context.sol)
pragma solidity ^0.8.20;
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/cryptography/ECDSA.sol)
pragma solidity ^0.8.20;
/**
* @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.
*
* These functions can be used to verify that a message was signed by the holder
* of the private keys of a given address.
*/
library ECDSA {
enum RecoverError {
NoError,
InvalidSignature,
InvalidSignatureLength,
InvalidSignatureS
}
/**
* @dev The signature derives the `address(0)`.
*/
error ECDSAInvalidSignature();
/**
* @dev The signature has an invalid length.
*/
error ECDSAInvalidSignatureLength(uint256 length);
/**
* @dev The signature has an S value that is in the upper half order.
*/
error ECDSAInvalidSignatureS(bytes32 s);
/**
* @dev Returns the address that signed a hashed message (`hash`) with `signature` or an error. This will not
* return address(0) without also returning an error description. Errors are documented using an enum (error type)
* and a bytes32 providing additional information about the error.
*
* If no error is returned, then the address can be used for verification purposes.
*
* The `ecrecover` EVM precompile allows for malleable (non-unique) signatures:
* this function rejects them by requiring the `s` value to be in the lower
* half order, and the `v` value to be either 27 or 28.
*
* IMPORTANT: `hash` _must_ be the result of a hash operation for the
* verification to be secure: it is possible to craft signatures that
* recover to arbitrary addresses for non-hashed data. A safe way to ensure
* this is by receiving a hash of the original message (which may otherwise
* be too long), and then calling {MessageHashUtils-toEthSignedMessageHash} on it.
*
* Documentation for signature generation:
* - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]
* - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]
*/
function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError, bytes32) {
if (signature.length == 65) {
bytes32 r;
bytes32 s;
uint8 v;
// ecrecover takes the signature parameters, and the only way to get them
// currently is to use assembly.
/// @solidity memory-safe-assembly
assembly {
r := mload(add(signature, 0x20))
s := mload(add(signature, 0x40))
v := byte(0, mload(add(signature, 0x60)))
}
return tryRecover(hash, v, r, s);
} else {
return (address(0), RecoverError.InvalidSignatureLength, bytes32(signature.length));
}
}
/**
* @dev Returns the address that signed a hashed message (`hash`) with
* `signature`. This address can then be used for verification purposes.
*
* The `ecrecover` EVM precompile allows for malleable (non-unique) signatures:
* this function rejects them by requiring the `s` value to be in the lower
* half order, and the `v` value to be either 27 or 28.
*
* IMPORTANT: `hash` _must_ be the result of a hash operation for the
* verification to be secure: it is possible to craft signatures that
* recover to arbitrary addresses for non-hashed data. A safe way to ensure
* this is by receiving a hash of the original message (which may otherwise
* be too long), and then calling {MessageHashUtils-toEthSignedMessageHash} on it.
*/
function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {
(address recovered, RecoverError error, bytes32 errorArg) = tryRecover(hash, signature);
_throwError(error, errorArg);
return recovered;
}
/**
* @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.
*
* See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]
*/
function tryRecover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address, RecoverError, bytes32) {
unchecked {
bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);
// We do not check for an overflow here since the shift operation results in 0 or 1.
uint8 v = uint8((uint256(vs) >> 255) + 27);
return tryRecover(hash, v, r, s);
}
}
/**
* @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.
*/
function recover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address) {
(address recovered, RecoverError error, bytes32 errorArg) = tryRecover(hash, r, vs);
_throwError(error, errorArg);
return recovered;
}
/**
* @dev Overload of {ECDSA-tryRecover} that receives the `v`,
* `r` and `s` signature fields separately.
*/
function tryRecover(
bytes32 hash,
uint8 v,
bytes32 r,
bytes32 s
) internal pure returns (address, RecoverError, bytes32) {
// EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature
// unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines
// the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most
// signatures from current libraries generate a unique signature with an s-value in the lower half order.
//
// If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value
// with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or
// vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept
// these malleable signatures as well.
if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {
return (address(0), RecoverError.InvalidSignatureS, s);
}
// If the signature is valid (and not malleable), return the signer address
address signer = ecrecover(hash, v, r, s);
if (signer == address(0)) {
return (address(0), RecoverError.InvalidSignature, bytes32(0));
}
return (signer, RecoverError.NoError, bytes32(0));
}
/**
* @dev Overload of {ECDSA-recover} that receives the `v`,
* `r` and `s` signature fields separately.
*/
function recover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address) {
(address recovered, RecoverError error, bytes32 errorArg) = tryRecover(hash, v, r, s);
_throwError(error, errorArg);
return recovered;
}
/**
* @dev Optionally reverts with the corresponding custom error according to the `error` argument provided.
*/
function _throwError(RecoverError error, bytes32 errorArg) private pure {
if (error == RecoverError.NoError) {
return; // no error: do nothing
} else if (error == RecoverError.InvalidSignature) {
revert ECDSAInvalidSignature();
} else if (error == RecoverError.InvalidSignatureLength) {
revert ECDSAInvalidSignatureLength(uint256(errorArg));
} else if (error == RecoverError.InvalidSignatureS) {
revert ECDSAInvalidSignatureS(errorArg);
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/ERC165.sol)
pragma solidity ^0.8.20;
import {IERC165} from "./IERC165.sol";
/**
* @dev Implementation of the {IERC165} interface.
*
* Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check
* for the additional interface id that will be supported. For example:
*
* ```solidity
* function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
* return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
* }
* ```
*/
abstract contract ERC165 is IERC165 {
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual returns (bool) {
return interfaceId == type(IERC165).interfaceId;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/IERC165.sol)
pragma solidity ^0.8.20;
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implementers can declare support of contract interfaces, which can then be
* queried by others ({ERC165Checker}).
*
* For an implementation, see {ERC165}.
*/
interface IERC165 {
/**
* @dev Returns true if this contract implements the interface defined by
* `interfaceId`. See the corresponding
* https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
* to learn more about how these ids are created.
*
* This function call must use less than 30 000 gas.
*/
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/Pausable.sol)
pragma solidity ^0.8.20;
import {Context} from "../utils/Context.sol";
/**
* @dev Contract module which allows children to implement an emergency stop
* mechanism that can be triggered by an authorized account.
*
* This module is used through inheritance. It will make available the
* modifiers `whenNotPaused` and `whenPaused`, which can be applied to
* the functions of your contract. Note that they will not be pausable by
* simply including this module, only once the modifiers are put in place.
*/
abstract contract Pausable is Context {
bool private _paused;
/**
* @dev Emitted when the pause is triggered by `account`.
*/
event Paused(address account);
/**
* @dev Emitted when the pause is lifted by `account`.
*/
event Unpaused(address account);
/**
* @dev The operation failed because the contract is paused.
*/
error EnforcedPause();
/**
* @dev The operation failed because the contract is not paused.
*/
error ExpectedPause();
/**
* @dev Initializes the contract in unpaused state.
*/
constructor() {
_paused = false;
}
/**
* @dev Modifier to make a function callable only when the contract is not paused.
*
* Requirements:
*
* - The contract must not be paused.
*/
modifier whenNotPaused() {
_requireNotPaused();
_;
}
/**
* @dev Modifier to make a function callable only when the contract is paused.
*
* Requirements:
*
* - The contract must be paused.
*/
modifier whenPaused() {
_requirePaused();
_;
}
/**
* @dev Returns true if the contract is paused, and false otherwise.
*/
function paused() public view virtual returns (bool) {
return _paused;
}
/**
* @dev Throws if the contract is paused.
*/
function _requireNotPaused() internal view virtual {
if (paused()) {
revert EnforcedPause();
}
}
/**
* @dev Throws if the contract is not paused.
*/
function _requirePaused() internal view virtual {
if (!paused()) {
revert ExpectedPause();
}
}
/**
* @dev Triggers stopped state.
*
* Requirements:
*
* - The contract must not be paused.
*/
function _pause() internal virtual whenNotPaused {
_paused = true;
emit Paused(_msgSender());
}
/**
* @dev Returns to normal state.
*
* Requirements:
*
* - The contract must be paused.
*/
function _unpause() internal virtual whenPaused {
_paused = false;
emit Unpaused(_msgSender());
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
interface IDToken {
function name() external view returns (string memory);
function totalSupply() external view returns (uint256);
function mint(address to, uint256 amount) external;
function burnFrom(address account, uint256 amount) external;
}{
"optimizer": {
"enabled": true,
"runs": 200
},
"evmVersion": "paris",
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"libraries": {}
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"version","type":"string"},{"internalType":"address payable","name":"exchangePoolAddress","type":"address"},{"internalType":"contract IDToken","name":"rewarTokenAddress","type":"address"},{"internalType":"uint256","name":"_baseVoteFee","type":"uint256"},{"internalType":"uint256","name":"_rewardFee","type":"uint256"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"AccessControlBadConfirmation","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"bytes32","name":"neededRole","type":"bytes32"}],"name":"AccessControlUnauthorizedAccount","type":"error"},{"inputs":[{"internalType":"address","name":"target","type":"address"}],"name":"AddressEmptyCode","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"AddressInsufficientBalance","type":"error"},{"inputs":[],"name":"ECDSAInvalidSignature","type":"error"},{"inputs":[{"internalType":"uint256","name":"length","type":"uint256"}],"name":"ECDSAInvalidSignatureLength","type":"error"},{"inputs":[{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"ECDSAInvalidSignatureS","type":"error"},{"inputs":[],"name":"EnforcedPause","type":"error"},{"inputs":[],"name":"ExpectedPause","type":"error"},{"inputs":[],"name":"FailedInnerCall","type":"error"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"SafeERC20FailedOperation","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"bridgeId","type":"bytes32"},{"indexed":false,"internalType":"uint256","name":"sourceChainId","type":"uint256"},{"indexed":false,"internalType":"address","name":"receiver","type":"address"},{"indexed":false,"internalType":"address","name":"tokenAddress","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"address[]","name":"validators","type":"address[]"}],"name":"Bridge","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"bridgeId","type":"bytes32"},{"indexed":false,"internalType":"uint256","name":"sourceChainId","type":"uint256"},{"indexed":false,"internalType":"address","name":"receiver","type":"address"},{"indexed":false,"internalType":"address","name":"tokenAddress","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"address","name":"confirmer","type":"address"}],"name":"Confirmation","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"bridgeId","type":"bytes32"},{"indexed":true,"internalType":"uint256","name":"bridgeIndex","type":"uint256"},{"indexed":false,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"uint256","name":"chainId","type":"uint256"},{"indexed":false,"internalType":"address","name":"tokenAddress","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Deposit","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"bridgeId","type":"bytes32"},{"indexed":true,"internalType":"address","name":"receiver","type":"address"},{"indexed":false,"internalType":"address","name":"bridgeTokenAddress","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Withdraw","type":"event"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"GOVERNOR_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"RELAYER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"bytes32","name":"bridgeId","type":"bytes32"},{"internalType":"uint256","name":"bridgeIndex","type":"uint256"},{"internalType":"address","name":"sender","type":"address"},{"internalType":"uint256","name":"chainId","type":"uint256"},{"internalType":"uint256","name":"sourceChainId","type":"uint256"},{"internalType":"address","name":"sourceBridgeAddress","type":"address"},{"internalType":"address","name":"tokenAddress","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"internalType":"struct DBridge.VoteData","name":"voteData","type":"tuple"}],"name":"addBridge","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"tokenAddress","type":"address"},{"internalType":"uint256","name":"chainId","type":"uint256"},{"internalType":"address","name":"bridgeTokenAddress","type":"address"}],"name":"addSupportedChain","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"tokenAddress","type":"address"},{"internalType":"uint256","name":"tokenPlatformFee","type":"uint256"},{"internalType":"bool","name":"isMintableBurnableToken","type":"bool"}],"name":"addToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"bytes32","name":"bridgeId","type":"bytes32"},{"internalType":"uint256","name":"bridgeIndex","type":"uint256"},{"internalType":"address","name":"sender","type":"address"},{"internalType":"uint256","name":"chainId","type":"uint256"},{"internalType":"uint256","name":"sourceChainId","type":"uint256"},{"internalType":"address","name":"sourceBridgeAddress","type":"address"},{"internalType":"address","name":"tokenAddress","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"bytes[]","name":"signatures","type":"bytes[]"}],"internalType":"struct DBridge.WithdrawData","name":"withdrawData","type":"tuple"}],"name":"bridge","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"bridgeTxn","outputs":[{"internalType":"uint256","name":"bridgeIndex","type":"uint256"},{"internalType":"enum DBridge.TxnType","name":"txnType","type":"uint8"},{"internalType":"address","name":"sender","type":"address"},{"internalType":"uint256","name":"chainId","type":"uint256"},{"internalType":"address","name":"tokenAddress","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"bool","name":"isWithdrawed","type":"bool"},{"internalType":"bool","name":"isVerifiedByRelayer","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"bytes32","name":"bridgeId","type":"bytes32"},{"internalType":"uint256","name":"bridgeIndex","type":"uint256"},{"internalType":"address","name":"sender","type":"address"},{"internalType":"uint256","name":"chainId","type":"uint256"},{"internalType":"uint256","name":"sourceChainId","type":"uint256"},{"internalType":"address","name":"sourceBridgeAddress","type":"address"},{"internalType":"address","name":"tokenAddress","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"internalType":"struct DBridge.VoteData","name":"voteData","type":"tuple"}],"name":"confirmBridge","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"chainId","type":"uint256"},{"internalType":"address","name":"tokenAddress","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"deposit","outputs":[{"internalType":"bytes32","name":"bridgeId","type":"bytes32"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"domainHash","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"tokenAddress","type":"address"},{"internalType":"bool","name":"isEnable","type":"bool"}],"name":"enableDisableToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"tokenAddress","type":"address"},{"internalType":"uint256","name":"chainId","type":"uint256"}],"name":"getBridgeTokenAddress","outputs":[{"internalType":"address","name":"bridgeTokenAddress","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"callerConfirmation","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"supportedTokens","outputs":[{"internalType":"uint256","name":"platformFee","type":"uint256"},{"internalType":"bool","name":"isAvailable","type":"bool"},{"internalType":"bool","name":"isMintableBurnable","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"tokenAddress","type":"address"},{"internalType":"uint256","name":"newPlatformFee","type":"uint256"}],"name":"updateTokenPlatformFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"bridgeId","type":"bytes32"}],"name":"withdraw","outputs":[],"stateMutability":"payable","type":"function"}]Contract Creation Code
60c060405260006002553480156200001657600080fd5b506040516200304f3803806200304f833981016040819052620000399162000356565b6000805460ff191681556200004f9033620001d9565b506200007c7f7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f5533620001d9565b506001600160a01b0380851660a052600380549185166001600160a01b03199092169190911790556004829055600581905560405162000123906020017f454950373132446f6d61696e28737472696e67206e616d652c737472696e672081527f76657273696f6e2c75696e7432353620636861696e49642c6164647265737320602082015271766572696679696e67436f6e74726163742960701b604082015260520190565b60405160208183030381529060405280519060200120866040516020016200014c9190620003fe565b6040516020818303038152906040528051906020012086604051602001620001759190620003fe565b60408051601f1981840301815282825280516020918201209083019490945281019190915260608101919091524660808201523060a082015260c00160408051601f198184030181529190528051602090910120608052506200041c945050505050565b60008281526001602090815260408083206001600160a01b038516845290915281205460ff16620002665760008381526001602081815260408084206001600160a01b0387168086529252808420805460ff19169093179092559051339286917f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d9190a45060016200026a565b5060005b92915050565b634e487b7160e01b600052604160045260246000fd5b60005b83811015620002a357818101518382015260200162000289565b50506000910152565b600082601f830112620002be57600080fd5b81516001600160401b0380821115620002db57620002db62000270565b604051601f8301601f19908116603f0116810190828211818310171562000306576200030662000270565b816040528381528660208588010111156200032057600080fd5b6200033384602083016020890162000286565b9695505050505050565b6001600160a01b03811681146200035357600080fd5b50565b60008060008060008060c087890312156200037057600080fd5b86516001600160401b03808211156200038857600080fd5b620003968a838b01620002ac565b97506020890151915080821115620003ad57600080fd5b50620003bc89828a01620002ac565b9550506040870151620003cf816200033d565b6060880151909450620003e2816200033d565b809350506080870151915060a087015190509295509295509295565b600082516200041281846020870162000286565b9190910192915050565b60805160a051612bf862000457600039600081816108d501528181610e710152611b0e01526000818161051e0152611f000152612bf86000f3fe6080604052600436106101665760003560e01c80638456cb59116100d1578063aa69acdc1161008a578063ccc5749011610064578063ccc57490146104ca578063d547741f146104ec578063dfe86ac51461050c578063fd08f3f31461054057600080fd5b8063aa69acdc1461040a578063bc157ac11461048a578063c9bbd1fe146104aa57600080fd5b80638456cb59146103595780638e19899e1461036e57806391d1485414610381578063926d7d7f146103a15780639e67cfbe146103d5578063a217fddf146103f557600080fd5b806338c1a65e1161012357806338c1a65e146102545780633f4ba83a14610274578063519cc34f146102895780635c975abb146102c157806368c4ac26146102d9578063760098151461033957600080fd5b806301ffc9a71461016b5780630890add4146101a0578063248a9ca3146101b55780632701a334146101f45780632f2ff15d1461021457806336568abe14610234575b600080fd5b34801561017757600080fd5b5061018b610186366004612591565b610553565b60405190151581526020015b60405180910390f35b6101b36101ae3660046125bb565b61058a565b005b3480156101c157600080fd5b506101e66101d03660046125d4565b6000908152600160208190526040909120015490565b604051908152602001610197565b34801561020057600080fd5b506101b361020f366004612609565b61096f565b34801561022057600080fd5b506101b361022f366004612645565b6109cb565b34801561024057600080fd5b506101b361024f366004612645565b6109f7565b34801561026057600080fd5b506101b361026f36600461267f565b610a2f565b34801561028057600080fd5b506101b3610bca565b34801561029557600080fd5b506102a96102a43660046126bf565b610be0565b6040516001600160a01b039091168152602001610197565b3480156102cd57600080fd5b5060005460ff1661018b565b3480156102e557600080fd5b5061031c6102f43660046126e9565b6006602052600090815260409020600181015460029091015460ff8082169161010090041683565b604080519384529115156020840152151590820152606001610197565b34801561034557600080fd5b506101b3610354366004612704565b610c13565b34801561036557600080fd5b506101b3610c62565b6101b361037c3660046125d4565b610c75565b34801561038d57600080fd5b5061018b61039c366004612645565b61110d565b3480156103ad57600080fd5b506101e67fe2b7fb3b832174769106daebcfd6d1970523240dda11281102db9363b83b0dc481565b3480156103e157600080fd5b506101b36103f03660046126bf565b611138565b34801561040157600080fd5b506101e6600081565b34801561041657600080fd5b506104766104253660046125d4565b600760205260009081526040902080546001820154600283015460038401546004850154600590950154939460ff808516956001600160a01b03610100968790048116969416938183169291041688565b604051610197989796959493929190612751565b34801561049657600080fd5b506101e66104a53660046127bb565b6111ab565b3480156104b657600080fd5b506101b36104c53660046127f0565b6114c0565b3480156104d657600080fd5b506101e6600080516020612ba383398151915281565b3480156104f857600080fd5b506101b3610507366004612645565b6118db565b34801561051857600080fd5b506101e67f000000000000000000000000000000000000000000000000000000000000000081565b6101b361054e3660046125bb565b611901565b60006001600160e01b03198216637965db0b60e01b148061058457506301ffc9a760e01b6001600160e01b03198316145b92915050565b610592611cbd565b60006105a460608301604084016126e9565b6105b460c0840160a085016126e9565b60608401356105c960e0860160c087016126e9565b8560e0013586602001356040516020016105e89695949392919061282c565b6040516020818303038152906040528051906020012090508082600001351461062c5760405162461bcd60e51b815260040161062390612874565b60405180910390fd5b3361063d60608401604085016126e9565b6001600160a01b03160361068a5760405162461bcd60e51b815260206004820152601460248201527321b0b73737ba103b37ba32903337b91039b2b63360611b6044820152606401610623565b81356000908152600760205260409020600181015461010090046001600160a01b03166106f05760405162461bcd60e51b8152602060048201526014602482015273109c9a5919d948191bd95cdb89dd08195e1a5cdd60621b6044820152606401610623565b600581015460ff16156107405760405162461bcd60e51b8152602060048201526018602482015277213934b233b29030b63932b0b23c903bb4ba34323930bbb760411b6044820152606401610623565b60018181015460ff16818111156107595761075961273b565b1461079e5760405162461bcd60e51b81526020600482015260156024820152744e6f742061207769746864726177616c207479706560581b6044820152606401610623565b805460208401351480156107d657506107bd60608401604085016126e9565b600182015461010090046001600160a01b039081169116145b80156107e9575082608001358160020154145b8015610814575061080060e0840160c085016126e9565b60038201546001600160a01b039081169116145b801561082757508260e001358160040154145b6108735760405162461bcd60e51b815260206004820152601860248201527f4461746120766572696669636174696f6e206661696c656400000000000000006044820152606401610623565b60006004543461088391906128b5565b9050600081116108c85760405162461bcd60e51b815260206004820152601060248201526f496e73756666696369656e742066656560801b6044820152606401610623565b6040516001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016903480156108fc02916000818181858888f1935050505015801561091d573d6000803e3d6000fd5b50600682018054600181018255600091825260209091200180546001600160a01b0319163317905560055461095290826128d7565b336000908152600793909301602052604090922091909155505050565b600080516020612ba383398151915261098781611ce3565b61098f611cbd565b506001600160a01b0392831660009081526006602090815260408083209483529390529190912080546001600160a01b03191691909216179055565b600082815260016020819052604090912001546109e781611ce3565b6109f18383611ced565b50505050565b6001600160a01b0381163314610a205760405163334bd91960e11b815260040160405180910390fd5b610a2a8282611d66565b505050565b600080516020612ba3833981519152610a4781611ce3565b610a4f611cbd565b836001600160a01b03166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa925050508015610aa9575060408051601f3d908101601f19168201909252610aa6918101906128ee565b60015b610ae95760405162461bcd60e51b815260206004820152601160248201527020b2323932b9b9903737ba103a37b5b2b760791b6044820152606401610623565b846001600160a01b03166306fdde036040518163ffffffff1660e01b8152600401600060405180830381865afa925050508015610b4857506040513d6000823e601f3d908101601f19168201604052610b459190810190612941565b60015b610b885760405162461bcd60e51b815260206004820152601160248201527020b2323932b9b9903737ba103a37b5b2b760791b6044820152606401610623565b506001600160a01b038516600090815260066020526040902060028101805460019283018790558515156101000261ffff199091161790911790555050505050565b6000610bd581611ce3565b610bdd611dd3565b50565b6000610bea611cbd565b506001600160a01b03918216600090815260066020908152604080832093835292905220541690565b600080516020612ba3833981519152610c2b81611ce3565b610c33611cbd565b506001600160a01b03919091166000908152600660205260409020600201805460ff1916911515919091179055565b6000610c6d81611ce3565b610bdd611e25565b610c7d611cbd565b6000818152600760205260409020600181015461010090046001600160a01b0316610ce15760405162461bcd60e51b8152602060048201526014602482015273109c9a5919d948191bd95cdb89dd08195e1a5cdd60621b6044820152606401610623565b600581015460ff1615610d315760405162461bcd60e51b8152602060048201526018602482015277213934b233b29030b63932b0b23c903bb4ba34323930bbb760411b6044820152606401610623565b60018181015460ff1681811115610d4a57610d4a61273b565b14610d8f5760405162461bcd60e51b81526020600482015260156024820152744e6f742061207769746864726177616c207479706560581b6044820152606401610623565b6005810154610100900460ff16610dde5760405162461bcd60e51b8152602060048201526013602482015272109c9a5919d9481b9bdd081d995c9a599a5959606a1b6044820152606401610623565b60038101546001600160a01b03166000908152600660205260409020600101543414610e3f5760405162461bcd60e51b815260206004820152601060248201526f4e6f7420506c6174666f726d2066656560801b6044820152606401610623565b60038101546001600160a01b031660009081526006602052604090206001015415610ebb576040516001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016903480156108fc02916000818181858888f19350505050158015610eb9573d6000803e3d6000fd5b505b60058101805460ff1916600117905560038101546001600160a01b0316600090815260066020526040902060020154610100900460ff1615610f7357600381015460018201546004808401546040516340c10f1960e01b81526001600160a01b0361010090940484169281019290925260248201529116906340c10f1990604401600060405180830381600087803b158015610f5657600080fd5b505af1158015610f6a573d6000803e3d6000fd5b50505050610fa1565b600181015460048201546003830154610fa1926001600160a01b039182169261010090910490911690611e62565b60005b60068201548110156110a9576003546006830180546001600160a01b03909216916340c10f19919084908110610fdc57610fdc6129ee565b9060005260206000200160009054906101000a90046001600160a01b0316846007016000866006018681548110611015576110156129ee565b6000918252602080832091909101546001600160a01b039081168452908301939093526040918201902054905160e085901b6001600160e01b03191681529290911660048301526024820152604401600060405180830381600087803b15801561107e57600080fd5b505af1158015611092573d6000803e3d6000fd5b5050505080806110a190612a04565b915050610fa4565b50600181015460038201546004830154604080516001600160a01b03938416815260208101929092526101009093049091169184917fcd6ac346191b4b7531743e58f243dd4d350a52a9186641c1e5eac22b95aaedbe910160405180910390a35050565b60009182526001602090815260408084206001600160a01b0393909316845291905290205460ff1690565b600080516020612ba383398151915261115081611ce3565b6001600160a01b03831660009081526006602052604090206002015460ff1661118b5760405162461bcd60e51b815260040161062390612a1d565b506001600160a01b03909116600090815260066020526040902060010155565b60006111b5611cbd565b6001600160a01b03831660009081526006602052604090206002015460ff166111f05760405162461bcd60e51b815260040161062390612a1d565b6001600160a01b038381166000908152600660209081526040808320888452909152902054166112625760405162461bcd60e51b815260206004820152601960248201527f436861696e204944206973206e6f7420737570706f72746564000000000000006044820152606401610623565b6001600260008282546112759190612a4d565b90915550506001600160a01b0383811660009081526006602090815260408083208884528252918290205460025492516112bb94339430948b949092169289920161282c565b60408051601f1981840301815291815281516020928301206000818152600790935291206001015490915061010090046001600160a01b0316156113395760405162461bcd60e51b815260206004820152601560248201527442726964676520616c72656164792065786973747360581b6044820152606401610623565b6001600160a01b038316600090815260066020526040902060020154610100900460ff16156113d7576001600160a01b0383166379cc6790336040516001600160e01b031960e084901b1681526001600160a01b03909116600482015260248101859052604401600060405180830381600087803b1580156113ba57600080fd5b505af11580156113ce573d6000803e3d6000fd5b505050506113ec565b6113ec6001600160a01b038416333085611ec1565b60008181526007602090815260408083206001810180546001600160a81b0319163361010081029190911790915560028083018a90556003830180546001600160a01b0319166001600160a01b038b8116918217909255600485018a905560058501805461ffff191690559154918752600686528487208b88528652958490205484519283529482018a90529390941684830152606084018690529051909284917fd0c25ea866ba50b243f16b469e48cd4aec5bc45138d68bb1dc64eec170a03cdc916080908290030190a3509392505050565b6114c8611cbd565b6114f27fe2b7fb3b832174769106daebcfd6d1970523240dda11281102db9363b83b0dc43361110d565b61152e5760405162461bcd60e51b815260206004820152600d60248201526c2737ba1030903932b630bcb2b960991b6044820152606401610623565b803560009081526007602052604090206005810154610100900460ff16156115985760405162461bcd60e51b815260206004820152601760248201527f42726964676520616c72656164792076657269666965640000000000000000006044820152606401610623565b60006115aa60608401604085016126e9565b6115ba60c0850160a086016126e9565b466115cb60e0870160c088016126e9565b8660e0013587602001356040516020016115ea9695949392919061282c565b604051602081830303815290604052805190602001209050808360000135146116255760405162461bcd60e51b815260040161062390612874565b6003611635610100850185612a60565b905010156116855760405162461bcd60e51b815260206004820181905260248201527f73686f756c6420686176652033206f72206d6f7265207369676e6174757265736044820152606401610623565b600061169084611efa565b905060005b8151811015611738576116e17fe2b7fb3b832174769106daebcfd6d1970523240dda11281102db9363b83b0dc48383815181106116d4576116d46129ee565b602002602001015161110d565b6117265760405162461bcd60e51b8152602060048201526016602482015275556e617574686f72697a6564207369676e617475726560501b6044820152606401610623565b8061173081612a04565b915050611695565b50600183015461010090046001600160a01b03166117f757602084013583556001808401805460ff1916909117905561177760608501604086016126e9565b6001840180546001600160a01b039290921661010002610100600160a81b0319909216919091179055608084013560028401556117ba60e0850160c086016126e9565b6003840180546001600160a01b0319166001600160a01b039290921691909117905560e0840135600484015560058301805460ff1916905561185d565b60018381015460ff16818111156118105761181061273b565b1461185d5760405162461bcd60e51b815260206004820152601c60248201527f4e6f742061207769746864726177616c207472616e73616374696f6e000000006044820152606401610623565b60058301805461ff00191661010017905583357ff3c4725ca128aceaa65ff2945d9e99606bec738fcefd0f8484cbce81983cad5160808601356118a660608801604089016126e9565b6118b660e0890160c08a016126e9565b8860e00135866040516118cd959493929190612ab1565b60405180910390a250505050565b600082815260016020819052604090912001546118f781611ce3565b6109f18383611d66565b611909611cbd565b6006600061191d60e0840160c085016126e9565b6001600160a01b0316815260208101919091526040016000206002015460ff166119595760405162461bcd60e51b815260040161062390612a1d565b600061196b60608301604084016126e9565b61197b60c0840160a085016126e9565b4661198c60e0860160c087016126e9565b8560e0013586602001356040516020016119ab9695949392919061282c565b604051602081830303815290604052805190602001209050808260000135146119e65760405162461bcd60e51b815260040161062390612874565b336119f760608401604085016126e9565b6001600160a01b031603611a445760405162461bcd60e51b815260206004820152601460248201527321b0b73737ba103b37ba32903337b91039b2b63360611b6044820152606401610623565b81356000908152600760205260409020600181015461010090046001600160a01b031615611aac5760405162461bcd60e51b815260206004820152601560248201527442726964676520616c72656164792065786973747360581b6044820152606401610623565b600060045434611abc91906128b5565b905060008111611b015760405162461bcd60e51b815260206004820152601060248201526f496e73756666696369656e742066656560801b6044820152606401610623565b6040516001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016903480156108fc02916000818181858888f19350505050158015611b56573d6000803e3d6000fd5b50602084013582556001808301805460ff19169091179055611b7e60608501604086016126e9565b6001830180546001600160a01b039290921661010002610100600160a81b031990921691909117905560808401356002830155611bc160e0850160c086016126e9565b6003830180546001600160a01b03929092166001600160a01b031992831617905560e085013560048401556005808401805461ffff1916905560068401805460018101825560009182526020909120018054909216331790915554611c2690826128d7565b33600090815260078401602052604090819020919091558435907fc4b32bae10164ad1302d9de2f96f8e2eb9137954a60bc490dbf3034f7d42b92190608087013590611c7890606089019089016126e9565b611c8860e0890160c08a016126e9565b604080519384526001600160a01b03928316602085015291169082015260e0870135606082015233608082015260a0016118cd565b60005460ff1615611ce15760405163d93c066560e01b815260040160405180910390fd5b565b610bdd8133612198565b6000611cf9838361110d565b611d5e5760008381526001602081815260408084206001600160a01b0387168086529252808420805460ff19169093179092559051339286917f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d9190a4506001610584565b506000610584565b6000611d72838361110d565b15611d5e5760008381526001602090815260408083206001600160a01b0386168085529252808320805460ff1916905551339286917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a4506001610584565b611ddb6121d5565b6000805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b611e2d611cbd565b6000805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258611e083390565b6040516001600160a01b03838116602483015260448201839052610a2a91859182169063a9059cbb906064015b604051602081830303815290604052915060e01b6020820180516001600160e01b0383818316178352505050506121f8565b6040516001600160a01b0384811660248301528381166044830152606482018390526109f19186918216906323b872dd90608401611e8f565b606060007f0000000000000000000000000000000000000000000000000000000000000000604051602001611f9e907f427269646765546f6b656e28627974657333322062726964676549642c61646481527f726573732073656e6465722c75696e7432353620636861696e49642c6164647260208201527f65737320746f6b656e416464726573732c75696e7432353620616d6f756e7429604082015260600190565b604051602081830303815290604052805190602001208460000135856040016020810190611fcc91906126e9565b46611fdd60e0890160c08a016126e9565b6040805160208101969096528501939093526001600160a01b03918216606085015260808401521660a082015260e08086013560c0830152016040516020818303038152906040528051906020012060405160200161205392919061190160f01b81526002810192909252602282015260420190565b60408051601f1981840301815291905280516020909101209050600061207d610100850185612a60565b905067ffffffffffffffff81111561209757612097612907565b6040519080825280602002602001820160405280156120c0578160200160208202803683370190505b50905060005b6120d4610100860186612a60565b90508110156121905760006120ed610100870187612a60565b838181106120fd576120fd6129ee565b905060200281019061210f9190612b22565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929350612153925086915083905061225b565b838381518110612165576121656129ee565b6001600160a01b0390921660209283029190910190910152508061218881612a04565b9150506120c6565b509392505050565b6121a2828261110d565b6121d15760405163e2517d3f60e01b81526001600160a01b038216600482015260248101839052604401610623565b5050565b60005460ff16611ce157604051638dfc202b60e01b815260040160405180910390fd5b600061220d6001600160a01b03841683612285565b905080516000141580156122325750808060200190518101906122309190612b69565b155b15610a2a57604051635274afe760e01b81526001600160a01b0384166004820152602401610623565b60008060008061226b868661229a565b92509250925061227b82826122e7565b5090949350505050565b6060612293838360006123a0565b9392505050565b600080600083516041036122d45760208401516040850151606086015160001a6122c68882858561243d565b9550955095505050506122e0565b50508151600091506002905b9250925092565b60008260038111156122fb576122fb61273b565b03612304575050565b60018260038111156123185761231861273b565b036123365760405163f645eedf60e01b815260040160405180910390fd5b600282600381111561234a5761234a61273b565b0361236b5760405163fce698f760e01b815260048101829052602401610623565b600382600381111561237f5761237f61273b565b036121d1576040516335e2f38360e21b815260048101829052602401610623565b6060814710156123c55760405163cd78605960e01b8152306004820152602401610623565b600080856001600160a01b031684866040516123e19190612b86565b60006040518083038185875af1925050503d806000811461241e576040519150601f19603f3d011682016040523d82523d6000602084013e612423565b606091505b509150915061243386838361250c565b9695505050505050565b600080807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08411156124785750600091506003905082612502565b604080516000808252602082018084528a905260ff891692820192909252606081018790526080810186905260019060a0016020604051602081039080840390855afa1580156124cc573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b0381166124f857506000925060019150829050612502565b9250600091508190505b9450945094915050565b6060826125215761251c82612568565b612293565b815115801561253857506001600160a01b0384163b155b1561256157604051639996b31560e01b81526001600160a01b0385166004820152602401610623565b5080612293565b8051156125785780518082602001fd5b604051630a12f52160e11b815260040160405180910390fd5b6000602082840312156125a357600080fd5b81356001600160e01b03198116811461229357600080fd5b600061010082840312156125ce57600080fd5b50919050565b6000602082840312156125e657600080fd5b5035919050565b80356001600160a01b038116811461260457600080fd5b919050565b60008060006060848603121561261e57600080fd5b612627846125ed565b92506020840135915061263c604085016125ed565b90509250925092565b6000806040838503121561265857600080fd5b82359150612668602084016125ed565b90509250929050565b8015158114610bdd57600080fd5b60008060006060848603121561269457600080fd5b61269d846125ed565b92506020840135915060408401356126b481612671565b809150509250925092565b600080604083850312156126d257600080fd5b6126db836125ed565b946020939093013593505050565b6000602082840312156126fb57600080fd5b612293826125ed565b6000806040838503121561271757600080fd5b612720836125ed565b9150602083013561273081612671565b809150509250929050565b634e487b7160e01b600052602160045260246000fd5b88815261010081016002891061277757634e487b7160e01b600052602160045260246000fd5b60208201989098526001600160a01b039687166040820152606081019590955292909416608084015260a083015291151560c082015290151560e090910152919050565b6000806000606084860312156127d057600080fd5b833592506127e0602085016125ed565b9150604084013590509250925092565b60006020828403121561280257600080fd5b813567ffffffffffffffff81111561281957600080fd5b8201610120818503121561229357600080fd5b6bffffffffffffffffffffffff19606097881b8116825295871b8616601482015260288101949094529190941b9092166048820152605c810192909252607c820152609c0190565b602080825260119082015270125b9d985b1a5908189c9a5919d9481a59607a1b604082015260600190565b634e487b7160e01b600052601160045260246000fd5b6000826128d257634e487b7160e01b600052601260045260246000fd5b500490565b80820281158282048414176105845761058461289f565b60006020828403121561290057600080fd5b5051919050565b634e487b7160e01b600052604160045260246000fd5b60005b83811015612938578181015183820152602001612920565b50506000910152565b60006020828403121561295357600080fd5b815167ffffffffffffffff8082111561296b57600080fd5b818401915084601f83011261297f57600080fd5b81518181111561299157612991612907565b604051601f8201601f19908116603f011681019083821181831017156129b9576129b9612907565b816040528281528760208487010111156129d257600080fd5b6129e383602083016020880161291d565b979650505050505050565b634e487b7160e01b600052603260045260246000fd5b600060018201612a1657612a1661289f565b5060010190565b602080825260169082015275151bdad95b881a5cc81b9bdd081cdd5c1c1bdc9d195960521b604082015260600190565b808201808211156105845761058461289f565b6000808335601e19843603018112612a7757600080fd5b83018035915067ffffffffffffffff821115612a9257600080fd5b6020019150600581901b3603821315612aaa57600080fd5b9250929050565b600060a08201878352602060018060a01b0380891682860152808816604086015286606086015260a0608086015282865180855260c087019150838801945060005b81811015612b11578551841683529484019491840191600101612af3565b50909b9a5050505050505050505050565b6000808335601e19843603018112612b3957600080fd5b83018035915067ffffffffffffffff821115612b5457600080fd5b602001915036819003821315612aaa57600080fd5b600060208284031215612b7b57600080fd5b815161229381612671565b60008251612b9881846020870161291d565b919091019291505056fe7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f55a26469706673582212203760a831d6179e39d805216571811e3fa3e73b679195d643cac4e4262a7a5c1964736f6c6343000814003300000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000100000000000000000000000000160ac9cf35903960ed493264b16ca6dc3e308f8c00000000000000000000000004b4349f7dacc02404f1634af0a313c87c0a7784000000000000000000000000000000000000000000000000002386f26fc1000000000000000000000000000000000000000000000000152d02c7e14af6800000000000000000000000000000000000000000000000000000000000000000000744427269646765000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003312e300000000000000000000000000000000000000000000000000000000000
Deployed Bytecode
0x6080604052600436106101665760003560e01c80638456cb59116100d1578063aa69acdc1161008a578063ccc5749011610064578063ccc57490146104ca578063d547741f146104ec578063dfe86ac51461050c578063fd08f3f31461054057600080fd5b8063aa69acdc1461040a578063bc157ac11461048a578063c9bbd1fe146104aa57600080fd5b80638456cb59146103595780638e19899e1461036e57806391d1485414610381578063926d7d7f146103a15780639e67cfbe146103d5578063a217fddf146103f557600080fd5b806338c1a65e1161012357806338c1a65e146102545780633f4ba83a14610274578063519cc34f146102895780635c975abb146102c157806368c4ac26146102d9578063760098151461033957600080fd5b806301ffc9a71461016b5780630890add4146101a0578063248a9ca3146101b55780632701a334146101f45780632f2ff15d1461021457806336568abe14610234575b600080fd5b34801561017757600080fd5b5061018b610186366004612591565b610553565b60405190151581526020015b60405180910390f35b6101b36101ae3660046125bb565b61058a565b005b3480156101c157600080fd5b506101e66101d03660046125d4565b6000908152600160208190526040909120015490565b604051908152602001610197565b34801561020057600080fd5b506101b361020f366004612609565b61096f565b34801561022057600080fd5b506101b361022f366004612645565b6109cb565b34801561024057600080fd5b506101b361024f366004612645565b6109f7565b34801561026057600080fd5b506101b361026f36600461267f565b610a2f565b34801561028057600080fd5b506101b3610bca565b34801561029557600080fd5b506102a96102a43660046126bf565b610be0565b6040516001600160a01b039091168152602001610197565b3480156102cd57600080fd5b5060005460ff1661018b565b3480156102e557600080fd5b5061031c6102f43660046126e9565b6006602052600090815260409020600181015460029091015460ff8082169161010090041683565b604080519384529115156020840152151590820152606001610197565b34801561034557600080fd5b506101b3610354366004612704565b610c13565b34801561036557600080fd5b506101b3610c62565b6101b361037c3660046125d4565b610c75565b34801561038d57600080fd5b5061018b61039c366004612645565b61110d565b3480156103ad57600080fd5b506101e67fe2b7fb3b832174769106daebcfd6d1970523240dda11281102db9363b83b0dc481565b3480156103e157600080fd5b506101b36103f03660046126bf565b611138565b34801561040157600080fd5b506101e6600081565b34801561041657600080fd5b506104766104253660046125d4565b600760205260009081526040902080546001820154600283015460038401546004850154600590950154939460ff808516956001600160a01b03610100968790048116969416938183169291041688565b604051610197989796959493929190612751565b34801561049657600080fd5b506101e66104a53660046127bb565b6111ab565b3480156104b657600080fd5b506101b36104c53660046127f0565b6114c0565b3480156104d657600080fd5b506101e6600080516020612ba383398151915281565b3480156104f857600080fd5b506101b3610507366004612645565b6118db565b34801561051857600080fd5b506101e67fef2dfa72dd8590c7d331f8c9b73a02f2d71dbb91d4e65207c55804afa24f515281565b6101b361054e3660046125bb565b611901565b60006001600160e01b03198216637965db0b60e01b148061058457506301ffc9a760e01b6001600160e01b03198316145b92915050565b610592611cbd565b60006105a460608301604084016126e9565b6105b460c0840160a085016126e9565b60608401356105c960e0860160c087016126e9565b8560e0013586602001356040516020016105e89695949392919061282c565b6040516020818303038152906040528051906020012090508082600001351461062c5760405162461bcd60e51b815260040161062390612874565b60405180910390fd5b3361063d60608401604085016126e9565b6001600160a01b03160361068a5760405162461bcd60e51b815260206004820152601460248201527321b0b73737ba103b37ba32903337b91039b2b63360611b6044820152606401610623565b81356000908152600760205260409020600181015461010090046001600160a01b03166106f05760405162461bcd60e51b8152602060048201526014602482015273109c9a5919d948191bd95cdb89dd08195e1a5cdd60621b6044820152606401610623565b600581015460ff16156107405760405162461bcd60e51b8152602060048201526018602482015277213934b233b29030b63932b0b23c903bb4ba34323930bbb760411b6044820152606401610623565b60018181015460ff16818111156107595761075961273b565b1461079e5760405162461bcd60e51b81526020600482015260156024820152744e6f742061207769746864726177616c207479706560581b6044820152606401610623565b805460208401351480156107d657506107bd60608401604085016126e9565b600182015461010090046001600160a01b039081169116145b80156107e9575082608001358160020154145b8015610814575061080060e0840160c085016126e9565b60038201546001600160a01b039081169116145b801561082757508260e001358160040154145b6108735760405162461bcd60e51b815260206004820152601860248201527f4461746120766572696669636174696f6e206661696c656400000000000000006044820152606401610623565b60006004543461088391906128b5565b9050600081116108c85760405162461bcd60e51b815260206004820152601060248201526f496e73756666696369656e742066656560801b6044820152606401610623565b6040516001600160a01b037f000000000000000000000000160ac9cf35903960ed493264b16ca6dc3e308f8c16903480156108fc02916000818181858888f1935050505015801561091d573d6000803e3d6000fd5b50600682018054600181018255600091825260209091200180546001600160a01b0319163317905560055461095290826128d7565b336000908152600793909301602052604090922091909155505050565b600080516020612ba383398151915261098781611ce3565b61098f611cbd565b506001600160a01b0392831660009081526006602090815260408083209483529390529190912080546001600160a01b03191691909216179055565b600082815260016020819052604090912001546109e781611ce3565b6109f18383611ced565b50505050565b6001600160a01b0381163314610a205760405163334bd91960e11b815260040160405180910390fd5b610a2a8282611d66565b505050565b600080516020612ba3833981519152610a4781611ce3565b610a4f611cbd565b836001600160a01b03166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa925050508015610aa9575060408051601f3d908101601f19168201909252610aa6918101906128ee565b60015b610ae95760405162461bcd60e51b815260206004820152601160248201527020b2323932b9b9903737ba103a37b5b2b760791b6044820152606401610623565b846001600160a01b03166306fdde036040518163ffffffff1660e01b8152600401600060405180830381865afa925050508015610b4857506040513d6000823e601f3d908101601f19168201604052610b459190810190612941565b60015b610b885760405162461bcd60e51b815260206004820152601160248201527020b2323932b9b9903737ba103a37b5b2b760791b6044820152606401610623565b506001600160a01b038516600090815260066020526040902060028101805460019283018790558515156101000261ffff199091161790911790555050505050565b6000610bd581611ce3565b610bdd611dd3565b50565b6000610bea611cbd565b506001600160a01b03918216600090815260066020908152604080832093835292905220541690565b600080516020612ba3833981519152610c2b81611ce3565b610c33611cbd565b506001600160a01b03919091166000908152600660205260409020600201805460ff1916911515919091179055565b6000610c6d81611ce3565b610bdd611e25565b610c7d611cbd565b6000818152600760205260409020600181015461010090046001600160a01b0316610ce15760405162461bcd60e51b8152602060048201526014602482015273109c9a5919d948191bd95cdb89dd08195e1a5cdd60621b6044820152606401610623565b600581015460ff1615610d315760405162461bcd60e51b8152602060048201526018602482015277213934b233b29030b63932b0b23c903bb4ba34323930bbb760411b6044820152606401610623565b60018181015460ff1681811115610d4a57610d4a61273b565b14610d8f5760405162461bcd60e51b81526020600482015260156024820152744e6f742061207769746864726177616c207479706560581b6044820152606401610623565b6005810154610100900460ff16610dde5760405162461bcd60e51b8152602060048201526013602482015272109c9a5919d9481b9bdd081d995c9a599a5959606a1b6044820152606401610623565b60038101546001600160a01b03166000908152600660205260409020600101543414610e3f5760405162461bcd60e51b815260206004820152601060248201526f4e6f7420506c6174666f726d2066656560801b6044820152606401610623565b60038101546001600160a01b031660009081526006602052604090206001015415610ebb576040516001600160a01b037f000000000000000000000000160ac9cf35903960ed493264b16ca6dc3e308f8c16903480156108fc02916000818181858888f19350505050158015610eb9573d6000803e3d6000fd5b505b60058101805460ff1916600117905560038101546001600160a01b0316600090815260066020526040902060020154610100900460ff1615610f7357600381015460018201546004808401546040516340c10f1960e01b81526001600160a01b0361010090940484169281019290925260248201529116906340c10f1990604401600060405180830381600087803b158015610f5657600080fd5b505af1158015610f6a573d6000803e3d6000fd5b50505050610fa1565b600181015460048201546003830154610fa1926001600160a01b039182169261010090910490911690611e62565b60005b60068201548110156110a9576003546006830180546001600160a01b03909216916340c10f19919084908110610fdc57610fdc6129ee565b9060005260206000200160009054906101000a90046001600160a01b0316846007016000866006018681548110611015576110156129ee565b6000918252602080832091909101546001600160a01b039081168452908301939093526040918201902054905160e085901b6001600160e01b03191681529290911660048301526024820152604401600060405180830381600087803b15801561107e57600080fd5b505af1158015611092573d6000803e3d6000fd5b5050505080806110a190612a04565b915050610fa4565b50600181015460038201546004830154604080516001600160a01b03938416815260208101929092526101009093049091169184917fcd6ac346191b4b7531743e58f243dd4d350a52a9186641c1e5eac22b95aaedbe910160405180910390a35050565b60009182526001602090815260408084206001600160a01b0393909316845291905290205460ff1690565b600080516020612ba383398151915261115081611ce3565b6001600160a01b03831660009081526006602052604090206002015460ff1661118b5760405162461bcd60e51b815260040161062390612a1d565b506001600160a01b03909116600090815260066020526040902060010155565b60006111b5611cbd565b6001600160a01b03831660009081526006602052604090206002015460ff166111f05760405162461bcd60e51b815260040161062390612a1d565b6001600160a01b038381166000908152600660209081526040808320888452909152902054166112625760405162461bcd60e51b815260206004820152601960248201527f436861696e204944206973206e6f7420737570706f72746564000000000000006044820152606401610623565b6001600260008282546112759190612a4d565b90915550506001600160a01b0383811660009081526006602090815260408083208884528252918290205460025492516112bb94339430948b949092169289920161282c565b60408051601f1981840301815291815281516020928301206000818152600790935291206001015490915061010090046001600160a01b0316156113395760405162461bcd60e51b815260206004820152601560248201527442726964676520616c72656164792065786973747360581b6044820152606401610623565b6001600160a01b038316600090815260066020526040902060020154610100900460ff16156113d7576001600160a01b0383166379cc6790336040516001600160e01b031960e084901b1681526001600160a01b03909116600482015260248101859052604401600060405180830381600087803b1580156113ba57600080fd5b505af11580156113ce573d6000803e3d6000fd5b505050506113ec565b6113ec6001600160a01b038416333085611ec1565b60008181526007602090815260408083206001810180546001600160a81b0319163361010081029190911790915560028083018a90556003830180546001600160a01b0319166001600160a01b038b8116918217909255600485018a905560058501805461ffff191690559154918752600686528487208b88528652958490205484519283529482018a90529390941684830152606084018690529051909284917fd0c25ea866ba50b243f16b469e48cd4aec5bc45138d68bb1dc64eec170a03cdc916080908290030190a3509392505050565b6114c8611cbd565b6114f27fe2b7fb3b832174769106daebcfd6d1970523240dda11281102db9363b83b0dc43361110d565b61152e5760405162461bcd60e51b815260206004820152600d60248201526c2737ba1030903932b630bcb2b960991b6044820152606401610623565b803560009081526007602052604090206005810154610100900460ff16156115985760405162461bcd60e51b815260206004820152601760248201527f42726964676520616c72656164792076657269666965640000000000000000006044820152606401610623565b60006115aa60608401604085016126e9565b6115ba60c0850160a086016126e9565b466115cb60e0870160c088016126e9565b8660e0013587602001356040516020016115ea9695949392919061282c565b604051602081830303815290604052805190602001209050808360000135146116255760405162461bcd60e51b815260040161062390612874565b6003611635610100850185612a60565b905010156116855760405162461bcd60e51b815260206004820181905260248201527f73686f756c6420686176652033206f72206d6f7265207369676e6174757265736044820152606401610623565b600061169084611efa565b905060005b8151811015611738576116e17fe2b7fb3b832174769106daebcfd6d1970523240dda11281102db9363b83b0dc48383815181106116d4576116d46129ee565b602002602001015161110d565b6117265760405162461bcd60e51b8152602060048201526016602482015275556e617574686f72697a6564207369676e617475726560501b6044820152606401610623565b8061173081612a04565b915050611695565b50600183015461010090046001600160a01b03166117f757602084013583556001808401805460ff1916909117905561177760608501604086016126e9565b6001840180546001600160a01b039290921661010002610100600160a81b0319909216919091179055608084013560028401556117ba60e0850160c086016126e9565b6003840180546001600160a01b0319166001600160a01b039290921691909117905560e0840135600484015560058301805460ff1916905561185d565b60018381015460ff16818111156118105761181061273b565b1461185d5760405162461bcd60e51b815260206004820152601c60248201527f4e6f742061207769746864726177616c207472616e73616374696f6e000000006044820152606401610623565b60058301805461ff00191661010017905583357ff3c4725ca128aceaa65ff2945d9e99606bec738fcefd0f8484cbce81983cad5160808601356118a660608801604089016126e9565b6118b660e0890160c08a016126e9565b8860e00135866040516118cd959493929190612ab1565b60405180910390a250505050565b600082815260016020819052604090912001546118f781611ce3565b6109f18383611d66565b611909611cbd565b6006600061191d60e0840160c085016126e9565b6001600160a01b0316815260208101919091526040016000206002015460ff166119595760405162461bcd60e51b815260040161062390612a1d565b600061196b60608301604084016126e9565b61197b60c0840160a085016126e9565b4661198c60e0860160c087016126e9565b8560e0013586602001356040516020016119ab9695949392919061282c565b604051602081830303815290604052805190602001209050808260000135146119e65760405162461bcd60e51b815260040161062390612874565b336119f760608401604085016126e9565b6001600160a01b031603611a445760405162461bcd60e51b815260206004820152601460248201527321b0b73737ba103b37ba32903337b91039b2b63360611b6044820152606401610623565b81356000908152600760205260409020600181015461010090046001600160a01b031615611aac5760405162461bcd60e51b815260206004820152601560248201527442726964676520616c72656164792065786973747360581b6044820152606401610623565b600060045434611abc91906128b5565b905060008111611b015760405162461bcd60e51b815260206004820152601060248201526f496e73756666696369656e742066656560801b6044820152606401610623565b6040516001600160a01b037f000000000000000000000000160ac9cf35903960ed493264b16ca6dc3e308f8c16903480156108fc02916000818181858888f19350505050158015611b56573d6000803e3d6000fd5b50602084013582556001808301805460ff19169091179055611b7e60608501604086016126e9565b6001830180546001600160a01b039290921661010002610100600160a81b031990921691909117905560808401356002830155611bc160e0850160c086016126e9565b6003830180546001600160a01b03929092166001600160a01b031992831617905560e085013560048401556005808401805461ffff1916905560068401805460018101825560009182526020909120018054909216331790915554611c2690826128d7565b33600090815260078401602052604090819020919091558435907fc4b32bae10164ad1302d9de2f96f8e2eb9137954a60bc490dbf3034f7d42b92190608087013590611c7890606089019089016126e9565b611c8860e0890160c08a016126e9565b604080519384526001600160a01b03928316602085015291169082015260e0870135606082015233608082015260a0016118cd565b60005460ff1615611ce15760405163d93c066560e01b815260040160405180910390fd5b565b610bdd8133612198565b6000611cf9838361110d565b611d5e5760008381526001602081815260408084206001600160a01b0387168086529252808420805460ff19169093179092559051339286917f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d9190a4506001610584565b506000610584565b6000611d72838361110d565b15611d5e5760008381526001602090815260408083206001600160a01b0386168085529252808320805460ff1916905551339286917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a4506001610584565b611ddb6121d5565b6000805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b611e2d611cbd565b6000805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258611e083390565b6040516001600160a01b03838116602483015260448201839052610a2a91859182169063a9059cbb906064015b604051602081830303815290604052915060e01b6020820180516001600160e01b0383818316178352505050506121f8565b6040516001600160a01b0384811660248301528381166044830152606482018390526109f19186918216906323b872dd90608401611e8f565b606060007fef2dfa72dd8590c7d331f8c9b73a02f2d71dbb91d4e65207c55804afa24f5152604051602001611f9e907f427269646765546f6b656e28627974657333322062726964676549642c61646481527f726573732073656e6465722c75696e7432353620636861696e49642c6164647260208201527f65737320746f6b656e416464726573732c75696e7432353620616d6f756e7429604082015260600190565b604051602081830303815290604052805190602001208460000135856040016020810190611fcc91906126e9565b46611fdd60e0890160c08a016126e9565b6040805160208101969096528501939093526001600160a01b03918216606085015260808401521660a082015260e08086013560c0830152016040516020818303038152906040528051906020012060405160200161205392919061190160f01b81526002810192909252602282015260420190565b60408051601f1981840301815291905280516020909101209050600061207d610100850185612a60565b905067ffffffffffffffff81111561209757612097612907565b6040519080825280602002602001820160405280156120c0578160200160208202803683370190505b50905060005b6120d4610100860186612a60565b90508110156121905760006120ed610100870187612a60565b838181106120fd576120fd6129ee565b905060200281019061210f9190612b22565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929350612153925086915083905061225b565b838381518110612165576121656129ee565b6001600160a01b0390921660209283029190910190910152508061218881612a04565b9150506120c6565b509392505050565b6121a2828261110d565b6121d15760405163e2517d3f60e01b81526001600160a01b038216600482015260248101839052604401610623565b5050565b60005460ff16611ce157604051638dfc202b60e01b815260040160405180910390fd5b600061220d6001600160a01b03841683612285565b905080516000141580156122325750808060200190518101906122309190612b69565b155b15610a2a57604051635274afe760e01b81526001600160a01b0384166004820152602401610623565b60008060008061226b868661229a565b92509250925061227b82826122e7565b5090949350505050565b6060612293838360006123a0565b9392505050565b600080600083516041036122d45760208401516040850151606086015160001a6122c68882858561243d565b9550955095505050506122e0565b50508151600091506002905b9250925092565b60008260038111156122fb576122fb61273b565b03612304575050565b60018260038111156123185761231861273b565b036123365760405163f645eedf60e01b815260040160405180910390fd5b600282600381111561234a5761234a61273b565b0361236b5760405163fce698f760e01b815260048101829052602401610623565b600382600381111561237f5761237f61273b565b036121d1576040516335e2f38360e21b815260048101829052602401610623565b6060814710156123c55760405163cd78605960e01b8152306004820152602401610623565b600080856001600160a01b031684866040516123e19190612b86565b60006040518083038185875af1925050503d806000811461241e576040519150601f19603f3d011682016040523d82523d6000602084013e612423565b606091505b509150915061243386838361250c565b9695505050505050565b600080807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08411156124785750600091506003905082612502565b604080516000808252602082018084528a905260ff891692820192909252606081018790526080810186905260019060a0016020604051602081039080840390855afa1580156124cc573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b0381166124f857506000925060019150829050612502565b9250600091508190505b9450945094915050565b6060826125215761251c82612568565b612293565b815115801561253857506001600160a01b0384163b155b1561256157604051639996b31560e01b81526001600160a01b0385166004820152602401610623565b5080612293565b8051156125785780518082602001fd5b604051630a12f52160e11b815260040160405180910390fd5b6000602082840312156125a357600080fd5b81356001600160e01b03198116811461229357600080fd5b600061010082840312156125ce57600080fd5b50919050565b6000602082840312156125e657600080fd5b5035919050565b80356001600160a01b038116811461260457600080fd5b919050565b60008060006060848603121561261e57600080fd5b612627846125ed565b92506020840135915061263c604085016125ed565b90509250925092565b6000806040838503121561265857600080fd5b82359150612668602084016125ed565b90509250929050565b8015158114610bdd57600080fd5b60008060006060848603121561269457600080fd5b61269d846125ed565b92506020840135915060408401356126b481612671565b809150509250925092565b600080604083850312156126d257600080fd5b6126db836125ed565b946020939093013593505050565b6000602082840312156126fb57600080fd5b612293826125ed565b6000806040838503121561271757600080fd5b612720836125ed565b9150602083013561273081612671565b809150509250929050565b634e487b7160e01b600052602160045260246000fd5b88815261010081016002891061277757634e487b7160e01b600052602160045260246000fd5b60208201989098526001600160a01b039687166040820152606081019590955292909416608084015260a083015291151560c082015290151560e090910152919050565b6000806000606084860312156127d057600080fd5b833592506127e0602085016125ed565b9150604084013590509250925092565b60006020828403121561280257600080fd5b813567ffffffffffffffff81111561281957600080fd5b8201610120818503121561229357600080fd5b6bffffffffffffffffffffffff19606097881b8116825295871b8616601482015260288101949094529190941b9092166048820152605c810192909252607c820152609c0190565b602080825260119082015270125b9d985b1a5908189c9a5919d9481a59607a1b604082015260600190565b634e487b7160e01b600052601160045260246000fd5b6000826128d257634e487b7160e01b600052601260045260246000fd5b500490565b80820281158282048414176105845761058461289f565b60006020828403121561290057600080fd5b5051919050565b634e487b7160e01b600052604160045260246000fd5b60005b83811015612938578181015183820152602001612920565b50506000910152565b60006020828403121561295357600080fd5b815167ffffffffffffffff8082111561296b57600080fd5b818401915084601f83011261297f57600080fd5b81518181111561299157612991612907565b604051601f8201601f19908116603f011681019083821181831017156129b9576129b9612907565b816040528281528760208487010111156129d257600080fd5b6129e383602083016020880161291d565b979650505050505050565b634e487b7160e01b600052603260045260246000fd5b600060018201612a1657612a1661289f565b5060010190565b602080825260169082015275151bdad95b881a5cc81b9bdd081cdd5c1c1bdc9d195960521b604082015260600190565b808201808211156105845761058461289f565b6000808335601e19843603018112612a7757600080fd5b83018035915067ffffffffffffffff821115612a9257600080fd5b6020019150600581901b3603821315612aaa57600080fd5b9250929050565b600060a08201878352602060018060a01b0380891682860152808816604086015286606086015260a0608086015282865180855260c087019150838801945060005b81811015612b11578551841683529484019491840191600101612af3565b50909b9a5050505050505050505050565b6000808335601e19843603018112612b3957600080fd5b83018035915067ffffffffffffffff821115612b5457600080fd5b602001915036819003821315612aaa57600080fd5b600060208284031215612b7b57600080fd5b815161229381612671565b60008251612b9881846020870161291d565b919091019291505056fe7935bd0ae54bc31f548c14dba4d37c5c64b3f8ca900cb468fb8abd54d5894f55a26469706673582212203760a831d6179e39d805216571811e3fa3e73b679195d643cac4e4262a7a5c1964736f6c63430008140033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
00000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000100000000000000000000000000160ac9cf35903960ed493264b16ca6dc3e308f8c00000000000000000000000004b4349f7dacc02404f1634af0a313c87c0a7784000000000000000000000000000000000000000000000000002386f26fc1000000000000000000000000000000000000000000000000152d02c7e14af6800000000000000000000000000000000000000000000000000000000000000000000744427269646765000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003312e300000000000000000000000000000000000000000000000000000000000
-----Decoded View---------------
Arg [0] : name (string): DBridge
Arg [1] : version (string): 1.0
Arg [2] : exchangePoolAddress (address): 0x160AC9CF35903960Ed493264B16Ca6Dc3e308F8c
Arg [3] : rewarTokenAddress (address): 0x04B4349f7DaCC02404f1634Af0a313c87c0a7784
Arg [4] : _baseVoteFee (uint256): 10000000000000000
Arg [5] : _rewardFee (uint256): 100000000000000000000000
-----Encoded View---------------
10 Constructor Arguments found :
Arg [0] : 00000000000000000000000000000000000000000000000000000000000000c0
Arg [1] : 0000000000000000000000000000000000000000000000000000000000000100
Arg [2] : 000000000000000000000000160ac9cf35903960ed493264b16ca6dc3e308f8c
Arg [3] : 00000000000000000000000004b4349f7dacc02404f1634af0a313c87c0a7784
Arg [4] : 000000000000000000000000000000000000000000000000002386f26fc10000
Arg [5] : 00000000000000000000000000000000000000000000152d02c7e14af6800000
Arg [6] : 0000000000000000000000000000000000000000000000000000000000000007
Arg [7] : 4442726964676500000000000000000000000000000000000000000000000000
Arg [8] : 0000000000000000000000000000000000000000000000000000000000000003
Arg [9] : 312e300000000000000000000000000000000000000000000000000000000000
Loading...
Loading
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.