Source Code
Overview
ETH Balance
0 ETH
Eth Value
$0.00View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
Cross-Chain Transactions
Loading...
Loading
Contract Name:
FlapperUniV2
Compiler Version
v0.8.21+commit.d9974bed
Optimization Enabled:
Yes with 200 runs
Other Settings:
paris EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-FileCopyrightText: © 2023 Dai Foundation <www.daifoundation.org>
// SPDX-License-Identifier: AGPL-3.0-or-later
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
pragma solidity ^0.8.21;
import { Babylonian } from "src/Babylonian.sol";
interface SpotterLike {
function par() external view returns (uint256);
}
interface GemLike {
function decimals() external view returns (uint8);
function balanceOf(address) external view returns (uint256);
function transfer(address, uint256) external;
}
interface PipLike {
function read() external view returns (bytes32);
}
// https://github.com/Uniswap/v2-core/blob/ee547b17853e71ed4e0101ccfd52e70d5acded58/contracts/UniswapV2Pair.sol
interface PairLike {
function getReserves() external view returns (uint112, uint112, uint32);
function token0() external view returns (address);
function mint(address) external returns (uint256);
function swap(uint256, uint256, address, bytes calldata) external;
function sync() external;
}
contract FlapperUniV2 {
mapping (address => uint256) public wards;
PipLike public pip; // Reference price oracle
uint256 public want; // [WAD] Relative multiplier of the reference price to insist on in the swap.
// For example: 0.98 * WAD allows 2% worse price than the reference.
SpotterLike public immutable spotter;
address public immutable usds;
address public immutable gem;
address public immutable receiver;
PairLike public immutable pair;
bool public immutable usdsFirst;
event Rely(address indexed usr);
event Deny(address indexed usr);
event File(bytes32 indexed what, uint256 data);
event File(bytes32 indexed what, address data);
event Exec(uint256 lot, uint256 sell, uint256 buy, uint256 liquidity);
constructor(
address _spotter,
address _usds,
address _gem,
address _pair,
address _receiver
) {
spotter = SpotterLike(_spotter);
usds = _usds;
gem = _gem;
require(GemLike(gem).decimals() == 18, "FlapperUniV2/gem-decimals-not-18");
pair = PairLike(_pair);
usdsFirst = pair.token0() == usds;
receiver = _receiver;
wards[msg.sender] = 1;
emit Rely(msg.sender);
want = WAD; // Initial value for safety
}
modifier auth {
require(wards[msg.sender] == 1, "FlapperUniV2/not-authorized");
_;
}
uint256 internal constant WAD = 10 ** 18;
uint256 internal constant RAY = 10 ** 27;
function rely(address usr) external auth { wards[usr] = 1; emit Rely(usr); }
function deny(address usr) external auth { wards[usr] = 0; emit Deny(usr); }
// Warning - low `want` values increase the susceptibility to oracle manipulation attacks
function file(bytes32 what, uint256 data) external auth {
if (what == "want") want = data;
else revert("FlapperUniV2/file-unrecognized-param");
emit File(what, data);
}
function file(bytes32 what, address data) external auth {
if (what == "pip") pip = PipLike(data);
else revert("FlapperUniV2/file-unrecognized-param");
emit File(what, data);
}
function _getReserves() internal returns (uint256 reserveUsds, uint256 reserveGem) {
(uint256 _reserveA, uint256 _reserveB,) = pair.getReserves();
(reserveUsds, reserveGem) = usdsFirst ? (_reserveA, _reserveB) : (_reserveB, _reserveA);
uint256 _usdsBalance = GemLike(usds).balanceOf(address(pair));
uint256 _gemBalance = GemLike(gem).balanceOf(address(pair));
if (_usdsBalance > reserveUsds || _gemBalance > reserveGem) {
pair.sync();
(reserveUsds, reserveGem) = (_usdsBalance, _gemBalance);
}
}
// The Uniswap invariant needs to hold through the swap.
// Additionally, The deposited funds need to be in the same ratio as the reserves after the swap.
//
// (1) reserveUsds * reserveGem = (reserveUsds + sell * 997 / 1000) * (reserveGem - bought)
// (2) (lot - sell) / bought = (reserveUsds + sell) / (reserveGem - bought)
//
// The solution for the these equations for variables `sell` and `bought` is used below.
function _getUsdsToSell(uint256 lot, uint256 reserveUsds) internal pure returns (uint256 sell) {
sell = (Babylonian.sqrt(reserveUsds * (lot * 3_988_000 + reserveUsds * 3_988_009)) - reserveUsds * 1997) / 1994;
}
// Based on: https://github.com/Uniswap/v2-periphery/blob/0335e8f7e1bd1e8d8329fd300aea2ef2f36dd19f/contracts/libraries/UniswapV2Library.sol#L43
function _getAmountOut(uint256 amtIn, uint256 reserveIn, uint256 reserveOut) internal pure returns (uint256 amtOut) {
uint256 _amtInFee = amtIn * 997;
amtOut = _amtInFee * reserveOut / (reserveIn * 1000 + _amtInFee);
}
function exec(uint256 lot) external auth {
// Check Amounts
(uint256 _reserveUsds, uint256 _reserveGem) = _getReserves();
uint256 _sell = _getUsdsToSell(lot, _reserveUsds);
uint256 _buy = _getAmountOut(_sell, _reserveUsds, _reserveGem);
require(_buy >= _sell * want / (uint256(pip.read()) * RAY / spotter.par()), "FlapperUniV2/insufficient-buy-amount");
//
// Swap
GemLike(usds).transfer(address(pair), _sell);
(uint256 _amt0Out, uint256 _amt1Out) = usdsFirst ? (uint256(0), _buy) : (_buy, uint256(0));
pair.swap(_amt0Out, _amt1Out, address(this), new bytes(0));
//
// Deposit
GemLike(usds).transfer(address(pair), lot - _sell);
GemLike(gem).transfer(address(pair), _buy);
uint256 _liquidity = pair.mint(receiver);
//
emit Exec(lot, _sell, _buy, _liquidity);
}
}// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.8.21;
// Based on https://github.com/Uniswap/solidity-lib/blob/c01640b0f0f1d8a85cba8de378cc48469fcfd9a6/contracts/libraries/Babylonian.sol
// computes square roots using the babylonian method
// https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method
library Babylonian {
// credit for this implementation goes to
// https://github.com/abdk-consulting/abdk-libraries-solidity/blob/5e1e7c11b35f8313d3f7ce11c1b86320d7c0b554/ABDKMath64x64.sol#L725
function sqrt(uint256 x) internal pure returns (uint256) {
unchecked {
if (x == 0) return 0;
// this block is equivalent to r = uint256(1) << (BitMath.mostSignificantBit(x) / 2);
// however that code costs significantly more gas
uint256 xx = x;
uint256 r = 1;
if (xx >= 0x100000000000000000000000000000000) {
xx >>= 128;
r <<= 64;
}
if (xx >= 0x10000000000000000) {
xx >>= 64;
r <<= 32;
}
if (xx >= 0x100000000) {
xx >>= 32;
r <<= 16;
}
if (xx >= 0x10000) {
xx >>= 16;
r <<= 8;
}
if (xx >= 0x100) {
xx >>= 8;
r <<= 4;
}
if (xx >= 0x10) {
xx >>= 4;
r <<= 2;
}
if (xx >= 0x4) {
r <<= 1;
}
r = (r + x / r) >> 1;
r = (r + x / r) >> 1;
r = (r + x / r) >> 1;
r = (r + x / r) >> 1;
r = (r + x / r) >> 1;
r = (r + x / r) >> 1;
r = (r + x / r) >> 1; // Seven iterations should be enough
uint256 r1 = x / r;
return (r < r1 ? r : r1);
}
}
}{
"remappings": [
"dss-interfaces/=lib/dss-test/lib/dss-interfaces/src/",
"dss-test/=lib/dss-test/src/",
"forge-std/=lib/dss-test/lib/forge-std/src/"
],
"optimizer": {
"enabled": true,
"runs": 200
},
"metadata": {
"useLiteralContent": false,
"bytecodeHash": "ipfs",
"appendCBOR": true
},
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"evmVersion": "paris",
"viaIR": false,
"libraries": {}
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[{"internalType":"address","name":"_spotter","type":"address"},{"internalType":"address","name":"_usds","type":"address"},{"internalType":"address","name":"_gem","type":"address"},{"internalType":"address","name":"_pair","type":"address"},{"internalType":"address","name":"_receiver","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"usr","type":"address"}],"name":"Deny","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"lot","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"sell","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"buy","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"liquidity","type":"uint256"}],"name":"Exec","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"what","type":"bytes32"},{"indexed":false,"internalType":"uint256","name":"data","type":"uint256"}],"name":"File","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"what","type":"bytes32"},{"indexed":false,"internalType":"address","name":"data","type":"address"}],"name":"File","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"usr","type":"address"}],"name":"Rely","type":"event"},{"inputs":[{"internalType":"address","name":"usr","type":"address"}],"name":"deny","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"lot","type":"uint256"}],"name":"exec","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"what","type":"bytes32"},{"internalType":"uint256","name":"data","type":"uint256"}],"name":"file","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"what","type":"bytes32"},{"internalType":"address","name":"data","type":"address"}],"name":"file","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"gem","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pair","outputs":[{"internalType":"contract PairLike","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pip","outputs":[{"internalType":"contract PipLike","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"receiver","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"usr","type":"address"}],"name":"rely","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"spotter","outputs":[{"internalType":"contract SpotterLike","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"usds","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"usdsFirst","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"want","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"wards","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}]Contract Creation Code
6101406040523480156200001257600080fd5b50604051620015ca380380620015ca83398101604081905262000035916200021e565b6001600160a01b0380861660805284811660a052831660c08190526040805163313ce56760e01b8152905163313ce567916004808201926020929091908290030181865afa1580156200008c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620000b291906200028e565b60ff16601214620001095760405162461bcd60e51b815260206004820181905260248201527f466c6170706572556e6956322f67656d2d646563696d616c732d6e6f742d3138604482015260640160405180910390fd5b816001600160a01b0316610100816001600160a01b03168152505060a0516001600160a01b0316610100516001600160a01b0316630dfe16816040518163ffffffff1660e01b8152600401602060405180830381865afa15801562000172573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620001989190620002ba565b6001600160a01b039081169190911461012052811660e0523360008181526020819052604080822060019055517fdd0e34038ac38b2a1ce960229778ac48a8719bc900b6c4f8d0475c6e8b385a609190a25050670de0b6b3a764000060025550620002d8915050565b80516001600160a01b03811681146200021957600080fd5b919050565b600080600080600060a086880312156200023757600080fd5b620002428662000201565b9450620002526020870162000201565b9350620002626040870162000201565b9250620002726060870162000201565b9150620002826080870162000201565b90509295509295909350565b600060208284031215620002a157600080fd5b815160ff81168114620002b357600080fd5b9392505050565b600060208284031215620002cd57600080fd5b620002b38262000201565b60805160a05160c05160e0516101005161012051611224620003a6600039600081816102450152818161078f0152610b550152600081816101d8015281816106ff015281816107e80152818161088501528181610923015281816109f101528181610abc01528181610b9901528181610c4c0152610cfb01526000818161027c01526109c501526000818161019e015281816109520152610c7a0152600081816101640152818161072e015281816108560152610bca015260008181610125015261056901526112246000f3fe608060405234801561001057600080fd5b50600436106100ea5760003560e01c8063a8aa1b311161008c578063d741e2f911610066578063d741e2f91461022d578063def0dae514610240578063f7260d3e14610277578063f873cb911461029e57600080fd5b8063a8aa1b31146101d3578063bf353dbb146101fa578063d4e8be831461021a57600080fd5b80634cf282fb116100c85780634cf282fb1461015f57806365fae35e146101865780637bd2bea7146101995780639c52a7f1146101c057600080fd5b80631f1fcd51146100ef57806329ae81141461010b5780632e77468d14610120575b600080fd5b6100f860025481565b6040519081526020015b60405180910390f35b61011e610119366004610f9c565b6102b1565b005b6101477f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b039091168152602001610102565b6101477f000000000000000000000000000000000000000000000000000000000000000081565b61011e610194366004610fda565b610393565b6101477f000000000000000000000000000000000000000000000000000000000000000081565b61011e6101ce366004610fda565b610407565b6101477f000000000000000000000000000000000000000000000000000000000000000081565b6100f8610208366004610fda565b60006020819052908152604090205481565b61011e610228366004610ff5565b61047a565b600154610147906001600160a01b031681565b6102677f000000000000000000000000000000000000000000000000000000000000000081565b6040519015158152602001610102565b6101477f000000000000000000000000000000000000000000000000000000000000000081565b61011e6102ac366004611021565b61050c565b336000908152602081905260409020546001146102e95760405162461bcd60e51b81526004016102e09061103a565b60405180910390fd5b81631dd85b9d60e21b03610301576002819055610355565b60405162461bcd60e51b8152602060048201526024808201527f466c6170706572556e6956322f66696c652d756e7265636f676e697a65642d706044820152636172616d60e01b60648201526084016102e0565b817fe986e40cc8c151830d4f61050f4fb2e4add8567caad2d5f5496f9158e91fe4c78260405161038791815260200190565b60405180910390a25050565b336000908152602081905260409020546001146103c25760405162461bcd60e51b81526004016102e09061103a565b6001600160a01b03811660008181526020819052604080822060019055517fdd0e34038ac38b2a1ce960229778ac48a8719bc900b6c4f8d0475c6e8b385a609190a250565b336000908152602081905260409020546001146104365760405162461bcd60e51b81526004016102e09061103a565b6001600160a01b038116600081815260208190526040808220829055517f184450df2e323acec0ed3b5c7531b81f9b4cdef7914dfd4c0a4317416bb5251b9190a250565b336000908152602081905260409020546001146104a95760405162461bcd60e51b81526004016102e09061103a565b816207069760ec1b0361030157600180546001600160a01b0319166001600160a01b0383161790556040516001600160a01b038216815282907f8fef588b5fc1afbf5b2f06c1a435d513f208da2e6704c3d8f0e0ec91167066ba90602001610387565b3360009081526020819052604090205460011461053b5760405162461bcd60e51b81526004016102e09061103a565b600080610546610ab4565b9150915060006105568484610d7f565b90506000610565828585610de1565b90507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663495d32cb6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156105c5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105e99190611071565b600154604080516315f789a960e21b815290516b033b2e3c9fd0803ce8000000926001600160a01b0316916357de26a49160048083019260209291908290030181865afa15801561063e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106629190611071565b61066c91906110a0565b61067691906110d3565b60025461068390846110a0565b61068d91906110d3565b8110156106e85760405162461bcd60e51b8152602060048201526024808201527f466c6170706572556e6956322f696e73756666696369656e742d6275792d616d6044820152631bdd5b9d60e21b60648201526084016102e0565b60405163a9059cbb60e01b81526001600160a01b037f000000000000000000000000000000000000000000000000000000000000000081166004830152602482018490527f0000000000000000000000000000000000000000000000000000000000000000169063a9059cbb90604401600060405180830381600087803b15801561077257600080fd5b505af1158015610786573d6000803e3d6000fd5b505050506000807f00000000000000000000000000000000000000000000000000000000000000006107ba578260006107be565b6000835b6040805160008152602081019182905263022c0d9f60e01b90915291935091506001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063022c0d9f9061082290859085903090602481016110f5565b600060405180830381600087803b15801561083c57600080fd5b505af1158015610850573d6000803e3d6000fd5b505050507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663a9059cbb7f0000000000000000000000000000000000000000000000000000000000000000868a6108b09190611161565b6040516001600160e01b031960e085901b1681526001600160a01b0390921660048301526024820152604401600060405180830381600087803b1580156108f657600080fd5b505af115801561090a573d6000803e3d6000fd5b505060405163a9059cbb60e01b81526001600160a01b037f000000000000000000000000000000000000000000000000000000000000000081166004830152602482018790527f000000000000000000000000000000000000000000000000000000000000000016925063a9059cbb9150604401600060405180830381600087803b15801561099857600080fd5b505af11580156109ac573d6000803e3d6000fd5b50506040516335313c2160e11b81526001600160a01b037f000000000000000000000000000000000000000000000000000000000000000081166004830152600093507f0000000000000000000000000000000000000000000000000000000000000000169150636a627842906024016020604051808303816000875af1158015610a3b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a5f9190611071565b604080518a815260208101889052908101869052606081018290529091507ffb112cd3d2a2cef06ec86538a2eda5b9e81c2ac8368e61122d30695c81f2d23a9060800160405180910390a15050505050505050565b6000806000807f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316630902f1ac6040518163ffffffff1660e01b8152600401606060405180830381865afa158015610b18573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b3c919061118b565b506001600160701b031691506001600160701b031691507f0000000000000000000000000000000000000000000000000000000000000000610b7f578082610b82565b81815b6040516370a0823160e01b81526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000811660048301529296509094506000917f000000000000000000000000000000000000000000000000000000000000000016906370a0823190602401602060405180830381865afa158015610c11573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c359190611071565b6040516370a0823160e01b81526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000811660048301529192506000917f000000000000000000000000000000000000000000000000000000000000000016906370a0823190602401602060405180830381865afa158015610cc1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ce59190611071565b905085821180610cf457508481115b15610d77577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663fff6cae96040518163ffffffff1660e01b8152600401600060405180830381600087803b158015610d5457600080fd5b505af1158015610d68573d6000803e3d6000fd5b50505050818180965081975050505b505050509091565b60006107ca610d90836107cd6110a0565b610dc6610da085623cda296110a0565b610dad87623cda206110a0565b610db791906111db565b610dc190866110a0565b610e26565b610dd09190611161565b610dda91906110d3565b9392505050565b600080610df0856103e56110a0565b905080610dff856103e86110a0565b610e0991906111db565b610e1384836110a0565b610e1d91906110d3565b95945050505050565b600081600003610e3857506000919050565b816001600160801b8210610e515760809190911c9060401b5b680100000000000000008210610e6c5760409190911c9060201b5b6401000000008210610e835760209190911c9060101b5b620100008210610e985760109190911c9060081b5b6101008210610eac5760089190911c9060041b5b60108210610ebf5760049190911c9060021b5b60048210610ecb5760011b5b6001818581610edc57610edc6110bd565b048201901c90506001818581610ef457610ef46110bd565b048201901c90506001818581610f0c57610f0c6110bd565b048201901c90506001818581610f2457610f246110bd565b048201901c90506001818581610f3c57610f3c6110bd565b048201901c90506001818581610f5457610f546110bd565b048201901c90506001818581610f6c57610f6c6110bd565b048201901c90506000818581610f8457610f846110bd565b049050808210610f945780610e1d565b509392505050565b60008060408385031215610faf57600080fd5b50508035926020909101359150565b80356001600160a01b0381168114610fd557600080fd5b919050565b600060208284031215610fec57600080fd5b610dda82610fbe565b6000806040838503121561100857600080fd5b8235915061101860208401610fbe565b90509250929050565b60006020828403121561103357600080fd5b5035919050565b6020808252601b908201527f466c6170706572556e6956322f6e6f742d617574686f72697a65640000000000604082015260600190565b60006020828403121561108357600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b80820281158282048414176110b7576110b761108a565b92915050565b634e487b7160e01b600052601260045260246000fd5b6000826110f057634e487b7160e01b600052601260045260246000fd5b500490565b84815260006020858184015260018060a01b038516604084015260806060840152835180608085015260005b8181101561113d5785810183015185820160a001528201611121565b50600060a0828601015260a0601f19601f8301168501019250505095945050505050565b818103818111156110b7576110b761108a565b80516001600160701b0381168114610fd557600080fd5b6000806000606084860312156111a057600080fd5b6111a984611174565b92506111b760208501611174565b9150604084015163ffffffff811681146111d057600080fd5b809150509250925092565b808201808211156110b7576110b761108a56fea26469706673582212207b07d7b1d72f1e35699e85ea811c318280c07bf46199f5f90e2cf5b05b580f8464736f6c6343000815003300000000000000000000000065c79fcb50ca1594b025960e539ed7a9a6d434a3000000000000000000000000dc035d45d973e3ec169d2276ddab16f1e407384f00000000000000000000000056072c95faa701256059aa122697b133aded92790000000000000000000000002621cc0b3f3c079c1db0e80794aa24976f0b9e3c000000000000000000000000be8e3e3618f7474f8cb1d074a26affef007e98fb
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106100ea5760003560e01c8063a8aa1b311161008c578063d741e2f911610066578063d741e2f91461022d578063def0dae514610240578063f7260d3e14610277578063f873cb911461029e57600080fd5b8063a8aa1b31146101d3578063bf353dbb146101fa578063d4e8be831461021a57600080fd5b80634cf282fb116100c85780634cf282fb1461015f57806365fae35e146101865780637bd2bea7146101995780639c52a7f1146101c057600080fd5b80631f1fcd51146100ef57806329ae81141461010b5780632e77468d14610120575b600080fd5b6100f860025481565b6040519081526020015b60405180910390f35b61011e610119366004610f9c565b6102b1565b005b6101477f00000000000000000000000065c79fcb50ca1594b025960e539ed7a9a6d434a381565b6040516001600160a01b039091168152602001610102565b6101477f000000000000000000000000dc035d45d973e3ec169d2276ddab16f1e407384f81565b61011e610194366004610fda565b610393565b6101477f00000000000000000000000056072c95faa701256059aa122697b133aded927981565b61011e6101ce366004610fda565b610407565b6101477f0000000000000000000000002621cc0b3f3c079c1db0e80794aa24976f0b9e3c81565b6100f8610208366004610fda565b60006020819052908152604090205481565b61011e610228366004610ff5565b61047a565b600154610147906001600160a01b031681565b6102677f000000000000000000000000000000000000000000000000000000000000000081565b6040519015158152602001610102565b6101477f000000000000000000000000be8e3e3618f7474f8cb1d074a26affef007e98fb81565b61011e6102ac366004611021565b61050c565b336000908152602081905260409020546001146102e95760405162461bcd60e51b81526004016102e09061103a565b60405180910390fd5b81631dd85b9d60e21b03610301576002819055610355565b60405162461bcd60e51b8152602060048201526024808201527f466c6170706572556e6956322f66696c652d756e7265636f676e697a65642d706044820152636172616d60e01b60648201526084016102e0565b817fe986e40cc8c151830d4f61050f4fb2e4add8567caad2d5f5496f9158e91fe4c78260405161038791815260200190565b60405180910390a25050565b336000908152602081905260409020546001146103c25760405162461bcd60e51b81526004016102e09061103a565b6001600160a01b03811660008181526020819052604080822060019055517fdd0e34038ac38b2a1ce960229778ac48a8719bc900b6c4f8d0475c6e8b385a609190a250565b336000908152602081905260409020546001146104365760405162461bcd60e51b81526004016102e09061103a565b6001600160a01b038116600081815260208190526040808220829055517f184450df2e323acec0ed3b5c7531b81f9b4cdef7914dfd4c0a4317416bb5251b9190a250565b336000908152602081905260409020546001146104a95760405162461bcd60e51b81526004016102e09061103a565b816207069760ec1b0361030157600180546001600160a01b0319166001600160a01b0383161790556040516001600160a01b038216815282907f8fef588b5fc1afbf5b2f06c1a435d513f208da2e6704c3d8f0e0ec91167066ba90602001610387565b3360009081526020819052604090205460011461053b5760405162461bcd60e51b81526004016102e09061103a565b600080610546610ab4565b9150915060006105568484610d7f565b90506000610565828585610de1565b90507f00000000000000000000000065c79fcb50ca1594b025960e539ed7a9a6d434a36001600160a01b031663495d32cb6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156105c5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105e99190611071565b600154604080516315f789a960e21b815290516b033b2e3c9fd0803ce8000000926001600160a01b0316916357de26a49160048083019260209291908290030181865afa15801561063e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106629190611071565b61066c91906110a0565b61067691906110d3565b60025461068390846110a0565b61068d91906110d3565b8110156106e85760405162461bcd60e51b8152602060048201526024808201527f466c6170706572556e6956322f696e73756666696369656e742d6275792d616d6044820152631bdd5b9d60e21b60648201526084016102e0565b60405163a9059cbb60e01b81526001600160a01b037f0000000000000000000000002621cc0b3f3c079c1db0e80794aa24976f0b9e3c81166004830152602482018490527f000000000000000000000000dc035d45d973e3ec169d2276ddab16f1e407384f169063a9059cbb90604401600060405180830381600087803b15801561077257600080fd5b505af1158015610786573d6000803e3d6000fd5b505050506000807f00000000000000000000000000000000000000000000000000000000000000006107ba578260006107be565b6000835b6040805160008152602081019182905263022c0d9f60e01b90915291935091506001600160a01b037f0000000000000000000000002621cc0b3f3c079c1db0e80794aa24976f0b9e3c169063022c0d9f9061082290859085903090602481016110f5565b600060405180830381600087803b15801561083c57600080fd5b505af1158015610850573d6000803e3d6000fd5b505050507f000000000000000000000000dc035d45d973e3ec169d2276ddab16f1e407384f6001600160a01b031663a9059cbb7f0000000000000000000000002621cc0b3f3c079c1db0e80794aa24976f0b9e3c868a6108b09190611161565b6040516001600160e01b031960e085901b1681526001600160a01b0390921660048301526024820152604401600060405180830381600087803b1580156108f657600080fd5b505af115801561090a573d6000803e3d6000fd5b505060405163a9059cbb60e01b81526001600160a01b037f0000000000000000000000002621cc0b3f3c079c1db0e80794aa24976f0b9e3c81166004830152602482018790527f00000000000000000000000056072c95faa701256059aa122697b133aded927916925063a9059cbb9150604401600060405180830381600087803b15801561099857600080fd5b505af11580156109ac573d6000803e3d6000fd5b50506040516335313c2160e11b81526001600160a01b037f000000000000000000000000be8e3e3618f7474f8cb1d074a26affef007e98fb81166004830152600093507f0000000000000000000000002621cc0b3f3c079c1db0e80794aa24976f0b9e3c169150636a627842906024016020604051808303816000875af1158015610a3b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a5f9190611071565b604080518a815260208101889052908101869052606081018290529091507ffb112cd3d2a2cef06ec86538a2eda5b9e81c2ac8368e61122d30695c81f2d23a9060800160405180910390a15050505050505050565b6000806000807f0000000000000000000000002621cc0b3f3c079c1db0e80794aa24976f0b9e3c6001600160a01b0316630902f1ac6040518163ffffffff1660e01b8152600401606060405180830381865afa158015610b18573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b3c919061118b565b506001600160701b031691506001600160701b031691507f0000000000000000000000000000000000000000000000000000000000000000610b7f578082610b82565b81815b6040516370a0823160e01b81526001600160a01b037f0000000000000000000000002621cc0b3f3c079c1db0e80794aa24976f0b9e3c811660048301529296509094506000917f000000000000000000000000dc035d45d973e3ec169d2276ddab16f1e407384f16906370a0823190602401602060405180830381865afa158015610c11573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c359190611071565b6040516370a0823160e01b81526001600160a01b037f0000000000000000000000002621cc0b3f3c079c1db0e80794aa24976f0b9e3c811660048301529192506000917f00000000000000000000000056072c95faa701256059aa122697b133aded927916906370a0823190602401602060405180830381865afa158015610cc1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ce59190611071565b905085821180610cf457508481115b15610d77577f0000000000000000000000002621cc0b3f3c079c1db0e80794aa24976f0b9e3c6001600160a01b031663fff6cae96040518163ffffffff1660e01b8152600401600060405180830381600087803b158015610d5457600080fd5b505af1158015610d68573d6000803e3d6000fd5b50505050818180965081975050505b505050509091565b60006107ca610d90836107cd6110a0565b610dc6610da085623cda296110a0565b610dad87623cda206110a0565b610db791906111db565b610dc190866110a0565b610e26565b610dd09190611161565b610dda91906110d3565b9392505050565b600080610df0856103e56110a0565b905080610dff856103e86110a0565b610e0991906111db565b610e1384836110a0565b610e1d91906110d3565b95945050505050565b600081600003610e3857506000919050565b816001600160801b8210610e515760809190911c9060401b5b680100000000000000008210610e6c5760409190911c9060201b5b6401000000008210610e835760209190911c9060101b5b620100008210610e985760109190911c9060081b5b6101008210610eac5760089190911c9060041b5b60108210610ebf5760049190911c9060021b5b60048210610ecb5760011b5b6001818581610edc57610edc6110bd565b048201901c90506001818581610ef457610ef46110bd565b048201901c90506001818581610f0c57610f0c6110bd565b048201901c90506001818581610f2457610f246110bd565b048201901c90506001818581610f3c57610f3c6110bd565b048201901c90506001818581610f5457610f546110bd565b048201901c90506001818581610f6c57610f6c6110bd565b048201901c90506000818581610f8457610f846110bd565b049050808210610f945780610e1d565b509392505050565b60008060408385031215610faf57600080fd5b50508035926020909101359150565b80356001600160a01b0381168114610fd557600080fd5b919050565b600060208284031215610fec57600080fd5b610dda82610fbe565b6000806040838503121561100857600080fd5b8235915061101860208401610fbe565b90509250929050565b60006020828403121561103357600080fd5b5035919050565b6020808252601b908201527f466c6170706572556e6956322f6e6f742d617574686f72697a65640000000000604082015260600190565b60006020828403121561108357600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b80820281158282048414176110b7576110b761108a565b92915050565b634e487b7160e01b600052601260045260246000fd5b6000826110f057634e487b7160e01b600052601260045260246000fd5b500490565b84815260006020858184015260018060a01b038516604084015260806060840152835180608085015260005b8181101561113d5785810183015185820160a001528201611121565b50600060a0828601015260a0601f19601f8301168501019250505095945050505050565b818103818111156110b7576110b761108a565b80516001600160701b0381168114610fd557600080fd5b6000806000606084860312156111a057600080fd5b6111a984611174565b92506111b760208501611174565b9150604084015163ffffffff811681146111d057600080fd5b809150509250925092565b808201808211156110b7576110b761108a56fea26469706673582212207b07d7b1d72f1e35699e85ea811c318280c07bf46199f5f90e2cf5b05b580f8464736f6c63430008150033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
00000000000000000000000065c79fcb50ca1594b025960e539ed7a9a6d434a3000000000000000000000000dc035d45d973e3ec169d2276ddab16f1e407384f00000000000000000000000056072c95faa701256059aa122697b133aded92790000000000000000000000002621cc0b3f3c079c1db0e80794aa24976f0b9e3c000000000000000000000000be8e3e3618f7474f8cb1d074a26affef007e98fb
-----Decoded View---------------
Arg [0] : _spotter (address): 0x65C79fcB50Ca1594B025960e539eD7A9a6D434A3
Arg [1] : _usds (address): 0xdC035D45d973E3EC169d2276DDab16f1e407384F
Arg [2] : _gem (address): 0x56072C95FAA701256059aa122697B133aDEd9279
Arg [3] : _pair (address): 0x2621CC0B3F3c079c1Db0E80794AA24976F0b9e3c
Arg [4] : _receiver (address): 0xBE8E3e3618f7474F8cB1d074A26afFef007E98FB
-----Encoded View---------------
5 Constructor Arguments found :
Arg [0] : 00000000000000000000000065c79fcb50ca1594b025960e539ed7a9a6d434a3
Arg [1] : 000000000000000000000000dc035d45d973e3ec169d2276ddab16f1e407384f
Arg [2] : 00000000000000000000000056072c95faa701256059aa122697b133aded9279
Arg [3] : 0000000000000000000000002621cc0b3f3c079c1db0e80794aa24976f0b9e3c
Arg [4] : 000000000000000000000000be8e3e3618f7474f8cb1d074a26affef007e98fb
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 34 Chains
| Chain | Token | Portfolio % | Price | Amount | Value |
|---|
Loading...
Loading
Loading...
Loading
Loading...
Loading
[ 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.