Cryo Explorer Ethereum Mainnet

Address Contract Partially Verified

Address 0x17F960aedb1320358c9458B9FC71e7ac85922667
Balance 0 ETH
Nonce 1
Code Size 2133 bytes
Indexed Transactions 0
External Etherscan · Sourcify

Contract Bytecode

2133 bytes
0x608060405234801561001057600080fd5b50600436106100725760003560e01c8063a75c508211610050578063a75c5082146100b4578063f224aa02146100c7578063f2fde38b1461010357600080fd5b8063715018a61461007757806380faddeb146100815780638da5cb5b14610094575b600080fd5b61007f610116565b005b61007f61008f3660046104dd565b61012a565b6000546040516001600160a01b0390911681526020015b60405180910390f35b61007f6100c23660046105ef565b61015d565b6100f36100d53660046106e4565b6001600160a01b031660009081526001602052604090205460ff1690565b60405190151581526020016100ab565b61007f6101113660046106e4565b61036a565b61011e6103ff565b6101286000610459565b565b6101326103ff565b6001600160a01b03919091166000908152600160205260409020805460ff1916911515919091179055565b3360009081526001602052604090205460ff1661017957600080fd5b80518251146101b4576040517fa121188700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000825167ffffffffffffffff8111156101d0576101d0610519565b60405190808252806020026020018201604052801561021557816020015b60408051808201909152600080825260208201528152602001906001900390816101ee5790505b50905060005b83518110156102a457604051806040016040528085838151811061024157610241610706565b60200260200101516001600160a01b0316815260200184838151811061026957610269610706565b602002602001015181525082828151811061028657610286610706565b6020026020010181905250808061029c9061071c565b91505061021b565b506040517ff40c4ea20000000000000000000000000000000000000000000000000000000081526001600160a01b0385169063f40c4ea2906102ea908490600401610743565b600060405180830381600087803b15801561030457600080fd5b505af1158015610318573d6000803e3d6000fd5b50505050846001600160a01b031686887f5bfe767725df75d5b8e32061b6c63e91a0c87154b21e12585989e00f8b098bc0868660405161035992919061079b565b60405180910390a450505050505050565b6103726103ff565b6001600160a01b0381166103f35760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b6103fc81610459565b50565b6000546001600160a01b031633146101285760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016103ea565b600080546001600160a01b038381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b80356001600160a01b03811681146104d857600080fd5b919050565b600080604083850312156104f057600080fd5b6104f9836104c1565b91506020830135801515811461050e57600080fd5b809150509250929050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff8111828210171561055857610558610519565b604052919050565b600067ffffffffffffffff82111561057a5761057a610519565b5060051b60200190565b600082601f83011261059557600080fd5b813560206105aa6105a583610560565b61052f565b82815260059290921b840181019181810190868411156105c957600080fd5b8286015b848110156105e457803583529183019183016105cd565b509695505050505050565b60008060008060008060c0878903121561060857600080fd5b863595506020808801359550610620604089016104c1565b945061062e606089016104c1565b9350608088013567ffffffffffffffff8082111561064b57600080fd5b818a0191508a601f83011261065f57600080fd5b813561066d6105a582610560565b81815260059190911b8301840190848101908d83111561068c57600080fd5b938501935b828510156106b1576106a2856104c1565b82529385019390850190610691565b9650505060a08a01359250808311156106c957600080fd5b50506106d789828a01610584565b9150509295509295509295565b6000602082840312156106f657600080fd5b6106ff826104c1565b9392505050565b634e487b7160e01b600052603260045260246000fd5b60006001820161073c57634e487b7160e01b600052601160045260246000fd5b5060010190565b602080825282518282018190526000919060409081850190868401855b8281101561078e57815180516001600160a01b03168552860151868501529284019290850190600101610760565b5091979650505050505050565b604080825283519082018190526000906020906060840190828701845b828110156107dd5781516001600160a01b0316845292840192908401906001016107b8565b5050508381038285015284518082528583019183019060005b81811015610812578351835292840192918401916001016107f6565b509097965050505050505056fea26469706673582212205b701d04a6b143bd23cf4b90f61f1bb4185026417b2469df7b0ac5967bab173964736f6c63430008150033

Verified Source Code Partial Match

Compiler: v0.8.21+commit.d9974bed EVM: paris Optimization: Yes (1660 runs)
SturdyAllocator.sol 187 lines
//SPDX-License-Identifier: AGPL-v3.0
pragma solidity ^0.8.0;


