Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: integrate blast #380

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions contracts/blast/AtomicManualPartyBlast.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.20;

import { BlastClaimableYield } from "./utils/BlastClaimableYield.sol";
import { AtomicManualParty, IPartyFactory } from "../crowdfund/AtomicManualParty.sol";

contract AtomicManualPartyBlast is AtomicManualParty, BlastClaimableYield {
constructor(
IPartyFactory partyFactory,
address blast,
address governor
) AtomicManualParty(partyFactory) BlastClaimableYield(blast, governor) {}
}
13 changes: 13 additions & 0 deletions contracts/blast/BasicMetadataProviderBlast.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.20;

import { BlastClaimableYield } from "./utils/BlastClaimableYield.sol";
import { BasicMetadataProvider, IGlobals } from "../renderers/BasicMetadataProvider.sol";

contract BasicMetadataProviderBlast is BasicMetadataProvider, BlastClaimableYield {
constructor(
IGlobals globals,
address blast,
address governor
) BasicMetadataProvider(globals) BlastClaimableYield(blast, governor) {}
}
24 changes: 24 additions & 0 deletions contracts/blast/BondingCurveAuthorityBlast.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.20;

import { BlastClaimableYield } from "./utils/BlastClaimableYield.sol";
import { BondingCurveAuthority } from "../authorities/BondingCurveAuthority.sol";

contract BondingCurveAuthorityBlast is BondingCurveAuthority, BlastClaimableYield {
constructor(
address payable partyDao,
uint16 initialPartyDaoFeeBps,
uint16 initialTreasuryFeeBps,
uint16 initialCreatorFeeBps,
address blast,
address governor
)
BondingCurveAuthority(
partyDao,
initialPartyDaoFeeBps,
initialTreasuryFeeBps,
initialCreatorFeeBps
)
BlastClaimableYield(blast, governor)
{}
}
14 changes: 14 additions & 0 deletions contracts/blast/ContributionRouterBlast.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.20;

import { BlastClaimableYield } from "./utils/BlastClaimableYield.sol";
import { ContributionRouter } from "../crowdfund/ContributionRouter.sol";

contract ContributionRouterBlast is ContributionRouter, BlastClaimableYield {
constructor(
address owner,
uint96 initialFeePerMint,
address blast,
address governor
) ContributionRouter(owner, initialFeePerMint) BlastClaimableYield(blast, governor) {}
}
9 changes: 9 additions & 0 deletions contracts/blast/CrowdfundFactoryBlast.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.20;

import { BlastClaimableYield } from "./utils/BlastClaimableYield.sol";
import { CrowdfundFactory } from "../crowdfund/CrowdfundFactory.sol";

contract CrowdfundFactoryBlast is CrowdfundFactory, BlastClaimableYield {
constructor(address blast, address governor) BlastClaimableYield(blast, governor) {}
}
23 changes: 23 additions & 0 deletions contracts/blast/InitialETHCrowdfundBlast.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.20;

import { IBlast, YieldMode, GasMode } from "./utils/IBlast.sol";
import { InitialETHCrowdfund, MetadataProvider, IGlobals } from "../crowdfund/InitialETHCrowdfund.sol";
import { MetadataProvider } from "../renderers/MetadataProvider.sol";

contract InitialETHCrowdfundBlast is InitialETHCrowdfund {
IBlast immutable BLAST;
constructor(IGlobals globals, address blast) InitialETHCrowdfund(globals) {
BLAST = IBlast(blast);
}

function initialize(
InitialETHCrowdfund.InitialETHCrowdfundOptions memory crowdfundOpts,
InitialETHCrowdfund.ETHPartyOptions memory partyOpts,
MetadataProvider customMetadataProvider,
bytes memory customMetadata
) public payable override {
super.initialize(crowdfundOpts, partyOpts, customMetadataProvider, customMetadata);
BLAST.configure(YieldMode.AUTOMATIC, GasMode.CLAIMABLE, address(party));
}
}
13 changes: 13 additions & 0 deletions contracts/blast/MetadataProviderBlast.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.20;

