Skip to content

Commit

Permalink
Deploy new Contract
Browse files Browse the repository at this point in the history
  • Loading branch information
carletex committed Dec 6, 2023
1 parent 9c166d3 commit be1dbb1
Show file tree
Hide file tree
Showing 5 changed files with 300 additions and 7 deletions.
4 changes: 4 additions & 0 deletions builderList.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ const builderList = [
"0x5dCb5f4F39Caa6Ca25380cfc42280330b49d3c93", // damianmarti.eth
"0xB4F53bd85c00EF22946d24Ae26BC38Ac64F5E7B1", // pabl0cks.eth
"0x0D0f9Ebd254e510AA6F3788ecb6E6fC8bf78188F", // dgrcode.eth
"0x4cBe80191E63567191668D860ACabaF15DAC5512", // andrealbiac.eth
"0x45334F41aAA464528CD5bc0F582acadC49Eb0Cd1", // 0xrinat.eth
"0x1990a6bCdb13D33463cBA884a1aE6020292523e8", // inc.carletex.eth
"0xA122A7Ed69597DBd77Fb2C539E13B7C3fB804637", // portdev.eth
];

export { builderList };
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,13 @@ import "@openzeppelin/contracts/access/Ownable.sol";
// _|"""""|_|"""""| {======|_|"""""|_|"""""|_|"""""|_|"""""| {======|_|"""""|_|"""""|_|"""""|_|"""""|_|"""""|_|"""""|
// "`-0-0-'"`-0-0-'./o--000'"`-0-0-'"`-0-0-'"`-0-0-'"`-0-0-'./o--000'"`-0-0-'"`-0-0-'"`-0-0-'"`-0-0-'"`-0-0-'"`-0-0-'

