Skip to content

Commit

Permalink
feat(sdk): add static base address properties to targets
Browse files Browse the repository at this point in the history
  • Loading branch information
sammccord committed Jul 5, 2024
1 parent e21fcb7 commit 0e2656c
Show file tree
Hide file tree
Showing 76 changed files with 140 additions and 111 deletions.

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions packages/evm/artifacts/contracts/BoostCore.sol/BoostCore.d.ts

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"_format": "hh-sol-dbg-1",
"buildInfo": "../../build-info/6ef16b07d3da31c494cd89a3fc91a1e2.json"
"buildInfo": "../../build-info/725b7e5d577db36613ebdabf15bb8669.json"
}
4 changes: 2 additions & 2 deletions packages/evm/artifacts/contracts/BoostCore.sol/BoostCore.json

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"_format": "hh-sol-dbg-1",
"buildInfo": "../../build-info/6ef16b07d3da31c494cd89a3fc91a1e2.json"
"buildInfo": "../../build-info/725b7e5d577db36613ebdabf15bb8669.json"
}

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"_format": "hh-sol-dbg-1",
"buildInfo": "../../../build-info/6ef16b07d3da31c494cd89a3fc91a1e2.json"
"buildInfo": "../../../build-info/725b7e5d577db36613ebdabf15bb8669.json"
}

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"_format": "hh-sol-dbg-1",
"buildInfo": "../../../build-info/6ef16b07d3da31c494cd89a3fc91a1e2.json"
"buildInfo": "../../../build-info/725b7e5d577db36613ebdabf15bb8669.json"
}

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"_format": "hh-sol-dbg-1",
"buildInfo": "../../../build-info/6ef16b07d3da31c494cd89a3fc91a1e2.json"
"buildInfo": "../../../build-info/725b7e5d577db36613ebdabf15bb8669.json"
}

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"_format": "hh-sol-dbg-1",
"buildInfo": "../../../build-info/6ef16b07d3da31c494cd89a3fc91a1e2.json"
"buildInfo": "../../../build-info/725b7e5d577db36613ebdabf15bb8669.json"
}

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"_format": "hh-sol-dbg-1",
"buildInfo": "../../../build-info/6ef16b07d3da31c494cd89a3fc91a1e2.json"
"buildInfo": "../../../build-info/725b7e5d577db36613ebdabf15bb8669.json"
}

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"_format": "hh-sol-dbg-1",
"buildInfo": "../../../build-info/6ef16b07d3da31c494cd89a3fc91a1e2.json"
"buildInfo": "../../../build-info/725b7e5d577db36613ebdabf15bb8669.json"
}

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"_format": "hh-sol-dbg-1",
"buildInfo": "../../../build-info/6ef16b07d3da31c494cd89a3fc91a1e2.json"
"buildInfo": "../../../build-info/725b7e5d577db36613ebdabf15bb8669.json"
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"_format": "hh-sol-dbg-1",
"buildInfo": "../../../build-info/6ef16b07d3da31c494cd89a3fc91a1e2.json"
"buildInfo": "../../../build-info/725b7e5d577db36613ebdabf15bb8669.json"
}

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"_format": "hh-sol-dbg-1",
"buildInfo": "../../../build-info/6ef16b07d3da31c494cd89a3fc91a1e2.json"
"buildInfo": "../../../build-info/725b7e5d577db36613ebdabf15bb8669.json"
}

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"_format": "hh-sol-dbg-1",
"buildInfo": "../../../build-info/6ef16b07d3da31c494cd89a3fc91a1e2.json"
"buildInfo": "../../../build-info/725b7e5d577db36613ebdabf15bb8669.json"
}

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"_format": "hh-sol-dbg-1",
"buildInfo": "../../../build-info/6ef16b07d3da31c494cd89a3fc91a1e2.json"
"buildInfo": "../../../build-info/725b7e5d577db36613ebdabf15bb8669.json"
}

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"_format": "hh-sol-dbg-1",
"buildInfo": "../../../build-info/6ef16b07d3da31c494cd89a3fc91a1e2.json"
"buildInfo": "../../../build-info/725b7e5d577db36613ebdabf15bb8669.json"
}

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"_format": "hh-sol-dbg-1",
"buildInfo": "../../../build-info/6ef16b07d3da31c494cd89a3fc91a1e2.json"
"buildInfo": "../../../build-info/725b7e5d577db36613ebdabf15bb8669.json"
}

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"_format": "hh-sol-dbg-1",
"buildInfo": "../../../build-info/6ef16b07d3da31c494cd89a3fc91a1e2.json"
"buildInfo": "../../../build-info/725b7e5d577db36613ebdabf15bb8669.json"
}

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"_format": "hh-sol-dbg-1",
"buildInfo": "../../../build-info/6ef16b07d3da31c494cd89a3fc91a1e2.json"
"buildInfo": "../../../build-info/725b7e5d577db36613ebdabf15bb8669.json"
}

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"_format": "hh-sol-dbg-1",
"buildInfo": "../../../build-info/6ef16b07d3da31c494cd89a3fc91a1e2.json"
"buildInfo": "../../../build-info/725b7e5d577db36613ebdabf15bb8669.json"
}

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ export interface BoostLib$Type {
"contractName": "BoostLib",
"sourceName": "contracts/shared/BoostLib.sol",
"abi": [],
"bytecode": "0x6055604b600b8282823980515f1a607314603f577f4e487b71000000000000000000000000000000000000000000000000000000005f525f60045260245ffd5b305f52607381538281f3fe730000000000000000000000000000000000000000301460806040525f80fdfea26469706673582212202e2c61c2793abe89bdeeffed25cf207b91ed3cbf4292d308d531e6b1430250d664736f6c63430008190033",
"deployedBytecode": "0x730000000000000000000000000000000000000000301460806040525f80fdfea26469706673582212202e2c61c2793abe89bdeeffed25cf207b91ed3cbf4292d308d531e6b1430250d664736f6c63430008190033",
"bytecode": "0x6055604b600b8282823980515f1a607314603f577f4e487b71000000000000000000000000000000000000000000000000000000005f525f60045260245ffd5b305f52607381538281f3fe730000000000000000000000000000000000000000301460806040525f80fdfea26469706673582212205d9c822dc269da7c0febf1d57621e1164ed8a4fdb1787d2ca45b8d75c2c080d164736f6c63430008190033",
"deployedBytecode": "0x730000000000000000000000000000000000000000301460806040525f80fdfea26469706673582212205d9c822dc269da7c0febf1d57621e1164ed8a4fdb1787d2ca45b8d75c2c080d164736f6c63430008190033",
"linkReferences": {},
"deployedLinkReferences": {}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"_format": "hh-sol-dbg-1",
"buildInfo": "../../../build-info/6ef16b07d3da31c494cd89a3fc91a1e2.json"
"buildInfo": "../../../build-info/725b7e5d577db36613ebdabf15bb8669.json"
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
"contractName": "BoostLib",
"sourceName": "contracts/shared/BoostLib.sol",
"abi": [],
"bytecode": "0x6055604b600b8282823980515f1a607314603f577f4e487b71000000000000000000000000000000000000000000000000000000005f525f60045260245ffd5b305f52607381538281f3fe730000000000000000000000000000000000000000301460806040525f80fdfea26469706673582212202e2c61c2793abe89bdeeffed25cf207b91ed3cbf4292d308d531e6b1430250d664736f6c63430008190033",
"deployedBytecode": "0x730000000000000000000000000000000000000000301460806040525f80fdfea26469706673582212202e2c61c2793abe89bdeeffed25cf207b91ed3cbf4292d308d531e6b1430250d664736f6c63430008190033",
"bytecode": "0x6055604b600b8282823980515f1a607314603f577f4e487b71000000000000000000000000000000000000000000000000000000005f525f60045260245ffd5b305f52607381538281f3fe730000000000000000000000000000000000000000301460806040525f80fdfea26469706673582212205d9c822dc269da7c0febf1d57621e1164ed8a4fdb1787d2ca45b8d75c2c080d164736f6c63430008190033",
"deployedBytecode": "0x730000000000000000000000000000000000000000301460806040525f80fdfea26469706673582212205d9c822dc269da7c0febf1d57621e1164ed8a4fdb1787d2ca45b8d75c2c080d164736f6c63430008190033",
"linkReferences": {},
"deployedLinkReferences": {}
}

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"_format": "hh-sol-dbg-1",
"buildInfo": "../../../build-info/6ef16b07d3da31c494cd89a3fc91a1e2.json"
"buildInfo": "../../../build-info/725b7e5d577db36613ebdabf15bb8669.json"
}

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"_format": "hh-sol-dbg-1",
"buildInfo": "../../../build-info/6ef16b07d3da31c494cd89a3fc91a1e2.json"
"buildInfo": "../../../build-info/725b7e5d577db36613ebdabf15bb8669.json"
}
3 changes: 1 addition & 2 deletions packages/evm/contracts/actions/Action.sol
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,5 @@ abstract contract Action is Cloneable {

function getComponentInterface() public pure virtual returns (bytes4) {
return type(Action).interfaceId;
}

}
}
5 changes: 2 additions & 3 deletions packages/evm/contracts/allowlists/AllowList.sol
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ abstract contract AllowList is Ownable, Cloneable {
constructor() {
_initializeOwner(msg.sender);
}

/// @notice Check if a user is authorized
/// @param user_ The address of the user
/// @param data_ The data payload for the authorization check, if applicable
Expand All @@ -32,7 +32,6 @@ abstract contract AllowList is Ownable, Cloneable {
/// @dev This function can only be called by the owner
function setAllowed(address[] calldata users_, bool[] calldata allowed_) external virtual;


/// @notice Set the denied status of a user
/// @param users_ The list of users to update
/// @param denied_ The denied status of each user
Expand All @@ -42,5 +41,5 @@ abstract contract AllowList is Ownable, Cloneable {

function getComponentInterface() public pure virtual returns (bytes4) {
return type(AllowList).interfaceId;
}
}
}
6 changes: 5 additions & 1 deletion packages/evm/contracts/allowlists/SimpleAllowList.sol
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,11 @@ contract SimpleAllowList is AllowList, OwnableRoles {
}

/// @inheritdoc AllowList
function setAllowed(address[] calldata users_, bool[] calldata allowed_) external override onlyRoles(LIST_MANAGER_ROLE) {
function setAllowed(address[] calldata users_, bool[] calldata allowed_)
external
override
onlyRoles(LIST_MANAGER_ROLE)
{
if (users_.length != allowed_.length) revert BoostError.LengthMismatch();

for (uint256 i = 0; i < users_.length; i++) {
Expand Down
10 changes: 4 additions & 6 deletions packages/evm/contracts/budgets/ASimpleBudget.sol
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ import {Cloneable} from "contracts/shared/Cloneable.sol";
abstract contract ASimpleBudget is Budget, IERC1155Receiver, ReentrancyGuard {
using SafeTransferLib for address;



/// @dev The total amount of each fungible asset distributed from the budget
mapping(address => uint256) private _distributedFungible;

Expand All @@ -37,11 +35,10 @@ abstract contract ASimpleBudget is Budget, IERC1155Receiver, ReentrancyGuard {

/// @inheritdoc Cloneable
/// @param data_ The packed init data for the budget `(address owner, address[] authorized)`
function initialize(bytes calldata data_) public virtual override{
function initialize(bytes calldata data_) public virtual override {
revert NotInitializing();
}


/// @inheritdoc Budget
/// @notice Allocates assets to the budget
/// @param data_ The packed data for the {Transfer} request
Expand Down Expand Up @@ -303,10 +300,11 @@ abstract contract ASimpleBudget is Budget, IERC1155Receiver, ReentrancyGuard {

/// @inheritdoc Cloneable
function supportsInterface(bytes4 interfaceId) public view virtual override(Budget, IERC165) returns (bool) {
return interfaceId == type(ASimpleBudget).interfaceId || interfaceId == type(IERC1155Receiver).interfaceId || interfaceId == type(IERC165).interfaceId || Budget.supportsInterface(interfaceId);
return interfaceId == type(ASimpleBudget).interfaceId || interfaceId == type(IERC1155Receiver).interfaceId
|| interfaceId == type(IERC165).interfaceId || Budget.supportsInterface(interfaceId);
}

function getComponentInterface() public pure virtual override returns (bytes4) {
return type(ASimpleBudget).interfaceId;
}
}
}
4 changes: 2 additions & 2 deletions packages/evm/contracts/budgets/Budget.sol
Original file line number Diff line number Diff line change
Expand Up @@ -126,10 +126,10 @@ abstract contract Budget is Ownable, Cloneable, Receiver {
/// @return True if the account is authorized
/// @dev The mechanism for checking authorization is left to the implementing contract
function isAuthorized(address account_) external view virtual returns (bool);

function getComponentInterface() public pure virtual returns (bytes4) {
return type(Budget).interfaceId;
}
}

/// @inheritdoc Receiver
receive() external payable virtual override {
Expand Down
3 changes: 1 addition & 2 deletions packages/evm/contracts/budgets/SimpleBudget.sol
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.24;

import {ASimpleBudget} from "contracts/budgets/ASimpleBudget.sol";

/// @title Simple Budget
/// @notice A minimal budget implementation that simply holds and distributes tokens (ERC20-like and native)
/// @dev This type of budget supports ETH, ERC20, and ERC1155 assets only
contract SimpleBudget is ASimpleBudget {

/// @notice The payload for initializing a SimpleBudget
struct InitPayload {
address owner;
Expand All @@ -28,5 +28,4 @@ contract SimpleBudget is ASimpleBudget {
_isAuthorized[init_.authorized[i]] = true;
}
}

}
2 changes: 1 addition & 1 deletion packages/evm/contracts/incentives/ERC20Incentive.sol
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ contract ERC20Incentive is Incentive {

/// @notice The strategy for the incentive (MINT or POOL)
Strategy public strategy;

/// @notice The limit (max claims, or max entries for raffles)
uint256 public limit;

Expand Down
6 changes: 2 additions & 4 deletions packages/evm/contracts/incentives/Incentive.sol
Original file line number Diff line number Diff line change
Expand Up @@ -65,18 +65,16 @@ abstract contract Incentive is Ownable, Cloneable, ReentrancyGuard {
function preflight(bytes calldata data_) external view virtual returns (bytes memory);

/// @return The current reward
function currentReward() public view virtual returns (uint256)
{
function currentReward() public view virtual returns (uint256) {
return reward;
}


/// @inheritdoc Cloneable
function supportsInterface(bytes4 interfaceId) public view virtual override(Cloneable) returns (bool) {
return interfaceId == type(Incentive).interfaceId || super.supportsInterface(interfaceId);
}

function getComponentInterface() public pure virtual returns (bytes4) {
return type(Incentive).interfaceId;
}
}
}
2 changes: 1 addition & 1 deletion packages/evm/contracts/validators/Validator.sol
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,5 @@ abstract contract Validator is Ownable, Cloneable {

function getComponentInterface() public pure virtual returns (bytes4) {
return type(Validator).interfaceId;
}
}
}
2 changes: 2 additions & 0 deletions packages/evm/test/BoostRegistry.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,11 @@ contract MockAllowList is AllowList {
function isAllowed(address guy, bytes calldata) external view override returns (bool) {
return guy == owner() || guy == address(0xdeadbeef);
}

function setAllowed(address[] calldata users_, bool[] calldata allowed_) external override {
revert BoostError.NotImplemented();
}

function setDenied(address[] calldata users_, bool[] calldata denied_) external override {
revert BoostError.NotImplemented();
}
Expand Down
2 changes: 2 additions & 0 deletions packages/sdk/src/Actions/ContractAction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ import type { CallParams } from '../utils';
export type { ContractActionPayload };

export class ContractAction extends DeployableTarget<ContractActionPayload> {
public static base = import.meta.env.VITE_CONTRACT_ACTION_BASE;

public async chainId(
params: CallParams<typeof readContractActionChainId> = {},
) {
Expand Down
2 changes: 2 additions & 0 deletions packages/sdk/src/Actions/ERC721MintAction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ import { ContractAction } from './ContractAction';
export type { ERC721MintActionPayload };

export class ERC721MintAction extends ContractAction {
public static override base = import.meta.env.VITE_ERC721_MINT_ACTION_BASE;

public override async execute(
data: Hex,
params: CallParams<typeof writeErc721MintActionExecute> = {},
Expand Down
2 changes: 2 additions & 0 deletions packages/sdk/src/AllowLists/SimpleAllowList.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ import type { CallParams } from '../utils';
export type { SimpleAllowListPayload };

export class SimpleAllowList extends DeployableTarget<SimpleAllowListPayload> {
public static base = import.meta.env.VITE_SIMPLE_ALLOWLIST_BASE;

public async isAllowed(
address: Address,
params: CallParams<typeof readSimpleAllowListIsAllowed> = {},
Expand Down
2 changes: 2 additions & 0 deletions packages/sdk/src/AllowLists/SimpleDenyList.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ import type { CallParams } from '../utils';
export type { SimpleDenyListPayload };

export class SimpleDenyList extends DeployableTarget<SimpleDenyListPayload> {
public static base = import.meta.env.VITE_SIMPLE_DENYLIST_BASE;

public async isAllowed(
address: Address,
params: CallParams<typeof readSimpleDenyListIsAllowed> = {},
Expand Down
8 changes: 1 addition & 7 deletions packages/sdk/src/BoostCore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,19 @@ import {
readBoostCoreGetBoost,
readBoostCoreGetBoostCount,
simulateBoostCoreClaimIncentive,
simulateBoostCoreCreateBoost,
simulateBoostCoreSetClaimFee,
simulateBoostCoreSetProtocolFeeReceiver,
writeBoostCoreClaimIncentive,
writeBoostCoreSetClaimFee,
writeBoostCoreSetProtocolFeeReceiver,
} from '@boostxyz/evm';
import { bytecode } from '@boostxyz/evm/artifacts/contracts/BoostCore.sol/BoostCore.json';
import {
getAccount,
getTransaction,
waitForTransactionReceipt,
} from '@wagmi/core';
import { getAccount, waitForTransactionReceipt } from '@wagmi/core';
import { createWriteContract } from '@wagmi/core/codegen';
import {
type Address,
type Hash,
type Hex,
decodeFunctionData,
parseEventLogs,
zeroAddress,
zeroHash,
Expand Down
2 changes: 2 additions & 0 deletions packages/sdk/src/Budgets/SimpleBudget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ import type { CallParams } from '../utils';
export type { SimpleBudgetPayload };

export class SimpleBudget extends DeployableTarget<SimpleBudgetPayload> {
public static base = import.meta.env.VITE_SIMPLE_BUDGET_BASE;

public start(params: CallParams<typeof readVestingBudgetStart> = {}) {
return readVestingBudgetStart(this._config, {
address: this.assertValidAddress(),
Expand Down
2 changes: 2 additions & 0 deletions packages/sdk/src/Budgets/VestingBudget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ import type { CallParams } from '../utils';
export type { VestingBudgetPayload };

export class VestingBudget extends DeployableTarget<VestingBudgetPayload> {
public static base = import.meta.env.VITE_VESTING_BUDGET_BASE;

public start(params: CallParams<typeof readVestingBudgetStart> = {}) {
return readVestingBudgetStart(this._config, {
address: this.assertValidAddress(),
Expand Down
Loading

0 comments on commit 0e2656c

Please sign in to comment.