ETH Price: $2,988.74 (-7.14%)

Contract

0x555555987d98079b9f43CDcDBD52DbB24FfEEef5

Overview

ETH Balance

0 ETH

ETH Value

$0.00

More Info

Private Name Tags

Multichain Info

No addresses found
Transaction Hash
Block
From
To

There are no matching entries

1 Internal Transaction found.

Latest 1 internal transaction

Parent Transaction Hash Block From To
2556233452024-09-20 22:16:58486 days ago1726870618  Contract Creation0 ETH

Cross-Chain Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
ShipmentPlanner

Compiler Version
v0.8.25+commit.b61c2a91

Optimization Enabled:
Yes with 100 runs

Other Settings:
shanghai EvmVersion
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.20;

/**
 * @notice Constraints of how many Beans to send to a given route at the current time.
 * @param points Weight of this shipment route relative to all routes. Expects precision of 1e18.
 * @param cap Maximum Beans that can be received by this stream at this time.
 */
struct ShipmentPlan {
    uint256 points;
    uint256 cap;
}

interface IBeanstalk {
    function isFertilizing() external view returns (bool);

    function totalUnfertilizedBeans() external view returns (uint256);

    function leftoverBeans() external view returns (uint256);

    function isHarvesting(uint256 fieldId) external view returns (bool);

    function totalUnharvestable(uint256 fieldId) external view returns (uint256);

    function fieldCount() external view returns (uint256);
}

/**
 * @title ShipmentPlanner
 * @notice Contains getters for retrieving ShipmentPlans for various Beanstalk components.
 * @dev Lives as a standalone immutable contract. Updating shipment plans requires deploying
 * a new instance and updating the ShipmentRoute planContract addresses help in AppStorage.
 * @dev Called via staticcall. New plan getters must be view/pure functions.
 */
contract ShipmentPlanner {
    uint256 constant BARN_POINTS = 333_333_333_333_333_333;
    uint256 constant FIELD_POINTS = 333_333_333_333_333_333;
    uint256 constant SILO_POINTS = 333_333_333_333_333_333;

    IBeanstalk beanstalk;

    constructor(address beanstalkAddress) {
        beanstalk = IBeanstalk(beanstalkAddress);
    }

    /**
     * @notice Get the current points and cap for Barn shipments.
     * @dev The Barn cap is the amount of outstanding unfertilized fertilizer.
     * @dev data param is unused data to configure plan details.
     */
    function getBarnPlan(bytes memory) external view returns (ShipmentPlan memory shipmentPlan) {
        if (!beanstalk.isFertilizing()) return shipmentPlan;
        return
            ShipmentPlan({
                points: BARN_POINTS,
                cap: beanstalk.totalUnfertilizedBeans() - beanstalk.leftoverBeans()
            });
    }

    /**
     * @notice Get the current points and cap for Field shipments.
     * @dev The Field cap is the amount of outstanding Pods unharvestable pods.
     * @param data Encoded uint256 containing the index of the Field to receive the Beans.
     */
    function getFieldPlan(
        bytes memory data
    ) external view returns (ShipmentPlan memory shipmentPlan) {
        uint256 fieldId = abi.decode(data, (uint256));
        require(fieldId < beanstalk.fieldCount(), "Field does not exist");
        if (!beanstalk.isHarvesting(fieldId)) return shipmentPlan;
        return ShipmentPlan({points: FIELD_POINTS, cap: beanstalk.totalUnharvestable(fieldId)});
    }

    /**
     * @notice Get the current points and cap for Silo shipments.
     * @dev The Silo has no cap.
     * @dev data param is unused data to configure plan details.
     */
    function getSiloPlan(bytes memory) external pure returns (ShipmentPlan memory shipmentPlan) {
        return ShipmentPlan({points: SILO_POINTS, cap: type(uint256).max});
    }
}

