DECOMPILED SOLIDITY (Heimdall)
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.0;
/// @title Decompiled Contract
/// @author Jonathan Becker <jonathan@jbecker.dev>
/// @custom:version heimdall-rs v0.9.2
///
/// @notice This contract was decompiled using the heimdall-rs decompiler.
/// It was generated directly by tracing the EVM opcodes from this contract.
/// As a result, it may not compile or even be valid solidity code.
/// Despite this, it should be obvious what each function does. Overall
/// logic should have been preserved throughout decompiling.
///
/// @custom:github You can find the open-source decompiler here:
/// https://heimdall.rs
contract DecompiledContract {
uint256 public constant tokenPeg = 100000000;
uint256 public constant getTokenPriceSource = 100000000;
uint256 public minDebt;
uint256 public priceSourceDecimals;
bytes32 store_r;
uint256 public gainRatio;
uint256 public adminFee;
address public mai;
mapping(bytes32 => bytes32) storage_map_af;
bool public version;
uint256 public maxDebt;
address public collateral;
uint256 public iR;
mapping(bytes32 => bytes32) storage_map_i;
uint256 public maiDebt;
uint256 public totalSupply;
address public stabilityPool;
address public adm;
uint256 public openingFee;
mapping(bytes32 => bytes32) storage_map_x;
uint256 store_ae;
address public ref;
bytes32 store_p;
bytes32 store_d;
uint256 public decimalDifferenceRaisedToTen;
address public owner;
bool public custom;
mapping(bytes32 => bytes32) storage_map_a;
uint256 public totalBorrowed;
uint256 public debtRatio;
address public ethPriceSource;
uint256 public _minimumCollateralPercentage;
uint256 public getClosingFee;
uint256 public refFee;
uint256 store_ah;
uint256 public vaultCount;
event UpdatedOracleName(string);
event UpdatedMaxDebt(uint256);
event UpdatedGainRatio(uint256);
event UpdatedAdmin(address);
event UpdatedRef(address);
event AddedFrontEnd(uint256);
event UpdatedFrontEnd(uint256, uint256);
event Approval(address, address, uint256);
event UpdatedRouter(address);
event UpdatedOpeningFee(uint256);
event UpdatedMinCollateralRatio(uint256);
event UpdatedFees(uint256, uint256);
event ApprovalForAll(address, address, bool);
event UpdatedEthPriceSource(address);
event UpdatedStabilityPool(address);
event Transfer(address, address, uint256);
event BurnedToken(uint256);
event UpdatedMinDebt(uint256);
event UpdatedInterestRate(uint256);
event RemovedFrontEnd(uint256);
event UpdatedDebtRatio(uint256);
event CreateVault(uint256, address);
event UpdatedClosingFee(uint256);
event DepositCollateral(uint256, uint256);
event UpdatedCustomURI(bool);
event UpdatedTokenURI(string);
event OwnershipTransferred(address, address);
/// @custom:selector 0x095ea7b3
/// @custom:signature approve(address arg0, uint256 arg1) public payable
/// @param arg0 ["address", "uint160", "bytes20", "int160"]
/// @param arg1 ["uint256", "bytes32", "int256"]
function approve(address arg0, uint256 arg1) public payable {
require(arg0 == (address(arg0)));
uint256 var_a = arg1;
require(address(storage_map_a[var_a]), "ERC721: invalid token ID");
require(!(address(arg0) == (address(storage_map_a[var_a]))), "ERC721: invalid token ID");
require(address(storage_map_a[var_a]) == msg.sender, "ERC721: invalid token ID");
var_a = address(msg.sender);
require(bytes1(storage_map_a[var_a]), "ERC721: invalid token ID");
var_a = arg1;
storage_map_a[var_a] = (address(arg0)) | (uint96(storage_map_a[var_a]));
var_a = arg1;
require(address(storage_map_a[var_a]), "ERC721: invalid token ID");
emit Approval(address(storage_map_a[var_a]), address(arg0), arg1);
require(address(storage_map_a[var_a]) == msg.sender, "ERC721: approve caller is not token owner or approved for all");
}
/// @custom:selector 0xece13732
/// @custom:signature depositCollateral(uint256 arg0, uint256 arg1) public payable
/// @param arg0 ["uint256", "bytes32", "int256"]
/// @param arg1 ["uint256", "bytes32", "int256"]
function depositCollateral(uint256 arg0, uint256 arg1) public payable {
uint256 var_a = arg0;
require(!(!address(storage_map_a[var_a])), "must use router");
require(!(address(version)), "must use router");
require(msg.sender == (address(version)), "must use router");
var_a = arg0;
require(!storage_map_a[var_a] > ~(arg1));
var_a = arg0;
require(!(storage_map_a[var_a] + arg1) < storage_map_a[var_a]);
var_a = arg0;
storage_map_a[var_a] = storage_map_a[var_a] + arg1;
uint256 var_c = ((0x84 + var_i) - var_i) + 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0;
var_i = 0x40 + var_i;
require(!0 > var_i.length);
(bool success, bytes memory ret0) = address(collateral).transfer(0);
require(ret0.length == 0);
require(!var_o);
require(!(0 > var_i.length), "