Address Contract Verified
Address
0x379D5fDD6808CE6Fc7E1450F85c98c8312CC82ca
Balance
0.373153 ETH
Nonce
1
Code Size
8246 bytes
Creator
0x32152293...4a28 at tx 0x3e94cb8d...0750b7
Indexed Transactions
0
Contract Bytecode
8246 bytes
0x6080604052600436106101ac5760003560e01c80638da5cb5b116100ec578063c860ebc61161008a578063db8d55f111610064578063db8d55f11461046c578063f8228f7b146104f9578063fb93f0161461050f578063fc0c546a1461052f57600080fd5b8063c860ebc6146104a2578063d294f093146104cf578063db18ba7d146104e457600080fd5b8063a6f9dae1116100c6578063a6f9dae11461041c578063b187bd261461043c578063b69ef8a81461046c578063c763e5a11461048057600080fd5b80638da5cb5b146103475780639d1b9f5014610399578063a5d53104146103fc57600080fd5b8063419f75fe116101595780634cc3f6e8116101335780634cc3f6e8146102f2578063649c6c56146101d3578063750456911461031257806381d1f9dc1461033257600080fd5b8063419f75fe1461029257806342ae278c146102b257806347e7ef24146102d257600080fd5b8063202bdfc31161018a578063202bdfc3146102455780633b3438ce146102585780633e0353831461027c57600080fd5b806316c38b3c146101b157806318fdc2c8146101d3578063191622ff146101f3575b600080fd5b3480156101bd57600080fd5b506101d16101cc366004611c50565b61055c565b005b3480156101df57600080fd5b506101d16101ee366004611c6d565b610638565b3480156101ff57600080fd5b50600854600954600a546040805173ffffffffffffffffffffffffffffffffffffffff948516815292841660208401529216918101919091526060015b60405180910390f35b6101d1610253366004611c86565b6106ca565b34801561026457600080fd5b5061026e60055481565b60405190815260200161023c565b34801561028857600080fd5b5061026e60045481565b34801561029e57600080fd5b506101d16102ad366004611c6d565b610b10565b3480156102be57600080fd5b5061026e6102cd366004611d2b565b610ba2565b3480156102de57600080fd5b506101d16102ed366004611d6e565b610d1a565b3480156102fe57600080fd5b506101d161030d366004611d98565b61106b565b34801561031e57600080fd5b506101d161032d366004611d2b565b611224565b34801561033e57600080fd5b5061026e611315565b34801561035357600080fd5b506001546103749073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200161023c565b3480156103a557600080fd5b506103ec6103b4366004611d6e565b73ffffffffffffffffffffffffffffffffffffffff919091166000908152600760209081526040808320938352929052205460ff1690565b604051901515815260200161023c565b34801561040857600080fd5b506101d1610417366004611dcb565b61139e565b34801561042857600080fd5b506101d1610437366004611dcb565b6114d5565b34801561044857600080fd5b50600a5474010000000000000000000000000000000000000000900460ff166103ec565b34801561047857600080fd5b50303161026e565b34801561048c57600080fd5b5061049561160c565b60405161023c9190611e16565b3480156104ae57600080fd5b506002546103749073ffffffffffffffffffffffffffffffffffffffff1681565b3480156104db57600080fd5b506101d161169a565b3480156104f057600080fd5b5060045461026e565b34801561050557600080fd5b5061026e60065481565b34801561051b57600080fd5b506101d161052a366004611c6d565b6118b4565b34801561053b57600080fd5b506000546103749073ffffffffffffffffffffffffffffffffffffffff1681565b60015473ffffffffffffffffffffffffffffffffffffffff1633146105ee5760405162461bcd60e51b815260206004820152602160248201527f4f6e6c7920746865206f776e65722063616e20646f207468697320616374696f60448201527f6e0000000000000000000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b600a805491151574010000000000000000000000000000000000000000027fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff909216919091179055565b60015473ffffffffffffffffffffffffffffffffffffffff1633146106c55760405162461bcd60e51b815260206004820152602160248201527f4f6e6c7920746865206f776e65722063616e20646f207468697320616374696f60448201527f6e0000000000000000000000000000000000000000000000000000000000000060648201526084016105e5565b600455565b600a547501000000000000000000000000000000000000000000900460ff16156107365760405162461bcd60e51b815260206004820152600e60248201527f4e6f2072652d656e7472616e637900000000000000000000000000000000000060448201526064016105e5565b600a80547fffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffffff167501000000000000000000000000000000000000000000179081905574010000000000000000000000000000000000000000900460ff16156107e05760405162461bcd60e51b815260206004820152601660248201527f4272696467652061637475616c6c79207061757365640000000000000000000060448201526064016105e5565b6006548310156108325760405162461bcd60e51b815260206004820152601360248201527f494e5355464953414e545f5155414e544954590000000000000000000000000060448201526064016105e5565b610850606461084a605a610844611315565b90611946565b90611959565b34101561089f5760405162461bcd60e51b815260206004820152600d60248201527f5041594d454e545f41424f52540000000000000000000000000000000000000060448201526064016105e5565b6000546040517f70a08231000000000000000000000000000000000000000000000000000000008152336004820152849173ffffffffffffffffffffffffffffffffffffffff16906370a082319060240160206040518083038186803b15801561090857600080fd5b505afa15801561091c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109409190611e67565b101561098e5760405162461bcd60e51b815260206004820152601260248201527f494e5355464953414e545f42414c414e4345000000000000000000000000000060448201526064016105e5565b6000546040517fdd62ed3e000000000000000000000000000000000000000000000000000000008152336004820152306024820152849173ffffffffffffffffffffffffffffffffffffffff169063dd62ed3e9060440160206040518083038186803b1580156109fd57600080fd5b505afa158015610a11573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a359190611e67565b1015610a835760405162461bcd60e51b815260206004820152601460248201527f494e5355464953414e545f414c4c4f57414e434500000000000000000000000060448201526064016105e5565b600054610aa89073ffffffffffffffffffffffffffffffffffffffff16333086611965565b7f4090136e50c099ef9961fa1e7fb2361fc21e86732a92ff014883455b80318914838383604051610adb93929190611e80565b60405180910390a15050600a80547fffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffffff16905550565b60015473ffffffffffffffffffffffffffffffffffffffff163314610b9d5760405162461bcd60e51b815260206004820152602160248201527f4f6e6c7920746865206f776e65722063616e20646f207468697320616374696f60448201527f6e0000000000000000000000000000000000000000000000000000000000000060648201526084016105e5565b600655565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff828116600483015260009182918616906370a082319060240160206040518083038186803b158015610c0e57600080fd5b505afa158015610c22573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c469190611e67565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff85811660048301529192506000918616906370a082319060240160206040518083038186803b158015610cb357600080fd5b505afa158015610cc7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ceb9190611e67565b905060008111610cfa57600080fd5b610d108161084a84670de0b6b3a7640000611946565b9695505050505050565b60015473ffffffffffffffffffffffffffffffffffffffff163314610da75760405162461bcd60e51b815260206004820152602160248201527f4f6e6c7920746865206f776e65722063616e20646f207468697320616374696f60448201527f6e0000000000000000000000000000000000000000000000000000000000000060648201526084016105e5565b600a547501000000000000000000000000000000000000000000900460ff1615610e135760405162461bcd60e51b815260206004820152600e60248201527f4e6f2072652d656e7472616e637900000000000000000000000000000000000060448201526064016105e5565b600a80547fffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffffff1675010000000000000000000000000000000000000000001790556040517f70a08231000000000000000000000000000000000000000000000000000000008152336004820152819073ffffffffffffffffffffffffffffffffffffffff8416906370a082319060240160206040518083038186803b158015610eba57600080fd5b505afa158015610ece573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ef29190611e67565b1015610f405760405162461bcd60e51b815260206004820152601260248201527f494e5355464953414e545f42414c414e4345000000000000000000000000000060448201526064016105e5565b6040517fdd62ed3e000000000000000000000000000000000000000000000000000000008152336004820152306024820152819073ffffffffffffffffffffffffffffffffffffffff84169063dd62ed3e9060440160206040518083038186803b158015610fad57600080fd5b505afa158015610fc1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fe59190611e67565b10156110335760405162461bcd60e51b815260206004820152601460248201527f494e5355464953414e545f414c4c4f57414e434500000000000000000000000060448201526064016105e5565b61103f82333084611965565b5050600a80547fffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffffff169055565b60025473ffffffffffffffffffffffffffffffffffffffff163314806110a8575060015473ffffffffffffffffffffffffffffffffffffffff1633145b6110f45760405162461bcd60e51b815260206004820152601560248201527f4f6e6c792070726f6772616d206f72204f776e6572000000000000000000000060448201526064016105e5565b73ffffffffffffffffffffffffffffffffffffffff8316600090815260076020908152604080832084845290915290205460ff161561119b5760405162461bcd60e51b815260206004820152602160248201527f427269646765207265717565737420616c72656164792070726f63657373656460448201527f2e0000000000000000000000000000000000000000000000000000000000000060648201526084016105e5565b6111fb838273ffffffffffffffffffffffffffffffffffffffff90911660009081526007602090815260408083209383529290522080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055565b60005461121f9073ffffffffffffffffffffffffffffffffffffffff168484611ae9565b505050565b60015473ffffffffffffffffffffffffffffffffffffffff1633146112b15760405162461bcd60e51b815260206004820152602160248201527f4f6e6c7920746865206f776e65722063616e20646f207468697320616374696f60448201527f6e0000000000000000000000000000000000000000000000000000000000000060648201526084016105e5565b6008805473ffffffffffffffffffffffffffffffffffffffff9485167fffffffffffffffffffffffff0000000000000000000000000000000000000000918216179091556009805493851693821693909317909255600a8054919093169116179055565b600a5460009073ffffffffffffffffffffffffffffffffffffffff161561139757600854600954600a546000926113699273ffffffffffffffffffffffffffffffffffffffff918216929082169116610ba2565b9050611391606461084460045461084a670de0b6b3a76400008661194690919063ffffffff16565b91505090565b5060055490565b60015473ffffffffffffffffffffffffffffffffffffffff16331461142b5760405162461bcd60e51b815260206004820152602160248201527f4f6e6c7920746865206f776e65722063616e20646f207468697320616374696f60448201527f6e0000000000000000000000000000000000000000000000000000000000000060648201526084016105e5565b73ffffffffffffffffffffffffffffffffffffffff811661148e5760405162461bcd60e51b815260206004820152600f60248201527f4e6f207a65726f2061646472657373000000000000000000000000000000000060448201526064016105e5565b600280547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b60015473ffffffffffffffffffffffffffffffffffffffff1633146115625760405162461bcd60e51b815260206004820152602160248201527f4f6e6c7920746865206f776e65722063616e20646f207468697320616374696f60448201527f6e0000000000000000000000000000000000000000000000000000000000000060648201526084016105e5565b73ffffffffffffffffffffffffffffffffffffffff81166115c55760405162461bcd60e51b815260206004820152600f60248201527f4e6f207a65726f2061646472657373000000000000000000000000000000000060448201526064016105e5565b600180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b6003805461161990611ed4565b80601f016020809104026020016040519081016040528092919081815260200182805461164590611ed4565b80156116925780601f1061166757610100808354040283529160200191611692565b820191906000526020600020905b81548152906001019060200180831161167557829003601f168201915b505050505081565b60015473ffffffffffffffffffffffffffffffffffffffff1633146117275760405162461bcd60e51b815260206004820152602160248201527f4f6e6c7920746865206f776e65722063616e20646f207468697320616374696f60448201527f6e0000000000000000000000000000000000000000000000000000000000000060648201526084016105e5565b600a547501000000000000000000000000000000000000000000900460ff16156117935760405162461bcd60e51b815260206004820152600e60248201527f4e6f2072652d656e7472616e637900000000000000000000000000000000000060448201526064016105e5565b600a80547fffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffffff16750100000000000000000000000000000000000000000017905560015460009073ffffffffffffffffffffffffffffffffffffffff166117f7303190565b604051600081818185875af1925050503d8060008114611833576040519150601f19603f3d011682016040523d82523d6000602084013e611838565b606091505b50509050806118895760405162461bcd60e51b815260206004820152601660248201527f4272696467655472616e73666572206661696c6564210000000000000000000060448201526064016105e5565b50600a80547fffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffffff169055565b60015473ffffffffffffffffffffffffffffffffffffffff1633146119415760405162461bcd60e51b815260206004820152602160248201527f4f6e6c7920746865206f776e65722063616e20646f207468697320616374696f60448201527f6e0000000000000000000000000000000000000000000000000000000000000060648201526084016105e5565b600555565b60006119528284611f28565b9392505050565b60006119528284611f8c565b6040805173ffffffffffffffffffffffffffffffffffffffff85811660248301528481166044830152606480830185905283518084039091018152608490920183526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f23b872dd000000000000000000000000000000000000000000000000000000001790529151600092839290881691611a049190611fc7565b6000604051808303816000865af19150503d8060008114611a41576040519150601f19603f3d011682016040523d82523d6000602084013e611a46565b606091505b5091509150818015611a70575080511580611a70575080806020019051810190611a709190611fe3565b611ae15760405162461bcd60e51b8152602060048201526024808201527f5472616e7366657248656c7065723a205452414e534645525f46524f4d5f464160448201527f494c45440000000000000000000000000000000000000000000000000000000060648201526084016105e5565b505050505050565b6040805173ffffffffffffffffffffffffffffffffffffffff8481166024830152604480830185905283518084039091018152606490920183526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb000000000000000000000000000000000000000000000000000000001790529151600092839290871691611b809190611fc7565b6000604051808303816000865af19150503d8060008114611bbd576040519150601f19603f3d011682016040523d82523d6000602084013e611bc2565b606091505b5091509150818015611bec575080511580611bec575080806020019051810190611bec9190611fe3565b611c385760405162461bcd60e51b815260206004820152601f60248201527f5472616e7366657248656c7065723a205452414e534645525f4641494c45440060448201526064016105e5565b5050505050565b8015158114611c4d57600080fd5b50565b600060208284031215611c6257600080fd5b813561195281611c3f565b600060208284031215611c7f57600080fd5b5035919050565b600080600060408486031215611c9b57600080fd5b83359250602084013567ffffffffffffffff80821115611cba57600080fd5b818601915086601f830112611cce57600080fd5b813581811115611cdd57600080fd5b876020828501011115611cef57600080fd5b6020830194508093505050509250925092565b803573ffffffffffffffffffffffffffffffffffffffff81168114611d2657600080fd5b919050565b600080600060608486031215611d4057600080fd5b611d4984611d02565b9250611d5760208501611d02565b9150611d6560408501611d02565b90509250925092565b60008060408385031215611d8157600080fd5b611d8a83611d02565b946020939093013593505050565b600080600060608486031215611dad57600080fd5b611db684611d02565b95602085013595506040909401359392505050565b600060208284031215611ddd57600080fd5b61195282611d02565b60005b83811015611e01578181015183820152602001611de9565b83811115611e10576000848401525b50505050565b6020815260008251806020840152611e35816040850160208701611de6565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169190910160400192915050565b600060208284031215611e7957600080fd5b5051919050565b83815260406020820152816040820152818360608301376000818301606090810191909152601f9092017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016010192915050565b600181811c90821680611ee857607f821691505b60208210811415611f22577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b50919050565b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615611f87577f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b500290565b600082611fc2577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b60008251611fd9818460208701611de6565b9190910192915050565b600060208284031215611ff557600080fd5b815161195281611c3f56fea2646970667358221220241ef8564b2e5cd56f7a317eed75e69410f805ea05568624ddb25f8c4fa790f764736f6c63430008090033
Verified Source Code Full Match
Compiler: v0.8.9+commit.e5eed63a
EVM: london
Optimization: Yes (10000 runs)
EVMBridge.sol 205 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;
import "./interfaces/IERC20.sol";
import "./utils/TransferHelper.sol";
import "./libs/SafeMath.sol";
import "./libs/SignedSafeMath.sol";
/**
* @title EVMBridge
* @author Jeremy Guyet (@jguyet)
* @dev
* Smart Contract for manage the transfers between two blockchains
* who respect the Ethereum Virtual Machine normal. This Smart contract
* contains the list of the chains accepted and list all transactions initialized
* with their hash proof from the destination chain. this smart contract is decentralized
* but managed by one wallet address (The owner wallet of the Graphlinq project).
* This contract is managed by API in Nodejs and we wait 100 block before transfer anything.
*/
contract EVMBridge {
using SafeMath for uint256;
using SignedSafeMath for int256;
address public token;
address public owner;
address public program;
string public chain;
uint256 public feesInDollar;
uint256 public defaultFeesInETH;
uint256 public minimumTransferQuantity;
//event emitted when new transfer on GLQ bridge
event BridgeTransfer(
uint256 amount,
string toChain
);
mapping(address => mapping(uint256 => bool)) transfers;
// Private dex information
address private dex_in;
address private dex_out;
address private dex_pool;
bool internal paused;
bool internal locked;
constructor(
string memory _bridgeChain,
address _token,
uint256 _feesInDollar,
uint256 _minimumTransferQuantity) {
require(msg.sender != address(0), "ABORT sender - address(0)");
token = _token;
owner = msg.sender;
program = msg.sender;
chain = _bridgeChain;
feesInDollar = _feesInDollar;
minimumTransferQuantity = _minimumTransferQuantity;
defaultFeesInETH = 0;
}
modifier onlyOwner() {
require(msg.sender == owner, "Only the owner can do this action");
_;
}
modifier onlyProgramOrOwner() {
require(msg.sender == program || msg.sender == owner, "Only program or Owner");
_;
}
modifier activated() {
require(paused == false, "Bridge actually paused");
_;
}
modifier noReentrant() {
require(!locked, "No re-entrancy");
locked = true;
_;
locked = false;
}
function getFeesInDollar() public view returns (uint256) {
return feesInDollar;
}
function setFeesInDollar(uint256 cost) public onlyOwner {
feesInDollar = cost;
}
function setDefaultFeesInETH(uint256 cost) public onlyOwner {
defaultFeesInETH = cost;
}
function getFeesInETH() public view returns (uint256) {
if (dex_pool != address(0)) {
uint256 oneDollar = getTokenPriceOutFromPoolBalance(dex_in, dex_out, dex_pool);
return oneDollar.mul(1 ether).div(feesInDollar).mul(100); // multiplication 1 ether pour decaler les decimals.
}
return defaultFeesInETH;
}
function initTransfer(uint256 quantity, string calldata toChain) public payable noReentrant activated {
require(quantity >= minimumTransferQuantity,
"INSUFISANT_QUANTITY"
);
require(msg.value >= getFeesInETH().mul(90).div(100),
"PAYMENT_ABORT" // 90% of the fees minimum
);
require(IERC20(token).balanceOf(msg.sender) >= quantity, "INSUFISANT_BALANCE");
require(IERC20(token).allowance(msg.sender, address(this)) >= quantity, "INSUFISANT_ALLOWANCE");
TransferHelper.safeTransferFrom(token, msg.sender, address(this), quantity);
emit BridgeTransfer(quantity, toChain);
}
function deposit(address coin, uint256 quantity) public onlyOwner noReentrant {
require(IERC20(coin).balanceOf(msg.sender) >= quantity, "INSUFISANT_BALANCE");
require(IERC20(coin).allowance(msg.sender, address(this)) >= quantity, "INSUFISANT_ALLOWANCE");
TransferHelper.safeTransferFrom(coin, msg.sender, address(this), quantity);
}
function balance() public view returns (uint256){
return payable(address(this)).balance;
}
function getFees() public view returns (uint256) {
return balance();
}
function claimFees() public onlyOwner noReentrant {
(bool success,)=owner.call{value:balance()}("");
require(success, "BridgeTransfer failed!");
}
function setTransferProcessed(address sender, uint256 transferBn) private {
transfers[sender][transferBn] = true;
}
function isTransferProcessed(address sender, uint256 transferBn) public view returns (bool) {
return transfers[sender][transferBn];
}
function addTransferFrom(address to, uint256 amount, uint256 bn) public onlyProgramOrOwner {
require(isTransferProcessed(to, bn) == false, "Bridge request already processed.");
setTransferProcessed(to, bn);
TransferHelper.safeTransfer(token, to, amount);
}
function getDex() public view returns (address, address, address) {
return (dex_in, dex_out, dex_pool);
}
/**
* Only 18 decimals tokens.
*/
function setDex(address _in, address _out, address _pool) public onlyOwner {
dex_in = _in;
dex_out = _out;
dex_pool = _pool;
}
function getTokenPriceOutFromPoolBalance(address _in, address _out, address _pool) public view returns (uint256) {
uint256 balanceIn = IERC20(_in).balanceOf(_pool);
uint256 balanceOut = IERC20(_out).balanceOf(_pool);
require(balanceOut > 0);
return balanceIn.mul(1 ether).div(balanceOut);
// ex: in=USDC,out=ETH = price of ETH in USDC
// ex: in=ETH,out=USDC = price of USDC in ETH
}
function updateTransferCost(uint256 _feesInDollar) public onlyOwner {
feesInDollar = _feesInDollar;
}
function isPaused() public view returns (bool) {
return paused;
}
function setPaused(bool p) public onlyOwner {
paused = p;
}
function setMinimumTransferQuantity(uint256 quantity) public onlyOwner {
minimumTransferQuantity = quantity;
}
function changeOwner(address newOwner) public onlyOwner {
require(newOwner != address(0), "No zero address");
owner = newOwner;
}
function changeProgram(address newProgram) public onlyOwner {
require(newProgram != address(0), "No zero address");
program = newProgram;
}
function _getHash(uint256 timestamp, uint256 nonce, address addr) private pure returns (bytes32) {
return keccak256(abi.encodePacked(timestamp, addr, nonce));
}
}
SafeMath.sol 209 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev Wrappers over Solidity's arithmetic operations.
*
* NOTE: `SafeMath` is generally not needed starting with Solidity 0.8, since the compiler
* now has built in overflow checking.
*/
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
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);
}
}
/**
* @dev Returns the subtraction of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b > a) return (false, 0);
return (true, a - b);
}
}
/**
* @dev Returns the multiplication of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) return (true, 0);
uint256 c = a * b;
if (c / a != b) return (false, 0);
return (true, c);
}
}
/**
* @dev Returns the division of two unsigned integers, with a division by zero flag.
*
* _Available since v3.4._
*/
function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a / b);
}
}
/**
* @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.
*
* _Available since v3.4._
*/
function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a % b);
}
}
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
*
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
return a + b;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return a - b;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
*
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
return a * b;
}
/**
* @dev Returns the integer division of two unsigned integers, reverting on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator.
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return a / b;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* reverting when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return a % b;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {trySub}.
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
unchecked {
require(b <= a, errorMessage);
return a - b;
}
}
/**
* @dev Returns the integer division of two unsigned integers, reverting with custom message on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
unchecked {
require(b > 0, errorMessage);
return a / b;
}
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* reverting with custom message when dividing by zero.
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {tryMod}.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
unchecked {
require(b > 0, errorMessage);
return a % b;
}
}
}
IERC20.sol 20 lines
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.9;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
function name() external view returns (string memory);
function symbol() external view returns (string memory);
function decimals() external view returns (uint8);
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
SignedSafeMath.sol 19 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/math/SignedSafeMath.sol)
pragma solidity ^0.8.0;
library SignedSafeMath {
function mul(int256 a, int256 b) internal pure returns (int256) {
return a * b;
}
function div(int256 a, int256 b) internal pure returns (int256) {
return a / b;
}
function sub(int256 a, int256 b) internal pure returns (int256) {
return a - b;
}
function add(int256 a, int256 b) internal pure returns (int256) {
return a + b;
}
}
TransferHelper.sol 17 lines
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.9;
// helper methods for interacting with ERC20 tokens and sending ETH that do not consistently return true/false
library TransferHelper {
function safeTransfer(address token, address to, uint value) internal {
// bytes4(keccak256(bytes('transfer(address,uint256)')));
(bool success, bytes memory data) = token.call(abi.encodeWithSelector(0xa9059cbb, to, value));
require(success && (data.length == 0 || abi.decode(data, (bool))), 'TransferHelper: TRANSFER_FAILED');
}
function safeTransferFrom(address token, address from, address to, uint value) internal {
// bytes4(keccak256(bytes('transferFrom(address,address,uint256)')));
(bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x23b872dd, from, to, value));
require(success && (data.length == 0 || abi.decode(data, (bool))), 'TransferHelper: TRANSFER_FROM_FAILED');
}
}
Read Contract
balance 0xb69ef8a8 → uint256
chain 0xc763e5a1 → string
defaultFeesInETH 0x3b3438ce → uint256
feesInDollar 0x3e035383 → uint256
getDex 0x191622ff → address, address, address
getFees 0xdb8d55f1 → uint256
getFeesInDollar 0xdb18ba7d → uint256
getFeesInETH 0x81d1f9dc → uint256
getTokenPriceOutFromPoolBalance 0x42ae278c → uint256
isPaused 0xb187bd26 → bool
isTransferProcessed 0x9d1b9f50 → bool
minimumTransferQuantity 0xf8228f7b → uint256
owner 0x8da5cb5b → address
program 0xc860ebc6 → address
token 0xfc0c546a → address
Write Contract 12 functions
These functions modify contract state and require a wallet transaction to execute.
addTransferFrom 0x4cc3f6e8
address to
uint256 amount
uint256 bn
changeOwner 0xa6f9dae1
address newOwner
changeProgram 0xa5d53104
address newProgram
claimFees 0xd294f093
No parameters
deposit 0x47e7ef24
address coin
uint256 quantity
initTransfer 0x202bdfc3
uint256 quantity
string toChain
setDefaultFeesInETH 0xfb93f016
uint256 cost
setDex 0x75045691
address _in
address _out
address _pool
setFeesInDollar 0x18fdc2c8
uint256 cost
setMinimumTransferQuantity 0x419f75fe
uint256 quantity
setPaused 0x16c38b3c
bool p
updateTransferCost 0x649c6c56
uint256 _feesInDollar
Recent Transactions
No transactions found for this address