Settings
{
  "remappings": [
    "forge-std/=lib/forge-std/src/",
    "@openzeppelin/=node_modules/@openzeppelin/",
    "@wells/=node_modules/@beanstalk/wells1.1/",
    "@beanstalk/=node_modules/@beanstalk/",
    "@ethereum-waffle/=node_modules/@ethereum-waffle/",
    "@prb/=node_modules/@prb/",
    "@uniswap/=node_modules/@uniswap/",
    "ds-test/=node_modules/@beanstalk/wells/lib/forge-std/lib/ds-test/",
    "erc4626-tests/=node_modules/@beanstalk/wells/lib/openzeppelin-contracts/lib/erc4626-tests/",
    "eth-gas-reporter/=node_modules/eth-gas-reporter/",
    "hardhat/=node_modules/hardhat/",
    "openzeppelin-contracts-upgradeable/=node_modules/@beanstalk/wells/lib/openzeppelin-contracts-upgradeable/",
    "openzeppelin-contracts/=node_modules/@beanstalk/wells/lib/openzeppelin-contracts/",
    "prb-math/=node_modules/@beanstalk/wells/lib/prb-math/",
    "prb-test/=node_modules/@beanstalk/wells/lib/prb-math/lib/prb-test/",
    "uniswap/=node_modules/uniswap/"
  ],
  "optimizer": {
    "enabled": true,
    "runs": 100
  },
  "metadata": {
    "useLiteralContent": false,
    "bytecodeHash": "ipfs",
    "appendCBOR": true
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "evmVersion": "shanghai",
  "viaIR": false,
  "libraries": {}
}

Contract Security Audit

Contract ABI

API
[{"inputs":[{"internalType":"address","name":"beanstalkAddress","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"bytes","name":"","type":"bytes"}],"name":"getBarnPlan","outputs":[{"components":[{"internalType":"uint256","name":"points","type":"uint256"},{"internalType":"uint256","name":"cap","type":"uint256"}],"internalType":"struct ShipmentPlan","name":"shipmentPlan","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes","name":"data","type":"bytes"}],"name":"getFieldPlan","outputs":[{"components":[{"internalType":"uint256","name":"points","type":"uint256"},{"internalType":"uint256","name":"cap","type":"uint256"}],"internalType":"struct ShipmentPlan","name":"shipmentPlan","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes","name":"","type":"bytes"}],"name":"getSiloPlan","outputs":[{"components":[{"internalType":"uint256","name":"points","type":"uint256"},{"internalType":"uint256","name":"cap","type":"uint256"}],"internalType":"struct ShipmentPlan","name":"shipmentPlan","type":"tuple"}],"stateMutability":"pure","type":"function"}]

6080604052348015600e575f80fd5b50604051610626380380610626833981016040819052602b91604e565b5f80546001600160a01b0319166001600160a01b03929092169190911790556079565b5f60208284031215605d575f80fd5b81516001600160a01b03811681146072575f80fd5b9392505050565b6105a0806100865f395ff3fe608060405234801561000f575f80fd5b506004361061003f575f3560e01c806312e8d3ed1461004357806343055ba8146100755780637c65507514610088575b5f80fd5b61005661005136600461045d565b6100c6565b6040805182518152602092830151928101929092520160405180910390f35b61005661008336600461045d565b6102ac565b61005661009636600461045d565b506040805180820182525f80825260209182015281518083019092526704a03ce68d21555582525f199082015290565b604080518082019091525f80825260208201525f828060200190518101906100ee9190610508565b90505f8054906101000a90046001600160a01b03166001600160a01b031663bb485bbd6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561013e573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906101629190610508565b81106101ab5760405162461bcd60e51b8152602060048201526014602482015273119a595b1908191bd95cc81b9bdd08195e1a5cdd60621b604482015260640160405180910390fd5b5f546040516312fa99f160e21b8152600481018390526001600160a01b0390911690634bea67c490602401602060405180830381865afa1580156101f1573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610215919061051f565b61021f5750919050565b6040805180820182526704a03ce68d21555581525f549151633ca7ffa560e21b815260048101849052909160208301916001600160a01b039091169063f29ffe9490602401602060405180830381865afa15801561027f573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906102a39190610508565b90529392505050565b604080518082019091525f80825260208201525f8054906101000a90046001600160a01b03166001600160a01b0316636ae1c0146040518163ffffffff1660e01b8152600401602060405180830381865afa15801561030d573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610331919061051f565b61033a57919050565b60405180604001604052806704a03ce68d21555581526020015f8054906101000a90046001600160a01b03166001600160a01b0316638bb3aba86040518163ffffffff1660e01b8152600401602060405180830381865afa1580156103a1573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906103c59190610508565b5f8054906101000a90046001600160a01b03166001600160a01b031663a3ef48c96040518163ffffffff1660e01b8152600401602060405180830381865afa158015610413573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906104379190610508565b6104419190610545565b905292915050565b634e487b7160e01b5f52604160045260245ffd5b5f6020828403121561046d575f80fd5b813567ffffffffffffffff80821115610484575f80fd5b818401915084601f830112610497575f80fd5b8135818111156104a9576104a9610449565b604051601f8201601f19908116603f011681019083821181831017156104d1576104d1610449565b816040528281528760208487010111156104e9575f80fd5b826020860160208301375f928101602001929092525095945050505050565b5f60208284031215610518575f80fd5b5051919050565b5f6020828403121561052f575f80fd5b8151801515811461053e575f80fd5b9392505050565b8181038181111561056457634e487b7160e01b5f52601160045260245ffd5b9291505056fea26469706673582212209536d1b9a50f7afb9636aa94539cc61b8c37b281b5389a1aa0fc7a65ca728e6c64736f6c63430008190033000000000000000000000000d1a0060ba708bc4bcd3da6c37efa8dedf015fb70

Deployed Bytecode

0x608060405234801561000f575f80fd5b506004361061003f575f3560e01c806312e8d3ed1461004357806343055ba8146100755780637c65507514610088575b5f80fd5b61005661005136600461045d565b6100c6565b6040805182518152602092830151928101929092520160405180910390f35b61005661008336600461045d565b6102ac565b61005661009636600461045d565b506040805180820182525f80825260209182015281518083019092526704a03ce68d21555582525f199082015290565b604080518082019091525f80825260208201525f828060200190518101906100ee9190610508565b90505f8054906101000a90046001600160a01b03166001600160a01b031663bb485bbd6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561013e573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906101629190610508565b81106101ab5760405162461bcd60e51b8152602060048201526014602482015273119a595b1908191bd95cc81b9bdd08195e1a5cdd60621b604482015260640160405180910390fd5b5f546040516312fa99f160e21b8152600481018390526001600160a01b0390911690634bea67c490602401602060405180830381865afa1580156101f1573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610215919061051f565b61021f5750919050565b6040805180820182526704a03ce68d21555581525f549151633ca7ffa560e21b815260048101849052909160208301916001600160a01b039091169063f29ffe9490602401602060405180830381865afa15801561027f573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906102a39190610508565b90529392505050565b604080518082019091525f80825260208201525f8054906101000a90046001600160a01b03166001600160a01b0316636ae1c0146040518163ffffffff1660e01b8152600401602060405180830381865afa15801561030d573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610331919061051f565b61033a57919050565b60405180604001604052806704a03ce68d21555581526020015f8054906101000a90046001600160a01b03166001600160a01b0316638bb3aba86040518163ffffffff1660e01b8152600401602060405180830381865afa1580156103a1573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906103c59190610508565b5f8054906101000a90046001600160a01b03166001600160a01b031663a3ef48c96040518163ffffffff1660e01b8152600401602060405180830381865afa158015610413573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906104379190610508565b6104419190610545565b905292915050565b634e487b7160e01b5f52604160045260245ffd5b5f6020828403121561046d575f80fd5b813567ffffffffffffffff80821115610484575f80fd5b818401915084601f830112610497575f80fd5b8135818111156104a9576104a9610449565b604051601f8201601f19908116603f011681019083821181831017156104d1576104d1610449565b816040528281528760208487010111156104e9575f80fd5b826020860160208301375f928101602001929092525095945050505050565b5f60208284031215610518575f80fd5b5051919050565b5f6020828403121561052f575f80fd5b8151801515811461053e575f80fd5b9392505050565b8181038181111561056457634e487b7160e01b5f52601160045260245ffd5b9291505056fea26469706673582212209536d1b9a50f7afb9636aa94539cc61b8c37b281b5389a1aa0fc7a65ca728e6c64736f6c63430008190033

Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)

000000000000000000000000d1a0060ba708bc4bcd3da6c37efa8dedf015fb70

-----Decoded View---------------
Arg [0] : beanstalkAddress (address): 0xD1A0060ba708BC4BCD3DA6C37EFa8deDF015FB70

-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 000000000000000000000000d1a0060ba708bc4bcd3da6c37efa8dedf015fb70


Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading
Loading...
Loading
Loading...
Loading

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
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.