ETH Price: $3,423.75 (+2.16%)

Contract

0xA9AaebDB1C006C3AC923F7e613a8Bb182abe7D4b
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
0x60808060211279852024-11-06 10:22:4717 days ago1730888567IN
 Create: RaiseChangeTokenAmount
0 ETH0.0045447812.31386073

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
RaiseChangeTokenAmount

Compiler Version
v0.8.25+commit.b61c2a91

Optimization Enabled:
Yes with 200 runs

Other Settings:
paris EvmVersion
File 1 of 14 : FundraisingChangeTokenAmount.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.25;

/**************************************

    security-contact:
    - [email protected]

    maintainers:
    - [email protected]
    - [email protected]
    - [email protected]
    - [email protected]

    contributors:
    - [email protected]

**************************************/

// Local imports
import { AccessTypes } from "../../structs/AccessTypes.sol";
import { RaiseErrors } from "../../errors/RaiseErrors.sol";
import { LibRaise } from "../../libraries/storage/raise/LibRaise.sol";
import { LibERC20Asset } from "../../libraries/storage/assets/LibERC20Asset.sol";
import { RaiseService } from "../../libraries/services/raise/internal/RaiseService.sol";

/**************************************

    Fundraising change end

 **************************************/

/// @dev Initializer that changes hardcap and token amount of fundraising.
contract RaiseChangeTokenAmount {
    // -----------------------------------------------------------------------
    //                              Structs
    // -----------------------------------------------------------------------

    /// @dev Args for initializer.
    /// @param raiseId ID of raise
    /// @param hardcap New hardcap
    /// @param amountErc20 New ERC20 amount
    struct Arguments {
        string raiseId;
        uint256 hardcap;
        uint256 amountErc20;
    }

    // -----------------------------------------------------------------------
    //                              Events
    // -----------------------------------------------------------------------

    /// @dev Debug event for raise.
    event FundraisingBeforePrice(string raiseId, uint256 tokensPerBaseAsset, uint256 amountErc20, uint256 hardcap);
    event FundraisingChangePrice(string raiseId, uint256 tokensPerBaseAsset, uint256 amountErc20, uint256 hardcap);

    // -----------------------------------------------------------------------
    //                              Functions
    // -----------------------------------------------------------------------

    /// @dev External init function for a delegate call.
    /// @dev _args Arguments struct
    function init(Arguments calldata _args) external {
        // raise id
        string memory raiseId_ = _args.raiseId;

        // revert if raise does not exist
        if (!RaiseService.isRaiseExists(raiseId_)) revert RaiseErrors.RaiseDoesNotExists(raiseId_);

        // get values before update
        uint256 storageHardcap_ = LibRaise.getHardcap(raiseId_);
        uint256 storagePrice_ = LibRaise.getTokensPerBaseAsset(raiseId_);
        uint256 storageAmount_ = LibERC20Asset.getAmount(raiseId_);

        // emit event with old values
        emit FundraisingBeforePrice(raiseId_, storagePrice_, storageAmount_, storageHardcap_);

        // validate price per token == vested / hardcap
        if (storagePrice_ != (_args.amountErc20 * LibRaise.PRICE_PRECISION) / _args.hardcap) {
            revert RaiseErrors.PriceNotMatchConfiguration(storagePrice_, _args.hardcap, _args.amountErc20);
        }

        // set hardcap and erc20 amount
        LibRaise.setHardcap(raiseId_, _args.hardcap);
        LibERC20Asset.setAmount(raiseId_, _args.amountErc20);

        // get values after update
        storageHardcap_ = LibRaise.getHardcap(raiseId_);
        storagePrice_ = LibRaise.getTokensPerBaseAsset(raiseId_);
        storageAmount_ = LibERC20Asset.getAmount(raiseId_);

        // emit event with new values
        emit FundraisingChangePrice(raiseId_, storagePrice_, storageAmount_, storageHardcap_);
    }
}

File 2 of 14 : AccessTypes.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.25;

/**************************************

    security-contact:
    - [email protected]

    maintainers:
    - [email protected]
    - [email protected]
    - [email protected]
    - [email protected]

    contributors:
    - [email protected]

**************************************/

/// @notice Library containing role definition for access management.
library AccessTypes {
    // -----------------------------------------------------------------------
    //                              Constants
    // -----------------------------------------------------------------------

    /// @dev AngelBlock validator role
    bytes32 internal constant SIGNER_ROLE = keccak256("IS SIGNER");
}

File 3 of 14 : RaiseErrors.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.25;

/**************************************

    security-contact:
    - [email protected]

    maintainers:
    - [email protected]
    - [email protected]
    - [email protected]
    - [email protected]

    contributors:
    - [email protected]

**************************************/

/**************************************

    Raise errors

**************************************/

/// @dev All errors connected with raises.
library RaiseErrors {
    // -----------------------------------------------------------------------
    //                              Raise Creation
    // -----------------------------------------------------------------------

    error InvalidRaiseId(string raiseId); // 0xc2f9a803
    error InvalidRaiseStartEnd(uint256 start, uint256 end); // 0xb2fb4a1d
    error StartDateInPast(uint256 start); // 0x28b25bae
    error HardcapLessThanSoftcap(uint256 hardcap, uint256 softcap); // 0xa13f495f
    error InvalidVestedAmount(); // 0x17329d67
    error PriceNotMatchConfiguration(uint256 price, uint256 hardcap, uint256 vested); // 0x643c0fc5
    error InvalidTokenAddress(address token); // 0x73306803

    // -----------------------------------------------------------------------
    //                              Early Stage
    // -----------------------------------------------------------------------

    error OnlyForEarlyStage(string raiseId); // 0x2e14bd97
    error CannotForEarlyStage(string raiseId); // 0x28471ed7
    error TokenAlreadySet(string raiseId); // 0x11f125e1
    error TokenNotSet(string raiseId); // 0x64d2ac41
    error OnlyForStandard(string raiseId); // 0x493e93f0

    // -----------------------------------------------------------------------
    //                                 OTC
    // -----------------------------------------------------------------------

    error CannotForOTC(string raiseId); // 0x886ebb60

    // -----------------------------------------------------------------------
    //                              Investing
    // -----------------------------------------------------------------------

    error IncorrectAmount(uint256 amount); // 0x88967d2f
    error OwnerCannotInvest(address sender, string raiseId); // 0x44b4eea9
    error InvestmentOverLimit(uint256 existingInvestment, uint256 newInvestment, uint256 maxTicketSize); // 0x3ebbf796
    error InvestmentOverHardcap(uint256 existingInvestment, uint256 newInvestment, uint256 hardcap); // 0xf0152bdf
    error NotEnoughBalanceForInvestment(address sender, uint256 investment); // 0xaff6db15
    error NotEnoughAllowance(address sender, address spender, uint256 amount); // 0x892e7739

    // -----------------------------------------------------------------------
    //                              Raise State
    // -----------------------------------------------------------------------

    error RaiseAlreadyExists(string raiseId); // 0xa7bb9fe0
    error RaiseDoesNotExists(string raiseId); // 0x78134459
    error RaiseNotActive(string raiseId, uint256 currentTime); // 0x251061ff
    error RaiseNotFailed(string raiseId); // 0x1e45b786
    error RaiseNotSucceed(string raiseId); // 0x3925f3e4
    error RaiseAlreadyFinished(string raiseId); // 0x0287eafc

    // -----------------------------------------------------------------------
    //                              Softcap / Hardcap
    // -----------------------------------------------------------------------

    error HardcapAchieved(string raiseId); // 0x8e144f11

    // -----------------------------------------------------------------------
    //                              Finish Raise
    // -----------------------------------------------------------------------

    error RaiseCannotBeFinishedYet(string raiseId, uint256 raised, uint256 hardcap, uint256 endTimestamp); // 0xaaf81bbb
    error MerkleRootSet(uint256 raised, uint256 softcap, bytes32 merkleRoot); // 0x77242f66
    error MerkleRootNotSet(uint256 raised, uint256 softcap, bytes32 merkleRoot); // 0xfe60e7d0
    error InvalidMerkleProofs(string raiseId, address user, uint256 investment, bytes32[] proofs, bytes32 root, bytes32 leaf); // 0xa112d454
    error InvalidRaisedAmount(string raiseId, uint256 providedRaised, uint256 correctRaised); // 0x2d6d8be6
    error RaiseFinishedAlready(string raiseId); // 0xdef0e29b

    // -----------------------------------------------------------------------
    //                              Reclaim
    // -----------------------------------------------------------------------

    error NothingToReclaim(string raiseId); // 0xf803caaa
    error AlreadyReclaimed(string raiseId); // 0x5ab9f7ef

    // -----------------------------------------------------------------------
    //                              Refund
    // -----------------------------------------------------------------------

    error UserHasNotInvested(address sender, string raiseId); // 0xf2ed8df2
    error CallerNotStartup(address sender, string raiseId); // 0x73810657
    error InvestorAlreadyRefunded(address sender, string raiseId); // 0x2eff5e61
    error CollateralAlreadyRefunded(string raiseId); // 0xc4543938
}

