Overview
ETH Balance
0 ETH
Eth Value
$0.00More Info
Private Name Tags
ContractCreator
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Latest 1 internal transaction
Advanced mode:
Parent Transaction Hash | Method | Block |
From
|
To
|
|||
---|---|---|---|---|---|---|---|
0x60806040 | 16869468 | 764 days ago | Contract Creation | 0 ETH |
Loading...
Loading
Contract Name:
MockSiloRepository
Compiler Version
v0.7.1+commit.f4a555be
Optimization Enabled:
Yes with 9999 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: GPL-3.0-or-later // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU 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 General Public License for more details. // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. pragma solidity ^0.7.0; pragma experimental ABIEncoderV2; import "../interfaces/ISiloRepository.sol"; import "../interfaces/IInterestRateModel.sol"; import "./MockInterestRateModel.sol"; import "@orbcollective/shared-dependencies/contracts/MockMaliciousQueryReverter.sol"; contract MockSiloRepository is ISiloRepository, MockMaliciousQueryReverter { uint256 private _protocolShareFee; MockInterestRateModel private immutable _mockModel; constructor(uint256 compoundRate, uint256 currentRate) { _mockModel = new MockInterestRateModel(compoundRate, currentRate); } function getInterestRateModel( address, /* silo */ address /* asset */ ) external view override returns (IInterestRateModel) { maybeRevertMaliciously(); return _mockModel; } function protocolShareFee() external view override returns (uint256) { maybeRevertMaliciously(); return _protocolShareFee; } function setProtocolShareFee(uint256 shareFee) external { _protocolShareFee = shareFee; } }
// SPDX-License-Identifier: GPL-3.0-or-later // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU 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 General Public License for more details. // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. pragma solidity ^0.7.0; contract MockMaliciousQueryReverter { enum RevertType { DoNotRevert, NonMalicious, MaliciousSwapQuery, MaliciousJoinExitQuery } RevertType public revertType = RevertType.DoNotRevert; function setRevertType(RevertType newRevertType) external { revertType = newRevertType; } function maybeRevertMaliciously() public view { if (revertType == RevertType.NonMalicious) { revert("NON_MALICIOUS_REVERT"); } else if (revertType == RevertType.MaliciousSwapQuery) { spoofSwapQueryRevert(); } else if (revertType == RevertType.MaliciousJoinExitQuery) { spoofJoinExitQueryRevert(); } else { // Do nothing } } function spoofJoinExitQueryRevert() public pure { uint256[] memory tokenAmounts = new uint256[](2); tokenAmounts[0] = 1; tokenAmounts[1] = 2; uint256 bptAmount = 420; // solhint-disable-next-line no-inline-assembly assembly { // We will return a raw representation of `bptAmount` and `tokenAmounts` in memory, which is composed of // a 32-byte uint256, followed by a 32-byte for the array length, and finally the 32-byte uint256 values // Because revert expects a size in bytes, we multiply the array length (stored at `tokenAmounts`) by 32 let size := mul(mload(tokenAmounts), 32) // We store the `bptAmount` in the previous slot to the `tokenAmounts` array. We can make sure there // will be at least one available slot due to how the memory scratch space works. // We can safely overwrite whatever is stored in this slot as we will revert immediately after that. let start := sub(tokenAmounts, 0x20) mstore(start, bptAmount) // We send one extra value for the error signature "QueryError(uint256,uint256[])" which is 0x43adbafb // We use the previous slot to `bptAmount`. mstore(sub(start, 0x20), 0x0000000000000000000000000000000000000000000000000000000043adbafb) start := sub(start, 0x04) // When copying from `tokenAmounts` into returndata, we copy the additional 68 bytes to also return // the `bptAmount`, the array's length, and the error signature. revert(start, add(size, 68)) } } function spoofSwapQueryRevert() public pure { int256[] memory deltas = new int256[](2); deltas[0] = 1; deltas[1] = 2; // solhint-disable-next-line no-inline-assembly assembly { // We will return a raw representation of the array in memory, which is composed of a 32 byte length, // followed by the 32 byte int256 values. Because revert expects a size in bytes, we multiply the array // length (stored at `deltas`) by 32. let size := mul(mload(deltas), 32) // We send one extra value for the error signature "QueryError(int256[])" which is 0xfa61cc12. // We store it in the previous slot to the `deltas` array. We know there will be at least one available // slot due to how the memory scratch space works. // We can safely overwrite whatever is stored in this slot as we will revert immediately after that. mstore(sub(deltas, 0x20), 0x00000000000000000000000000000000000000000000000000000000fa61cc12) let start := sub(deltas, 0x04) // When copying from `deltas` into returndata, we copy an additional 36 bytes to also return the array's // length and the error signature. revert(start, add(size, 36)) } } }
// SPDX-License-Identifier: GPL-3.0-or-later // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU 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 General Public License for more details. // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. pragma solidity ^0.7.0; pragma experimental ABIEncoderV2; import "../interfaces/IInterestRateModel.sol"; import "@orbcollective/shared-dependencies/contracts/MockMaliciousQueryReverter.sol"; contract MockInterestRateModel is IInterestRateModel, MockMaliciousQueryReverter { uint256 private _rcomp; uint256 private _rcur; constructor(uint256 comp, uint256 cur) { _rcomp = comp; _rcur = cur; } function getCompoundInterestRate( address, /* _silo */ address, /* _asset */ uint256 /* _blockTimestamp */ ) external view override returns (uint256 rcomp) { maybeRevertMaliciously(); return _rcomp; } function getCurrentInterestRate( address, /* _silo */ address, /* _asset */ uint256 /* _blockTimestamp */ ) external view override returns (uint256 rcur) { return _rcur; } function setCompoundInterestRate(uint256 rate) external { maybeRevertMaliciously(); _rcomp = rate; } function setCurrentInterestRate(uint256 rate) external { maybeRevertMaliciously(); _rcur = rate; } }
// SPDX-License-Identifier: GPL-3.0-or-later // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU 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 General Public License for more details. // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. pragma solidity >=0.7.0 <0.9.0; interface IInterestRateModel { /** * @dev get compound interest rate * @param silo address of Silo * @param asset address of an asset in Silo for which interest rate should be calculated * @param blockTimestamp current block timestamp * @return rcomp compounded interest rate from last update until now (1e18 == 100%) */ function getCompoundInterestRate( address silo, address asset, uint256 blockTimestamp ) external view returns (uint256 rcomp); /** * @dev get current annual interest rate * @param silo address of Silo * @param asset address of an asset in Silo for which interest rate should be calculated * @param blockTimestamp current block timestamp * @return rcur current annual interest rate (1e18 == 100%) */ function getCurrentInterestRate( address silo, address asset, uint256 blockTimestamp ) external view returns (uint256 rcur); }
// SPDX-License-Identifier: GPL-3.0-or-later // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU 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 General Public License for more details. // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. pragma solidity >=0.7.0 <0.9.0; import "./IInterestRateModel.sol"; interface ISiloRepository { /** * @notice Get Interest Rate Model address for asset in given Silo * @dev If dedicated config is not set, method returns default config * @param silo address of Silo * @param asset address of an asset * @return address of interest rate model */ function getInterestRateModel(address silo, address asset) external view returns (IInterestRateModel); /** * @dev Get protocol share fee * @return protocol share fee in precision points (Solvency._PRECISION_DECIMALS == 100%) */ function protocolShareFee() external view returns (uint256); }
{ "optimizer": { "enabled": true, "runs": 9999 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[{"internalType":"uint256","name":"compoundRate","type":"uint256"},{"internalType":"uint256","name":"currentRate","type":"uint256"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"}],"name":"getInterestRateModel","outputs":[{"internalType":"contract IInterestRateModel","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maybeRevertMaliciously","outputs":[],"stateMutability":"view","type":"function"},{"inputs":[],"name":"protocolShareFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"revertType","outputs":[{"internalType":"enum MockMaliciousQueryReverter.RevertType","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"shareFee","type":"uint256"}],"name":"setProtocolShareFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"enum MockMaliciousQueryReverter.RevertType","name":"newRevertType","type":"uint8"}],"name":"setRevertType","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"spoofJoinExitQueryRevert","outputs":[],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"spoofSwapQueryRevert","outputs":[],"stateMutability":"pure","type":"function"}]
Contract Creation Code
60a06040526000805460ff1916905534801561001a57600080fd5b50604051610b15380380610b1583398101604081905261003991610094565b818160405161004790610087565b6100529291906100b7565b604051809103906000f08015801561006e573d6000803e3d6000fd5b5060601b6001600160601b031916608052506100c59050565b61055b806105ba83390190565b600080604083850312156100a6578182fd5b505080516020909101519092909150565b918252602082015260400190565b60805160601c6104d86100e26000398061028a52506104d86000f3fe608060405234801561001057600080fd5b50600436106100885760003560e01c806348b3eabc1161005b57806348b3eabc146100d05780637ce3ee48146100f05780639ab1e6b3146100f8578063d652e8c61461010b57610088565b8063146d4eee1461008d57806325ed3d441461009757806329478cb4146100b55780632cd10339146100bd575b600080fd5b610095610120565b005b61009f610190565b6040516100ac9190610499565b60405180910390f35b6100956101a1565b6100956100cb3660046103ef565b61023e565b6100e36100de3660046103bb565b61027d565b6040516100ac919061042d565b6100956102b0565b610095610106366004610415565b610389565b61011361038e565b6040516100ac919061044e565b604080516002808252606080830184529260208301908036833701905050905060018160008151811061014f57fe5b60200260200101818152505060028160018151811061016a57fe5b602002602001018181525050602081510263fa61cc126020830352600482036024820181fd5b600061019a6101a1565b5060015490565b600160005460ff1660038111156101b457fe5b14156101f5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016101ec90610462565b60405180910390fd5b600260005460ff16600381111561020857fe5b141561021b57610216610120565b61023c565b600360005460ff16600381111561022e57fe5b141561023c576102166102b0565b565b600080548291907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600183600381111561027557fe5b021790555050565b60006102876101a1565b507f00000000000000000000000000000000000000000000000000000000000000005b92915050565b60408051600280825260608083018452926020830190803683370190505090506001816000815181106102df57fe5b6020026020010181815250506002816001815181106102fa57fe5b60209081029190910181019190915281516101a47fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe084018190526343adbafb7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc085015291027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffdc83016044820181fd5b600155565b60005460ff1681565b803573ffffffffffffffffffffffffffffffffffffffff811681146102aa57600080fd5b600080604083850312156103cd578182fd5b6103d78484610397565b91506103e68460208501610397565b90509250929050565b600060208284031215610400578081fd5b81356004811061040e578182fd5b9392505050565b600060208284031215610426578081fd5b5035919050565b73ffffffffffffffffffffffffffffffffffffffff91909116815260200190565b602081016004831061045c57fe5b91905290565b60208082526014908201527f4e4f4e5f4d414c4943494f55535f524556455254000000000000000000000000604082015260600190565b9081526020019056fea26469706673582212209832fcc1e6db25bf58904f8984db194ed6862d3d6041391908c5464f02879dc564736f6c6343000701003360806040526000805460ff1916905534801561001a57600080fd5b5060405161055b38038061055b83398101604081905261003991610047565b60019190915560025561006a565b60008060408385031215610059578182fd5b505080516020909101519092909150565b6104e2806100796000396000f3fe608060405234801561001057600080fd5b50600436106100a35760003560e01c80632b38a573116100765780637ce3ee481161005b5780637ce3ee481461011c578063b1e0176514610124578063d652e8c614610137576100a3565b80632b38a573146100f65780632cd1033914610109576100a3565b8063071962ff146100a85780630d50690b146100d1578063146d4eee146100e657806329478cb4146100ee575b600080fd5b6100bb6100b63660046103dd565b61014c565b6040516100c891906104a3565b60405180910390f35b6100e46100df366004610440565b610156565b005b6100e4610163565b6100e46101d3565b6100e4610104366004610440565b610270565b6100e461011736600461041a565b61027d565b6100e46102bc565b6100bb6101323660046103dd565b610395565b61013f6103aa565b6040516100c89190610458565b6002549392505050565b61015e6101d3565b600155565b604080516002808252606080830184529260208301908036833701905050905060018160008151811061019257fe5b6020026020010181815250506002816001815181106101ad57fe5b602002602001018181525050602081510263fa61cc126020830352600482036024820181fd5b600160005460ff1660038111156101e657fe5b1415610227576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161021e9061046c565b60405180910390fd5b600260005460ff16600381111561023a57fe5b141561024d57610248610163565b61026e565b600360005460ff16600381111561026057fe5b141561026e576102486102bc565b565b6102786101d3565b600255565b600080548291907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660018360038111156102b457fe5b021790555050565b60408051600280825260608083018452926020830190803683370190505090506001816000815181106102eb57fe5b60200260200101818152505060028160018151811061030657fe5b60209081029190910181019190915281516101a47fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe084018190526343adbafb7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc085015291027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffdc83016044820181fd5b600061039f6101d3565b506001549392505050565b60005460ff1681565b803573ffffffffffffffffffffffffffffffffffffffff811681146103d757600080fd5b92915050565b6000806000606084860312156103f1578283fd5b6103fb85856103b3565b925061040a85602086016103b3565b9150604084013590509250925092565b60006020828403121561042b578081fd5b813560048110610439578182fd5b9392505050565b600060208284031215610451578081fd5b5035919050565b602081016004831061046657fe5b91905290565b60208082526014908201527f4e4f4e5f4d414c4943494f55535f524556455254000000000000000000000000604082015260600190565b9081526020019056fea26469706673582212206bd8a5f9c9e7bf1454c7a8972de7a585803fe273ef52421f5e9df80c47818f3964736f6c6343000701003300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106100885760003560e01c806348b3eabc1161005b57806348b3eabc146100d05780637ce3ee48146100f05780639ab1e6b3146100f8578063d652e8c61461010b57610088565b8063146d4eee1461008d57806325ed3d441461009757806329478cb4146100b55780632cd10339146100bd575b600080fd5b610095610120565b005b61009f610190565b6040516100ac9190610499565b60405180910390f35b6100956101a1565b6100956100cb3660046103ef565b61023e565b6100e36100de3660046103bb565b61027d565b6040516100ac919061042d565b6100956102b0565b610095610106366004610415565b610389565b61011361038e565b6040516100ac919061044e565b604080516002808252606080830184529260208301908036833701905050905060018160008151811061014f57fe5b60200260200101818152505060028160018151811061016a57fe5b602002602001018181525050602081510263fa61cc126020830352600482036024820181fd5b600061019a6101a1565b5060015490565b600160005460ff1660038111156101b457fe5b14156101f5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016101ec90610462565b60405180910390fd5b600260005460ff16600381111561020857fe5b141561021b57610216610120565b61023c565b600360005460ff16600381111561022e57fe5b141561023c576102166102b0565b565b600080548291907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600183600381111561027557fe5b021790555050565b60006102876101a1565b507f0000000000000000000000007c3209613c658568306520eb54192b3feea8a07f5b92915050565b60408051600280825260608083018452926020830190803683370190505090506001816000815181106102df57fe5b6020026020010181815250506002816001815181106102fa57fe5b60209081029190910181019190915281516101a47fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe084018190526343adbafb7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc085015291027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffdc83016044820181fd5b600155565b60005460ff1681565b803573ffffffffffffffffffffffffffffffffffffffff811681146102aa57600080fd5b600080604083850312156103cd578182fd5b6103d78484610397565b91506103e68460208501610397565b90509250929050565b600060208284031215610400578081fd5b81356004811061040e578182fd5b9392505050565b600060208284031215610426578081fd5b5035919050565b73ffffffffffffffffffffffffffffffffffffffff91909116815260200190565b602081016004831061045c57fe5b91905290565b60208082526014908201527f4e4f4e5f4d414c4943494f55535f524556455254000000000000000000000000604082015260600190565b9081526020019056fea26469706673582212209832fcc1e6db25bf58904f8984db194ed6862d3d6041391908c5464f02879dc564736f6c63430007010033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
-----Decoded View---------------
Arg [0] : compoundRate (uint256): 0
Arg [1] : currentRate (uint256): 0
-----Encoded View---------------
2 Constructor Arguments found :
Arg [0] : 0000000000000000000000000000000000000000000000000000000000000000
Arg [1] : 0000000000000000000000000000000000000000000000000000000000000000
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.