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

Contracts/gardener account #82

Closed
wants to merge 53 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
09a2734
removed garden contracts
Oba-One Aug 14, 2024
b04ad65
added action registry
Oba-One Aug 14, 2024
8a772f3
Started to modify contracts for work attestations
Oba-One Aug 17, 2024
ee393d3
added eas schema deployer
Oba-One Aug 17, 2024
cdb84b7
added schemas file with attestations needed for MVP.
Oba-One Aug 17, 2024
bba5c34
Action registry completed with comments and optimizations
Oba-One Aug 18, 2024
df9dee9
cleared constant not yet set with 0x0 address or bytes
Oba-One Aug 18, 2024
768665f
created schemas struct for resolver to reference attestation onAttest
Oba-One Aug 18, 2024
af19165
renamed deploy attestations to resolvers
Oba-One Aug 18, 2024
399d28b
updated resolvers adding needed imports
Oba-One Aug 18, 2024
37185b9
removed garden from name so attestations can scale past garden work
Oba-One Aug 18, 2024
34bfbf5
Merge branch 'main' of github.com:greenpill-dev-guild/green-goods int…
Oba-One Aug 18, 2024
e8a4be0
Merge branch 'main' of github.com:greenpill-dev-guild/green-goods int…
Oba-One Aug 18, 2024
0bfe57a
created lib for returing community token address
Oba-One Aug 18, 2024
8890341
added constatnts for community token and garden
Oba-One Aug 18, 2024
c6a92d3
address lint warning with more declartive mapping names
Oba-One Aug 18, 2024
c391aaf
added conditionals for enabling attestations be approved
Oba-One Aug 18, 2024
8a67ddb
prettified solidity code
Oba-One Aug 18, 2024
283d6d3
added back tab width 4 and added solhint ignore
Oba-One Aug 18, 2024
b81427c
fixed eas import mappings
Oba-One Aug 18, 2024
06d5311
added requires for resolvers
Oba-One Aug 18, 2024
8167a8a
reverted tab width to 2 for non solidity files
Oba-One Aug 18, 2024
41624d2
updated deploy scripts
Oba-One Aug 19, 2024
6c5d199
added new constants such as safe and token
Oba-One Aug 19, 2024
0b5a2ad
updated msg.sender to _msgSender()
Oba-One Aug 19, 2024
d1a47a2
added lib to get eas address
Oba-One Aug 19, 2024
a486b75
made token upgradeable
Oba-One Aug 19, 2024
b34d3c2
added overrides just for sol files
Oba-One Aug 19, 2024
75e7b2c
created delpoy script action registry, garden token and resolvers
Oba-One Aug 19, 2024
831a5f2
added test for garden token/acount and resolvers
Oba-One Aug 19, 2024
5340a7c
updated mapping using tokenbound forge-std and ds-test
Oba-One Aug 19, 2024
0c0fc77
polished libs with documentation and optimizations
Oba-One Aug 19, 2024
ecd1983
polished contracts adding comments for clear documentation
Oba-One Aug 19, 2024
8fe636f
created mock eas for testing
Oba-One Aug 19, 2024
c67df98
updated lock
Oba-One Aug 19, 2024
e4c2d99
added prod env var to set ethers deployment chain
Oba-One Aug 19, 2024
88e4717
added resolver as option for schema deployment
Oba-One Aug 19, 2024
f068b3b
polished test and commented out test not ready
Oba-One Aug 20, 2024
5ae4727
removed disabling initalizers
Oba-One Aug 20, 2024
e94bc2b
added Schema registry addresses
Oba-One Aug 20, 2024
4bb2dab
added emot for garden name
Oba-One Aug 20, 2024
9fd761a
polished deploy scripts
Oba-One Aug 20, 2024
66d038c
added title to action
Oba-One Aug 20, 2024
6bb3a01
updated sepolia rpc to proper one
Oba-One Aug 20, 2024
4152040
fixed solhint config issue
Oba-One Aug 20, 2024
c485362
updated commands for deploying splitting into different scripts
Oba-One Aug 20, 2024
68c9de5
updated name for etherscan api key
Oba-One Aug 20, 2024
502d80d
updated tokenbounsd constants and interface
Oba-One Aug 20, 2024
fc7a41d
disabled transfer ownership causing issues
Oba-One Aug 20, 2024
4636e29
modify intializer test now that owner stays same
Oba-One Aug 20, 2024
76821f7
added SAFE addresses for interacting with
Oba-One Aug 20, 2024
5183c09
added schema ids for dpeloyed attestation
Oba-One Aug 20, 2024
0caed08
optimized eas for different environments
Oba-One Aug 20, 2024
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
15 changes: 14 additions & 1 deletion packages/contracts/.prettierrc.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,22 @@
{
"plugins": ["prettier-plugin-solidity"],
"bracketSpacing": true,
"printWidth": 120,
"proseWrap": "always",
"singleQuote": false,
"tabWidth": 2,
"trailingComma": "all",
"useTabs": false
"useTabs": false,
"overrides": [
{
"files": "*.sol",
"options": {
"parser": "solidity-parse",
"printWidth": 120,
"tabWidth": 4,
"useTabs": false,
"singleQuote": false
}
}
]
}
2 changes: 1 addition & 1 deletion packages/contracts/.solhint.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"named-parameters-mapping": "warn",
"no-console": "off",
"not-rely-on-time": "off",
"one-contract-per-file": true,
"one-contract-per-file": "error",
"avoid-low-level-calls": "off",
"no-inline-assembly": "off",
"no-empty-blocks": "off",
Expand Down
6 changes: 6 additions & 0 deletions packages/contracts/.solhintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# directories
broadcast
cache
coverage
node_modules
out
4 changes: 2 additions & 2 deletions packages/contracts/foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ test = 'test'
multiline_func_header = "all"
number_underscore = "thousands"
quote_style = "double"
tab_width = 2
tab_width = 4
wrap_comments = true