File 4 of 14 : LibRaise.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.25;

/**************************************

    security-contact:
    - [email protected]

    maintainers:
    - [email protected]
    - [email protected]
    - [email protected]
    - [email protected]

    contributors:
    - [email protected]

**************************************/

// Local imports - Structs
import { StorageTypes } from "../../../structs/StorageTypes.sol";
import { EnumTypes } from "../../../structs/EnumTypes.sol";

/// @notice Library containing raise storage with getters and setters.
library LibRaise {
    // -----------------------------------------------------------------------
    //                              Constants
    // -----------------------------------------------------------------------

    /// @dev Raise storage pointer.
    bytes32 internal constant RAISE_STORAGE_POSITION = keccak256("angelblock.fundraising.storage.raise");
    /// @dev Precision used in price calculation
    uint256 internal constant PRICE_PRECISION = 10 ** 18;

    // -----------------------------------------------------------------------
    //                              Structs
    // -----------------------------------------------------------------------

    /// @dev Raise storage struct.
    /// @param raises Mapping of raise id to particular raise struct
    /// @param raiseDetails Mapping of raise id to vested token information
    /// @param raiseDataCrosschains Mapping of raise id to raise state information
    /// @param raiseStatus Status of raise
    struct RaiseStorage {
        mapping(string => StorageTypes.Raise) raises;
        mapping(string => StorageTypes.RaiseDetails) raiseDetails;
        mapping(string => StorageTypes.RaiseDataCC) raiseDataCrosschains;
        mapping(string => EnumTypes.RaiseStatus) raiseStatus;
    }

    // diamond storage getter
    function raiseStorage() internal pure returns (RaiseStorage storage rs) {
        // declare position
        bytes32 position = RAISE_STORAGE_POSITION;

        // set slot to position
        assembly {
            rs.slot := position
        }

        // explicit return
        return rs;
    }

    // -----------------------------------------------------------------------
    //                              Getters / setters
    // -----------------------------------------------------------------------

    /// @dev Diamond storage getter: raise id.
    /// @param _raiseId Requested raise id
    /// @return Existing raise id
    function getId(string memory _raiseId) internal view returns (string memory) {
        // return
        return raiseStorage().raises[_raiseId].raiseId;
    }

    /// @dev Diamond storage getter: raise type.
    /// @param _raiseId Raise id
    /// @return Raise type
    function getType(string memory _raiseId) internal view returns (EnumTypes.RaiseType) {
        // return
        return raiseStorage().raises[_raiseId].raiseType;
    }

    /// @dev Diamond storage getter: raise receiver.
    /// @param _raiseId Raise id
    /// @return Raise receiver
    function getReceiver(string memory _raiseId) internal view returns (address) {
        // return
        return raiseStorage().raises[_raiseId].receiver;
    }

    /// @dev Diamond storage setter: raise receiver.
    /// @param _raiseId Raise id
    /// @param _receiver Receiver address
    function setReceiver(string memory _raiseId, address _receiver) internal {
        // set receiver
        raiseStorage().raises[_raiseId].receiver = _receiver;
    }

    /// @dev Diamond storage getter: raise controller.
    /// @param _raiseId Raise id
    /// @return Raise controller
    function getController(string memory _raiseId) internal view returns (address) {
        // return
        return raiseStorage().raises[_raiseId].controller;
    }

    /// @dev Diamond storage setter: raise controller.
    /// @param _raiseId Raise id
    /// @param _controller Raise controller
    function setController(string memory _raiseId, address _controller) internal {
        // set controller
        raiseStorage().raises[_raiseId].controller = _controller;
    }

    /// @dev Diamond storage getter: tokens per base asset.
    /// @param _raiseId Raise id
    /// @return Tokens per base asset
    function getTokensPerBaseAsset(string memory _raiseId) internal view returns (uint256) {
        // return
        return raiseStorage().raiseDetails[_raiseId].tokensPerBaseAsset;
    }

    /// @dev Diamond storage setter: tokens per base asset.
    /// @param _raiseId Raise id
    /// @param _tokensPerBaseAsset Tokens per base asset
    function setTokensPerBaseAsset(string memory _raiseId, uint256 _tokensPerBaseAsset) internal {
        raiseStorage().raiseDetails[_raiseId].tokensPerBaseAsset = _tokensPerBaseAsset;
    }

    /// @dev Diamond storage getter: hardcap.
    /// @param _raiseId Raise id
    /// @return Hardcap
    function getHardcap(string memory _raiseId) internal view returns (uint256) {
        // return
        return raiseStorage().raiseDetails[_raiseId].hardcap;
    }

    /// @dev Diamond storage setter: hardcap.
    /// @param _raiseId Raise id
    /// @param _hardcap New hardcap
    function setHardcap(string memory _raiseId, uint256 _hardcap) internal {
        raiseStorage().raiseDetails[_raiseId].hardcap = _hardcap;
    }

    /// @dev Diamond storage getter: softcap.
    /// @param _raiseId Raise id
    /// @return Softcap
    function getSoftcap(string memory _raiseId) internal view returns (uint256) {
        // return
        return raiseStorage().raiseDetails[_raiseId].softcap;
    }

    /// @dev Diamond storage getter: raise start.
    /// @param _raiseId Raise id
    /// @return Start date of raise
    function getStart(string memory _raiseId) internal view returns (uint256) {
        // return
        return raiseStorage().raiseDetails[_raiseId].start;
    }

    /// @dev Diamond storage getter: raise end.
    /// @param _raiseId Raise id
    /// @return End date of raise
    function getEnd(string memory _raiseId) internal view returns (uint256) {
        // return
        return raiseStorage().raiseDetails[_raiseId].end;
    }

    /// @dev Diamond storage getter: raised.
    /// @param _raiseId Raise id
    /// @return Raised amount
    function getRaised(string memory _raiseId) internal view returns (uint256) {
        // return
        return raiseStorage().raiseDataCrosschains[_raiseId].raised;
    }

    /// @dev Diamond storage getter: merkle root.
    /// @param _raiseId Raise id
    /// @return Merkle root
    function getMerkleRoot(string memory _raiseId) internal view returns (bytes32) {
        return raiseStorage().raiseDataCrosschains[_raiseId].merkleRoot;
    }

    /// @dev Diamond storage getter: raise status.
    /// @param _raiseId Raise id
    /// @return Status of raise with provided id
    function getRaiseStatus(string memory _raiseId) internal view returns (EnumTypes.RaiseStatus) {
        return raiseStorage().raiseStatus[_raiseId];
    }

    /// @dev Diamond storage setter: set raise.
    /// @param _raiseId Raise id
    /// @param _raise Raise struct
    function setRaise(string memory _raiseId, StorageTypes.Raise memory _raise) internal {
        // set raise
        raiseStorage().raises[_raiseId] = _raise;
    }

    /// @dev Diamond storage setter: set raise details.
    /// @param _raiseId Raise id
    /// @param _raiseDetails Raise details struct
    function setRaiseDetails(string memory _raiseId, StorageTypes.RaiseDetails memory _raiseDetails) internal {
        // set raise details
        raiseStorage().raiseDetails[_raiseId] = _raiseDetails;
    }

    /// @dev Diamond storage setter: set raise cross-chain data.
    /// @param _raiseId Raise id
    /// @param _raiseDataCC Raise cross-chain data struct
    function setRaiseDataCrosschain(string memory _raiseId, StorageTypes.RaiseDataCC memory _raiseDataCC) internal {
        // set cross-chain raise data
        raiseStorage().raiseDataCrosschains[_raiseId] = _raiseDataCC;
    }

    /// @dev Diamond storage setter: raise status.
    /// @param _raiseId Raise id
    /// @param _status Raise enum status
    function setRaiseStatus(string memory _raiseId, EnumTypes.RaiseStatus _status) internal {
        raiseStorage().raiseStatus[_raiseId] = _status;
    }

    /// @dev Diamond storage setter: set end.
    /// @param _raiseId Raise id
    /// @param _end End date of fundraising
    function setEnd(string memory _raiseId, uint256 _end) internal {
        // set raise end date
        raiseStorage().raiseDetails[_raiseId].end = _end;
    }

    /// @dev Diamond storage setter: increase raised amount.
    /// @param _raiseId Raise id
    /// @param _amount Raised increment of amount
    function increaseRaised(string memory _raiseId, uint256 _amount) internal {
        raiseStorage().raiseDataCrosschains[_raiseId].raised += _amount;
    }
}

