Polygon Sponsored slots available. Book your slot here!
Contract Overview
[ Download CSV Export ]
Latest 1 internal transaction
Parent Txn Hash | Block | From | To | Value | |||
---|---|---|---|---|---|---|---|
0xa0949d897b11f654fe51ea8bfc1c39943ef4edbcdce2d9d2deea0ff50605c607 | 31547963 | 297 days 22 hrs ago | 0xf656d243a23a0987329ac6522292f4104a7388e1 | Contract Creation | 0 MATIC |
[ Download CSV Export ]
This contract may be a proxy contract. Click on More Options and select Is this a proxy? to confirm and enable the "Read as Proxy" & "Write as Proxy" tabs.
Similar Match Source Code
Note: This contract matches the deployed ByteCode of the Source Code for Contract 0x5aa0197D0d3E05c4aA070dfA2f54Cd67A447173A
Contract Name:
CErc20Delegator
Compiler Version
v0.8.10+commit.fc410830
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: UNLICENSED pragma solidity >=0.8.0; contract CDelegationStorage { /** * @notice Implementation address for this contract */ address public implementation; } abstract contract CDelegateInterface is CDelegationStorage { /** * @notice Emitted when implementation is changed */ event NewImplementation(address oldImplementation, address newImplementation); /** * @notice Called by the admin to update the implementation of the delegator * @param implementation_ The address of the new implementation for delegation * @param allowResign Flag to indicate whether to call _resignImplementation on the old implementation * @param becomeImplementationData The encoded bytes data to be passed to _becomeImplementation */ function _setImplementationSafe( address implementation_, bool allowResign, bytes calldata becomeImplementationData ) external virtual; /** * @notice Called by the delegator on a delegate to initialize it for duty * @dev Should revert if any issues arise which make it unfit for delegation * @param data The encoded bytes data for any initialization */ function _becomeImplementation(bytes calldata data) public virtual; /** * @notice Function called before all delegator functions * @dev Checks comptroller.autoImplementation and upgrades the implementation if necessary */ function _prepare() external payable virtual; function contractType() external virtual returns (string memory); }
// SPDX-License-Identifier: UNLICENSED pragma solidity >=0.8.0; import "./ComptrollerInterface.sol"; import "./InterestRateModel.sol"; import "./CDelegateInterface.sol"; /** * @title Compound's CErc20Delegator Contract * @notice CTokens which wrap an EIP-20 underlying and delegate to an implementation * @author Compound */ contract CErc20Delegator is CDelegationStorage { /** * @notice Construct a new money market * @param underlying_ The address of the underlying asset * @param comptroller_ The address of the Comptroller * @param interestRateModel_ The address of the interest rate model * @param name_ ERC-20 name of this token * @param symbol_ ERC-20 symbol of this token * @param implementation_ The address of the implementation the contract delegates to * @param becomeImplementationData The encoded args for becomeImplementation */ constructor( address underlying_, ComptrollerInterface comptroller_, address payable fuseAdmin_, InterestRateModel interestRateModel_, string memory name_, string memory symbol_, address implementation_, bytes memory becomeImplementationData, uint256 reserveFactorMantissa_, uint256 adminFeeMantissa_ ) { // First delegate gets to initialize the delegator (i.e. storage contract) delegateTo( implementation_, abi.encodeWithSignature( "initialize(address,address,address,address,string,string,uint256,uint256)", underlying_, comptroller_, fuseAdmin_, interestRateModel_, name_, symbol_, reserveFactorMantissa_, adminFeeMantissa_ ) ); // New implementations always get set via the settor (post-initialize) delegateTo( implementation_, abi.encodeWithSignature( "_setImplementationSafe(address,bool,bytes)", implementation_, false, becomeImplementationData ) ); } /** * @notice Internal method to delegate execution to another contract * @dev It returns to the external caller whatever the implementation returns or forwards reverts * @param callee The contract to delegatecall * @param data The raw data to delegatecall * @return The returned bytes from the delegatecall */ function delegateTo(address callee, bytes memory data) internal returns (bytes memory) { (bool success, bytes memory returnData) = callee.delegatecall(data); assembly { if eq(success, 0) { revert(add(returnData, 0x20), returndatasize()) } } return returnData; } /** * @notice Delegates execution to an implementation contract * @dev It returns to the external caller whatever the implementation returns or forwards reverts */ receive() external payable {} fallback() external payable { // Cannot send value to CErc20Delegator require(msg.value == 0, "CErc20Delegator:fallback: cannot send value to fallback"); // Check for automatic implementation delegateTo(implementation, abi.encodeWithSignature("_prepare()")); // delegate all other functions to current implementation (bool success, ) = implementation.delegatecall(msg.data); assembly { let free_mem_ptr := mload(0x40) returndatacopy(free_mem_ptr, 0, returndatasize()) switch success case 0 { revert(free_mem_ptr, returndatasize()) } default { return(free_mem_ptr, returndatasize()) } } } }
// SPDX-License-Identifier: UNLICENSED pragma solidity >=0.8.0; abstract contract ComptrollerInterface { /// @notice Indicator that this is a Comptroller contract (for inspection) bool public constant isComptroller = true; function getRewardsDistributors() external view virtual returns (address[] memory); function getMaxRedeemOrBorrow( address account, address cToken, bool isBorrow ) external virtual returns (uint256); /*** Assets You Are In ***/ function enterMarkets(address[] calldata cTokens) external virtual returns (uint256[] memory); function exitMarket(address cToken) external virtual returns (uint256); /*** Policy Hooks ***/ function mintAllowed( address cToken, address minter, uint256 mintAmount ) external virtual returns (uint256); function redeemAllowed( address cToken, address redeemer, uint256 redeemTokens ) external virtual returns (uint256); function redeemVerify( address cToken, address redeemer, uint256 redeemAmount, uint256 redeemTokens ) external virtual; function borrowAllowed( address cToken, address borrower, uint256 borrowAmount ) external virtual returns (uint256); function borrowWithinLimits(address cToken, uint256 accountBorrowsNew) external virtual returns (uint256); function repayBorrowAllowed( address cToken, address payer, address borrower, uint256 repayAmount ) external virtual returns (uint256); function liquidateBorrowAllowed( address cTokenBorrowed, address cTokenCollateral, address liquidator, address borrower, uint256 repayAmount ) external virtual returns (uint256); function seizeAllowed( address cTokenCollateral, address cTokenBorrowed, address liquidator, address borrower, uint256 seizeTokens ) external virtual returns (uint256); function transferAllowed( address cToken, address src, address dst, uint256 transferTokens ) external virtual returns (uint256); /*** Liquidity/Liquidation Calculations ***/ function liquidateCalculateSeizeTokens( address cTokenBorrowed, address cTokenCollateral, uint256 repayAmount ) external view virtual returns (uint256, uint256); /*** Pool-Wide/Cross-Asset Reentrancy Prevention ***/ function _beforeNonReentrant() external virtual; function _afterNonReentrant() external virtual; }
// SPDX-License-Identifier: UNLICENSED pragma solidity >=0.8.0; /** * @title Compound's InterestRateModel Interface * @author Compound */ abstract contract InterestRateModel { /// @notice Indicator that this is an InterestRateModel contract (for inspection) bool public constant isInterestRateModel = true; /** * @notice Calculates the current borrow interest rate per block * @param cash The total amount of cash the market has * @param borrows The total amount of borrows the market has outstanding * @param reserves The total amount of reserves the market has * @return The borrow rate per block (as a percentage, and scaled by 1e18) */ function getBorrowRate( uint256 cash, uint256 borrows, uint256 reserves ) public view virtual returns (uint256); /** * @notice Calculates the current supply interest rate per block * @param cash The total amount of cash the market has * @param borrows The total amount of borrows the market has outstanding * @param reserves The total amount of reserves the market has * @param reserveFactorMantissa The current reserve factor the market has * @return The supply rate per block (as a percentage, and scaled by 1e18) */ function getSupplyRate( uint256 cash, uint256 borrows, uint256 reserves, uint256 reserveFactorMantissa ) public view virtual returns (uint256); }
{ "remappings": [], "optimizer": { "enabled": true, "runs": 200 }, "metadata": { "useLiteralContent": true, "bytecodeHash": "none" }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "abi" ] } }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"address","name":"underlying_","type":"address"},{"internalType":"contract ComptrollerInterface","name":"comptroller_","type":"address"},{"internalType":"address payable","name":"fuseAdmin_","type":"address"},{"internalType":"contract InterestRateModel","name":"interestRateModel_","type":"address"},{"internalType":"string","name":"name_","type":"string"},{"internalType":"string","name":"symbol_","type":"string"},{"internalType":"address","name":"implementation_","type":"address"},{"internalType":"bytes","name":"becomeImplementationData","type":"bytes"},{"internalType":"uint256","name":"reserveFactorMantissa_","type":"uint256"},{"internalType":"uint256","name":"adminFeeMantissa_","type":"uint256"}],"stateMutability":"nonpayable","type":"constructor"},{"stateMutability":"payable","type":"fallback"},{"inputs":[],"name":"implementation","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"stateMutability":"payable","type":"receive"}]
Contract Creation Code
608060405234801561001057600080fd5b5060405161069638038061069683398101604081905261002f91610246565b610085848b8b8b8b8b8b8989604051602401610052989796959493929190610363565b60408051601f198184030181529190526020810180516001600160e01b039081166306db3ecd60e01b179091526100e316565b506100d384856000866040516024016100a0939291906103cc565b60408051601f198184030181529190526020810180516001600160e01b039081166350d85b7360e01b179091526100e316565b505050505050505050505061041d565b6060600080846001600160a01b0316846040516101009190610401565b600060405180830381855af49150503d806000811461013b576040519150601f19603f3d011682016040523d82523d6000602084013e610140565b606091505b50915091506000821415610155573d60208201fd5b949350505050565b80516001600160a01b038116811461017457600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b838110156101aa578181015183820152602001610192565b838111156101b9576000848401525b50505050565b600082601f8301126101d057600080fd5b81516001600160401b03808211156101ea576101ea610179565b604051601f8301601f19908116603f0116810190828211818310171561021257610212610179565b8160405283815286602085880101111561022b57600080fd5b61023c84602083016020890161018f565b9695505050505050565b6000806000806000806000806000806101408b8d03121561026657600080fd5b61026f8b61015d565b995061027d60208c0161015d565b985061028b60408c0161015d565b975061029960608c0161015d565b60808c01519097506001600160401b03808211156102b657600080fd5b6102c28e838f016101bf565b975060a08d01519150808211156102d857600080fd5b6102e48e838f016101bf565b96506102f260c08e0161015d565b955060e08d015191508082111561030857600080fd5b506103158d828e016101bf565b9350506101008b015191506101208b015190509295989b9194979a5092959850565b6000815180845261034f81602086016020860161018f565b601f01601f19169290920160200192915050565b6001600160a01b0389811682528881166020830152878116604083015286166060820152610100608082018190526000906103a083820188610337565b905082810360a08401526103b48187610337565b60c0840195909552505060e001529695505050505050565b6001600160a01b038416815282151560208201526060604082018190526000906103f890830184610337565b95945050505050565b6000825161041381846020870161018f565b9190910192915050565b61026a8061042c6000396000f3fe6080604052600436106100225760003560e01c80635c60da1b1461015c57610029565b3661002957005b34156100a15760405162461bcd60e51b815260206004820152603760248201527f43457263323044656c656761746f723a66616c6c6261636b3a2063616e6e6f7460448201527f2073656e642076616c756520746f2066616c6c6261636b000000000000000000606482015260840160405180910390fd5b6000546040805160048152602481019091526020810180516001600160e01b031663076de25160e21b1790526100e0916001600160a01b031690610198565b50600080546040516001600160a01b03909116906101019083903690610212565b600060405180830381855af49150503d806000811461013c576040519150601f19603f3d011682016040523d82523d6000602084013e610141565b606091505b505090506040513d6000823e818015610158573d82f35b3d82fd5b34801561016857600080fd5b5060005461017c906001600160a01b031681565b6040516001600160a01b03909116815260200160405180910390f35b6060600080846001600160a01b0316846040516101b59190610222565b600060405180830381855af49150503d80600081146101f0576040519150601f19603f3d011682016040523d82523d6000602084013e6101f5565b606091505b5091509150600082141561020a573d60208201fd5b949350505050565b8183823760009101908152919050565b6000825160005b818110156102435760208186018101518583015201610229565b81811115610252576000828501525b50919091019291505056fea164736f6c634300080a000a000000000000000000000000e0b52e49357fd4daf2c15e02058dce6bc0057db4000000000000000000000000d265ff7e5487e9dd556a4bb900cca6d087eb3ad2000000000000000000000000f656d243a23a0987329ac6522292f4104a7388e1000000000000000000000000ea128f2de6d18f61716046d0b4930c353f2aa4e600000000000000000000000000000000000000000000000000000000000001400000000000000000000000000000000000000000000000000000000000000180000000000000000000000000621093937cb4d9f22eb76096def6ab52748ec40500000000000000000000000000000000000000000000000000000000000001c0000000000000000000000000000000000000000000000000002386f26fc10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000184a6172766973206a4649415420616745555220546f6b656e000000000000000000000000000000000000000000000000000000000000000000000000000000086661674555522d3100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000
Deployed ByteCode Sourcemap
331:3149:1:-:0;;;;;;;;;;;;;;;;;;;;;;;;;2881:9;:14;2873:82;;;;-1:-1:-1;;;2873:82:1;;216:2:4;2873:82:1;;;198:21:4;255:2;235:18;;;228:30;294:34;274:18;;;267:62;365:25;345:18;;;338:53;408:19;;2873:82:1;;;;;;;;3015:14;;3031:37;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;3031:37:1;-1:-1:-1;;;3031:37:1;;;3004:65;;-1:-1:-1;;;;;3015:14:1;;3004:10;:65::i;:::-;-1:-1:-1;3139:12:1;3157:14;;:37;;-1:-1:-1;;;;;3157:14:1;;;;:37;;3139:12;;3185:8;;3157:37;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;3138:56;;;3244:4;3238:11;3288:16;3285:1;3271:12;3256:49;3320:7;3334:63;;;;3443:16;3429:12;3422:38;3334:63;3372:16;3358:12;3351:38;163:29:0;;;;;;;;;;-1:-1:-1;163:29:0;;;;-1:-1:-1;;;;;163:29:0;;;;;;-1:-1:-1;;;;;878:32:4;;;860:51;;848:2;833:18;163:29:0;;;;;;;2284:299:1;2357:12;2378;2392:23;2419:6;-1:-1:-1;;;;;2419:19:1;2439:4;2419:25;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2377:67;;;;2482:1;2473:7;2470:14;2467:83;;;2525:16;2518:4;2506:10;2502:21;2495:47;2467:83;2568:10;2284:299;-1:-1:-1;;;;2284:299:1:o;438:271:4:-;621:6;613;608:3;595:33;577:3;647:16;;672:13;;;647:16;438:271;-1:-1:-1;438:271:4:o;922:426::-;1051:3;1089:6;1083:13;1114:1;1124:129;1138:6;1135:1;1132:13;1124:129;;;1236:4;1220:14;;;1216:25;;1210:32;1197:11;;;1190:53;1153:12;1124:129;;;1271:6;1268:1;1265:13;1262:48;;;1306:1;1297:6;1292:3;1288:16;1281:27;1262:48;-1:-1:-1;1326:16:4;;;;;922:426;-1:-1:-1;;922:426:4:o
Swarm Source
none://164736f6c634300080a000a
Age | Block | Fee Address | BC Fee Address | Voting Power | Jailed | Incoming |
---|
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.