library AllocationLogger {

    /**
     * @param allocationUid: a uid generated by the sturdy subnet in response to your allocation request
     * @param minerUid: the uid of the miner whose allocation you use
     * @param userAddress: the address of the eoa account/contract which holds the assets that need to be allocated
     * @param allocatedPools: the addresses of the underlying "pools" in which the assets will be distributed across
     * @param allocationAmounts: the amounts allocated across the aforementioned pools (in the same order)
     */
    event AllocationEvent(
        bytes32 indexed allocationUid,
        uint256 indexed minerUid,
        address indexed userAddress,
        address[] allocatedPools,
        uint256[] allocationAmounts
    );
    error MismatchedArrays();

    function logAllocation(
        bytes32 allocationUid, 
        uint256 minerUid,
        address userAddress,
        address[] memory allocatedPools,
        uint256[] memory allocationAmounts
    ) internal {
        if(!(allocatedPools.length == allocationAmounts.length)) {
            revert MismatchedArrays();
        }

        // Emit the event
        emit AllocationEvent(allocationUid, minerUid, userAddress, allocatedPools, allocationAmounts);
    }
}

interface IDebtManager {
    struct StrategyAllocation {
        address strategy;
        uint256 debt;
    }
    function manualAllocation( StrategyAllocation[] memory _newPositions) external payable;
}

// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)
/**
 * @dev Provides information about the current execution context, including the
 * sender of the transaction and its data. While these are generally available
 * via msg.sender and msg.data, they should not be accessed in such a direct
 * manner, since when dealing with meta-transactions the account sending and
 * paying for execution may not be the actual sender (as far as an application
 * is concerned).
 *
 * This contract is only required for intermediate, library-like contracts.
 */
abstract contract Context {
    function _msgSender() internal view virtual returns (address) {
        return msg.sender;
    }

    function _msgData() internal view virtual returns (bytes calldata) {
        return msg.data;
    }
}

abstract contract Ownable is Context {
    address private _owner;

    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);

    /**
     * @dev Initializes the contract setting the deployer as the initial owner.
     */
    constructor() {
        _transferOwnership(_msgSender());
    }

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        _checkOwner();
        _;
    }

    /**
     * @dev Returns the address of the current owner.
     */
    function owner() public view virtual returns (address) {
        return _owner;
    }

    /**
     * @dev Throws if the sender is not the owner.
     */
    function _checkOwner() internal view virtual {
        require(owner() == _msgSender(), "Ownable: caller is not the owner");
    }

    /**
     * @dev Leaves the contract without owner. It will not be possible to call
     * `onlyOwner` functions. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby disabling any functionality that is only available to the owner.
     */
    function renounceOwnership() public virtual onlyOwner {
        _transferOwnership(address(0));
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) public virtual onlyOwner {
        require(newOwner != address(0), "Ownable: new owner is the zero address");
        _transferOwnership(newOwner);
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Internal function without access restriction.
     */
    function _transferOwnership(address newOwner) internal virtual {
        address oldOwner = _owner;
        _owner = newOwner;
        emit OwnershipTransferred(oldOwner, newOwner);
    }
}

contract SturdyAllocator is Ownable {
    mapping(address => bool) allocators;

    constructor() {
        allocators[msg.sender] = true;
    }

    function setAllocator(address allocator, bool value) public onlyOwner {
        allocators[allocator] = value;
    }

    function _isAllocator(address toCheck) public view returns (bool) {
        return allocators[toCheck];
    }

    modifier onlyAllocator() {
        require(_isAllocator(msg.sender));
        _;
    }

    function allocate(
        bytes32 allocationUid,
        uint256 minerUid,
        address userAddress,
        address debtManager,
        address[] memory silos, // NOTE: the silos must be available to the addresses pointed to by  DebtManager(debtManager).vault()
        uint256[] memory allocationAmounts
    ) public onlyAllocator {
        if (!(silos.length == allocationAmounts.length)) {
            revert AllocationLogger.MismatchedArrays();
        }
        // rebalance pools
        IDebtManager.StrategyAllocation[]
            memory allocs = new IDebtManager.StrategyAllocation[](silos.length);

        for (uint256 i = 0; i < silos.length; i++) {
            allocs[i] = IDebtManager.StrategyAllocation(
                silos[i],
                allocationAmounts[i]
            );
        }

        IDebtManager(debtManager).manualAllocation(allocs);

        // Emit the event
        // AllocationLogger.logAllocation(allocationUid, minerUid, userAddress, silos, allocationAmounts);
        emit AllocationLogger.AllocationEvent(
            allocationUid,
            minerUid,
            userAddress,
            silos,
            allocationAmounts
        );
    }
}

Read Contract

_isAllocator 0xf224aa02 → bool
owner 0x8da5cb5b → address

Write Contract 4 functions

These functions modify contract state and require a wallet transaction to execute.

allocate 0xa75c5082
bytes32 allocationUid
uint256 minerUid
address userAddress
address debtManager
address[] silos
uint256[] allocationAmounts
renounceOwnership 0x715018a6
No parameters
setAllocator 0x80faddeb
address allocator
bool value
transferOwnership 0xf2fde38b
address newOwner

Recent Transactions

No transactions found for this address