File 5 of 14 : LibERC20Asset.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.25;

/**************************************

    security-contact:
    - [email protected]

    maintainers:
    - [email protected]
    - [email protected]
    - [email protected]
    - [email protected]

    contributors:
    - [email protected]

**************************************/

// Local imports - Structs
import { StorageTypes } from "../../../structs/StorageTypes.sol";

/// @dev Library containing ERC-20 asset storage with getters and setters
library LibERC20Asset {
    // -----------------------------------------------------------------------
    //                              Constants
    // -----------------------------------------------------------------------

    /// @dev ERC-20 asset storage pointer.
    bytes32 internal constant ERC20_ASSET_STORAGE_POSITION = keccak256("angelblock.fundraising.erc20");

    // -----------------------------------------------------------------------
    //                              Structs
    // -----------------------------------------------------------------------

    /// @dev ERC-20 asset storage struct.
    /// @param erc20 Mapping of raise id to ERC-20 asset struct
    struct ERC20AssetStorage {
        mapping(string => StorageTypes.ERC20Asset) erc20;
    }

    // -----------------------------------------------------------------------
    //                              Diamond storage
    // -----------------------------------------------------------------------

    /// @dev Function returning ERC-20 asset storage at storage pointer slot.
    /// @return eas ERC20AssetStorage struct instance at storage pointer position
    function erc20AssetStorage() internal pure returns (ERC20AssetStorage storage eas) {
        // declare position
        bytes32 position = ERC20_ASSET_STORAGE_POSITION;

        // set slot to position
        assembly {
            eas.slot := position
        }

        // explicit return
        return eas;
    }

    // -----------------------------------------------------------------------
    //                              Getters / setters
    // -----------------------------------------------------------------------

    /// @dev Diamond storage getter: ERC-20 asset address.
    /// @param _raiseId ID of the raise
    /// @return Address of the ERC-20 asset
    function getAddress(string memory _raiseId) internal view returns (address) {
        return erc20AssetStorage().erc20[_raiseId].erc20;
    }

    /// @dev Diamond storage getter: ERC-20 asset chain id.
    /// @param _raiseId ID of the raise
    /// @return Id of the chain
    function getChainId(string memory _raiseId) internal view returns (uint256) {
        // return
        return erc20AssetStorage().erc20[_raiseId].chainId;
    }

    /// @dev Diamond storage setter: ERC-20 asset chain id.
    /// @param _raiseId ID of the raise
    /// @param _chainId Id of the chain
    function setChainId(string memory _raiseId, uint256 _chainId) internal {
        erc20AssetStorage().erc20[_raiseId].chainId = _chainId;
    }

    /// @dev Diamond storage getter: ERC-20 asset vested amount.
    /// @param _raiseId ID of the raise
    /// @return Amount of vested ERC-20 tokens
    function getAmount(string memory _raiseId) internal view returns (uint256) {
        return erc20AssetStorage().erc20[_raiseId].amount;
    }

    /// @dev Diamond storage setter: ERC-20 asset vested amount.
    /// @param _raiseId ID of the raise
    /// @param _amount Amount of vested ERC-20 tokens
    function setAmount(string memory _raiseId, uint256 _amount) internal {
        erc20AssetStorage().erc20[_raiseId].amount = _amount;
    }

    /// @dev Diamond storage setter: ERC-20 asset
    /// @param _raiseId ID of the raise
    /// @param _erc20Asset StorageTypes.ERC20Asset struct
    function setERC20Asset(string memory _raiseId, StorageTypes.ERC20Asset memory _erc20Asset) internal {
        erc20AssetStorage().erc20[_raiseId] = _erc20Asset;
    }

    /// @dev Diamond storage setter: ERC-20 asset address.
    /// @param _raiseId ID of the raise
    /// @param _erc20 Address of the ERC-20 asset
    function setERC20Address(string memory _raiseId, address _erc20) internal {
        erc20AssetStorage().erc20[_raiseId].erc20 = _erc20;
    }
}

File 6 of 14 : RaiseService.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.25;

/**************************************

    security-contact:
    - [email protected]

    maintainers:
    - [email protected]
    - [email protected]
    - [email protected]
    - [email protected]

    contributors:
    - [email protected]

**************************************/

// Local imports - constants, encoders, events, errors, structs
import { RequestErrors } from "../../../../errors/RequestErrors.sol";
import { RaiseErrors } from "../../../../errors/RaiseErrors.sol";
import { CrossChainErrors } from "../../../../errors/cross-chain/CrossChainErrors.sol";
import { StorageTypes } from "../../../../structs/StorageTypes.sol";
import { EnumTypes } from "../../../../structs/EnumTypes.sol";

// Local imports - storages
import { LibRaise } from "../../../storage/raise/LibRaise.sol";
import { LibERC20Asset } from "../../../storage/assets/LibERC20Asset.sol";
import { LibBaseAsset } from "../../../storage/assets/LibBaseAsset.sol";
import { LibNonce } from "../../../storage/utils/LibNonce.sol";

