Source Code
Overview
ETH Balance
0 ETH
Eth Value
$0.00Latest 1 internal transaction
Advanced mode:
| Parent Transaction Hash | Method | Block |
From
|
|
To
|
||
|---|---|---|---|---|---|---|---|
| - | 11441459 | 1904 days ago | Contract Creation | 0 ETH |
Loading...
Loading
Loading...
Loading
Cross-Chain Transactions
Loading...
Loading
Contract Name:
CurveRegistry
Compiler Version
v0.6.12+commit.27d51765
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.2 <0.7.0;
import "@openzeppelin/contracts/access/Ownable.sol";
import "./interfaces/ICurveDeposit.sol";
contract CurveRegistry is Ownable {
struct Depositor {
address contractAddress;
uint8 numTokens;
mapping(address => int128) coinToIndex;
}
mapping(address => Depositor) private lpTokenToDepositor;
bool public locked;
event AdapterRegistered(address adapter, bool isExit);
constructor() public {
// Needs to be explicitly set since we deploy through a Create2 proxy
transferOwnership(tx.origin);
}
function addDepositor(ICurveDeposit depositor, address lpToken) external onlyOwner {
require(lpTokenToDepositor[lpToken].contractAddress == address(0));
lpTokenToDepositor[lpToken].contractAddress = address(depositor);
bool usesUnderlying = depositorUsesUnderlying(depositor);
for(int128 i = 0; true; i += 1) {
address coin = getDepositorCoin(depositor, i, usesUnderlying);
if (coin == address(0)) {
lpTokenToDepositor[lpToken].numTokens = uint8(i);
break;
}
lpTokenToDepositor[lpToken].coinToIndex[coin] = i + 1;
}
}
function getDepositorAddress(address lpToken) external view returns (address) {
return lpTokenToDepositor[lpToken].contractAddress;
}
function getDepositor(address lpToken, address coin) external view returns (address, uint8, int128) {
Depositor storage depositor = lpTokenToDepositor[lpToken];
int128 index = depositor.coinToIndex[coin];
if (index == 0) {
revert('UNSUPPORTED');
}
return (depositor.contractAddress, depositor.numTokens, index - 1);
}
function depositorUsesUnderlying(ICurveDeposit depositor) private view returns (bool) {
try depositor.underlying_coins(0) {
return true;
} catch {
return false;
}
}
function getDepositorCoin(ICurveDeposit depositor, int128 index, bool usesUnderlying) private view returns (address) {
if (usesUnderlying) {
try depositor.underlying_coins(index) returns (address coin) {
return coin;
} catch {
return address(0);
}
} else {
try depositor.coins(index) returns (address coin) {
return coin;
} catch {
return address(0);
}
}
}
function setLocked(bool _locked) external onlyOwner {
locked = _locked;
}
function registerAdapter(bool isExit) external {
require(!locked);
emit AdapterRegistered(msg.sender, isExit);
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with GSN meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address payable) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes memory) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
import "../GSN/Context.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor () internal {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.6.2;
interface ICurveDeposit {
// function get_virtual_price() external view returns (uint);
function token() external returns (address);
function coins(int128 i) external view returns (address);
function underlying_coins(int128 i) external view returns (address);
function add_liquidity(
uint256[2] calldata amounts,
uint256 min_mint_amount
) external;
function add_liquidity(
uint256[3] calldata amounts,
uint256 min_mint_amount
) external;
function add_liquidity(
uint256[4] calldata amounts,
uint256 min_mint_amount
) external;
function remove_liquidity_imbalance(
uint256[2] calldata amounts,
uint256 max_burn_amount
) external;
function remove_liquidity_imbalance(
uint256[3] calldata amounts,
uint256 max_burn_amount
) external;
function remove_liquidity_imbalance(
uint256[4] calldata amounts,
uint256 max_burn_amount
) external;
// function remove_liquidity(
// uint256 _amount,
// uint256[4] calldata amounts
// ) external;
// function exchange(
// int128 from, int128 to, uint256 _from_amount, uint256 _min_to_amount
// ) external;
}{
"evmVersion": "istanbul",
"libraries": {},
"metadata": {
"bytecodeHash": "ipfs",
"useLiteralContent": true
},
"optimizer": {
"enabled": true,
"runs": 200
},
"remappings": [],
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"abi"
]
}
}
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"adapter","type":"address"},{"indexed":false,"internalType":"bool","name":"isExit","type":"bool"}],"name":"AdapterRegistered","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":[{"internalType":"contract ICurveDeposit","name":"depositor","type":"address"},{"internalType":"address","name":"lpToken","type":"address"}],"name":"addDepositor","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"lpToken","type":"address"},{"internalType":"address","name":"coin","type":"address"}],"name":"getDepositor","outputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint8","name":"","type":"uint8"},{"internalType":"int128","name":"","type":"int128"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"lpToken","type":"address"}],"name":"getDepositorAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"locked","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bool","name":"isExit","type":"bool"}],"name":"registerAdapter","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_locked","type":"bool"}],"name":"setLocked","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"}]Contract Creation Code
608060405234801561001057600080fd5b50600061001b610061565b600080546001600160a01b0319166001600160a01b038316908117825560405192935091600080516020610a03833981519152908290a35061005c32610065565b61015d565b3390565b61006d610061565b6000546001600160a01b039081169116146100cf576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6001600160a01b0381166101145760405162461bcd60e51b81526004018080602001828103825260268152602001806109dd6026913960400191505060405180910390fd5b600080546040516001600160a01b0380851693921691600080516020610a0383398151915291a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6108718061016c6000396000f3fe608060405234801561001057600080fd5b50600436106100935760003560e01c8063cf30901211610066578063cf30901214610140578063d2279dec1461015c578063e9de65fd14610182578063f2fde38b146101b0578063f7aac7da146101d657610093565b8063211e28b61461009857806335858b6c146100b9578063715018a6146101145780638da5cb5b1461011c575b600080fd5b6100b7600480360360208110156100ae57600080fd5b503515156101f5565b005b6100e7600480360360408110156100cf57600080fd5b506001600160a01b0381358116916020013516610260565b604080516001600160a01b03909416845260ff9092166020840152600f0b82820152519081900360600190f35b6100b7610300565b6101246103a2565b604080516001600160a01b039092168252519081900360200190f35b6101486103b1565b604080519115158252519081900360200190f35b6101246004803603602081101561017257600080fd5b50356001600160a01b03166103ba565b6100b76004803603604081101561019857600080fd5b506001600160a01b03813581169160200135166103db565b6100b7600480360360208110156101c657600080fd5b50356001600160a01b0316610553565b6100b7600480360360208110156101ec57600080fd5b5035151561064b565b6101fd61069a565b6000546001600160a01b0390811691161461024d576040805162461bcd60e51b8152602060048201819052602482015260008051602061081c833981519152604482015290519081900360640190fd5b6002805460ff1916911515919091179055565b6001600160a01b0380831660009081526001602081815260408084209486168452918401905281205490918291829190600f90810b9081900b6102d8576040805162461bcd60e51b815260206004820152600b60248201526a155394d5541413d495115160aa1b604482015290519081900360640190fd5b90546001600160a01b038116945060ff600160a01b9091041692506000190190509250925092565b61030861069a565b6000546001600160a01b03908116911614610358576040805162461bcd60e51b8152602060048201819052602482015260008051602061081c833981519152604482015290519081900360640190fd5b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031690565b60025460ff1681565b6001600160a01b03808216600090815260016020526040902054165b919050565b6103e361069a565b6000546001600160a01b03908116911614610433576040805162461bcd60e51b8152602060048201819052602482015260008051602061081c833981519152604482015290519081900360640190fd5b6001600160a01b03818116600090815260016020526040902054161561045857600080fd5b6001600160a01b03818116600090815260016020526040812080546001600160a01b031916928516929092179091556104908361069e565b905060005b60006104a2858385610720565b90506001600160a01b0381166104e657506001600160a01b0383166000908152600160205260409020805460ff60a01b1916600160a01b60ff84160217905561054d565b6001600160a01b03808516600090815260016020818152604080842095909416835293810190935220805491909201600f81900b6fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff1990921691909117909155610495565b50505050565b61055b61069a565b6000546001600160a01b039081169116146105ab576040805162461bcd60e51b8152602060048201819052602482015260008051602061081c833981519152604482015290519081900360640190fd5b6001600160a01b0381166105f05760405162461bcd60e51b81526004018080602001828103825260268152602001806107f66026913960400191505060405180910390fd5b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b60025460ff161561065b57600080fd5b60408051338152821515602082015281517fb46d7fba84aa6e639d6acb9ba8f5d65fa767cc87f616c171cf9a0eb8985ff362929181900390910190a150565b3390565b6000816001600160a01b031663b739953e60006040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b1580156106e557600080fd5b505afa92505050801561070a57506040513d602081101561070557600080fd5b505160015b610716575060006103d6565b50600190506103d6565b600081156107a757836001600160a01b031663b739953e846040518263ffffffff1660e01b81526004018082600f0b815260200191505060206040518083038186803b15801561076f57600080fd5b505afa92505050801561079457506040513d602081101561078f57600080fd5b505160015b6107a0575060006107ee565b90506107ee565b836001600160a01b03166323746eb8846040518263ffffffff1660e01b81526004018082600f0b815260200191505060206040518083038186803b15801561076f57600080fd5b939250505056fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f20616464726573734f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572a264697066735822122065f5e356bb21073a8ea1103d6d68d646bce7b3e3f5ae81bb2bcac1169896debd64736f6c634300060c00334f776e61626c653a206e6577206f776e657220697320746865207a65726f20616464726573738be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106100935760003560e01c8063cf30901211610066578063cf30901214610140578063d2279dec1461015c578063e9de65fd14610182578063f2fde38b146101b0578063f7aac7da146101d657610093565b8063211e28b61461009857806335858b6c146100b9578063715018a6146101145780638da5cb5b1461011c575b600080fd5b6100b7600480360360208110156100ae57600080fd5b503515156101f5565b005b6100e7600480360360408110156100cf57600080fd5b506001600160a01b0381358116916020013516610260565b604080516001600160a01b03909416845260ff9092166020840152600f0b82820152519081900360600190f35b6100b7610300565b6101246103a2565b604080516001600160a01b039092168252519081900360200190f35b6101486103b1565b604080519115158252519081900360200190f35b6101246004803603602081101561017257600080fd5b50356001600160a01b03166103ba565b6100b76004803603604081101561019857600080fd5b506001600160a01b03813581169160200135166103db565b6100b7600480360360208110156101c657600080fd5b50356001600160a01b0316610553565b6100b7600480360360208110156101ec57600080fd5b5035151561064b565b6101fd61069a565b6000546001600160a01b0390811691161461024d576040805162461bcd60e51b8152602060048201819052602482015260008051602061081c833981519152604482015290519081900360640190fd5b6002805460ff1916911515919091179055565b6001600160a01b0380831660009081526001602081815260408084209486168452918401905281205490918291829190600f90810b9081900b6102d8576040805162461bcd60e51b815260206004820152600b60248201526a155394d5541413d495115160aa1b604482015290519081900360640190fd5b90546001600160a01b038116945060ff600160a01b9091041692506000190190509250925092565b61030861069a565b6000546001600160a01b03908116911614610358576040805162461bcd60e51b8152602060048201819052602482015260008051602061081c833981519152604482015290519081900360640190fd5b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031690565b60025460ff1681565b6001600160a01b03808216600090815260016020526040902054165b919050565b6103e361069a565b6000546001600160a01b03908116911614610433576040805162461bcd60e51b8152602060048201819052602482015260008051602061081c833981519152604482015290519081900360640190fd5b6001600160a01b03818116600090815260016020526040902054161561045857600080fd5b6001600160a01b03818116600090815260016020526040812080546001600160a01b031916928516929092179091556104908361069e565b905060005b60006104a2858385610720565b90506001600160a01b0381166104e657506001600160a01b0383166000908152600160205260409020805460ff60a01b1916600160a01b60ff84160217905561054d565b6001600160a01b03808516600090815260016020818152604080842095909416835293810190935220805491909201600f81900b6fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff1990921691909117909155610495565b50505050565b61055b61069a565b6000546001600160a01b039081169116146105ab576040805162461bcd60e51b8152602060048201819052602482015260008051602061081c833981519152604482015290519081900360640190fd5b6001600160a01b0381166105f05760405162461bcd60e51b81526004018080602001828103825260268152602001806107f66026913960400191505060405180910390fd5b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b60025460ff161561065b57600080fd5b60408051338152821515602082015281517fb46d7fba84aa6e639d6acb9ba8f5d65fa767cc87f616c171cf9a0eb8985ff362929181900390910190a150565b3390565b6000816001600160a01b031663b739953e60006040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b1580156106e557600080fd5b505afa92505050801561070a57506040513d602081101561070557600080fd5b505160015b610716575060006103d6565b50600190506103d6565b600081156107a757836001600160a01b031663b739953e846040518263ffffffff1660e01b81526004018082600f0b815260200191505060206040518083038186803b15801561076f57600080fd5b505afa92505050801561079457506040513d602081101561078f57600080fd5b505160015b6107a0575060006107ee565b90506107ee565b836001600160a01b03166323746eb8846040518263ffffffff1660e01b81526004018082600f0b815260200191505060206040518083038186803b15801561076f57600080fd5b939250505056fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f20616464726573734f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572a264697066735822122065f5e356bb21073a8ea1103d6d68d646bce7b3e3f5ae81bb2bcac1169896debd64736f6c634300060c0033
Loading...
Loading
Loading...
Loading
Net Worth in USD
$0.00
Net Worth in ETH
0
Multichain Portfolio | 33 Chains
| Chain | Token | Portfolio % | Price | Amount | Value |
|---|
Loading...
Loading
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.