Address Contract Partially Verified
Address
0x0A5653CCa4DB1B6E265F47CAf6969e64f1CFdC45
Balance
0 ETH
Nonce
1
Code Size
1979 bytes
Creator
0x0f850D64...7c61 at tx 0x26e61398...e4420c
Indexed Transactions
0
Contract Bytecode
1979 bytes
0x608060405234801561001057600080fd5b506004361061009e5760003560e01c806367aea3131161006657806367aea3131461013f578063894ba8331461016357806394f3f81d1461016b578063a7e9445514610191578063ef693bed146101995761009e565b806324ba5884146100a3578063313ce567146100db57806335b28153146100e35780633b4da69f1461010b57806341b3a0d914610137575b600080fd5b6100c9600480360360208110156100b957600080fd5b50356001600160a01b03166101c5565b60408051918252519081900360200190f35b6100c96101d7565b610109600480360360208110156100f957600080fd5b50356001600160a01b03166101dd565b005b6101096004803603604081101561012157600080fd5b506001600160a01b038135169060200135610293565b6100c96103f4565b6101476103fa565b604080516001600160a01b039092168252519081900360200190f35b610109610409565b6101096004803603602081101561018157600080fd5b50356001600160a01b031661049d565b610147610552565b610109600480360360408110156101af57600080fd5b506001600160a01b038135169060200135610561565b60006020819052908152604090205481565b60045481565b33600090815260208190526040902054600114610241576040805162461bcd60e51b815260206004820152601f60248201527f436f696e4a6f696e2f6163636f756e742d6e6f742d617574686f72697a656400604482015290519081900360640190fd5b6001600160a01b0381166000818152602081815260409182902060019055815192835290517f599a298163e1678bb1c676052a8930bf0b8a1261ed6e01b8a2391e55f70001029281900390910190a150565b6001546001600160a01b031663efabcadc30846102bc6b033b2e3c9fd0803ce80000008661071b565b6040518463ffffffff1660e01b815260040180846001600160a01b03166001600160a01b03168152602001836001600160a01b03166001600160a01b031681526020018281526020019350505050600060405180830381600087803b15801561032457600080fd5b505af1158015610338573d6000803e3d6000fd5b505060025460408051632770a7eb60e21b81523360048201526024810186905290516001600160a01b039092169350639dc29fac925060448082019260009290919082900301818387803b15801561038f57600080fd5b505af11580156103a3573d6000803e3d6000fd5b5050604080513381526001600160a01b038616602082015280820185905290517f0e64978d073561c3dfd4d4e3e4dce066cde2ab246a44f990fabb0a21a4a3bd959350908190036060019150a15050565b60035481565b6001546001600160a01b031681565b3360009081526020819052604090205460011461046d576040805162461bcd60e51b815260206004820152601f60248201527f436f696e4a6f696e2f6163636f756e742d6e6f742d617574686f72697a656400604482015290519081900360640190fd5b600060038190556040517f2d4b4ecff7bd7503135271925520a2f6c0d98c9473ffc1a1e72c92502f51b25e9190a1565b33600090815260208190526040902054600114610501576040805162461bcd60e51b815260206004820152601f60248201527f436f696e4a6f696e2f6163636f756e742d6e6f742d617574686f72697a656400604482015290519081900360640190fd5b6001600160a01b03811660008181526020818152604080832092909255815192835290517f8834a87e641e9716be4f34527af5d23e11624f1ddeefede6ad75a9acfc31b9039281900390910190a150565b6002546001600160a01b031681565b6003546001146105b8576040805162461bcd60e51b815260206004820152601d60248201527f436f696e4a6f696e2f636f6e74726163742d6e6f742d656e61626c6564000000604482015290519081900360640190fd5b6001546001600160a01b031663efabcadc33306105e16b033b2e3c9fd0803ce80000008661071b565b6040518463ffffffff1660e01b815260040180846001600160a01b03166001600160a01b03168152602001836001600160a01b03166001600160a01b031681526020018281526020019350505050600060405180830381600087803b15801561064957600080fd5b505af115801561065d573d6000803e3d6000fd5b5050600254604080516340c10f1960e01b81526001600160a01b0387811660048301526024820187905291519190921693506340c10f199250604480830192600092919082900301818387803b1580156106b657600080fd5b505af11580156106ca573d6000803e3d6000fd5b5050604080513381526001600160a01b038616602082015280820185905290517fbc2a67d422c268da6fe45f3e7d194e1d98906d221f1cfad62a5c80f2cd209f4c9350908190036060019150a15050565b60008115806107365750508082028282828161073357fe5b04145b61077f576040805162461bcd60e51b8152602060048201526015602482015274436f696e4a6f696e2f6d756c2d6f766572666c6f7760581b604482015290519081900360640190fd5b9291505056fea26469706673582212209f4c6d5b37dbecf3c8ad8bd811748c3f5c58f5d2ce8c6b6109f0a1a07e29f96e64736f6c63430006070033
Verified Source Code Partial Match
Compiler: v0.6.7+commit.b8d736ae
EVM: istanbul
Optimization: Yes (200 runs)
CoinJoin.sol 128 lines
/** *Submitted for verification at Etherscan.io on 2021-02-02 */ /// BasicTokenAdapters.sol // Copyright (C) 2018 Rain <[email protected]> // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see <https://www.gnu.org/licenses/>. pragma solidity 0.6.7; abstract contract CollateralLike { function decimals() virtual public view returns (uint256); function transfer(address,uint256) virtual public returns (bool); function transferFrom(address,address,uint256) virtual public returns (bool); } abstract contract DSTokenLike { function mint(address,uint256) virtual external; function burn(address,uint256) virtual external; } abstract contract SAFEEngineLike { function modifyCollateralBalance(bytes32,address,int256) virtual external; function transferInternalCoins(address,address,uint256) virtual external; } contract CoinJoin { // --- Auth --- mapping (address => uint256) public authorizedAccounts; /** * @notice Add auth to an account * @param account Account to add auth to */ function addAuthorization(address account) external isAuthorized { authorizedAccounts[account] = 1; emit AddAuthorization(account); } /** * @notice Remove auth from an account * @param account Account to remove auth from */ function removeAuthorization(address account) external isAuthorized { authorizedAccounts[account] = 0; emit RemoveAuthorization(account); } /** * @notice Checks whether msg.sender can call an authed function **/ modifier isAuthorized { require(authorizedAccounts[msg.sender] == 1, "CoinJoin/account-not-authorized"); _; } // SAFE database SAFEEngineLike public safeEngine; // Coin created by the system; this is the external, ERC-20 representation, not the internal 'coinBalance' DSTokenLike public systemCoin; // Whether this contract is enabled or not uint256 public contractEnabled; // Number of decimals the system coin has uint256 public decimals; // --- Events --- event AddAuthorization(address account); event RemoveAuthorization(address account); event DisableContract(); event Join(address sender, address account, uint256 wad); event Exit(address sender, address account, uint256 wad); constructor(address safeEngine_, address systemCoin_) public { authorizedAccounts[msg.sender] = 1; contractEnabled = 1; safeEngine = SAFEEngineLike(safeEngine_); systemCoin = DSTokenLike(systemCoin_); decimals = 18; emit AddAuthorization(msg.sender); } /** * @notice Disable this contract */ function disableContract() external isAuthorized { contractEnabled = 0; emit DisableContract(); } uint256 constant RAY = 10 ** 27; function multiply(uint256 x, uint256 y) internal pure returns (uint256 z) { require(y == 0 || (z = x * y) / y == x, "CoinJoin/mul-overflow"); } /** * @notice Join system coins in the system * @dev Exited coins have 18 decimals but inside the system they have 45 (rad) decimals. When we join, the amount (wad) is multiplied by 10**27 (ray) * @param account Account that will receive the joined coins * @param wad Amount of external coins to join (18 decimal number) **/ function join(address account, uint256 wad) external { safeEngine.transferInternalCoins(address(this), account, multiply(RAY, wad)); systemCoin.burn(msg.sender, wad); emit Join(msg.sender, account, wad); } /** * @notice Exit system coins from the system and inside 'Coin.sol' * @dev Inside the system, coins have 45 (rad) decimals but outside they have 18 decimals (wad). When we exit, we specify a wad amount of coins and then the contract automatically multiplies wad by 10**27 to move the correct 45 decimal coin amount to this adapter * @param account Account that will receive the exited coins * @param wad Amount of internal coins to join (18 decimal number that will be multiplied by ray) **/ function exit(address account, uint256 wad) external { require(contractEnabled == 1, "CoinJoin/contract-not-enabled"); safeEngine.transferInternalCoins(msg.sender, address(this), multiply(RAY, wad)); systemCoin.mint(account, wad); emit Exit(msg.sender, account, wad); } }
Read Contract
authorizedAccounts 0x24ba5884 → uint256
contractEnabled 0x41b3a0d9 → uint256
decimals 0x313ce567 → uint256
safeEngine 0x67aea313 → address
systemCoin 0xa7e94455 → address
Write Contract 5 functions
These functions modify contract state and require a wallet transaction to execute.
addAuthorization 0x35b28153
address account
disableContract 0x894ba833
No parameters
exit 0xef693bed
address account
uint256 wad
join 0x3b4da69f
address account
uint256 wad
removeAuthorization 0x94f3f81d
address account
Recent Transactions
No transactions found for this address