library RaiseService {
    /**************************************

        Create raise

     **************************************/

    /// @dev Set to storage all raise and assets data.
    /// @param _raiseId ID of the raise
    /// @param _sender Message sender
    /// @param _nonce Used nonce
    /// @param _raise StorageTypes.Raise struct
    /// @param _raiseDetails StorageTypes.RaiseDetails struct
    /// @param _erc20Asset StorageTypes.ERC20Asset struct
    /// @param _baseAsset StorageTypes.BaseAsset struct
    function setRaiseCreationData(
        string memory _raiseId,
        address _sender,
        uint256 _nonce,
        StorageTypes.Raise memory _raise,
        StorageTypes.RaiseDetails memory _raiseDetails,
        StorageTypes.ERC20Asset memory _erc20Asset,
        StorageTypes.BaseAsset memory _baseAsset
    ) internal {
        // set raise to storage
        LibRaise.setRaise(_raiseId, _raise);
        // set raise details to storage
        LibRaise.setRaiseDetails(_raiseId, _raiseDetails);
        // set ERC-20 asset to storage
        LibERC20Asset.setERC20Asset(_raiseId, _erc20Asset);
        // set base asset to storage
        LibBaseAsset.setBaseAsset(_raiseId, _baseAsset);
        // set status
        LibRaise.setRaiseStatus(_raiseId, EnumTypes.RaiseStatus.RaiseCreated);
        // set nonce as used to storage
        LibNonce.setNonce(_sender, _nonce);
    }

    function validateCreationRequest(
        StorageTypes.Raise memory _raise,
        StorageTypes.RaiseDetails memory _raiseDetails,
        StorageTypes.ERC20Asset memory _erc20Asset,
        address _sender,
        uint256 _nonce
    ) internal view {
        if (_nonce <= LibNonce.getLastNonce(_sender)) {
            revert RequestErrors.NonceExpired(_sender, _nonce);
        }

        // check raise id
        if (bytes(_raise.raiseId).length == 0) {
            revert RaiseErrors.InvalidRaiseId(_raise.raiseId);
        }

        // verify if raise does not exist
        if (isRaiseExists(_raise.raiseId)) {
            revert RaiseErrors.RaiseAlreadyExists(_raise.raiseId);
        }

        // check start and end date
        if (_raiseDetails.start >= _raiseDetails.end) {
            revert RaiseErrors.InvalidRaiseStartEnd(_raiseDetails.start, _raiseDetails.end);
        }

        // start date and end date can be in present or future
        if (_raiseDetails.start < block.timestamp) {
            revert RaiseErrors.StartDateInPast(_raiseDetails.start);
        }

        // check hardcap and softcap
        if (_raiseDetails.hardcap < _raiseDetails.softcap) {
            revert RaiseErrors.HardcapLessThanSoftcap(_raiseDetails.hardcap, _raiseDetails.softcap);
        }

        // check if tokens are vested
        if (_erc20Asset.amount == 0) {
            revert RaiseErrors.InvalidVestedAmount();
        }

        // validate price per token == vested / hardcap
        if (_raiseDetails.tokensPerBaseAsset != (_erc20Asset.amount * LibRaise.PRICE_PRECISION) / _raiseDetails.hardcap) {
            revert RaiseErrors.PriceNotMatchConfiguration(_raiseDetails.tokensPerBaseAsset, _raiseDetails.hardcap, _erc20Asset.amount);
        }

        // validate token address for Early Stage type
        // TODO: Add support for AZ PSP22 here
        if (_raise.raiseType != EnumTypes.RaiseType.EarlyStage && _erc20Asset.erc20 == address(0)) {
            revert RaiseErrors.InvalidTokenAddress(_erc20Asset.erc20);
        }
    }

    /**************************************

        Finish raise

     **************************************/

    /// @dev Set finish raise
    /// @param _raiseId ID of the raise
    /// @param _raised uint256 raised funds
    /// @param _merkleRoot bytes32 merkle root
    function setFinishRaiseData(string memory _raiseId, uint256 _raised, bytes32 _merkleRoot) internal {
        StorageTypes.RaiseDataCC memory raiseDataCC_ = StorageTypes.RaiseDataCC({ raised: _raised, merkleRoot: _merkleRoot });
        LibRaise.setRaiseDataCrosschain(_raiseId, raiseDataCC_);

        if (isSoftcapAchieved(_raiseId)) {
            LibRaise.setRaiseStatus(_raiseId, EnumTypes.RaiseStatus.RaiseSucceed);
        } else {
            LibRaise.setRaiseStatus(_raiseId, EnumTypes.RaiseStatus.RaiseFailed);
        }
    }

    /// @dev Used for both: sender and receiver
    /// @param _raiseId ID of the raise
    /// @param _sender Message sender
    /// @param _nonce Used nonce
    function validateFinishRaiseRequest(string memory _raiseId, address _sender, uint256 _nonce) internal view {
        if (_nonce <= LibNonce.getLastNonce(_sender)) {
            revert RequestErrors.NonceExpired(_sender, _nonce);
        }

        if (LibRaise.getMerkleRoot(_raiseId) != 0) {
            revert RaiseErrors.RaiseAlreadyFinished(_raiseId);
        }
    }

    /**************************************

        Sold / unsold

     **************************************/

    /// @dev Get amount of sold tokens.
    /// @param _raiseId ID of raise
    /// @return Amount of tokens to claim by investor
    function getSold(string memory _raiseId) internal view returns (uint256) {
        // get tokens per base asset
        uint256 tokensPerBaseAsset_ = LibRaise.getTokensPerBaseAsset(_raiseId);

        // get raised
        uint256 raised_ = LibRaise.getRaised(_raiseId);

        // calculate how much tokens are sold
        return (tokensPerBaseAsset_ * raised_) / LibRaise.PRICE_PRECISION;
    }

    /// @dev Get amount of unsold tokens.
    /// @param _raiseId ID of raise
    /// @return Amount of tokens to reclaim by startup
    function getUnsold(string memory _raiseId) internal view returns (uint256) {
        // get all vested tokens
        uint256 vested_ = LibERC20Asset.getAmount(_raiseId);

        // get sold tokens
        uint256 sold_ = getSold(_raiseId);

        // return
        return vested_ - sold_;
    }

    /// @dev Get amount of unsold tokens.
    /// @param _raiseId ID of raise
    /// @param _diff Amount of unsold base asset
    /// @return Amount of tokens to reclaim by startup
    function calculateUnsold(string memory _raiseId, uint256 _diff) internal view returns (uint256) {
        // calculate how much tokens are unsold
        return (LibRaise.getTokensPerBaseAsset(_raiseId) * _diff) / LibRaise.PRICE_PRECISION;
    }

    /**************************************

        Getters

     **************************************/

    /// @dev Get amount of raised funds.
    /// @param _raiseId ID of raise
    /// @return Amount of collected funds in fundraising
    function getRaised(string memory _raiseId) internal view returns (uint256) {
        return LibRaise.getRaised(_raiseId);
    }

    /// @dev Get softcap limit.
    /// @param _raiseId ID of raise
    /// @return Softcap limit
    function getSoftcap(string memory _raiseId) internal view returns (uint256) {
        return LibRaise.getSoftcap(_raiseId);
    }

    /**************************************

        Checks

     **************************************/

    /// @dev Check if raise for given id exists.
    /// @param _raiseId ID of the raise
    /// @return True if raise exists
    function isRaiseExists(string memory _raiseId) internal view returns (bool) {
        // return
        return bytes(LibRaise.getId(_raiseId)).length != 0;
    }

    /// @dev Check if raise is active.
    /// @param _raiseId ID of raise
    /// @return True if investment round is ongoing
    function isRaiseActive(string memory _raiseId) internal view returns (bool) {
        // tx.members
        uint256 now_ = block.timestamp;

        // get raise start time
        uint256 start_ = LibRaise.getStart(_raiseId);
        // get raise end time
        uint256 end_ = LibRaise.getEnd(_raiseId);

        // final check
        return start_ <= now_ && now_ <= end_;
    }

    /// @dev Validation if raise was completed.
    /// @param _raiseId ID of raise
    function validateCompletedRaise(string memory _raiseId) internal view {
        // verify raise exists
        if (!isRaiseExists(_raiseId)) {
            revert RaiseErrors.RaiseDoesNotExists(_raiseId);
        }

        // check if raise failed already
        if (LibRaise.getRaiseStatus(_raiseId) != EnumTypes.RaiseStatus.RaiseSucceed) {
            revert RaiseErrors.RaiseNotSucceed(_raiseId);
        }
    }

    /// @dev Check if softcap was achieved.
    /// @param _raiseId ID of raise
    /// @return True if softcap was achieved
    function isSoftcapAchieved(string memory _raiseId) internal view returns (bool) {
        // return
        return LibRaise.getSoftcap(_raiseId) <= LibRaise.getRaised(_raiseId);
    }
}

File 7 of 14 : StorageTypes.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.25;

/**************************************

    security-contact:
    - [email protected]

    maintainers:
    - [email protected]
    - [email protected]
    - [email protected]
    - [email protected]

    contributors:
    - [email protected]

**************************************/

// Local imports
import { EnumTypes } from "./EnumTypes.sol";

