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

Subgraph and Gelato web3 function #26

Open
wants to merge 16 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
10 changes: 7 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
.yarn/cache
.yarn/install-state.gz

build/
artifacts/
node_modules/
.DS_Store
env/
.env
.history
.tmp
coverage*
deployments

packages/subgraph/subgraph.yaml
packages/subgraph/generated
1 change: 0 additions & 1 deletion .husky/.gitignore

This file was deleted.

21 changes: 0 additions & 21 deletions .husky/pre-commit

This file was deleted.

1 change: 0 additions & 1 deletion .nvmrc

This file was deleted.

541 changes: 541 additions & 0 deletions .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs

Large diffs are not rendered by default.

28 changes: 28 additions & 0 deletions .yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs

Large diffs are not rendered by default.

874 changes: 874 additions & 0 deletions .yarn/releases/yarn-3.6.4.cjs

Large diffs are not rendered by default.

9 changes: 9 additions & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
nodeLinker: node-modules

plugins:
- path: .yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs
spec: "@yarnpkg/plugin-workspace-tools"
- path: .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs
spec: "@yarnpkg/plugin-interactive-tools"

yarnPath: .yarn/releases/yarn-3.6.4.cjs
84 changes: 18 additions & 66 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,68 +1,20 @@
{
"name": "zodiac-delay-modifier",
"version": "1.0.0",
"description": "Modifier for delayed transactions in the Gnosis Safe",
"directories": {
"test": "test"
},
"scripts": {
"build": "hardhat compile",
"test": "hardhat test",
"deploy": "hardhat deploy --network",
"coverage": "hardhat coverage",
"lint": "yarn lint:sol && yarn lint:ts",
"lint:sol": "solhint 'contracts/**/*.sol'",
"lint:ts": "eslint --max-warnings 0 .",
"fmt:sol": "prettier 'contracts/**/*.sol' -w",
"prepack": "yarn build",
"prepare": "husky install"
},
"repository": {
"type": "git"
},
"author": "[email protected]",
"license": "MIT",
"devDependencies": {
"@gnosis.pm/zodiac": "1.0.1",
"@nomiclabs/hardhat-ethers": "2.0.0",
"@nomiclabs/hardhat-etherscan": "2.1.0",
"@nomiclabs/hardhat-waffle": "2.0.0",
"@types/chai": "4.2.14",
"@types/mocha": "8.2.0",
"@types/node": "14.14.21",
"@types/yargs": "16.0.0",
"@typescript-eslint/eslint-plugin": "4.7.0",
"@typescript-eslint/parser": "4.7.0",
"chai": "4.2.0",
"debug": "4.2.0",
"eslint": "7.13.0",
"eslint-config-prettier": "8.0.0",
"eslint-plugin-import": "2.22.1",
"eslint-plugin-no-only-tests": "2.4.0",
"eslint-plugin-prettier": "3.1.4",
"ethereum-waffle": "3.2.0",
"hardhat": "2.6.4",
"hardhat-deploy": "0.7.0-beta.38",
"husky": "5.1.3",
"prettier": "2.1.2",
"prettier-plugin-solidity": "1.0.0-alpha.60",
"solhint": "3.3.2",
"solhint-plugin-prettier": "0.0.5",
"solidity-coverage": "0.7.17",
"ts-node": "9.1.1",
"typescript": "4.1.3"
},
"dependencies": {
"@gnosis.pm/mock-contract": "^4.0.0",
"@gnosis.pm/safe-contracts": "1.3.0",
"@openzeppelin/contracts": "^4.3.1",
"argv": "^0.0.2",
"dotenv": "^8.0.0",
"ethers": "^5.4.6",
"solc": "0.8.1",
"yargs": "^16.1.1"
},
"resolutions": {
"bitcore-lib": "8.25.0"
}
"name": "zodiac-delay-monorepo",
"private": true,
"description": "Zodiac Delay monorepo",
"workspaces": [
"packages/*"
],
"scripts": {
"test": "yarn workspaces foreach run test",
"build": "yarn workspaces foreach run build",
"coverage": "yarn workspace zodiac-delay-modifier run coverage"
},
"repository": {
"type": "git",
"url": "https://github.com/gnosis/zodiac-modifier-delay.git"
},
"author": "",
"license": "LGPL-3.0+",
"packageManager": "[email protected]"
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
13 changes: 5 additions & 8 deletions hardhat.config.ts → packages/evm/hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const DEFAULT_MNEMONIC =

const sharedNetworkConfig: HttpNetworkUserConfig = {};
if (PK) {
console.log("yah")
console.log("yah");
sharedNetworkConfig.accounts = [PK];
} else {
sharedNetworkConfig.accounts = {
Expand All @@ -35,7 +35,7 @@ if (PK) {

if (["rinkeby", "mainnet"].includes(argv.network) && INFURA_KEY === undefined) {
throw new Error(
`Could not find Infura key in env, unable to connect to network ${argv.network}`,
`Could not find Infura key in env, unable to connect to network ${argv.network}`
);
}

Expand All @@ -47,10 +47,7 @@ export default {
sources: "contracts",
},
solidity: {
compilers: [
{ version: "0.8.0" },
{ version: "0.6.12" },
]
compilers: [{ version: "0.8.2" }, { version: "0.6.12" }],
},
networks: {
mainnet: {
Expand All @@ -67,8 +64,8 @@ export default {
},
matic: {
...sharedNetworkConfig,
url: "https://rpc-mainnet.maticvigil.com"
}
url: "https://rpc-mainnet.maticvigil.com",
},
},
namedAccounts: {
deployer: 0,
Expand Down
65 changes: 65 additions & 0 deletions packages/evm/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
{
"name": "zodiac-delay-modifier",
"version": "1.0.0",
"description": "Modifier for delayed transactions in the Gnosis Safe",
"directories": {
"test": "test"
},
"scripts": {
"build": "hardhat compile",
"test": "hardhat test",
"deploy": "hardhat deploy --network",
"coverage": "hardhat coverage",
"lint": "yarn lint:sol && yarn lint:ts",
"lint:sol": "solhint 'contracts/**/*.sol'",
"lint:ts": "eslint --max-warnings 0 .",
"fmt:sol": "prettier 'contracts/**/*.sol' -w",
"prepack": "yarn build"
},
"repository": {
"type": "git"
},
"author": "[email protected]",
"license": "LGPL-3.0+",
"devDependencies": {
"@gnosis.pm/zodiac": "1.0.1",
"@nomiclabs/hardhat-ethers": "2.0.0",
"@nomiclabs/hardhat-etherscan": "2.1.0",
"@nomiclabs/hardhat-waffle": "2.0.0",
"@types/chai": "4.2.14",
"@types/mocha": "8.2.0",
"@types/node": "20.8.6",
"@types/yargs": "16.0.0",
"@typescript-eslint/eslint-plugin": "4.7.0",
"@typescript-eslint/parser": "4.7.0",
"chai": "4.2.0",
"debug": "4.2.0",
"eslint": "7.13.0",
"eslint-config-prettier": "8.0.0",
"eslint-plugin-import": "2.22.1",
"eslint-plugin-no-only-tests": "2.4.0",
"eslint-plugin-prettier": "3.1.4",
"hardhat": "2.6.4",
"hardhat-deploy": "0.7.0-beta.38",
"prettier": "2.1.2",
"prettier-plugin-solidity": "1.0.0-alpha.60",
"solhint": "3.3.2",
"solhint-plugin-prettier": "0.0.5",
"solidity-coverage": "0.8.5",
"ts-node": "9.1.1",
"typescript": "4.1.3"
},
"dependencies": {
"@gnosis.pm/mock-contract": "^4.0.0",
"@gnosis.pm/safe-contracts": "1.3.0",
"@openzeppelin/contracts": "^4.3.1",
"argv": "^0.0.2",
"dotenv": "^8.0.0",
"ethers": "^5.7.2",
"solc": "0.8.1",
"yargs": "^16.1.1"
},
"resolutions": {
"bitcore-lib": "8.25.0"
}
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
38 changes: 38 additions & 0 deletions packages/gelato-web3-function/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Gelato web3 function for automated execution

This Gelato web3 function can be started for a Delay mod to automatically execute enqueued transactions as soon as the cooldown period has passed.

The latest version is deployed at IPFS CID: `QmYcfTe7pMaSEHpVAUvTQp6BjofXc8rAz5mnvgUR9t2bkm`

## How to run

### With Gelato Automate SDK

```ts
import { AutomateSDK } from "@gelatonetwork/automate-sdk";

const automate = new AutomateSDK(chainId, wallet);

const { taskId, tx } = await automate.createBatchExecTask({
name: "Web3Function - Delay dispatch",
web3FunctionHash: "QmYcfTe7pMaSEHpVAUvTQp6BjofXc8rAz5mnvgUR9t2bkm",
web3FunctionArgs: {
delayMod: "0x...", // address of the Delay mod to watch
gasAllowance: 1_000_000, // total gas that can be spent per interval
allowanceInterval: 7150, // unit is blocks (7150 blocks is roughly one day on mainnet)
},
});

await web3Function.secrets.set(
{
RELAY_API_KEY: "<YOUR GELATO RELAY API KEY>",
},
taskId
);
```

### With Gelato app

Go to https://beta.app.gelato.network/ and create a task in the desired interval and providing the IPFS CID `QmYcfTe7pMaSEHpVAUvTQp6BjofXc8rAz5mnvgUR9t2bkm`.

More info: https://docs.gelato.network/developer-services/web3-functions/running-web3-functions
1 change: 1 addition & 0 deletions packages/gelato-web3-function/delay-dispatch/.env.sample
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
RELAY_API_KEY=
Loading
Loading