import { BlastClaimableYield } from "./utils/BlastClaimableYield.sol";
import { MetadataProvider, IGlobals } from "../renderers/MetadataProvider.sol";

contract MetadataProviderBlast is MetadataProvider, BlastClaimableYield {
constructor(
IGlobals globals,
address blast,
address governor
) MetadataProvider(globals) BlastClaimableYield(blast, governor) {}
}
14 changes: 14 additions & 0 deletions contracts/blast/MetadataRegistryBlast.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.20;

import { BlastClaimableYield } from "./utils/BlastClaimableYield.sol";
import { MetadataRegistry, IGlobals } from "../renderers/MetadataRegistry.sol";

contract MetadataRegistryBlast is MetadataRegistry, BlastClaimableYield {
constructor(
IGlobals globals,
address[] memory registrars,
address blast,
address governor
) MetadataRegistry(globals, registrars) BlastClaimableYield(blast, governor) {}
}
18 changes: 18 additions & 0 deletions contracts/blast/PartyBlast.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.20;

import { IBlast, YieldMode, GasMode } from "./utils/IBlast.sol";
import { Party, IGlobals } from "../party/Party.sol";

contract PartyBlast is Party {
IBlast immutable BLAST;

constructor(IGlobals globals, address blast) Party(globals) {
BLAST = IBlast(blast);
}

function initialize(PartyInitData memory initData) public override {
super.initialize(initData);
BLAST.configure(YieldMode.AUTOMATIC, GasMode.CLAIMABLE, address(this));
}
}
13 changes: 13 additions & 0 deletions contracts/blast/SSTORE2MetadataProviderBlast.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.20;

import { BlastClaimableYield } from "./utils/BlastClaimableYield.sol";
import { SSTORE2MetadataProvider, IGlobals } from "../renderers/SSTORE2MetadataProvider.sol";

contract SSTORE2MetadataProviderBlast is SSTORE2MetadataProvider, BlastClaimableYield {
constructor(
IGlobals globals,
address blast,
address governor
) SSTORE2MetadataProvider(globals) BlastClaimableYield(blast, governor) {}
}
14 changes: 14 additions & 0 deletions contracts/blast/TokenDistributorBlast.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.20;

import { BlastClaimableYield } from "./utils/BlastClaimableYield.sol";
import { TokenDistributor, IGlobals } from "../distribution/TokenDistributor.sol";

contract TokenDistributorBlast is TokenDistributor, BlastClaimableYield {
constructor(
IGlobals globals,
uint40 emergencyDisabledTimestamp,
address blast,
address governor
) TokenDistributor(globals, emergencyDisabledTimestamp) BlastClaimableYield(blast, governor) {}
}
15 changes: 15 additions & 0 deletions contracts/blast/utils/BlastAutomaticYield.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// SPDX-License-Identifier: GPL-3.0
pragma solidity 0.8.20;

import { IBlast, YieldMode, GasMode } from "./IBlast.sol";

abstract contract BlastAutomaticYield {
/// @notice Constructor to configure the contract with Blast.
constructor(address blast, address governor) {
bytes memory blastCalldata = abi.encodeCall(
IBlast.configure,
(YieldMode.AUTOMATIC, GasMode.CLAIMABLE, governor)
);
address(blast).call(blastCalldata);
}
}
15 changes: 15 additions & 0 deletions contracts/blast/utils/BlastClaimableYield.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// SPDX-License-Identifier: GPL-3.0
pragma solidity 0.8.20;

import { IBlast, YieldMode, GasMode } from "./IBlast.sol";

abstract contract BlastClaimableYield {
/// @notice Constructor to configure the contract with Blast.
constructor(address blast, address governor) {
bytes memory blastCalldata = abi.encodeCall(
IBlast.configure,
(YieldMode.CLAIMABLE, GasMode.CLAIMABLE, governor)
);
address(blast).call(blastCalldata);
}
}
80 changes: 80 additions & 0 deletions contracts/blast/utils/IBlast.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.20;

