More Info
Private Name Tags
ContractCreator
Latest 25 from a total of 381 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Redeem All | 21241526 | 39 days ago | IN | 0 ETH | 0.00603132 | ||||
Redeem All | 21237596 | 40 days ago | IN | 0 ETH | 0.00296526 | ||||
Redeem All | 20974100 | 77 days ago | IN | 0 ETH | 0.00214561 | ||||
Redeem All | 20812178 | 99 days ago | IN | 0 ETH | 0.0062265 | ||||
Rebuild Cache | 20769988 | 105 days ago | IN | 0 ETH | 0.00016228 | ||||
Redeem All | 20464681 | 148 days ago | IN | 0 ETH | 0.00195285 | ||||
Redeem All | 20407456 | 156 days ago | IN | 0 ETH | 0.00045955 | ||||
Redeem | 20392140 | 158 days ago | IN | 0 ETH | 0.0006846 | ||||
Redeem | 19953127 | 219 days ago | IN | 0 ETH | 0.00086314 | ||||
Redeem All | 19790379 | 242 days ago | IN | 0 ETH | 0.00582437 | ||||
Redeem | 19679854 | 258 days ago | IN | 0 ETH | 0.00202017 | ||||
Redeem All | 19659191 | 260 days ago | IN | 0 ETH | 0.00796244 | ||||
Redeem | 19473055 | 287 days ago | IN | 0 ETH | 0.00578501 | ||||
Redeem | 19463922 | 288 days ago | IN | 0 ETH | 0.00778446 | ||||
Redeem All | 19389466 | 298 days ago | IN | 0 ETH | 0.02909057 | ||||
Redeem | 19350376 | 304 days ago | IN | 0 ETH | 0.0119593 | ||||
Redeem | 19104537 | 338 days ago | IN | 0 ETH | 0.00239797 | ||||
Redeem All | 18969272 | 357 days ago | IN | 0 ETH | 0.00758453 | ||||
Redeem | 18829946 | 377 days ago | IN | 0 ETH | 0.01151421 | ||||
Redeem | 18675952 | 398 days ago | IN | 0 ETH | 0.00705936 | ||||
Redeem | 18675921 | 398 days ago | IN | 0 ETH | 0.00660018 | ||||
Redeem | 18612714 | 407 days ago | IN | 0 ETH | 0.00490455 | ||||
Redeem All | 18552182 | 416 days ago | IN | 0 ETH | 0.0052296 | ||||
Redeem All | 18498640 | 423 days ago | IN | 0 ETH | 0.00413057 | ||||
Redeem | 18415606 | 435 days ago | IN | 0 ETH | 0.00438101 |
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
Contract Name:
SynthRedeemer
Compiler Version
v0.5.16+commit.9c3226ce
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity)
/** *Submitted for verification at Etherscan.io on 2021-09-10 */ /* ____ __ __ __ _ / __/__ __ ___ / /_ / / ___ / /_ (_)__ __ _\ \ / // // _ \/ __// _ \/ -_)/ __// / \ \ / /___/ \_, //_//_/\__//_//_/\__/ \__//_/ /_\_\ /___/ * Synthetix: SynthRedeemer.sol * * Latest source (may be newer): https://github.com/Synthetixio/synthetix/blob/master/contracts/SynthRedeemer.sol * Docs: https://docs.synthetix.io/contracts/SynthRedeemer * * Contract Dependencies: * - IAddressResolver * - ISynthRedeemer * - MixinResolver * - Owned * Libraries: * - SafeDecimalMath * - SafeMath * * MIT License * =========== * * Copyright (c) 2021 Synthetix * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE */ pragma solidity ^0.5.16; // https://docs.synthetix.io/contracts/source/contracts/owned contract Owned { address public owner; address public nominatedOwner; constructor(address _owner) public { require(_owner != address(0), "Owner address cannot be 0"); owner = _owner; emit OwnerChanged(address(0), _owner); } function nominateNewOwner(address _owner) external onlyOwner { nominatedOwner = _owner; emit OwnerNominated(_owner); } function acceptOwnership() external { require(msg.sender == nominatedOwner, "You must be nominated before you can accept ownership"); emit OwnerChanged(owner, nominatedOwner); owner = nominatedOwner; nominatedOwner = address(0); } modifier onlyOwner { _onlyOwner(); _; } function _onlyOwner() private view { require(msg.sender == owner, "Only the contract owner may perform this action"); } event OwnerNominated(address newOwner); event OwnerChanged(address oldOwner, address newOwner); } // https://docs.synthetix.io/contracts/source/interfaces/iaddressresolver interface IAddressResolver { function getAddress(bytes32 name) external view returns (address); function getSynth(bytes32 key) external view returns (address); function requireAndGetAddress(bytes32 name, string calldata reason) external view returns (address); } // https://docs.synthetix.io/contracts/source/interfaces/isynth interface ISynth { // Views function currencyKey() external view returns (bytes32); function transferableSynths(address account) external view returns (uint); // Mutative functions function transferAndSettle(address to, uint value) external returns (bool); function transferFromAndSettle( address from, address to, uint value ) external returns (bool); // Restricted: used internally to Synthetix function burn(address account, uint amount) external; function issue(address account, uint amount) external; } // https://docs.synthetix.io/contracts/source/interfaces/iissuer interface IIssuer { // Views function anySynthOrSNXRateIsInvalid() external view returns (bool anyRateInvalid); function availableCurrencyKeys() external view returns (bytes32[] memory); function availableSynthCount() external view returns (uint); function availableSynths(uint index) external view returns (ISynth); function canBurnSynths(address account) external view returns (bool); function collateral(address account) external view returns (uint); function collateralisationRatio(address issuer) external view returns (uint); function collateralisationRatioAndAnyRatesInvalid(address _issuer) external view returns (uint cratio, bool anyRateIsInvalid); function debtBalanceOf(address issuer, bytes32 currencyKey) external view returns (uint debtBalance); function issuanceRatio() external view returns (uint); function lastIssueEvent(address account) external view returns (uint); function maxIssuableSynths(address issuer) external view returns (uint maxIssuable); function minimumStakeTime() external view returns (uint); function remainingIssuableSynths(address issuer) external view returns ( uint maxIssuable, uint alreadyIssued, uint totalSystemDebt ); function synths(bytes32 currencyKey) external view returns (ISynth); function getSynths(bytes32[] calldata currencyKeys) external view returns (ISynth[] memory); function synthsByAddress(address synthAddress) external view returns (bytes32); function totalIssuedSynths(bytes32 currencyKey, bool excludeOtherCollateral) external view returns (uint); function transferableSynthetixAndAnyRateIsInvalid(address account, uint balance) external view returns (uint transferable, bool anyRateIsInvalid); // Restricted: used internally to Synthetix function issueSynths(address from, uint amount) external; function issueSynthsOnBehalf( address issueFor, address from, uint amount ) external; function issueMaxSynths(address from) external; function issueMaxSynthsOnBehalf(address issueFor, address from) external; function burnSynths(address from, uint amount) external; function burnSynthsOnBehalf( address burnForAddress, address from, uint amount ) external; function burnSynthsToTarget(address from) external; function burnSynthsToTargetOnBehalf(address burnForAddress, address from) external; function burnForRedemption( address deprecatedSynthProxy, address account, uint balance ) external; function liquidateDelinquentAccount( address account, uint susdAmount, address liquidator ) external returns (uint totalRedeemed, uint amountToLiquidate); } // Inheritance // Internal references // https://docs.synthetix.io/contracts/source/contracts/addressresolver contract AddressResolver is Owned, IAddressResolver { mapping(bytes32 => address) public repository; constructor(address _owner) public Owned(_owner) {} /* ========== RESTRICTED FUNCTIONS ========== */ function importAddresses(bytes32[] calldata names, address[] calldata destinations) external onlyOwner { require(names.length == destinations.length, "Input lengths must match"); for (uint i = 0; i < names.length; i++) { bytes32 name = names[i]; address destination = destinations[i]; repository[name] = destination; emit AddressImported(name, destination); } } /* ========= PUBLIC FUNCTIONS ========== */ function rebuildCaches(MixinResolver[] calldata destinations) external { for (uint i = 0; i < destinations.length; i++) { destinations[i].rebuildCache(); } } /* ========== VIEWS ========== */ function areAddressesImported(bytes32[] calldata names, address[] calldata destinations) external view returns (bool) { for (uint i = 0; i < names.length; i++) { if (repository[names[i]] != destinations[i]) { return false; } } return true; } function getAddress(bytes32 name) external view returns (address) { return repository[name]; } function requireAndGetAddress(bytes32 name, string calldata reason) external view returns (address) { address _foundAddress = repository[name]; require(_foundAddress != address(0), reason); return _foundAddress; } function getSynth(bytes32 key) external view returns (address) { IIssuer issuer = IIssuer(repository["Issuer"]); require(address(issuer) != address(0), "Cannot find Issuer address"); return address(issuer.synths(key)); } /* ========== EVENTS ========== */ event AddressImported(bytes32 name, address destination); } // Internal references // https://docs.synthetix.io/contracts/source/contracts/mixinresolver contract MixinResolver { AddressResolver public resolver; mapping(bytes32 => address) private addressCache; constructor(address _resolver) internal { resolver = AddressResolver(_resolver); } /* ========== INTERNAL FUNCTIONS ========== */ function combineArrays(bytes32[] memory first, bytes32[] memory second) internal pure returns (bytes32[] memory combination) { combination = new bytes32[](first.length + second.length); for (uint i = 0; i < first.length; i++) { combination[i] = first[i]; } for (uint j = 0; j < second.length; j++) { combination[first.length + j] = second[j]; } } /* ========== PUBLIC FUNCTIONS ========== */ // Note: this function is public not external in order for it to be overridden and invoked via super in subclasses function resolverAddressesRequired() public view returns (bytes32[] memory addresses) {} function rebuildCache() public { bytes32[] memory requiredAddresses = resolverAddressesRequired(); // The resolver must call this function whenver it updates its state for (uint i = 0; i < requiredAddresses.length; i++) { bytes32 name = requiredAddresses[i]; // Note: can only be invoked once the resolver has all the targets needed added address destination = resolver.requireAndGetAddress(name, string(abi.encodePacked("Resolver missing target: ", name))); addressCache[name] = destination; emit CacheUpdated(name, destination); } } /* ========== VIEWS ========== */ function isResolverCached() external view returns (bool) { bytes32[] memory requiredAddresses = resolverAddressesRequired(); for (uint i = 0; i < requiredAddresses.length; i++) { bytes32 name = requiredAddresses[i]; // false if our cache is invalid or if the resolver doesn't have the required address if (resolver.getAddress(name) != addressCache[name] || addressCache[name] == address(0)) { return false; } } return true; } /* ========== INTERNAL FUNCTIONS ========== */ function requireAndGetAddress(bytes32 name) internal view returns (address) { address _foundAddress = addressCache[name]; require(_foundAddress != address(0), string(abi.encodePacked("Missing address: ", name))); return _foundAddress; } /* ========== EVENTS ========== */ event CacheUpdated(bytes32 name, address destination); } // https://docs.synthetix.io/contracts/source/interfaces/ierc20 interface IERC20 { // ERC20 Optional Views function name() external view returns (string memory); function symbol() external view returns (string memory); function decimals() external view returns (uint8); // Views function totalSupply() external view returns (uint); function balanceOf(address owner) external view returns (uint); function allowance(address owner, address spender) external view returns (uint); // Mutative functions function transfer(address to, uint value) external returns (bool); function approve(address spender, uint value) external returns (bool); function transferFrom( address from, address to, uint value ) external returns (bool); // Events event Transfer(address indexed from, address indexed to, uint value); event Approval(address indexed owner, address indexed spender, uint value); } interface ISynthRedeemer { // Rate of redemption - 0 for none function redemptions(address synthProxy) external view returns (uint redeemRate); // sUSD balance of deprecated token holder function balanceOf(IERC20 synthProxy, address account) external view returns (uint balanceOfInsUSD); // Full sUSD supply of token function totalSupply(IERC20 synthProxy) external view returns (uint totalSupplyInsUSD); function redeem(IERC20 synthProxy) external; function redeemAll(IERC20[] calldata synthProxies) external; function redeemPartial(IERC20 synthProxy, uint amountOfSynth) external; // Restricted to Issuer function deprecate(IERC20 synthProxy, uint rateToRedeem) external; } /** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because programmers usually assume that an overflow raises an * error, which is the standard behavior in high level programming languages. * `SafeMath` restores this intuition by reverting the transaction when an * operation overflows. * * Using this library instead of the unchecked operations eliminates an entire * class of bugs, so it's recommended to use it always. */ library SafeMath { /** * @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) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } /** * @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) { require(b <= a, "SafeMath: subtraction overflow"); uint256 c = a - b; return c; } /** * @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) { // 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-solidity/pull/522 if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } /** * @dev Returns the integer division of two unsigned integers. Reverts 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) internal pure returns (uint256) { // Solidity only automatically asserts when dividing by 0 require(b > 0, "SafeMath: division by zero"); uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts 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) { require(b != 0, "SafeMath: modulo by zero"); return a % b; } } // Libraries // https://docs.synthetix.io/contracts/source/libraries/safedecimalmath library SafeDecimalMath { using SafeMath for uint; /* Number of decimal places in the representations. */ uint8 public constant decimals = 18; uint8 public constant highPrecisionDecimals = 27; /* The number representing 1.0. */ uint public constant UNIT = 10**uint(decimals); /* The number representing 1.0 for higher fidelity numbers. */ uint public constant PRECISE_UNIT = 10**uint(highPrecisionDecimals); uint private constant UNIT_TO_HIGH_PRECISION_CONVERSION_FACTOR = 10**uint(highPrecisionDecimals - decimals); /** * @return Provides an interface to UNIT. */ function unit() external pure returns (uint) { return UNIT; } /** * @return Provides an interface to PRECISE_UNIT. */ function preciseUnit() external pure returns (uint) { return PRECISE_UNIT; } /** * @return The result of multiplying x and y, interpreting the operands as fixed-point * decimals. * * @dev A unit factor is divided out after the product of x and y is evaluated, * so that product must be less than 2**256. As this is an integer division, * the internal division always rounds down. This helps save on gas. Rounding * is more expensive on gas. */ function multiplyDecimal(uint x, uint y) internal pure returns (uint) { /* Divide by UNIT to remove the extra factor introduced by the product. */ return x.mul(y) / UNIT; } /** * @return The result of safely multiplying x and y, interpreting the operands * as fixed-point decimals of the specified precision unit. * * @dev The operands should be in the form of a the specified unit factor which will be * divided out after the product of x and y is evaluated, so that product must be * less than 2**256. * * Unlike multiplyDecimal, this function rounds the result to the nearest increment. * Rounding is useful when you need to retain fidelity for small decimal numbers * (eg. small fractions or percentages). */ function _multiplyDecimalRound( uint x, uint y, uint precisionUnit ) private pure returns (uint) { /* Divide by UNIT to remove the extra factor introduced by the product. */ uint quotientTimesTen = x.mul(y) / (precisionUnit / 10); if (quotientTimesTen % 10 >= 5) { quotientTimesTen += 10; } return quotientTimesTen / 10; } /** * @return The result of safely multiplying x and y, interpreting the operands * as fixed-point decimals of a precise unit. * * @dev The operands should be in the precise unit factor which will be * divided out after the product of x and y is evaluated, so that product must be * less than 2**256. * * Unlike multiplyDecimal, this function rounds the result to the nearest increment. * Rounding is useful when you need to retain fidelity for small decimal numbers * (eg. small fractions or percentages). */ function multiplyDecimalRoundPrecise(uint x, uint y) internal pure returns (uint) { return _multiplyDecimalRound(x, y, PRECISE_UNIT); } /** * @return The result of safely multiplying x and y, interpreting the operands * as fixed-point decimals of a standard unit. * * @dev The operands should be in the standard unit factor which will be * divided out after the product of x and y is evaluated, so that product must be * less than 2**256. * * Unlike multiplyDecimal, this function rounds the result to the nearest increment. * Rounding is useful when you need to retain fidelity for small decimal numbers * (eg. small fractions or percentages). */ function multiplyDecimalRound(uint x, uint y) internal pure returns (uint) { return _multiplyDecimalRound(x, y, UNIT); } /** * @return The result of safely dividing x and y. The return value is a high * precision decimal. * * @dev y is divided after the product of x and the standard precision unit * is evaluated, so the product of x and UNIT must be less than 2**256. As * this is an integer division, the result is always rounded down. * This helps save on gas. Rounding is more expensive on gas. */ function divideDecimal(uint x, uint y) internal pure returns (uint) { /* Reintroduce the UNIT factor that will be divided out by y. */ return x.mul(UNIT).div(y); } /** * @return The result of safely dividing x and y. The return value is as a rounded * decimal in the precision unit specified in the parameter. * * @dev y is divided after the product of x and the specified precision unit * is evaluated, so the product of x and the specified precision unit must * be less than 2**256. The result is rounded to the nearest increment. */ function _divideDecimalRound( uint x, uint y, uint precisionUnit ) private pure returns (uint) { uint resultTimesTen = x.mul(precisionUnit * 10).div(y); if (resultTimesTen % 10 >= 5) { resultTimesTen += 10; } return resultTimesTen / 10; } /** * @return The result of safely dividing x and y. The return value is as a rounded * standard precision decimal. * * @dev y is divided after the product of x and the standard precision unit * is evaluated, so the product of x and the standard precision unit must * be less than 2**256. The result is rounded to the nearest increment. */ function divideDecimalRound(uint x, uint y) internal pure returns (uint) { return _divideDecimalRound(x, y, UNIT); } /** * @return The result of safely dividing x and y. The return value is as a rounded * high precision decimal. * * @dev y is divided after the product of x and the high precision unit * is evaluated, so the product of x and the high precision unit must * be less than 2**256. The result is rounded to the nearest increment. */ function divideDecimalRoundPrecise(uint x, uint y) internal pure returns (uint) { return _divideDecimalRound(x, y, PRECISE_UNIT); } /** * @dev Convert a standard decimal representation to a high precision one. */ function decimalToPreciseDecimal(uint i) internal pure returns (uint) { return i.mul(UNIT_TO_HIGH_PRECISION_CONVERSION_FACTOR); } /** * @dev Convert a high precision decimal to a standard decimal representation. */ function preciseDecimalToDecimal(uint i) internal pure returns (uint) { uint quotientTimesTen = i / (UNIT_TO_HIGH_PRECISION_CONVERSION_FACTOR / 10); if (quotientTimesTen % 10 >= 5) { quotientTimesTen += 10; } return quotientTimesTen / 10; } // Computes `a - b`, setting the value to 0 if b > a. function floorsub(uint a, uint b) internal pure returns (uint) { return b >= a ? 0 : a - b; } } // Inheritence // Libraries // Internal references contract SynthRedeemer is ISynthRedeemer, MixinResolver { using SafeDecimalMath for uint; bytes32 public constant CONTRACT_NAME = "SynthRedeemer"; mapping(address => uint) public redemptions; bytes32 private constant CONTRACT_ISSUER = "Issuer"; bytes32 private constant CONTRACT_SYNTHSUSD = "SynthsUSD"; constructor(address _resolver) public MixinResolver(_resolver) {} function resolverAddressesRequired() public view returns (bytes32[] memory addresses) { addresses = new bytes32[](2); addresses[0] = CONTRACT_ISSUER; addresses[1] = CONTRACT_SYNTHSUSD; } function issuer() internal view returns (IIssuer) { return IIssuer(requireAndGetAddress(CONTRACT_ISSUER)); } function sUSD() internal view returns (IERC20) { return IERC20(requireAndGetAddress(CONTRACT_SYNTHSUSD)); } function totalSupply(IERC20 synthProxy) public view returns (uint supplyInsUSD) { supplyInsUSD = synthProxy.totalSupply().multiplyDecimal(redemptions[address(synthProxy)]); } function balanceOf(IERC20 synthProxy, address account) external view returns (uint balanceInsUSD) { balanceInsUSD = synthProxy.balanceOf(account).multiplyDecimal(redemptions[address(synthProxy)]); } function redeemAll(IERC20[] calldata synthProxies) external { for (uint i = 0; i < synthProxies.length; i++) { _redeem(synthProxies[i], synthProxies[i].balanceOf(msg.sender)); } } function redeem(IERC20 synthProxy) external { _redeem(synthProxy, synthProxy.balanceOf(msg.sender)); } function redeemPartial(IERC20 synthProxy, uint amountOfSynth) external { // technically this check isn't necessary - Synth.burn would fail due to safe sub, // but this is a useful error message to the user require(synthProxy.balanceOf(msg.sender) >= amountOfSynth, "Insufficient balance"); _redeem(synthProxy, amountOfSynth); } function _redeem(IERC20 synthProxy, uint amountOfSynth) internal { uint rateToRedeem = redemptions[address(synthProxy)]; require(rateToRedeem > 0, "Synth not redeemable"); require(amountOfSynth > 0, "No balance of synth to redeem"); issuer().burnForRedemption(address(synthProxy), msg.sender, amountOfSynth); uint amountInsUSD = amountOfSynth.multiplyDecimal(rateToRedeem); sUSD().transfer(msg.sender, amountInsUSD); emit SynthRedeemed(address(synthProxy), msg.sender, amountOfSynth, amountInsUSD); } function deprecate(IERC20 synthProxy, uint rateToRedeem) external onlyIssuer { address synthProxyAddress = address(synthProxy); require(redemptions[synthProxyAddress] == 0, "Synth is already deprecated"); require(rateToRedeem > 0, "No rate for synth to redeem"); uint totalSynthSupply = synthProxy.totalSupply(); uint supplyInsUSD = totalSynthSupply.multiplyDecimal(rateToRedeem); require(sUSD().balanceOf(address(this)) >= supplyInsUSD, "sUSD must first be supplied"); redemptions[synthProxyAddress] = rateToRedeem; emit SynthDeprecated(address(synthProxy), rateToRedeem, totalSynthSupply, supplyInsUSD); } function requireOnlyIssuer() internal view { require(msg.sender == address(issuer()), "Restricted to Issuer contract"); } modifier onlyIssuer() { requireOnlyIssuer(); _; } event SynthRedeemed(address synth, address account, uint amountOfSynth, uint amountInsUSD); event SynthDeprecated(address synth, uint rateToRedeem, uint totalSynthSupply, uint supplyInsUSD); }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"address","name":"_resolver","type":"address"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"name","type":"bytes32"},{"indexed":false,"internalType":"address","name":"destination","type":"address"}],"name":"CacheUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"synth","type":"address"},{"indexed":false,"internalType":"uint256","name":"rateToRedeem","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"totalSynthSupply","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"supplyInsUSD","type":"uint256"}],"name":"SynthDeprecated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"synth","type":"address"},{"indexed":false,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"uint256","name":"amountOfSynth","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amountInsUSD","type":"uint256"}],"name":"SynthRedeemed","type":"event"},{"constant":true,"inputs":[],"name":"CONTRACT_NAME","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"contract IERC20","name":"synthProxy","type":"address"},{"internalType":"address","name":"account","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"balanceInsUSD","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"contract IERC20","name":"synthProxy","type":"address"},{"internalType":"uint256","name":"rateToRedeem","type":"uint256"}],"name":"deprecate","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"isResolverCached","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"rebuildCache","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"contract IERC20","name":"synthProxy","type":"address"}],"name":"redeem","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"contract IERC20[]","name":"synthProxies","type":"address[]"}],"name":"redeemAll","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"contract IERC20","name":"synthProxy","type":"address"},{"internalType":"uint256","name":"amountOfSynth","type":"uint256"}],"name":"redeemPartial","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"redemptions","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"resolver","outputs":[{"internalType":"contract AddressResolver","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"resolverAddressesRequired","outputs":[{"internalType":"bytes32[]","name":"addresses","type":"bytes32[]"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"contract IERC20","name":"synthProxy","type":"address"}],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"supplyInsUSD","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"}]
Contract Creation Code
608060405234801561001057600080fd5b506040516110b03803806110b08339818101604052602081101561003357600080fd5b5051600080546001600160a01b039092166001600160a01b031990921691909117905561104b806100656000396000f3fe608060405234801561001057600080fd5b50600436106100b45760003560e01c806395a2251f1161007157806395a2251f146101a15780639bc3f269146101c7578063b915ece0146101ed578063d6232e8914610219578063e4dc2aa414610289578063f7888aec146102af576100b4565b806304f3bcec146100b95780632af64bd3146100dd5780633a70599c146100f9578063614d08f8146101275780637418536014610141578063899ffef414610149575b600080fd5b6100c16102dd565b604080516001600160a01b039092168252519081900360200190f35b6100e56102ec565b604080519115158252519081900360200190f35b6101256004803603604081101561010f57600080fd5b506001600160a01b0381351690602001356103f6565b005b61012f610685565b60408051918252519081900360200190f35b610125610699565b610151610864565b60408051602080825283518183015283519192839290830191858101910280838360005b8381101561018d578181015183820152602001610175565b505050509050019250505060405180910390f35b610125600480360360208110156101b757600080fd5b50356001600160a01b03166108d0565b61012f600480360360208110156101dd57600080fd5b50356001600160a01b0316610950565b6101256004803603604081101561020357600080fd5b506001600160a01b038135169060200135610962565b6101256004803603602081101561022f57600080fd5b81019060208101813564010000000081111561024a57600080fd5b82018360208201111561025c57600080fd5b8035906020019184602083028401116401000000008311171561027e57600080fd5b509092509050610a2b565b61012f6004803603602081101561029f57600080fd5b50356001600160a01b0316610aba565b61012f600480360360408110156102c557600080fd5b506001600160a01b0381358116916020013516610b5c565b6000546001600160a01b031681565b600060606102f8610864565b905060005b81518110156103ec57600082828151811061031457fe5b602090810291909101810151600081815260018352604080822054915481516321f8a72160e01b81526004810185905291519395506001600160a01b03928316949216926321f8a72192602480840193919291829003018186803b15801561037b57600080fd5b505afa15801561038f573d6000803e3d6000fd5b505050506040513d60208110156103a557600080fd5b50516001600160a01b03161415806103d257506000818152600160205260409020546001600160a01b0316155b156103e357600093505050506103f3565b506001016102fd565b5060019150505b90565b6103fe610bc0565b6001600160a01b03821660009081526002602052604090205482901561046b576040805162461bcd60e51b815260206004820152601b60248201527f53796e746820697320616c726561647920646570726563617465640000000000604482015290519081900360640190fd5b600082116104c0576040805162461bcd60e51b815260206004820152601b60248201527f4e6f207261746520666f722073796e746820746f2072656465656d0000000000604482015290519081900360640190fd5b6000836001600160a01b03166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b1580156104fb57600080fd5b505afa15801561050f573d6000803e3d6000fd5b505050506040513d602081101561052557600080fd5b50519050600061053b828563ffffffff610c2f16565b905080610546610c59565b6001600160a01b03166370a08231306040518263ffffffff1660e01b815260040180826001600160a01b03166001600160a01b0316815260200191505060206040518083038186803b15801561059b57600080fd5b505afa1580156105af573d6000803e3d6000fd5b505050506040513d60208110156105c557600080fd5b5051101561061a576040805162461bcd60e51b815260206004820152601b60248201527f73555344206d75737420666972737420626520737570706c6965640000000000604482015290519081900360640190fd5b6001600160a01b0380841660009081526002602090815260409182902087905581519288168352820186905281810184905260608201839052517f729d5d4b6f2f5105eb1f707c4929870479e07c211953ef7014da9463fb15d88a9181900360800190a15050505050565b6c29bcb73a342932b232b2b6b2b960991b81565b60606106a3610864565b905060005b81518110156108605760008282815181106106bf57fe5b60209081029190910181015160008054604080517f5265736f6c766572206d697373696e67207461726765743a2000000000000000818701526039808201869052825180830390910181526059820180845263dacb2d0160e01b9052605d8201868152607d83019384528151609d840152815196985094966001600160a01b039094169563dacb2d0195899592949093909260bd90910191908501908083838c5b83811015610778578181015183820152602001610760565b50505050905090810190601f1680156107a55780820380516001836020036101000a031916815260200191505b50935050505060206040518083038186803b1580156107c357600080fd5b505afa1580156107d7573d6000803e3d6000fd5b505050506040513d60208110156107ed57600080fd5b505160008381526001602090815260409182902080546001600160a01b0319166001600160a01b03851690811790915582518681529182015281519293507f88a93678a3692f6789d9546fc621bf7234b101ddb7d4fe479455112831b8aa68929081900390910190a150506001016106a8565b5050565b60408051600280825260608083018452926020830190803883390190505090506524b9b9bab2b960d11b8160008151811061089b57fe5b6020026020010181815250506814de5b9d1a1cd554d160ba1b816001815181106108c157fe5b60200260200101818152505090565b604080516370a0823160e01b8152336004820152905161094d9183916001600160a01b038316916370a08231916024808301926020929190829003018186803b15801561091c57600080fd5b505afa158015610930573d6000803e3d6000fd5b505050506040513d602081101561094657600080fd5b5051610c75565b50565b60026020526000908152604090205481565b604080516370a0823160e01b8152336004820152905182916001600160a01b038516916370a0823191602480820192602092909190829003018186803b1580156109ab57600080fd5b505afa1580156109bf573d6000803e3d6000fd5b505050506040513d60208110156109d557600080fd5b50511015610a21576040805162461bcd60e51b8152602060048201526014602482015273496e73756666696369656e742062616c616e636560601b604482015290519081900360640190fd5b6108608282610c75565b60005b81811015610ab557610aad838383818110610a4557fe5b905060200201356001600160a01b0316848484818110610a6157fe5b604080516370a0823160e01b81523360048201529051602092830294909401356001600160a01b0316936370a08231935060248083019392829003018186803b15801561091c57600080fd5b600101610a2e565b505050565b6000610b5660026000846001600160a01b03166001600160a01b0316815260200190815260200160002054836001600160a01b03166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b158015610b1e57600080fd5b505afa158015610b32573d6000803e3d6000fd5b505050506040513d6020811015610b4857600080fd5b50519063ffffffff610c2f16565b92915050565b6001600160a01b0380831660008181526002602090815260408083205481516370a0823160e01b8152958716600487015290519294610bb994919391926370a0823192602480840193829003018186803b158015610b1e57600080fd5b9392505050565b610bc8610ea4565b6001600160a01b0316336001600160a01b031614610c2d576040805162461bcd60e51b815260206004820152601d60248201527f5265737472696374656420746f2049737375657220636f6e7472616374000000604482015290519081900360640190fd5b565b6000670de0b6b3a7640000610c4a848463ffffffff610eb816565b81610c5157fe5b049392505050565b6000610c706814de5b9d1a1cd554d160ba1b610f11565b905090565b6001600160a01b03821660009081526002602052604090205480610cd7576040805162461bcd60e51b815260206004820152601460248201527353796e7468206e6f742072656465656d61626c6560601b604482015290519081900360640190fd5b60008211610d2c576040805162461bcd60e51b815260206004820152601d60248201527f4e6f2062616c616e6365206f662073796e746820746f2072656465656d000000604482015290519081900360640190fd5b610d34610ea4565b604080516335a1b01b60e21b81526001600160a01b038681166004830152336024830152604482018690529151929091169163d686c06c9160648082019260009290919082900301818387803b158015610d8d57600080fd5b505af1158015610da1573d6000803e3d6000fd5b505050506000610dba8284610c2f90919063ffffffff16565b9050610dc4610c59565b6001600160a01b031663a9059cbb33836040518363ffffffff1660e01b815260040180836001600160a01b03166001600160a01b0316815260200182815260200192505050602060405180830381600087803b158015610e2357600080fd5b505af1158015610e37573d6000803e3d6000fd5b505050506040513d6020811015610e4d57600080fd5b5050604080516001600160a01b03861681523360208201528082018590526060810183905290517f8734fd5c7511ef698c61bce7dd8eefb212edea08cf7d9d4694e223c6f6121aef9181900360800190a150505050565b6000610c706524b9b9bab2b960d11b610f11565b600082610ec757506000610b56565b82820282848281610ed457fe5b0414610bb95760405162461bcd60e51b8152600401808060200182810382526021815260200180610ff66021913960400191505060405180910390fd5b600081815260016020908152604080832054815170026b4b9b9b4b7339030b2323932b9b99d1607d1b9381019390935260318084018690528251808503909101815260519093019091526001600160a01b03169081610fee5760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610fb3578181015183820152602001610f9b565b50505050905090810190601f168015610fe05780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b509291505056fe536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f77a265627a7a723158207084373c27f3352851007e41581f5b04f0c24aaaec5e84f5181357a8fc5134a864736f6c634300051000320000000000000000000000004e3b31eb0e5cb73641ee1e65e7dcefe520ba3ef2
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106100b45760003560e01c806395a2251f1161007157806395a2251f146101a15780639bc3f269146101c7578063b915ece0146101ed578063d6232e8914610219578063e4dc2aa414610289578063f7888aec146102af576100b4565b806304f3bcec146100b95780632af64bd3146100dd5780633a70599c146100f9578063614d08f8146101275780637418536014610141578063899ffef414610149575b600080fd5b6100c16102dd565b604080516001600160a01b039092168252519081900360200190f35b6100e56102ec565b604080519115158252519081900360200190f35b6101256004803603604081101561010f57600080fd5b506001600160a01b0381351690602001356103f6565b005b61012f610685565b60408051918252519081900360200190f35b610125610699565b610151610864565b60408051602080825283518183015283519192839290830191858101910280838360005b8381101561018d578181015183820152602001610175565b505050509050019250505060405180910390f35b610125600480360360208110156101b757600080fd5b50356001600160a01b03166108d0565b61012f600480360360208110156101dd57600080fd5b50356001600160a01b0316610950565b6101256004803603604081101561020357600080fd5b506001600160a01b038135169060200135610962565b6101256004803603602081101561022f57600080fd5b81019060208101813564010000000081111561024a57600080fd5b82018360208201111561025c57600080fd5b8035906020019184602083028401116401000000008311171561027e57600080fd5b509092509050610a2b565b61012f6004803603602081101561029f57600080fd5b50356001600160a01b0316610aba565b61012f600480360360408110156102c557600080fd5b506001600160a01b0381358116916020013516610b5c565b6000546001600160a01b031681565b600060606102f8610864565b905060005b81518110156103ec57600082828151811061031457fe5b602090810291909101810151600081815260018352604080822054915481516321f8a72160e01b81526004810185905291519395506001600160a01b03928316949216926321f8a72192602480840193919291829003018186803b15801561037b57600080fd5b505afa15801561038f573d6000803e3d6000fd5b505050506040513d60208110156103a557600080fd5b50516001600160a01b03161415806103d257506000818152600160205260409020546001600160a01b0316155b156103e357600093505050506103f3565b506001016102fd565b5060019150505b90565b6103fe610bc0565b6001600160a01b03821660009081526002602052604090205482901561046b576040805162461bcd60e51b815260206004820152601b60248201527f53796e746820697320616c726561647920646570726563617465640000000000604482015290519081900360640190fd5b600082116104c0576040805162461bcd60e51b815260206004820152601b60248201527f4e6f207261746520666f722073796e746820746f2072656465656d0000000000604482015290519081900360640190fd5b6000836001600160a01b03166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b1580156104fb57600080fd5b505afa15801561050f573d6000803e3d6000fd5b505050506040513d602081101561052557600080fd5b50519050600061053b828563ffffffff610c2f16565b905080610546610c59565b6001600160a01b03166370a08231306040518263ffffffff1660e01b815260040180826001600160a01b03166001600160a01b0316815260200191505060206040518083038186803b15801561059b57600080fd5b505afa1580156105af573d6000803e3d6000fd5b505050506040513d60208110156105c557600080fd5b5051101561061a576040805162461bcd60e51b815260206004820152601b60248201527f73555344206d75737420666972737420626520737570706c6965640000000000604482015290519081900360640190fd5b6001600160a01b0380841660009081526002602090815260409182902087905581519288168352820186905281810184905260608201839052517f729d5d4b6f2f5105eb1f707c4929870479e07c211953ef7014da9463fb15d88a9181900360800190a15050505050565b6c29bcb73a342932b232b2b6b2b960991b81565b60606106a3610864565b905060005b81518110156108605760008282815181106106bf57fe5b60209081029190910181015160008054604080517f5265736f6c766572206d697373696e67207461726765743a2000000000000000818701526039808201869052825180830390910181526059820180845263dacb2d0160e01b9052605d8201868152607d83019384528151609d840152815196985094966001600160a01b039094169563dacb2d0195899592949093909260bd90910191908501908083838c5b83811015610778578181015183820152602001610760565b50505050905090810190601f1680156107a55780820380516001836020036101000a031916815260200191505b50935050505060206040518083038186803b1580156107c357600080fd5b505afa1580156107d7573d6000803e3d6000fd5b505050506040513d60208110156107ed57600080fd5b505160008381526001602090815260409182902080546001600160a01b0319166001600160a01b03851690811790915582518681529182015281519293507f88a93678a3692f6789d9546fc621bf7234b101ddb7d4fe479455112831b8aa68929081900390910190a150506001016106a8565b5050565b60408051600280825260608083018452926020830190803883390190505090506524b9b9bab2b960d11b8160008151811061089b57fe5b6020026020010181815250506814de5b9d1a1cd554d160ba1b816001815181106108c157fe5b60200260200101818152505090565b604080516370a0823160e01b8152336004820152905161094d9183916001600160a01b038316916370a08231916024808301926020929190829003018186803b15801561091c57600080fd5b505afa158015610930573d6000803e3d6000fd5b505050506040513d602081101561094657600080fd5b5051610c75565b50565b60026020526000908152604090205481565b604080516370a0823160e01b8152336004820152905182916001600160a01b038516916370a0823191602480820192602092909190829003018186803b1580156109ab57600080fd5b505afa1580156109bf573d6000803e3d6000fd5b505050506040513d60208110156109d557600080fd5b50511015610a21576040805162461bcd60e51b8152602060048201526014602482015273496e73756666696369656e742062616c616e636560601b604482015290519081900360640190fd5b6108608282610c75565b60005b81811015610ab557610aad838383818110610a4557fe5b905060200201356001600160a01b0316848484818110610a6157fe5b604080516370a0823160e01b81523360048201529051602092830294909401356001600160a01b0316936370a08231935060248083019392829003018186803b15801561091c57600080fd5b600101610a2e565b505050565b6000610b5660026000846001600160a01b03166001600160a01b0316815260200190815260200160002054836001600160a01b03166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b158015610b1e57600080fd5b505afa158015610b32573d6000803e3d6000fd5b505050506040513d6020811015610b4857600080fd5b50519063ffffffff610c2f16565b92915050565b6001600160a01b0380831660008181526002602090815260408083205481516370a0823160e01b8152958716600487015290519294610bb994919391926370a0823192602480840193829003018186803b158015610b1e57600080fd5b9392505050565b610bc8610ea4565b6001600160a01b0316336001600160a01b031614610c2d576040805162461bcd60e51b815260206004820152601d60248201527f5265737472696374656420746f2049737375657220636f6e7472616374000000604482015290519081900360640190fd5b565b6000670de0b6b3a7640000610c4a848463ffffffff610eb816565b81610c5157fe5b049392505050565b6000610c706814de5b9d1a1cd554d160ba1b610f11565b905090565b6001600160a01b03821660009081526002602052604090205480610cd7576040805162461bcd60e51b815260206004820152601460248201527353796e7468206e6f742072656465656d61626c6560601b604482015290519081900360640190fd5b60008211610d2c576040805162461bcd60e51b815260206004820152601d60248201527f4e6f2062616c616e6365206f662073796e746820746f2072656465656d000000604482015290519081900360640190fd5b610d34610ea4565b604080516335a1b01b60e21b81526001600160a01b038681166004830152336024830152604482018690529151929091169163d686c06c9160648082019260009290919082900301818387803b158015610d8d57600080fd5b505af1158015610da1573d6000803e3d6000fd5b505050506000610dba8284610c2f90919063ffffffff16565b9050610dc4610c59565b6001600160a01b031663a9059cbb33836040518363ffffffff1660e01b815260040180836001600160a01b03166001600160a01b0316815260200182815260200192505050602060405180830381600087803b158015610e2357600080fd5b505af1158015610e37573d6000803e3d6000fd5b505050506040513d6020811015610e4d57600080fd5b5050604080516001600160a01b03861681523360208201528082018590526060810183905290517f8734fd5c7511ef698c61bce7dd8eefb212edea08cf7d9d4694e223c6f6121aef9181900360800190a150505050565b6000610c706524b9b9bab2b960d11b610f11565b600082610ec757506000610b56565b82820282848281610ed457fe5b0414610bb95760405162461bcd60e51b8152600401808060200182810382526021815260200180610ff66021913960400191505060405180910390fd5b600081815260016020908152604080832054815170026b4b9b9b4b7339030b2323932b9b99d1607d1b9381019390935260318084018690528251808503909101815260519093019091526001600160a01b03169081610fee5760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610fb3578181015183820152602001610f9b565b50505050905090810190601f168015610fe05780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b509291505056fe536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f77a265627a7a723158207084373c27f3352851007e41581f5b04f0c24aaaec5e84f5181357a8fc5134a864736f6c63430005100032
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
0000000000000000000000004e3b31eb0e5cb73641ee1e65e7dcefe520ba3ef2
-----Decoded View---------------
Arg [0] : _resolver (address): 0x4E3b31eB0E5CB73641EE1E65E7dCEFe520bA3ef2
-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 0000000000000000000000004e3b31eb0e5cb73641ee1e65e7dcefe520ba3ef2
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 30 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|---|---|---|---|---|
ETH | 100.00% | $0.967347 | 919,621.1376 | $889,592.75 |
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.