extra_output_files = [
Expand All @@ -43,7 +43,7 @@ fs_permissions = [{ access = "read", path = "./"}]
eth_rpc_url = "http://localhost:8545"

[profile.sepolia]
eth_rpc_url = "https://arb-mainnet.g.alchemy.com/v2/i2qnBKk5GQ8pVGPLA-G3D9il5o0ULQO3"
eth_rpc_url = "https://eth-sepolia.g.alchemy.com/v2/i2qnBKk5GQ8pVGPLA-G3D9il5o0ULQO3"

[profile.arbitrum]
eth_rpc_url = "https://arb-mainnet.g.alchemy.com/v2/i2qnBKk5GQ8pVGPLA-G3D9il5o0ULQO3"
Expand Down
11 changes: 6 additions & 5 deletions packages/contracts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "contracts",
"version": "0.0.8",
"private": true,
"description": "Contracts for Protocol",
"descripticon": "Contracts for Protocol",
"scripts": {
"account": "node script/ListAccount.js",
"chain": "anvil --config-out localhost.json",
Expand All @@ -13,9 +13,11 @@
"lint": "pnpm run prettier && pnpm run solhint",
"anvil": "source .env && anvil --fork-url $ANVIL_FORK_URL --chain-id $ANVIL_CHAIN_ID",
"build": "forge build",
"test": "pnpm run build && forge test -f https://sepolia-rollup.arbitrum.io/rpc --gas-report",
"deploy:arbitrum": "source .env && FOUNDRY_PROFILE=arbitrum forge script script/Arbitrum.s.sol:ArbitrumScript --private-key $FORGE_PRIVATE_KEY --etherscan-api-key $ETHERSCAN_API_KEY --broadcast",
"deploy:arbitrum-sepolia": "source .env && FOUNDRY_PROFILE=arbitrum-sepolia forge script script/ArbitrumSepolia.s.sol:ArbitrumScript --private-key $FORGE_PRIVATE_KEY --etherscan-api-key $ETHERSCAN_API_KEY --broadcast"
"test": "pnpm run build && forge test -f https://eth-sepolia.g.alchemy.com/v2/i2qnBKk5GQ8pVGPLA-G3D9il5o0ULQO3 --gas-report",
"deploy:counter": "source .env && forge script script/Counter.s.sol:CounterScript --private-key $PRIVATE_KEY --etherscan-api-key $API_KEY_ETHERSCAN",
"deploy:action": "source .env && forge script script/DeployActionRegistry.s.sol:DeployActionRegistry --private-key $PRIVATE_KEY --etherscan-api-key $API_KEY_ETHERSCAN",
"deploy:garden": "source .env && forge script script/DeployGardenToken.s.sol:DeployGardenToken --private-key $PRIVATE_KEY --etherscan-api-key $API_KEY_ETHERSCAN",
"deploy:resolvers": "source .env && forge script script/DeployResolvers.s.sol:DeployResolvers --private-key $PRIVATE_KEY --etherscan-api-key $API_KEY_ETHERSCAN"
},
"dependencies": {
"@ethereum-attestation-service/eas-contracts": "1.7.1",
Expand All @@ -29,7 +31,6 @@
"toml": "~3.0.0",
"solidity-coverage": "^0.8.12",
"solhint": "^5.0.3",
"forge-std": "github:foundry-rs/forge-std#v1.8.1",
"prettier": "^3.3.3",
"prettier-plugin-solidity": "^1.4.0"
}
Expand Down
10 changes: 5 additions & 5 deletions packages/contracts/remappings.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
ds-test=./node_modules/ds-test/src/
forge-std=./node_modules/forge-std/src/
@openzeppelin/contracts=lib/tokenbound/lib/openzeppelin-contracts/contracts/
@openzeppelin/contracts-upgradeable=./node_modules/@openzeppelin/contracts-upgradeable/
@eas=./node_modules/@ethereum-attestation-service/eas-contracts/contracts/
@tokenbound=./lib/tokenbound/src/
erc6551/=lib/tokenbound/lib/erc6551/src/
forge-std=./lib/tokenbound/lib/forge-std/src/
ds-test=./lib/tokenbound/lib/forge-std/lib/ds-test/src/
@eas=./node_modules/@ethereum-attestation-service/eas-contracts/contracts/
@openzeppelin/contracts=lib/tokenbound/lib/openzeppelin-contracts/contracts/
@openzeppelin/contracts-upgradeable=./node_modules/@openzeppelin/contracts-upgradeable/
2 changes: 1 addition & 1 deletion packages/contracts/script/Counter.s.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.25;

import "forge-std/Script.sol";
import { Script } from "forge-std/Script.sol";

contract CounterScript is Script {
function setUp() public {}
Expand Down
65 changes: 65 additions & 0 deletions packages/contracts/script/DeployActionRegistry.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.25;

import { Script, console } from "forge-std/Script.sol";
import { Create2 } from "@openzeppelin/contracts/utils/Create2.sol";
import { FACTORY, SALT } from "../src/Constants.sol";
import { ActionRegistry, Capital } from "../src/registries/Action.sol";

/// @title DeployActionRegistry
/// @notice Script for deploying the ActionRegistry contract using CREATE2.
contract DeployActionRegistry is Script {
function run() public {
// Calculate the CREATE2 address for the ActionRegistry
address predictedRegistryAddress = Create2.computeAddress(
SALT,
keccak256(abi.encodePacked(type(ActionRegistry).creationCode, "")),
FACTORY
);

// Check if the contract is already deployed
if (predictedRegistryAddress.code.length == 0) {
vm.startBroadcast();
ActionRegistry newRegistry = new ActionRegistry{ salt: SALT }();

Capital[] memory capitals = new Capital[](1);
capitals[0] = Capital.LIVING;

string[] memory media = new string[](2);
media[0] = "QmWYQY9vnb9ot7u49UMeH41DdjZghrgr2YoaYaNwYSpeAn";
media[1] = "QmS9K5EdyakRPW7gV86xivaUNx1AuhPUzUSRD53WnjL4Uz";

newRegistry.initialize(address(this));
newRegistry.registerAction(
block.timestamp,
block.timestamp + 30 days,
"Test Action 1",
"QmTmbcRyKtkMpMFWsm6D8YpgwMUuds3jE4sJdjqhqFGvWe",
capitals,
media
);
newRegistry.registerAction(
block.timestamp,
block.timestamp + 30 days,
"Test Action 2",
"QmTmbcRyKtkMpMFWsm6D8YpgwMUuds3jE4sJdjqhqFGvWe",
capitals,
media
);

vm.stopBroadcast();

console.log("ActionRegistry deployed at:", predictedRegistryAddress);
} else {
console.log("ActionRegistry already exists at:", predictedRegistryAddress);
}

// Print out verification commands
console.log("\nVerification Commands:\n");
console.log(
"ActionRegistry: forge verify-contract --num-of-optimizations 200 --chain-id",
block.chainid,
predictedRegistryAddress
);
}
}
130 changes: 0 additions & 130 deletions packages/contracts/script/DeployGardenAccount.s.sol

This file was deleted.

Loading