contract YourContract is Ownable {
contract SandGardenStreams is Ownable {

struct BuilderStreamInfo {
uint256 cap;
uint256 last;
}
mapping(address => BuilderStreamInfo) public streamedBuilders;
// ToDo. Change to 30 days
uint256 public frequency = 2592000; // 30 days

event Withdraw(address indexed to, uint256 amount, string reason);
Expand Down Expand Up @@ -98,4 +97,4 @@ contract YourContract is Ownable {
// to support receiving ETH by default
receive() external payable {}
fallback() external payable {}
}
}
4 changes: 2 additions & 2 deletions packages/hardhat/deploy/00_deploy_your_contract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const deployYourContract: DeployFunction = async function (hre: HardhatRuntimeEn
const { deployer } = await hre.getNamedAccounts();
const { deploy } = hre.deployments;

await deploy("YourContract", {
await deploy("SandGardenStreams", {
from: deployer,
// Contract constructor arguments
args: [],
Expand All @@ -33,7 +33,7 @@ const deployYourContract: DeployFunction = async function (hre: HardhatRuntimeEn
autoMine: true,
});

const yourContract = await hre.ethers.getContract("YourContract", deployer);
const yourContract = await hre.ethers.getContract("SandGardenStreams", deployer);

console.log("🫡 adding batch of builders");
const builderStakes = Array(builderList.length).fill(ethers.utils.parseEther("1.5"));
Expand Down
290 changes: 290 additions & 0 deletions packages/nextjs/generated/hardhat_contracts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,296 @@ export default {
},
],
},
SandGardenStreams: {
address: "0x964d0C9a421953F95dAF3A5c5406093a3014A5D8",
abi: [
{
inputs: [],
stateMutability: "nonpayable",
type: "constructor",
},
{
anonymous: false,
inputs: [
{
indexed: true,
internalType: "address",
name: "to",
type: "address",
},
{
indexed: false,
internalType: "uint256",
name: "amount",
type: "uint256",
},
],
name: "AddBuilder",
type: "event",
},
{
anonymous: false,
inputs: [
{
indexed: true,
internalType: "address",
name: "previousOwner",
type: "address",
},
{
indexed: true,
internalType: "address",
name: "newOwner",
type: "address",
},
],
name: "OwnershipTransferred",
type: "event",
},
{
anonymous: false,
inputs: [
{
indexed: true,
internalType: "address",
name: "to",
type: "address",
},
{
indexed: false,
internalType: "uint256",
name: "amount",
type: "uint256",
},
],
name: "UpdateBuilder",
type: "event",
},
{
anonymous: false,
inputs: [
{
indexed: true,
internalType: "address",
name: "to",
type: "address",
},
{
indexed: false,
internalType: "uint256",
name: "amount",
type: "uint256",
},
{
indexed: false,
internalType: "string",
name: "reason",
type: "string",
},
],
name: "Withdraw",
type: "event",
},
{
stateMutability: "payable",
type: "fallback",
},
{
inputs: [
{
internalType: "address[]",
name: "_builders",
type: "address[]",
},
{
internalType: "uint256[]",
name: "_caps",
type: "uint256[]",
},
],
name: "addBatch",
outputs: [],
stateMutability: "nonpayable",
type: "function",
},
{
inputs: [
{
internalType: "address payable",
name: "_builder",
type: "address",
},
{
internalType: "uint256",
name: "_cap",
type: "uint256",
},
],
name: "addBuilderStream",
outputs: [],
stateMutability: "nonpayable",
type: "function",
},
{
inputs: [
{
internalType: "address[]",
name: "_builders",
type: "address[]",
},
],
name: "allBuildersData",
outputs: [
{
components: [
{
internalType: "address",
name: "builderAddress",
type: "address",
},
{
internalType: "uint256",
name: "cap",
type: "uint256",
},
{
internalType: "uint256",
name: "unlockedAmount",
type: "uint256",
},
],
internalType: "struct SandGardenStreams.BuilderData[]",
name: "",
type: "tuple[]",
},
],
stateMutability: "view",
type: "function",
},
{
inputs: [],
name: "frequency",
outputs: [
{
internalType: "uint256",
name: "",
type: "uint256",
},
],
stateMutability: "view",
type: "function",
},
{
inputs: [],
name: "owner",
outputs: [
{
internalType: "address",
name: "",
type: "address",
},
],
stateMutability: "view",
type: "function",
},
{
inputs: [
{
internalType: "uint256",
name: "_amount",
type: "uint256",
},
{
internalType: "string",
name: "_reason",
type: "string",
},
],
name: "streamWithdraw",
outputs: [],
stateMutability: "nonpayable",
type: "function",
},
{
inputs: [
{
internalType: "address",
name: "",
type: "address",
},
],
name: "streamedBuilders",
outputs: [
{
internalType: "uint256",
name: "cap",
type: "uint256",
},
{
internalType: "uint256",
name: "last",
type: "uint256",
},
],
stateMutability: "view",
type: "function",
},
{
inputs: [
{
internalType: "address",
name: "newOwner",
type: "address",
},
],
name: "transferOwnership",
outputs: [],
stateMutability: "nonpayable",
type: "function",
},
{
inputs: [
{
internalType: "address",
name: "_builder",
type: "address",
},
],
name: "unlockedBuilderAmount",
outputs: [
{
internalType: "uint256",
name: "",
type: "uint256",
},
],
stateMutability: "view",
type: "function",
},
{
inputs: [
{
internalType: "address payable",
name: "_builder",
type: "address",
},
{
internalType: "uint256",
name: "_cap",
type: "uint256",
},
],
name: "updateBuilderStreamCap",
outputs: [],
stateMutability: "nonpayable",
type: "function",
},
{
stateMutability: "payable",
type: "receive",
},
],
},
},
},
],
Expand Down
4 changes: 2 additions & 2 deletions packages/nextjs/hooks/scaffold-eth/useScaffoldEventHistory.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ContractAbi, ContractName } from "./contract.types";
import { ExtractAbiEventNames } from "abitype";
import {Abi, ExtractAbiEventNames} from "abitype";
import { useProvider, useContract } from "wagmi";
import { useDeployedContractInfo } from "~~/hooks/scaffold-eth";
import { ethers } from "ethers";
Expand Down Expand Up @@ -44,7 +44,7 @@ export const useScaffoldEventHistory = <

const contract = useContract({
address: deployedContractData?.address,
abi: deployedContractData?.abi,
abi: deployedContractData?.abi as Abi,
signerOrProvider: provider,
});

Expand Down

0 comments on commit be1dbb1

Please sign in to comment.