Skip to content
Verified contractExactMIT

CurveGraduation

Address0x523d46a159eaca0b0f528592b14037337fd797bc
Balance

0 ETH

 

Transactions

1

 

Compiler

solc 0.8.26

 

Same code

1 more contract

 

Details

Compiler
solc 0.8.26+commit.8a97fa7a
Language
solidity
Optimization
Yes, 200 runs
License
MIT
Match
Exactcreation code: yes, runtime code: yes
Verified on Sourcify
Created in block
26,257,246
Creation transaction
0x516a116ea0…6f5a3178b0

aggdotfun/aggdotfun/CurveGraduationTracker.sol

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

/**
 * @title  CurveGraduationTracker
 * @notice A curve sells out, the launchpad moves the token to a pool.
 *         This contract keeps the moment that happened so routing
 *         knows when to stop using the curve.
 *
 *            .
 *           /|        curve
 *          / |
 *         /  |
 *   _____/   |____    pool
 *        sold out
 *
 * @dev    Reporters are set by the owner. A token graduates once.
 *         A second report for the same token returns false.
 *
 * @custom:project agg.fun
 * @custom:website https://agg.fun
 * @custom:x       @tetranode
 */
contract CurveGraduation {
    struct Graduation {
        address pool;
        uint64 atTime;
        uint64 atBlock;
    }

    address public owner;
    bool public ready;
    uint256 public total;

    mapping(address => Graduation) private done;
    mapping(address => bool) public reporter;

    event Graduated(address indexed token, address indexed pool, uint64 atBlock);
    event ReporterSet(address indexed who, bool on);

    function initAgg() external returns (bool) {
        if (ready) return false;
        ready = true;
        owner = msg.sender;
        reporter[msg.sender] = true;
        return true;
    }

    function setReporter(address who, bool on) external returns (bool) {
        if (msg.sender != owner || who == address(0)) return false;
        reporter[who] = on;
        emit ReporterSet(who, on);
        return true;
    }

    function markGraduated(address token, address pool) external returns (bool) {
        if (!reporter[msg.sender] || token == address(0) || pool == address(0)) return false;
        if (done[token].atTime != 0) return false;
        done[token] = Graduation(pool, uint64(block.timestamp), uint64(block.number));
        total += 1;
        emit Graduated(token, pool, uint64(block.number));
        return true;
    }

    function isGraduated(address token) external view returns (bool) {
        return done[token].atTime != 0;
    }

    function graduationOf(address token) external view returns (address pool, uint64 atTime, uint64 atBlock) {
        Graduation memory g = done[token];
        return (g.pool, g.atTime, g.atBlock);
    }
}
Compiler settingsShow
{
  "optimizer": {
    "runs": 200,
    "enabled": true
  },
  "remappings": []
}

Source code and metadata: Sourcify.

The source code belongs to the authors of the contract.