/// @notice Library with core storage structs definition.
library StorageTypes {
    // -----------------------------------------------------------------------
    //                              Raise
    // -----------------------------------------------------------------------

    /// @dev Struct containing main information about the raise.
    /// @param raiseId UUID of raise
    /// @param raiseType Type of raise
    /// @param receiver Address of wallet that will receive funds from Escrow
    /// @param controller Address of wallet that will trigger claim on Escrow
    struct Raise {
        string raiseId;
        EnumTypes.RaiseType raiseType;
        address receiver;
        address controller;
    }

    /// @dev Struct containing main information about the raise for Substrate-based chains.
    /// @param raiseId UUID of raise
    /// @param raiseType Type of raise
    /// @param owner Substrate address of startup
    struct SubstrateRaise {
        string raiseId;
        EnumTypes.RaiseType raiseType;
        string owner; // TODO: Convert to receiver and controller
    }

    /// @dev Struct containing detailed info about raise.
    /// @param tokensPerBaseAsset Ratio of how much tokens is worth 1 unit of base asset (erc20 * precision / hardcap)
    /// @param hardcap Max amount of base asset to collect during a raise
    /// @param softcap Min amount of base asset to collect during a raise
    /// @param start Start date of raise
    /// @param end End date of raise
    struct RaiseDetails {
        uint256 tokensPerBaseAsset;
        uint256 hardcap;
        uint256 softcap;
        uint256 start;
        uint256 end;
    }

    /// @dev Struct containing information about the raise shared across chains.
    /// @param raised Amount of raised base asset for fundraising
    /// @param merkleRoot Merkle root compressing all information about investors and their investments
    struct RaiseDataCC {
        uint256 raised;
        bytes32 merkleRoot;
    }

    // -----------------------------------------------------------------------
    //                              ERC-20 Asset
    // -----------------------------------------------------------------------

    /// @dev Struct defining ERC20 offered by startup for investments.
    /// @param erc20 Address of ERC20 token
    /// @param chainId ID of network that asset exists
    /// @param amount Total amount of ERC20 used in vesting
    struct ERC20Asset {
        address erc20;
        uint256 chainId;
        uint256 amount;
    }

    /// @dev Struct defining PSP22 offered by startup for investments for Substrate-based chains.
    /// @param psp22 Address of PSP22 token
    /// @param chainId ID of network that asset exists
    /// @param amount Total amount of PSP22 used in vesting
    struct PSP22Asset {
        string psp22;
        uint256 chainId;
        uint256 amount;
    }

    // -----------------------------------------------------------------------
    //                              Base Asset
    // -----------------------------------------------------------------------

    /// @dev Struct defining base asset used for investment on particular chain.
    /// @param base Address of base asset
    /// @param chainId ID of network that asset exists
    struct BaseAsset {
        address base;
        uint256 chainId;
    }

    /// @dev Struct defining base asset used for investment on particular chain.
    /// @param ethBase Address of eth base asset
    /// @param azBase Address of substrate base asset
    /// @param chainId ID of network that asset exists
    struct SubstrateBaseAsset {
        address ethBase;
        string azBase;
        uint256 chainId;
    }

    // -----------------------------------------------------------------------
    //                              Investor Funds Info
    // -----------------------------------------------------------------------

    /// @dev Struct containing info about state of investor funds.
    /// @param invested Mapping that stores how much given address invested
    /// @param investmentRefunded Mapping that tracks if user was refunded
    struct InvestorFundsInfo {
        mapping(address => uint256) invested;
        mapping(address => bool) investmentRefunded;
    }

    // -----------------------------------------------------------------------
    //                              Startup Funds Info
    // -----------------------------------------------------------------------

    /// @dev Struct containing info about state of startup funds.
    /// @param collateralRefunded Boolean describing if startup was refunded
    /// @param reclaimed Boolean that shows if startup reclaimed unsold tokens
    struct StartupFundsInfo {
        bool collateralRefunded;
        bool reclaimed;
    }

    // -----------------------------------------------------------------------
    //                              Milestone
    // -----------------------------------------------------------------------

    /// @dev Struct containing info about milestone and shares it's unlocking.
    /// @param milestoneId UUID of milestone
    /// @param milestoneNo Index of milestone (counted from 1)
    /// @param share % of unlocked tokens (12.5% = 12.5 * 1_000_000)
    struct Milestone {
        string milestoneId;
        uint256 milestoneNo;
        uint256 share;
    }

    /// @dev Struct containing milestones and share data.
    /// @param milestones Ordered list of unlocked milestones containing all their details
    /// @param unlockedShares Sum of shares from all submitted milestones
    /// @param rejectedShares Amount of shares reverted back due to failed repair plan
    /// @param totalShares Sum of all unlocked and rejected shares (should not exceed 100%)
    struct ShareInfo {
        Milestone[] milestones;
        uint256 unlockedShares;
        uint256 rejectedShares;
        uint256 totalShares;
    }

    // -----------------------------------------------------------------------
    //                              Claiming
    // -----------------------------------------------------------------------

    /// @dev Struct containing frequently used storage for claiming purposes.
    /// @param investorClaimed Mapping that stores amount claimed of each investor
    /// @param startupClaimed Amount of claimed assets by startup owner
    struct ClaimingInfo {
        mapping(address => uint256) investorClaimed;
        uint256 startupClaimed;
    }

    /// @dev Struct containing informations about claiming schedules for investors.
    /// @param claimingId UUID of claiming
    /// @param milestoneId UUID of milestone
    /// @param partialShare Share of milestone tokens which are unlocked in the given claiming
    /// @param unlockTimestamp Timestamp on which tokens are unlocked
    struct ClaimingSchedule {
        string claimingId;
        string milestoneId;
        uint256 partialShare;
        uint256 unlockTimestamp;
    }
}

File 8 of 14 : EnumTypes.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.25;

/**************************************

    security-contact:
    - [email protected]

    maintainers:
    - [email protected]
    - [email protected]
    - [email protected]
    - [email protected]

    contributors:
    - [email protected]

**************************************/

/// @notice Library with core types definition.
library EnumTypes {
    // -----------------------------------------------------------------------
    //                              Raise
    // -----------------------------------------------------------------------

    /// @dev Definition of supported types of raises.
    enum RaiseType {
        Standard,
        EarlyStage,
        OTC
    }

    /// @dev Definition of raise statuses.
    enum RaiseStatus {
        RaiseCreated,
        RaiseFailed,
        RaiseSucceed
    }

    // -----------------------------------------------------------------------
    //                              Cross chain
    // -----------------------------------------------------------------------

    /// @dev Definition of supported cross chain providers.
    enum CrossChainProvider {
        None,
        LayerZero,
        AlephZero
    }

    // -----------------------------------------------------------------------
    //                              Milestone
    // -----------------------------------------------------------------------

    /// @dev Definiction of action to perform for reschedule claimings
    enum RescheduleActionType {
        UpdateAndCreate,
        OnlyUpdate,
        UpdateAndDelete
    }
}

File 9 of 14 : RequestErrors.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.25;

/**************************************

    security-contact:
    - [email protected]

    maintainers:
    - [email protected]
    - [email protected]
    - [email protected]
    - [email protected]

    contributors:
    - [email protected]

**************************************/

import { RequestTypes } from "../structs/RequestTypes.sol";

/**************************************

    Request errors

**************************************/

/// @dev All errors connected with secure communication.
library RequestErrors {
    // -----------------------------------------------------------------------
    //                              Request
    // -----------------------------------------------------------------------

    error RequestExpired(address sender, uint256 expiry); // 0x8a288b92
    error NonceExpired(address sender, uint256 nonce); // 0x2b6069a9
    error IncorrectSender(address sender); // 0x7da9057e
    error BadgeUriEmpty(); // 0xb03cfc55
}

File 10 of 14 : CrossChainErrors.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.25;

import "../../structs/EnumTypes.sol";

/**************************************

    security-contact:
    - [email protected]

    maintainers:
    - [email protected]
    - [email protected]
    - [email protected]
    - [email protected]

    contributors:
    - [email protected]

**************************************/

import { EnumTypes } from "../../structs/EnumTypes.sol";

/**************************************

    Cross-chain errors
    
**************************************/

/// @dev All errors used in cross chain communication
library CrossChainErrors {
    // -----------------------------------------------------------------------
    //                              Chain id & Provider
    // -----------------------------------------------------------------------

    error InvalidChainId(uint256 current, uint256 expected); // 0x9fba672f
    error UnsupportedChainId(uint256 chainId); // 0xa5dab5fe
    error ProviderChainIdMismatch(EnumTypes.CrossChainProvider provider, uint256 requestChainId, uint256 blockChainId); // 0x72c80f07
    error UnsupportedProvider(); // 0x7f4d001d
    error NotCrossChainRequest(); // 0x5a64c0eb

    // -----------------------------------------------------------------------
    //                              Payload
    // -----------------------------------------------------------------------

    error EmptyPayload(); // 0x2e3f1f34
}

File 11 of 14 : LibBaseAsset.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.25;

/**************************************

    security-contact:
    - [email protected]

    maintainers:
    - [email protected]
    - [email protected]
    - [email protected]
    - [email protected]

    contributors:
    - [email protected]

**************************************/

// Local imports - Structs
import { StorageTypes } from "../../../structs/StorageTypes.sol";

