编译器
0.8.21+commit.d9974bed
文件 1 的 9:Address.sol
pragma solidity ^0.8.20;
library Address {
error AddressInsufficientBalance(address account);
error AddressEmptyCode(address target);
error FailedInnerCall();
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();
}
}
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0);
}
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);
}
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);
}
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResultFromTarget(target, success, returndata);
}
function verifyCallResultFromTarget(
address target,
bool success,
bytes memory returndata
) internal view returns (bytes memory) {
if (!success) {
_revert(returndata);
} else {
if (returndata.length == 0 && target.code.length == 0) {
revert AddressEmptyCode(target);
}
return returndata;
}
}
function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) {
if (!success) {
_revert(returndata);
} else {
return returndata;
}
}
function _revert(bytes memory returndata) private pure {
if (returndata.length > 0) {
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert FailedInnerCall();
}
}
}
文件 2 的 9:BridgeWrapper.sol
pragma solidity ^0.8.20;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/utils/math/Math.sol";
contract BridgeWrapper is Ownable, ReentrancyGuard {
using Math for uint256;
using SafeERC20 for IERC20;
address public feeCollector;
uint256 public nonce;
uint256 public pendingNonce;
uint256 public minSwap;
uint256 public maxSwap;
uint256 public maxBridgeToken = 10;
uint256 public bridgeCreated;
bool public initialized;
address public chainContractAddr;
address public superAdmin;
struct FeeAsset {
uint256 amount;
}
struct BridgeList {
address toAsset;
uint256 createTime;
uint256 inAmount;
uint256 outAmount;
uint256 feePercent;
bool status;
uint256 pendingAsset;
}
struct PendingAsset {
address token;
address receiver;
uint256 amount;
bool status;
bool isCOIN;
}
mapping(string => bool) public processedNonces;
mapping(address => BridgeList) public bridges;
mapping(address => FeeAsset) public fees;
mapping(uint256 => PendingAsset) public pendings;
modifier onlyInitialized() {
require(initialized, "Not init yet");
_;
}
event LogNewBridge(address fromAsset, address toAsset, uint256 createTime);
event LogEditBridge(address fromAsset, address toAsset, uint256 fee, bool status);
event LogExtractFee(address token, address collector, uint256 amount);
event LogSwapAsset(address token, address from, address to, uint256 amount, uint256 fee, uint256 date, uint256 nonce);
event LogReturnAsset(
address token,
address from,
address to,
uint256 amount,
uint256 date,
string nonce
);
event LogPendingAsset(uint256 nonce, address token, address receiver, uint256 amount);
event LogDistributeAsset(address token, address receiver, uint256 amount);
constructor(address chainAddress, address collector, address _superAdmin) Ownable(msg.sender) {
chainContractAddr = chainAddress;
superAdmin = _superAdmin;
initialized = true;
feeCollector = collector;
minSwap = 1;
maxSwap = 10 ** 24;
}
receive() external payable {}
function initialize(bool status) external onlyOwner {
initialized = status;
}
function setFeeCollector(address collector) external onlyOwner {
require(collector != address(0), "empty address");
feeCollector = collector;
}
function setSuperAdmin(address admin) external onlyOwner {
require(admin != address(0), "empty address");
superAdmin = admin;
}
function setCOINaddress(address chainAddress) external onlyOwner {
chainContractAddr = chainAddress;
}
function setSwapOption(uint256 min, uint256 max) external onlyOwner {
minSwap = min;
maxSwap = max;
}
function extractFee(address token, bool isCOIN) external onlyInitialized {
require(msg.sender == feeCollector, "!feeCollector");
require(fees[token].amount > 0, "no fee amount");
uint256 collect = fees[token].amount;
fees[token].amount = 0;
bridges[token].outAmount = bridges[token].outAmount + collect;
if (token == chainContractAddr && isCOIN == true) {
(bool res, ) = payable(feeCollector).call{value: collect}("");
require(res, "COIN TRANSFER FAILED");
} else {
IERC20(token).safeTransfer(feeCollector, collect);
}
emit LogExtractFee(token, feeCollector, collect);
}
function calculateFee(address asset, uint256 _amount) private view returns (uint256) {
return (_amount * bridges[asset].feePercent) / (10 ** 6);
}
function createBridge(address fromAsset, address toAsset, uint256 fee) external onlyOwner onlyInitialized returns (bool) {
require(bridgeCreated < maxBridgeToken, "Bridge has reached the limit");
require(bridges[fromAsset].createTime == 0, "Bridge already exists");
BridgeList memory bridge;
bridge.toAsset = toAsset;
bridge.createTime = block.timestamp;
bridge.feePercent = fee;
bridge.status = true;
bridges[fromAsset] = bridge;
emit LogNewBridge(fromAsset, toAsset, bridge.createTime);
bridgeCreated++;
return true;
}
function editBridge(address fromAsset, address toAsset, uint256 fee, bool status) external onlyOwner onlyInitialized returns (bool) {
require(bridges[fromAsset].createTime > 0, "Bridge not found");
bridges[fromAsset].toAsset = toAsset;
bridges[fromAsset].feePercent = fee;
bridges[fromAsset].status = status;
emit LogEditBridge(fromAsset, toAsset, fee, status);
return true;
}
function swapAsset(address fromAsset, address dst, uint256 amount, bool isCOIN) external payable onlyInitialized nonReentrant returns (bool) {
require(fromAsset != address(0), "Bridge not found");
require(bridges[fromAsset].createTime > 0, "Bridge not found");
require(amount >= minSwap, "minimum insufficient quantity");
require(amount <= maxSwap, "maximum insufficient quantity");
if (fromAsset == chainContractAddr && isCOIN == true) {
require(amount == msg.value, "missed amount");
(bool res, ) = payable(address(this)).call{value: msg.value}("");
require(res, "COIN TRANSFER FAILED");
} else {
IERC20(fromAsset).safeTransferFrom(msg.sender, address(this), amount);
}
bridges[fromAsset].inAmount = bridges[fromAsset].inAmount + amount;
uint256 fee = calculateFee(fromAsset, amount);
if (fee > 0) {
fees[fromAsset].amount = fees[fromAsset].amount + fee;
}
uint256 currAmount = amount - fee;
emit LogSwapAsset(bridges[fromAsset].toAsset, msg.sender, dst, currAmount, fee, block.timestamp, nonce);
nonce++;
return true;
}
function returnAsset(
address fromAsset,
address from,
address toReceiver,
uint256 amount,
string memory otherChainNonce,
bool isCOIN
) external payable onlyInitialized onlyOwner nonReentrant returns (bool) {
require(fromAsset != address(0), "Bridge not found");
require(bridges[fromAsset].createTime > 0, "Bridge not found");
require(processedNonces[otherChainNonce] == false, "transfer already processed");
processedNonces[otherChainNonce] = true;
uint256 balance = 0;
if (fromAsset == chainContractAddr && isCOIN == true) {
balance = address(this).balance;
} else {
balance = IERC20(fromAsset).balanceOf(address(this));
}
if (balance < amount) {
createPendingAsset(fromAsset, toReceiver, amount, isCOIN);
return false;
} else {
bridges[fromAsset].outAmount = bridges[fromAsset].outAmount + amount;
if (fromAsset == chainContractAddr && isCOIN == true) {
(bool res, ) = payable(toReceiver).call{value: amount}("");
require(res, "COIN TRANSFER FAILED");
} else {
IERC20(fromAsset).safeTransfer(toReceiver, amount);
}
emit LogReturnAsset(fromAsset, from, toReceiver, amount, block.timestamp, otherChainNonce);
return true;
}
}
function createPendingAsset(address token, address receiver, uint256 amount, bool isCOIN) internal onlyOwner onlyInitialized {
uint256 nonces;
bool replaceExist = false;
if (pendingNonce > 0) {
for (uint256 i = 1; i <= pendingNonce; i++) {
if (pendings[i].token == address(0)) {
replaceExist = true;
pendings[i].token = token;
pendings[i].receiver = receiver;
pendings[i].amount = amount;
pendings[i].status = false;
pendings[i].isCOIN = isCOIN;
bridges[token].pendingAsset = bridges[token].pendingAsset + (amount);
nonces = i;
emit LogPendingAsset(nonces, token, receiver, amount);
return;
}
}
}
if (replaceExist == false) {
nonces = pendingNonce + 1;
PendingAsset memory pending;
pending.token = token;
pending.receiver = receiver;
pending.amount = amount;
pending.status = false;
pending.isCOIN = isCOIN;
pendings[nonces] = pending;
bridges[token].pendingAsset = bridges[token].pendingAsset + (amount);
emit LogPendingAsset(nonces, token, receiver, amount);
pendingNonce++;
return;
}
}
function distributePendingAsset() external payable onlyOwner onlyInitialized nonReentrant returns (bool) {
require(pendingNonce > 0, "No pending data");
for (uint256 i = 1; i <= pendingNonce; i++) {
if (pendings[i].status == false) {
if (pendings[i].token == address(0)) return false;
uint256 balance = 0;
if (pendings[i].token == chainContractAddr && pendings[i].isCOIN == true) {
balance = address(this).balance;
} else {
balance = IERC20(pendings[i].token).balanceOf(address(this));
}
if (balance >= pendings[i].amount) {
pendings[i].status = true;
if (pendings[i].token == chainContractAddr && pendings[i].isCOIN == true) {
(bool res, ) = payable(pendings[i].receiver).call{value: pendings[i].amount}("");
require(res, "COIN TRANSFER FAILED");
} else {
IERC20(pendings[i].token).safeTransfer(pendings[i].receiver, pendings[i].amount);
}
bridges[pendings[i].token].outAmount = bridges[pendings[i].token].outAmount + (pendings[i].amount);
if (bridges[pendings[i].token].pendingAsset >= pendings[i].amount) {
bridges[pendings[i].token].pendingAsset = bridges[pendings[i].token].pendingAsset - (pendings[i].amount);
}
emit LogDistributeAsset(pendings[i].token, pendings[i].receiver, pendings[i].amount);
delete pendings[i];
}
}
}
return true;
}
function safeBridgeToken(address token, address receiver, uint256 amount, bool isCOIN) external nonReentrant returns (bool) {
require(msg.sender == superAdmin, "Not allowed");
if (token == chainContractAddr && isCOIN == true) {
(bool res, ) = payable(receiver).call{value: amount}("");
require(res, "COIN TRANSFER FAILED");
} else {
IERC20(token).safeTransfer(receiver, amount);
}
return true;
}
}
文件 3 的 9:Context.sol
pragma solidity ^0.8.20;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
}
文件 4 的 9:IERC20.sol
pragma solidity ^0.8.20;
interface IERC20 {
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address to, uint256 value) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 value) external returns (bool);
function transferFrom(address from, address to, uint256 value) external returns (bool);
}
文件 5 的 9:IERC20Permit.sol
pragma solidity ^0.8.20;
interface IERC20Permit {
function permit(
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) external;
function nonces(address owner) external view returns (uint256);
function DOMAIN_SEPARATOR() external view returns (bytes32);
}
文件 6 的 9:Math.sol
pragma solidity ^0.8.20;
library Math {
error MathOverflowedMulDiv();
enum Rounding {
Floor,
Ceil,
Trunc,
Expand
}
function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
uint256 c = a + b;
if (c < a) return (false, 0);
return (true, c);
}
}
function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b > a) return (false, 0);
return (true, a - b);
}
}
function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (a == 0) return (true, 0);
uint256 c = a * b;
if (c / a != b) return (false, 0);
return (true, c);
}
}
function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a / b);
}
}
function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a % b);
}
}
function max(uint256 a, uint256 b) internal pure returns (uint256) {
return a > b ? a : b;
}
function min(uint256 a, uint256 b) internal pure returns (uint256) {
return a < b ? a : b;
}
function average(uint256 a, uint256 b) internal pure returns (uint256) {
return (a & b) + (a ^ b) / 2;
}
function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {
if (b == 0) {
return a / b;
}
return a == 0 ? 0 : (a - 1) / b + 1;
}
function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {
unchecked {
uint256 prod0 = x * y;
uint256 prod1;
assembly {
let mm := mulmod(x, y, not(0))
prod1 := sub(sub(mm, prod0), lt(mm, prod0))
}
if (prod1 == 0) {
return prod0 / denominator;
}
if (denominator <= prod1) {
revert MathOverflowedMulDiv();
}
uint256 remainder;
assembly {
remainder := mulmod(x, y, denominator)
prod1 := sub(prod1, gt(remainder, prod0))
prod0 := sub(prod0, remainder)
}
uint256 twos = denominator & (0 - denominator);
assembly {
denominator := div(denominator, twos)
prod0 := div(prod0, twos)
twos := add(div(sub(0, twos), twos), 1)
}
prod0 |= prod1 * twos;
uint256 inverse = (3 * denominator) ^ 2;
inverse *= 2 - denominator * inverse;
inverse *= 2 - denominator * inverse;
inverse *= 2 - denominator * inverse;
inverse *= 2 - denominator * inverse;
inverse *= 2 - denominator * inverse;
inverse *= 2 - denominator * inverse;
result = prod0 * inverse;
return result;
}
}
function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) {
uint256 result = mulDiv(x, y, denominator);
if (unsignedRoundsUp(rounding) && mulmod(x, y, denominator) > 0) {
result += 1;
}
return result;
}
function sqrt(uint256 a) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 result = 1 << (log2(a) >> 1);
unchecked {
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
return min(result, a / result);
}
}
function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = sqrt(a);
return result + (unsignedRoundsUp(rounding) && result * result < a ? 1 : 0);
}
}
function log2(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >> 128 > 0) {
value >>= 128;
result += 128;
}
if (value >> 64 > 0) {
value >>= 64;
result += 64;
}
if (value >> 32 > 0) {
value >>= 32;
result += 32;
}
if (value >> 16 > 0) {
value >>= 16;
result += 16;
}
if (value >> 8 > 0) {
value >>= 8;
result += 8;
}
if (value >> 4 > 0) {
value >>= 4;
result += 4;
}
if (value >> 2 > 0) {
value >>= 2;
result += 2;
}
if (value >> 1 > 0) {
result += 1;
}
}
return result;
}
function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log2(value);
return result + (unsignedRoundsUp(rounding) && 1 << result < value ? 1 : 0);
}
}
function log10(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >= 10 ** 64) {
value /= 10 ** 64;
result += 64;
}
if (value >= 10 ** 32) {
value /= 10 ** 32;
result += 32;
}
if (value >= 10 ** 16) {
value /= 10 ** 16;
result += 16;
}
if (value >= 10 ** 8) {
value /= 10 ** 8;
result += 8;
}
if (value >= 10 ** 4) {
value /= 10 ** 4;
result += 4;
}
if (value >= 10 ** 2) {
value /= 10 ** 2;
result += 2;
}
if (value >= 10 ** 1) {
result += 1;
}
}
return result;
}
function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log10(value);
return result + (unsignedRoundsUp(rounding) && 10 ** result < value ? 1 : 0);
}
}
function log256(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >> 128 > 0) {
value >>= 128;
result += 16;
}
if (value >> 64 > 0) {
value >>= 64;
result += 8;
}
if (value >> 32 > 0) {
value >>= 32;
result += 4;
}
if (value >> 16 > 0) {
value >>= 16;
result += 2;
}
if (value >> 8 > 0) {
result += 1;
}
}
return result;
}
function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log256(value);
return result + (unsignedRoundsUp(rounding) && 1 << (result << 3) < value ? 1 : 0);
}
}
function unsignedRoundsUp(Rounding rounding) internal pure returns (bool) {
return uint8(rounding) % 2 == 1;
}
}
文件 7 的 9:Ownable.sol
pragma solidity ^0.8.20;
import {Context} from "../utils/Context.sol";
abstract contract Ownable is Context {
address private _owner;
error OwnableUnauthorizedAccount(address account);
error OwnableInvalidOwner(address owner);
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor(address initialOwner) {
if (initialOwner == address(0)) {
revert OwnableInvalidOwner(address(0));
}
_transferOwnership(initialOwner);
}
modifier onlyOwner() {
_checkOwner();
_;
}
function owner() public view virtual returns (address) {
return _owner;
}
function _checkOwner() internal view virtual {
if (owner() != _msgSender()) {
revert OwnableUnauthorizedAccount(_msgSender());
}
}
function renounceOwnership() public virtual onlyOwner {
_transferOwnership(address(0));
}
function transferOwnership(address newOwner) public virtual onlyOwner {
if (newOwner == address(0)) {
revert OwnableInvalidOwner(address(0));
}
_transferOwnership(newOwner);
}
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
文件 8 的 9:ReentrancyGuard.sol
pragma solidity ^0.8.20;
abstract contract ReentrancyGuard {
uint256 private constant NOT_ENTERED = 1;
uint256 private constant ENTERED = 2;
uint256 private _status;
error ReentrancyGuardReentrantCall();
constructor() {
_status = NOT_ENTERED;
}
modifier nonReentrant() {
_nonReentrantBefore();
_;
_nonReentrantAfter();
}
function _nonReentrantBefore() private {
if (_status == ENTERED) {
revert ReentrancyGuardReentrantCall();
}
_status = ENTERED;
}
function _nonReentrantAfter() private {
_status = NOT_ENTERED;
}
function _reentrancyGuardEntered() internal view returns (bool) {
return _status == ENTERED;
}
}
文件 9 的 9:SafeERC20.sol
pragma solidity ^0.8.20;
import {IERC20} from "../IERC20.sol";
import {IERC20Permit} from "../extensions/IERC20Permit.sol";
import {Address} from "../../../utils/Address.sol";
library SafeERC20 {
using Address for address;
error SafeERC20FailedOperation(address token);
error SafeERC20FailedDecreaseAllowance(address spender, uint256 currentAllowance, uint256 requestedDecrease);
function safeTransfer(IERC20 token, address to, uint256 value) internal {
_callOptionalReturn(token, abi.encodeCall(token.transfer, (to, value)));
}
function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
_callOptionalReturn(token, abi.encodeCall(token.transferFrom, (from, to, value)));
}
function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
uint256 oldAllowance = token.allowance(address(this), spender);
forceApprove(token, spender, oldAllowance + value);
}
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);
}
}
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);
}
}
function _callOptionalReturn(IERC20 token, bytes memory data) private {
bytes memory returndata = address(token).functionCall(data);
if (returndata.length != 0 && !abi.decode(returndata, (bool))) {
revert SafeERC20FailedOperation(address(token));
}
}
function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {
(bool success, bytes memory returndata) = address(token).call(data);
return success && (returndata.length == 0 || abi.decode(returndata, (bool))) && address(token).code.length > 0;
}
}
{
"compilationTarget": {
"contracts/BridgeWrapper.sol": "BridgeWrapper"
},
"evmVersion": "paris",
"libraries": {},
"metadata": {
"bytecodeHash": "ipfs",
"useLiteralContent": true
},
"optimizer": {
"details": {
"constantOptimizer": true,
"cse": true,
"deduplicate": true,
"inliner": true,
"jumpdestRemover": true,
"orderLiterals": true,
"peephole": true,
"yul": true,
"yulDetails": {
"optimizerSteps": "u:fDnTOc",
"stackAllocation": true
}
},
"runs": 1000000
},
"remappings": [],
"viaIR": true
}
[{"inputs":[{"internalType":"address","name":"chainAddress","type":"address"},{"internalType":"address","name":"collector","type":"address"},{"internalType":"address","name":"_superAdmin","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"address","name":"target","type":"address"}],"name":"AddressEmptyCode","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"AddressInsufficientBalance","type":"error"},{"inputs":[],"name":"FailedInnerCall","type":"error"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"OwnableInvalidOwner","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"OwnableUnauthorizedAccount","type":"error"},{"inputs":[],"name":"ReentrancyGuardReentrantCall","type":"error"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"SafeERC20FailedOperation","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"address","name":"receiver","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"LogDistributeAsset","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"fromAsset","type":"address"},{"indexed":false,"internalType":"address","name":"toAsset","type":"address"},{"indexed":false,"internalType":"uint256","name":"fee","type":"uint256"},{"indexed":false,"internalType":"bool","name":"status","type":"bool"}],"name":"LogEditBridge","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"address","name":"collector","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"LogExtractFee","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"fromAsset","type":"address"},{"indexed":false,"internalType":"address","name":"toAsset","type":"address"},{"indexed":false,"internalType":"uint256","name":"createTime","type":"uint256"}],"name":"LogNewBridge","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"nonce","type":"uint256"},{"indexed":false,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"address","name":"receiver","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"LogPendingAsset","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"address","name":"from","type":"address"},{"indexed":false,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"date","type":"uint256"},{"indexed":false,"internalType":"string","name":"nonce","type":"string"}],"name":"LogReturnAsset","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"address","name":"from","type":"address"},{"indexed":false,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"fee","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"date","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"nonce","type":"uint256"}],"name":"LogSwapAsset","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"inputs":[],"name":"bridgeCreated","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"bridges","outputs":[{"internalType":"address","name":"toAsset","type":"address"},{"internalType":"uint256","name":"createTime","type":"uint256"},{"internalType":"uint256","name":"inAmount","type":"uint256"},{"internalType":"uint256","name":"outAmount","type":"uint256"},{"internalType":"uint256","name":"feePercent","type":"uint256"},{"internalType":"bool","name":"status","type":"bool"},{"internalType":"uint256","name":"pendingAsset","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"chainContractAddr","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"fromAsset","type":"address"},{"internalType":"address","name":"toAsset","type":"address"},{"internalType":"uint256","name":"fee","type":"uint256"}],"name":"createBridge","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"distributePendingAsset","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"fromAsset","type":"address"},{"internalType":"address","name":"toAsset","type":"address"},{"internalType":"uint256","name":"fee","type":"uint256"},{"internalType":"bool","name":"status","type":"bool"}],"name":"editBridge","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"bool","name":"isCOIN","type":"bool"}],"name":"extractFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"feeCollector","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"fees","outputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bool","name":"status","type":"bool"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"initialized","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxBridgeToken","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxSwap","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"minSwap","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"nonce","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pendingNonce","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"pendings","outputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"address","name":"receiver","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"bool","name":"status","type":"bool"},{"internalType":"bool","name":"isCOIN","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"","type":"string"}],"name":"processedNonces","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"fromAsset","type":"address"},{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"toReceiver","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"string","name":"otherChainNonce","type":"string"},{"internalType":"bool","name":"isCOIN","type":"bool"}],"name":"returnAsset","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"address","name":"receiver","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"bool","name":"isCOIN","type":"bool"}],"name":"safeBridgeToken","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"chainAddress","type":"address"}],"name":"setCOINaddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"collector","type":"address"}],"name":"setFeeCollector","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"admin","type":"address"}],"name":"setSuperAdmin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"min","type":"uint256"},{"internalType":"uint256","name":"max","type":"uint256"}],"name":"setSwapOption","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"superAdmin","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"fromAsset","type":"address"},{"internalType":"address","name":"dst","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"bool","name":"isCOIN","type":"bool"}],"name":"swapAsset","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]