enum YieldMode {
AUTOMATIC,
VOID,
CLAIMABLE
}

enum GasMode {
VOID,
CLAIMABLE
}

interface IBlast {
// configure
function configureContract(
address contractAddress,
YieldMode _yield,
GasMode gasMode,
address governor
) external;
function configure(YieldMode _yield, GasMode gasMode, address governor) external;

// base configuration options
function configureClaimableYield() external;
function configureClaimableYieldOnBehalf(address contractAddress) external;
function configureAutomaticYield() external;
function configureAutomaticYieldOnBehalf(address contractAddress) external;
function configureVoidYield() external;
function configureVoidYieldOnBehalf(address contractAddress) external;
function configureClaimableGas() external;
function configureClaimableGasOnBehalf(address contractAddress) external;
function configureVoidGas() external;
function configureVoidGasOnBehalf(address contractAddress) external;
function configureGovernor(address _governor) external;
function configureGovernorOnBehalf(address _newGovernor, address contractAddress) external;

// claim yield
function claimYield(
address contractAddress,
address recipientOfYield,
uint256 amount
) external returns (uint256);
function claimAllYield(
address contractAddress,
address recipientOfYield
) external returns (uint256);

// claim gas
function claimAllGas(
address contractAddress,
address recipientOfGas
) external returns (uint256);
function claimGasAtMinClaimRate(
address contractAddress,
address recipientOfGas,
uint256 minClaimRateBips
) external returns (uint256);
function claimMaxGas(
address contractAddress,
address recipientOfGas
) external returns (uint256);
function claimGas(
address contractAddress,
address recipientOfGas,
uint256 gasToClaim,
uint256 gasSecondsToConsume
) external returns (uint256);

// read functions
function readClaimableYield(address contractAddress) external view returns (uint256);
function readYieldConfiguration(address contractAddress) external view returns (uint8);
function readGasParams(
address contractAddress
)
external
view
returns (uint256 etherSeconds, uint256 etherBalance, uint256 lastUpdated, GasMode);
}
2 changes: 1 addition & 1 deletion contracts/crowdfund/InitialETHCrowdfund.sol
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ contract InitialETHCrowdfund is ETHCrowdfundBase {
ETHPartyOptions memory partyOpts,
MetadataProvider customMetadataProvider,
bytes memory customMetadata
) external payable onlyInitialize {
) public payable virtual onlyInitialize {
// Create party the initial crowdfund will be for.
Party party_ = _createParty(partyOpts, customMetadataProvider, customMetadata);

Expand Down
2 changes: 1 addition & 1 deletion contracts/party/Party.sol
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ contract Party is PartyGovernanceNFT {

/// @notice Initializer to be called prior to using the contract.
/// @param initData Options used to initialize the party governance.
function initialize(PartyInitData memory initData) external onlyInitialize {
function initialize(PartyInitData memory initData) public virtual onlyInitialize {
PartyGovernanceNFT._initialize(
initData.options.name,
initData.options.symbol,
Expand Down
15 changes: 15 additions & 0 deletions deploy/Blast.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8;

import "./blast/DeployBlast.s.sol";
import "./LibDeployConstants.sol";

contract BlastDeploy is DeployScriptBlast {
function _run() internal override {
console.log("Starting blast deploy script.");

deploy(LibDeployConstants.blast(this.getDeployer()));

console.log("Ending blast deploy script.");
}
}
15 changes: 15 additions & 0 deletions deploy/BlastSepolia.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8;

import "./blast/DeployBlast.s.sol";
import "./LibDeployConstants.sol";

contract BlastSepoliaDeploy is DeployScriptBlast {
function _run() internal override {
console.log("Starting blast sepolia deploy script.");

deploy(LibDeployConstants.blastSepolia(this.getDeployer()));

console.log("Ending blast sepolia deploy script.");
}
}
Loading
Loading