/// @dev Library containing base asset storage with getters and setters
library LibBaseAsset {
    // -----------------------------------------------------------------------
    //                              Constants
    // -----------------------------------------------------------------------

    /// @dev Base asset storage pointer.
    bytes32 internal constant BASE_ASSET_STORAGE_POSITION = keccak256("angelblock.fundraising.baseAsset");

    // -----------------------------------------------------------------------
    //                              Structs
    // -----------------------------------------------------------------------

    /// @dev Base asset storage struct.
    /// @param base Mapping of raise id to base asset struct
    struct BaseAssetStorage {
        mapping(string => StorageTypes.BaseAsset) base;
    }

    // -----------------------------------------------------------------------
    //                              Diamond storage
    // -----------------------------------------------------------------------

    /// @dev Function returning base asset storage at storage pointer slot.
    /// @return bas BaseAssetStorage struct instance at storage pointer position
    function baseAssetStorage() internal pure returns (BaseAssetStorage storage bas) {
        // declare position
        bytes32 position = BASE_ASSET_STORAGE_POSITION;

        // set slot to position
        assembly {
            bas.slot := position
        }

        // explicit return
        return bas;
    }

    // -----------------------------------------------------------------------
    //                              Getters / setters
    // -----------------------------------------------------------------------

    /// @dev Diamond storage getter: Base asset address.
    /// @param _raiseId ID of the raise
    /// @return Address of the base asset
    function getAddress(string memory _raiseId) internal view returns (address) {
        // return
        return baseAssetStorage().base[_raiseId].base;
    }

    /// @dev Diamond storage getter: Base asset chain id.
    /// @param _raiseId ID of the raise
    /// @return Id of the chain
    function getChainId(string memory _raiseId) internal view returns (uint256) {
        // return
        return baseAssetStorage().base[_raiseId].chainId;
    }

    /// @dev Diamond storage setter: Base asset
    /// @param _raiseId ID of the raise
    /// @param _baseAsset StorageTypes.BaseAsset struct
    function setBaseAsset(string memory _raiseId, StorageTypes.BaseAsset memory _baseAsset) internal {
        // set base asset
        baseAssetStorage().base[_raiseId] = _baseAsset;
    }
}

File 12 of 14 : LibNonce.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.25;

/**************************************

    security-contact:
    - [email protected]

    maintainers:
    - [email protected]
    - [email protected]
    - [email protected]
    - [email protected]

    contributors:
    - [email protected]

**************************************/

/**************************************

    Nonce library

    ------------------------------

    Diamond storage containing nonces

 **************************************/

/// @notice Library implementing NonceStorage and functions.
library LibNonce {
    // -----------------------------------------------------------------------
    //                              Storage pointer
    // -----------------------------------------------------------------------

    /// @dev Storage pointer.
    bytes32 internal constant NONCE_STORAGE_POSITION = keccak256("angelblock.fundraising.nonce");

    // -----------------------------------------------------------------------
    //                              Structs
    // -----------------------------------------------------------------------

    /// @dev Nonce diamond storage.
    /// @param nonces Mapping of address to nonce information.
    struct NonceStorage {
        mapping(address => uint256) nonces;
    }

    // -----------------------------------------------------------------------
    //                              Diamond storage
    // -----------------------------------------------------------------------

    /// @dev Function returning nonce storage at storage pointer slot.
    /// @return ns NonceStorage struct instance at storage pointer position
    function nonceStorage() internal pure returns (NonceStorage storage ns) {
        // declare position
        bytes32 position = NONCE_STORAGE_POSITION;

        // set slot to position
        assembly {
            ns.slot := position
        }

        // explicit return
        return ns;
    }

    // -----------------------------------------------------------------------
    //                              Getters / setters
    // -----------------------------------------------------------------------

    /// @dev Diamond storage getter: nonce per account.
    /// @param _account Address for which nonce should be checked
    /// @return Current nonce of account
    function getLastNonce(address _account) internal view returns (uint256) {
        // return
        return nonceStorage().nonces[_account];
    }

    /// @dev Diamond storage setter: nonce per account.
    /// @param _account Address for which nonce should be set
    /// @param _nonce New value for nonce
    function setNonce(address _account, uint256 _nonce) internal {
        // get storage
        NonceStorage storage ns = nonceStorage();

        // set nonce
        ns.nonces[_account] = _nonce;
    }
}

File 13 of 14 : RequestTypes.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.25;

/**************************************

    security-contact:
    - [email protected]

    maintainers:
    - [email protected]
    - [email protected]
    - [email protected]
    - [email protected]

    contributors:
    - [email protected]

**************************************/

// Local imports
import { CrossChainRequestTypes } from "./CrossChainRequestTypes.sol";
import { StorageTypes } from "./StorageTypes.sol";

/// @notice Library that defines requests sent from frontend to smart contracts.
library RequestTypes {
    // -----------------------------------------------------------------------
    //                              Base
    // -----------------------------------------------------------------------

    /// @dev Struct defining low level data for any request.
    /// @param sender Address of account executing tx
    /// @param expiry Deadline on which request expires
    /// @param nonce Number used only once used to prevent tx reply or out of order execution
    struct BaseRequest {
        address sender;
        uint256 expiry;
        uint256 nonce;
    }

    // -----------------------------------------------------------------------
    //                              Raise
    // -----------------------------------------------------------------------

    /// @dev Struct used to create a raise.
    /// @param raise Struct containing info about raise
    /// @param raiseDetails Mapping of raise id to vested token information
    /// @param erc20Asset Struct containing info about vested ERC20
    /// @param baseAsset Struct containing info about asset used for investment
    /// @param badgeUri IPFS URI that initializes equity badge for the raise
    /// @param base Struct defining low level data for a request
    struct CreateRaiseRequest {
        StorageTypes.Raise raise;
        StorageTypes.RaiseDetails raiseDetails;
        StorageTypes.ERC20Asset erc20Asset;
        StorageTypes.BaseAsset baseAsset;
        string badgeUri;
        BaseRequest base;
    }

    /// @dev Struct used to create a raise.
    /// @param raise Struct containing info about raise
    /// @param raiseDetails Mapping of raise id to vested token information
    /// @param erc20Asset Struct containing info about vested ERC20
    /// @param baseAsset Struct containing info about asset used for investment
    /// @param crossChainBase Struct defining low level data for a cross-chain requests
    struct RegisterRaiseRequest {
        StorageTypes.Raise raise;
        StorageTypes.RaiseDetails raiseDetails;
        StorageTypes.ERC20Asset erc20Asset;
        StorageTypes.BaseAsset baseAsset;
        CrossChainRequestTypes.CrossChainBase crossChainBase;
    }

    /// @dev Struct used to create a raise for Substrate-based chains.
    /// @param raise Struct containing info about raise
    /// @param raiseDetails Mapping of raise id to vested token information
    /// @param psp22Asset Struct containing info about vested ERC20
    /// @param baseAsset Struct containing info about asset used for investment
    /// @param crossChainBase Struct defining low level data for a cross-chain requests
    struct SubstrateRegisterRaiseRequest {
        StorageTypes.SubstrateRaise raise;
        StorageTypes.RaiseDetails raiseDetails;
        StorageTypes.PSP22Asset psp22Asset;
        StorageTypes.SubstrateBaseAsset baseAsset;
        CrossChainRequestTypes.CrossChainBase crossChainBase;
    }

    /// @dev Struct Used to finish a raise.
    /// @param raiseId Id of finished raise
    /// @param raised Number of collected tokens
    /// @param merkleRoot Root value of merkle tree build from investments
    /// @param base Struct defining low level data for a request
    struct FinishRaiseRequest {
        string raiseId;
        uint256 raised;
        bytes32 merkleRoot;
        BaseRequest base;
    }

    /// @dev Struct used to finish a raise in receiver
    /// @param raiseId Id of finished raise
    /// @param raised Number of collected tokens
    /// @param merkleRoot Root value of merkle tree build from investments
    /// @param crossChainBase Struct defining low level data for a cross-chain requests
    struct FinishRaiseReceiverRequest {
        string raiseId;
        uint256 raised;
        bytes32 merkleRoot;
        CrossChainRequestTypes.CrossChainBase crossChainBase;
    }

    // -----------------------------------------------------------------------
    //                              Set token
    // -----------------------------------------------------------------------

    /// @dev Struct used to set a token for an early stage raise.
    /// @param raiseId UUID of raise
    /// @param token Address of ERC20
    /// @param base Struct defining low level data for a request
    struct SetTokenRequest {
        string raiseId;
        address token;
        BaseRequest base;
    }

    // -----------------------------------------------------------------------
    //                              Invest
    // -----------------------------------------------------------------------

    /// @dev Struct used to invest into raise.
    /// @param raiseId UUID of raise
    /// @param investment Amount of base asset used to invest
    /// @param maxTicketSize Individual limit of investment for validation
    /// @param base Struct defining low level data for a request
    struct InvestRequest {
        string raiseId;
        uint256 investment;
        uint256 maxTicketSize;
        BaseRequest base;
    }

    // -----------------------------------------------------------------------
    //                              Voting
    // -----------------------------------------------------------------------

    /// @dev Struct used to unlock milestone
    /// @param raiseId UUID of raise
    /// @param milestone Struct containing info about unlocked milestone
    /// @param base Struct defining low level data for a request
    struct UnlockMilestoneRequest {
        string raiseId;
        StorageTypes.Milestone milestone;
        BaseRequest base;
    }

    /// @dev Struct used to unlock milestone for receiver
    /// @param raiseId UUID of raise
    /// @param milestone Struct containing info about unlocked milestone
    /// @param crossChainBase Struct defining low level data for a cross-chain requests
    struct UnlockMilestoneReceiverRequest {
        string raiseId;
        StorageTypes.Milestone milestone;
        CrossChainRequestTypes.CrossChainBase crossChainBase;
    }

    /// @dev Struct used to submit failed repair plan
    /// @param raiseId UUID of raise
    /// @param base Struct defining low level data for a request
    struct RejectRaiseRequest {
        string raiseId;
        BaseRequest base;
    }

    /// @dev Struct used to submit failed repair plan for receiver
    /// @param raiseId UUID of raise
    /// @param crossChainBase Struct defining low level data for a cross-chain request
    struct RejectRaiseReceiverRequest {
        string raiseId;
        CrossChainRequestTypes.CrossChainBase crossChainBase;
    }

    // -----------------------------------------------------------------------
    //                              Claiming
    // -----------------------------------------------------------------------

    /// @dev Struct used to submit claiming schedule
    /// @param raiseId UUID of raise
    /// @param milestoneId UUID of milestone
    /// @param claimingSchedules Array of ClaimingSchedule structs
    /// @param base Struct defining low level data for a request
    struct SubmitClaimingRequest {
        string raiseId;
        string milestoneId;
        StorageTypes.ClaimingSchedule[] claimingSchedules;
        BaseRequest base;
    }

    /// @dev Struct used to submit claiming schedule
    /// @param raiseId UUID of raise
    /// @param milestoneId UUID of milestone
    /// @param claimingSchedules Array of ClaimingSchedule structs
    /// @param crossChainBase Struct defining low level data for a cross-chain requests
    struct SubmitClaimingReceiverRequest {
        string raiseId;
        string milestoneId;
        StorageTypes.ClaimingSchedule[] claimingSchedules;
        CrossChainRequestTypes.CrossChainBase crossChainBase;
    }

    /// @dev Struct used to claim tokens by investor
    /// @param raiseId UUID of raise
    /// @param investment Investment of msg.sender
    /// @param proofs Merkle proofs for msg.sender
    /// @param base Struct defining low level data for a request
    struct InvestorClaimRequest {
        string raiseId;
        uint256 investment;
        bytes32[] proofs;
        BaseRequest base;
    }

    /// @dev Struct used to claim tokens by startup
    /// @param raiseId UUID of raise
    /// @param base Struct defining low level data for a request
    struct StartupClaimRequest {
        string raiseId;
        BaseRequest base;
    }

    /// @dev Struct used to reschedule claiming schedule
    /// @param milestoneId UUID of milestone
    /// @param claimingSchedules Array of ClaimingSchedule structs
    /// @param base Struct defining low level data for a request
    struct RescheduleClaimingRequest {
        string raiseId;
        string milestoneId;
        StorageTypes.ClaimingSchedule[] claimingSchedules;
        BaseRequest base;
    }

    /// @dev Struct used to reschedule claimings
    /// @param raiseId UUID of raise
    /// @param milestoneId UUID of milestone
    /// @param claimingSchedules Array of ClaimingSchedule structs
    /// @param crossChainBase Struct defining low level data for a cross-chain requests
    struct RescheduleClaimingReceiverRequest {
        string raiseId;
        string milestoneId;
        StorageTypes.ClaimingSchedule[] claimingSchedules;
        CrossChainRequestTypes.CrossChainBase crossChainBase;
    }
}

File 14 of 14 : CrossChainRequestTypes.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.25;

/**************************************

    security-contact:
    - [email protected]

    maintainers:
    - [email protected]
    - [email protected]
    - [email protected]
    - [email protected]

    contributors:
    - [email protected]

**************************************/

// Local imports - Structs
import { StorageTypes } from "./StorageTypes.sol";
import { EnumTypes } from "./EnumTypes.sol";

/// @notice Library that defines requests sent from frontend to smart contracts.
library CrossChainRequestTypes {
    // -----------------------------------------------------------------------
    //                              Cross chain
    // -----------------------------------------------------------------------

    /// @dev Struct containing chosen cross-chain provider and encoded data.
    /// @param provider Cross chain provider
    /// @param data Data encoding message in format for specific provider
    struct CrossChainData {
        EnumTypes.CrossChainProvider provider;
        bytes data;
    }

    /// @dev Struct containing base for cross-chain message.
    /// @param sender Address of sender
    /// @param nonce Nonce of cross-chain message
    struct CrossChainBase {
        address sender;
        uint256 nonce;
    }

    // -----------------------------------------------------------------------
    //                              LayerZero
    // -----------------------------------------------------------------------

    /// @dev Struct containing cross chain message in LayerZero format
    /// @param payload Encoded cross-chain call with data
    /// @param additionalParams Additional parameters for LayerZero
    /// @param fee Fee covering execution cost
    struct LayerZeroData {
        bytes payload;
        bytes additionalParams;
        uint256 fee;
    }

    /// @dev Struct containing cross chain health check in LayerZero format
    /// @param base Just cross-chain base
    struct LayerZeroHealthCheck {
        CrossChainBase base;
    }

    // -----------------------------------------------------------------------
    //                              AlephZero
    // -----------------------------------------------------------------------

    /// @dev Struct containing cross chain message in AlephZero format
    /// @param nonce Cross chain nonce of tx
    /// @param fee Unused fee if we would like to publish Bridge
    /// @param selector Byte-encoded substrate function to call
    /// @param args Byte-encoded cross-chain arguments for function
    /// @param options Byte-encoded cross chain settings for Bridge tx
    /// @param metadata Byte-encoded metadata in Scale format for Bridge
    struct AlephZeroData {
        uint256 nonce;
        uint256 fee;
        bytes4 selector;
        bytes args;
        bytes options;
        bytes metadata;
    }
}

Settings
{
  "remappings": [
    "@openzeppelin/=src/fundraising/node_modules/@openzeppelin/",
    "ds-test/=src/fundraising/node_modules/ds-test/src/",
    "forge-std/=src/fundraising/node_modules/forge-std/src/",
    "@layerzerolabs/lz-evm-oapp-v2/=src/fundraising/node_modules/@layerzerolabs/lz-evm-oapp-v2/",
    "@layerzerolabs/lz-evm-messagelib-v2/=src/fundraising/node_modules/@layerzerolabs/lz-evm-messagelib-v2/",
    "@layerzerolabs/lz-evm-protocol-v2/=src/fundraising/node_modules/@layerzerolabs/lz-evm-protocol-v2/",
    "solidity-bytes-utils/=src/fundraising/node_modules/solidity-bytes-utils/",
    "ethereum-xcm-v3/=src/fundraising/node_modules/ethereum-xcm-v3/",
    "base58-solidity/=src/fundraising/node_modules/base58-solidity/",
    "murky/=src/fundraising/node_modules/murky/",
    "stringutils/=node_modules/stringutils/src/",
    "permit2/=node_modules/permit2/src/",
    "hardhat/=src/fundraising/node_modules/hardhat/",
    "openzeppelin-contracts/=src/fundraising/node_modules/murky/lib/openzeppelin-contracts/",
    "safe/=src/fundraising/node_modules/safe/",
    "solidity-stringutils/=src/fundraising/node_modules/surl/lib/solidity-stringutils/src/",
    "surl/=src/fundraising/node_modules/surl/"
  ],
  "optimizer": {
    "enabled": true,
    "runs": 200,
    "details": {
      "yul": true
    }
  },
  "metadata": {
    "useLiteralContent": false,
    "bytecodeHash": "ipfs",
    "appendCBOR": true
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "evmVersion": "paris",
  "viaIR": true,
  "libraries": {}
}

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"uint256","name":"price","type":"uint256"},{"internalType":"uint256","name":"hardcap","type":"uint256"},{"internalType":"uint256","name":"vested","type":"uint256"}],"name":"PriceNotMatchConfiguration","type":"error"},{"inputs":[{"internalType":"string","name":"raiseId","type":"string"}],"name":"RaiseDoesNotExists","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"string","name":"raiseId","type":"string"},{"indexed":false,"internalType":"uint256","name":"tokensPerBaseAsset","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amountErc20","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"hardcap","type":"uint256"}],"name":"FundraisingBeforePrice","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"string","name":"raiseId","type":"string"},{"indexed":false,"internalType":"uint256","name":"tokensPerBaseAsset","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amountErc20","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"hardcap","type":"uint256"}],"name":"FundraisingChangePrice","type":"event"},{"inputs":[{"components":[{"internalType":"string","name":"raiseId","type":"string"},{"internalType":"uint256","name":"hardcap","type":"uint256"},{"internalType":"uint256","name":"amountErc20","type":"uint256"}],"internalType":"struct RaiseChangeTokenAmount.Arguments","name":"_args","type":"tuple"}],"name":"init","outputs":[],"stateMutability":"nonpayable","type":"function"}]

608080604052346015576105b5908161001b8239f35b600080fdfe6080604052600436101561001257600080fd5b6000803560e01c636a6f4c611461002857600080fd5b346104b457806003196020368201126104b15767ffffffffffffffff9081600435116104a85760606004353603918201126104a85760048035013590602219018112156104a857600435019060048201359081116104a857602482019181360383136104ac576100a3601f8301601f191660200160806104b7565b8160805260248236920101116104a857602091819060a03760800101526040516020816080516100d78183856080016104ef565b81017fcb6c47b3daa6db10ae5e4ec1cf9f8100d11f82b57c506d550c00ec86c5cce1d281520301902060405190828154918260011c9260018116801561049e575b60208510811461048a578486528593929181156104685750600114610427575b50610145925003826104b7565b51156104005760016040516020816080516101648183856080016104ef565b810160008051602061056083398151915281520301902001547f6faf101849f4d6fc2b8d811c16d6e7123e42ad6ba7efdefd9b858dc8f4b7bf7f6040516020816080516101b58183856080016104ef565b8101600080516020610560833981519152815203019020549160026040516020816080516101e78183856080016104ef565b81017f9d245c8905a41e40b5d7d8d225eabcef70dc5100963a988bf7a9d7b6a0cd4a74815203019020015461022460405192839286608085610537565b0390a16044600435013590670de0b6b3a7640000908183029183830414831517156103ec57602460043501359182156103d85782900481036103b55750600160405160208160805161027a8183856080016104ef565b8101600080516020610560833981519152815203019020015560026040516020816080516102ac8183856080016104ef565b81017f9d245c8905a41e40b5d7d8d225eabcef70dc5100963a988bf7a9d7b6a0cd4a7481520301902001557fb09fe0231d694ba589c13f024a77fac48eed4350a3585bff5c2f50cca651fcbd60016040516020816080516103118183856080016104ef565b810160008051602061056083398151915281520301902001546040516020816080516103418183856080016104ef565b8101600080516020610560833981519152815203019020546103af60026040516020816080516103758183856080016104ef565b81017f9d245c8905a41e40b5d7d8d225eabcef70dc5100963a988bf7a9d7b6a0cd4a74815203019020015492604051938493608085610537565b0390a180f35b826064926040519263643c0fc560e01b8452600484015260248301526044820152fd5b634e487b7160e01b85526012600452602485fd5b634e487b7160e01b84526011600452602484fd5b604051637813445960e01b81526020600482015280610423602482016080610512565b0390fd5b85525060208420909184915b81831061044c5750509060206101459282010138610138565b6020919350806001915483858801015201910190918392610433565b90506020925061014594915060ff191682840152151560051b82010138610138565b634e487b7160e01b87526022600452602487fd5b93607f1693610118565b5050fd5b505050fd5b50fd5b80fd5b90601f8019910116810190811067ffffffffffffffff8211176104d957604052565b634e487b7160e01b600052604160045260246000fd5b60005b8381106105025750506000910152565b81810151838201526020016104f2565b9060209161052b815180928185528580860191016104ef565b601f01601f1916010190565b9092610550606093969594608084526080840190610512565b9560208301526040820152015256fecb6c47b3daa6db10ae5e4ec1cf9f8100d11f82b57c506d550c00ec86c5cce1d3a26469706673582212203516c89d3dc526c2caace595b7b0fb922fc7ceb88e9ad0baddc351f44047faa864736f6c63430008190033

Deployed Bytecode

0x6080604052600436101561001257600080fd5b6000803560e01c636a6f4c611461002857600080fd5b346104b457806003196020368201126104b15767ffffffffffffffff9081600435116104a85760606004353603918201126104a85760048035013590602219018112156104a857600435019060048201359081116104a857602482019181360383136104ac576100a3601f8301601f191660200160806104b7565b8160805260248236920101116104a857602091819060a03760800101526040516020816080516100d78183856080016104ef565b81017fcb6c47b3daa6db10ae5e4ec1cf9f8100d11f82b57c506d550c00ec86c5cce1d281520301902060405190828154918260011c9260018116801561049e575b60208510811461048a578486528593929181156104685750600114610427575b50610145925003826104b7565b51156104005760016040516020816080516101648183856080016104ef565b810160008051602061056083398151915281520301902001547f6faf101849f4d6fc2b8d811c16d6e7123e42ad6ba7efdefd9b858dc8f4b7bf7f6040516020816080516101b58183856080016104ef565b8101600080516020610560833981519152815203019020549160026040516020816080516101e78183856080016104ef565b81017f9d245c8905a41e40b5d7d8d225eabcef70dc5100963a988bf7a9d7b6a0cd4a74815203019020015461022460405192839286608085610537565b0390a16044600435013590670de0b6b3a7640000908183029183830414831517156103ec57602460043501359182156103d85782900481036103b55750600160405160208160805161027a8183856080016104ef565b8101600080516020610560833981519152815203019020015560026040516020816080516102ac8183856080016104ef565b81017f9d245c8905a41e40b5d7d8d225eabcef70dc5100963a988bf7a9d7b6a0cd4a7481520301902001557fb09fe0231d694ba589c13f024a77fac48eed4350a3585bff5c2f50cca651fcbd60016040516020816080516103118183856080016104ef565b810160008051602061056083398151915281520301902001546040516020816080516103418183856080016104ef565b8101600080516020610560833981519152815203019020546103af60026040516020816080516103758183856080016104ef565b81017f9d245c8905a41e40b5d7d8d225eabcef70dc5100963a988bf7a9d7b6a0cd4a74815203019020015492604051938493608085610537565b0390a180f35b826064926040519263643c0fc560e01b8452600484015260248301526044820152fd5b634e487b7160e01b85526012600452602485fd5b634e487b7160e01b84526011600452602484fd5b604051637813445960e01b81526020600482015280610423602482016080610512565b0390fd5b85525060208420909184915b81831061044c5750509060206101459282010138610138565b6020919350806001915483858801015201910190918392610433565b90506020925061014594915060ff191682840152151560051b82010138610138565b634e487b7160e01b87526022600452602487fd5b93607f1693610118565b5050fd5b505050fd5b50fd5b80fd5b90601f8019910116810190811067ffffffffffffffff8211176104d957604052565b634e487b7160e01b600052604160045260246000fd5b60005b8381106105025750506000910152565b81810151838201526020016104f2565b9060209161052b815180928185528580860191016104ef565b601f01601f1916010190565b9092610550606093969594608084526080840190610512565b9560208301526040820152015256fecb6c47b3daa6db10ae5e4ec1cf9f8100d11f82b57c506d550c00ec86c5cce1d3a26469706673582212203516c89d3dc526c2caace595b7b0fb922fc7ceb88e9ad0baddc351f44047faa864736f6c63430008190033

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

Block Uncle Number Difficulty Gas Used Reward
View All Uncles
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.