generated from BlossomLabs/web3-turbo-template
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'dev' into magic-number
- Loading branch information
Showing
4 changed files
with
34 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,10 @@ | ||
name: "Code Review by Gemini AI" | ||
on: | ||
pull_request: | ||
issue_comment: | ||
types: | ||
- created | ||
- updated | ||
|
||
jobs: | ||
review: | ||
runs-on: ubuntu-latest | ||
|
@@ -10,41 +14,38 @@ jobs: | |
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: "Check for !ai keyword in commit message" | ||
id: check_commit_message | ||
run: | | ||
COMMIT_MESSAGE=$(git log -1 --pretty=%B) | ||
echo "Commit message: $COMMIT_MESSAGE" | ||
if [[ "$COMMIT_MESSAGE" == *"!ai"* ]]; then | ||
echo "run_ai=true" >> $GITHUB_ENV | ||
else | ||
echo "run_ai=false" >> $GITHUB_ENV | ||
fi | ||
- name: Only PR comments | ||
if: ${{ !github.event.issue.pull_request || !contains(github.event.comment.body,'!ai') }} | ||
run: exit 1 | ||
|
||
- name: "Check if relevant files are modified" | ||
id: check_changes | ||
shell: bash | ||
run: | | ||
# Check for modified .ts, .tsx, or .sol files | ||
git fetch origin "${{ github.event.pull_request.head.ref }}" # fetch the branch with changes | ||
git fetch origin "${{ github.event.pull_request.base.ref }}" # fetch the target branch | ||
git diff --name-only "origin/${{ github.event.pull_request.base.ref }}" "origin/${{ github.event.pull_request.head.ref }}" > modified_files.txt | ||
- name: Put a reaction to the comment | ||
run: gh api graphql --silent --raw-field query="mutation AddReaction {addReaction(input:{subjectId:\"$NODE_ID\",content:EYES}){reaction{content}subject{id}}}" | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
NODE_ID: ${{ github.event.comment.node_id }} | ||
|
||
# Check if there are any .ts, .tsx, or .sol files modified | ||
if grep -E '\.ts$|\.tsx$|\.sol$' modified_files.txt; then | ||
echo "files_changed=true" >> $GITHUB_ENV | ||
else | ||
echo "files_changed=false" >> $GITHUB_ENV | ||
fi | ||
- name: Fetch PR details using GitHub API | ||
id: pr-details | ||
uses: actions/github-script@v6 | ||
with: | ||
script: | | ||
const pr_number = context.payload.issue.number; | ||
const pr = await github.rest.pulls.get({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
pull_number: pr_number | ||
}); | ||
return pr.data; | ||
- name: "Get diff of the pull request" | ||
if: env.files_changed == 'true' && env.run_ai == 'true' | ||
id: get_diff | ||
shell: bash | ||
env: | ||
PULL_REQUEST_HEAD_REF: "${{ github.event.pull_request.head.ref }}" | ||
PULL_REQUEST_BASE_REF: "${{ github.event.pull_request.base.ref }}" | ||
PULL_REQUEST_HEAD_REF: "${{ steps.pr-details.outputs.head.ref }}" | ||
PULL_REQUEST_BASE_REF: "${{ steps.pr-details.outputs.base.ref }}" | ||
run: |- | ||
echo "PULL_REQUEST_HEAD_REF: $PULL_REQUEST_HEAD_REF" | ||
echo "PULL_REQUEST_BASE_REF: $PULL_REQUEST_BASE_REF" | ||
# Only include changes to .ts, .tsx, and .sol files in the diff | ||
git diff "origin/${{ env.PULL_REQUEST_BASE_REF }}" -- '*.ts' '*.tsx' '*.sol' > "diff.txt" | ||
{ | ||
|
@@ -55,15 +56,14 @@ jobs: | |
- uses: rubensflinco/[email protected] | ||
name: "Code Review by Gemini AI" | ||
if: env.files_changed == 'true' && env.run_ai == 'true' | ||
continue-on-error: true | ||
id: review | ||
with: | ||
gemini_api_key: ${{ secrets.GEMINI_API_KEY }} | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
github_repository: ${{ github.repository }} | ||
github_pull_request_number: ${{ github.event.pull_request.number }} | ||
git_commit_hash: ${{ github.event.pull_request.head.sha }} | ||
github_pull_request_number: ${{ steps.pr-details.outputs.number }} | ||
git_commit_hash: ${{ steps.pr-details.outputs.head.sha }} | ||
model: "gemini-1.5-pro-latest" | ||
pull_request_diff: |- | ||
${{ steps.get_diff.outputs.pull_request_diff }} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,4 +12,5 @@ out/*Deploy* | |
out/utils/* | ||
!out/*SafeArbitrator* | ||
!out/*IArbitrator* | ||
!out/*CollateralVault.sol* | ||
!out/utils/Mock* |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"abi":[{"type":"function","name":"depositCollateral","inputs":[{"name":"proposalId","type":"uint256","internalType":"uint256"},{"name":"user","type":"address","internalType":"address"}],"outputs":[],"stateMutability":"payable"},{"type":"function","name":"initialize","inputs":[],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"withdrawCollateral","inputs":[{"name":"_proposalId","type":"uint256","internalType":"uint256"},{"name":"_user","type":"address","internalType":"address"},{"name":"_amount","type":"uint256","internalType":"uint256"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"withdrawCollateralFor","inputs":[{"name":"_proposalId","type":"uint256","internalType":"uint256"},{"name":"_fromUser","type":"address","internalType":"address"},{"name":"_toUser","type":"address","internalType":"address"},{"name":"_amount","type":"uint256","internalType":"uint256"}],"outputs":[],"stateMutability":"nonpayable"}],"bytecode":{"object":"0x","sourceMap":"","linkReferences":{}},"deployedBytecode":{"object":"0x","sourceMap":"","linkReferences":{}},"methodIdentifiers":{"depositCollateral(uint256,address)":"481fef8a","initialize()":"8129fc1c","withdrawCollateral(uint256,address,uint256)":"99ea56b0","withdrawCollateralFor(uint256,address,address,uint256)":"8969ab53"},"rawMetadata":"{\"compiler\":{\"version\":\"0.8.19+commit.7dd6d404\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"proposalId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"}],\"name\":\"depositCollateral\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_proposalId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"_user\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"withdrawCollateral\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_proposalId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"_fromUser\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_toUser\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"withdrawCollateralFor\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"pkg/contracts/src/interfaces/ICollateralVault.sol\":\"ICollateralVault\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":0},\"remappings\":[\":@openzeppelin/contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/contracts/\",\":@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/\",\":@openzeppelin/foundry/=lib/openzeppelin-foundry-upgrades/src/\",\":@prb/math/=lib/allo-v2/lib/v2-core/lib/prb-math/\",\":@prb/test/=lib/allo-v2/lib/v2-core/lib/prb-test/src/\",\":@sablier/v2-core/=lib/allo-v2/lib/v2-core/\",\":ERC1155/=lib/allo-v2/lib/hats-protocol/lib/ERC1155/\",\":allo-v2-contracts/=lib/allo-v2/contracts/\",\":allo-v2-test/=lib/allo-v2/test/\",\":allo-v2/=lib/allo-v2/\",\":ds-test/=lib/allo-v2/lib/forge-std/lib/ds-test/src/\",\":eas-contracts/=lib/allo-v2/lib/eas-contracts/contracts/\",\":erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/\",\":forge-gas-snapshot/=lib/allo-v2/lib/permit2/lib/forge-gas-snapshot/src/\",\":forge-std/=lib/forge-std/src/\",\":hats-protocol/=lib/allo-v2/lib/hats-protocol/\",\":openzeppelin-contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/\",\":openzeppelin-contracts/=lib/openzeppelin-contracts/\",\":openzeppelin-foundry-upgrades/=lib/openzeppelin-foundry-upgrades/src/\",\":openzeppelin/=lib/openzeppelin-contracts/contracts/\",\":permit2/=lib/allo-v2/lib/permit2/\",\":prb-math/=lib/allo-v2/lib/v2-core/lib/prb-math/src/\",\":prb-test/=lib/allo-v2/lib/v2-core/lib/prb-test/src/\",\":safe-smart-account/=lib/safe-smart-account/\",\":solady/=lib/allo-v2/lib/solady/\",\":solarray/=lib/allo-v2/lib/v2-core/lib/solarray/src/\",\":solbase/=lib/allo-v2/lib/hats-protocol/lib/solbase/src/\",\":solidity-stringutils/=lib/openzeppelin-foundry-upgrades/lib/solidity-stringutils/\",\":solmate/=lib/allo-v2/lib/permit2/lib/solmate/\",\":utils/=lib/allo-v2/lib/hats-protocol/lib/utils/\",\":v2-core/=lib/allo-v2/lib/v2-core/\"]},\"sources\":{\"pkg/contracts/src/interfaces/ICollateralVault.sol\":{\"keccak256\":\"0x3043f36ad1493c07052ee9feb7128e433772ccbe7c053c5d90ef6575e048f184\",\"license\":\"AGPL-3.0-only\",\"urls\":[\"bzz-raw://ec6b957426edea88f80ee65f5ea856ac879b0bcf1f33f920eb238ea154134d23\",\"dweb:/ipfs/QmSfV8i3zKoDxgD8tFhLKKnDcokaPCrptstiuj2FZfKhjv\"]}},\"version\":1}","metadata":{"compiler":{"version":"0.8.19+commit.7dd6d404"},"language":"Solidity","output":{"abi":[{"inputs":[{"internalType":"uint256","name":"proposalId","type":"uint256"},{"internalType":"address","name":"user","type":"address"}],"stateMutability":"payable","type":"function","name":"depositCollateral"},{"inputs":[],"stateMutability":"nonpayable","type":"function","name":"initialize"},{"inputs":[{"internalType":"uint256","name":"_proposalId","type":"uint256"},{"internalType":"address","name":"_user","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"stateMutability":"nonpayable","type":"function","name":"withdrawCollateral"},{"inputs":[{"internalType":"uint256","name":"_proposalId","type":"uint256"},{"internalType":"address","name":"_fromUser","type":"address"},{"internalType":"address","name":"_toUser","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"stateMutability":"nonpayable","type":"function","name":"withdrawCollateralFor"}],"devdoc":{"kind":"dev","methods":{},"version":1},"userdoc":{"kind":"user","methods":{},"version":1}},"settings":{"remappings":["@openzeppelin/contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/contracts/","@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/","@openzeppelin/foundry/=lib/openzeppelin-foundry-upgrades/src/","@prb/math/=lib/allo-v2/lib/v2-core/lib/prb-math/","@prb/test/=lib/allo-v2/lib/v2-core/lib/prb-test/src/","@sablier/v2-core/=lib/allo-v2/lib/v2-core/","ERC1155/=lib/allo-v2/lib/hats-protocol/lib/ERC1155/","allo-v2-contracts/=lib/allo-v2/contracts/","allo-v2-test/=lib/allo-v2/test/","allo-v2/=lib/allo-v2/","ds-test/=lib/allo-v2/lib/forge-std/lib/ds-test/src/","eas-contracts/=lib/allo-v2/lib/eas-contracts/contracts/","erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/","forge-gas-snapshot/=lib/allo-v2/lib/permit2/lib/forge-gas-snapshot/src/","forge-std/=lib/forge-std/src/","hats-protocol/=lib/allo-v2/lib/hats-protocol/","openzeppelin-contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/","openzeppelin-contracts/=lib/openzeppelin-contracts/","openzeppelin-foundry-upgrades/=lib/openzeppelin-foundry-upgrades/src/","openzeppelin/=lib/openzeppelin-contracts/contracts/","permit2/=lib/allo-v2/lib/permit2/","prb-math/=lib/allo-v2/lib/v2-core/lib/prb-math/src/","prb-test/=lib/allo-v2/lib/v2-core/lib/prb-test/src/","safe-smart-account/=lib/safe-smart-account/","solady/=lib/allo-v2/lib/solady/","solarray/=lib/allo-v2/lib/v2-core/lib/solarray/src/","solbase/=lib/allo-v2/lib/hats-protocol/lib/solbase/src/","solidity-stringutils/=lib/openzeppelin-foundry-upgrades/lib/solidity-stringutils/","solmate/=lib/allo-v2/lib/permit2/lib/solmate/","utils/=lib/allo-v2/lib/hats-protocol/lib/utils/","v2-core/=lib/allo-v2/lib/v2-core/"],"optimizer":{"enabled":true,"runs":0},"metadata":{"bytecodeHash":"ipfs"},"compilationTarget":{"pkg/contracts/src/interfaces/ICollateralVault.sol":"ICollateralVault"},"evmVersion":"paris","libraries":{}},"sources":{"pkg/contracts/src/interfaces/ICollateralVault.sol":{"keccak256":"0x3043f36ad1493c07052ee9feb7128e433772ccbe7c053c5d90ef6575e048f184","urls":["bzz-raw://ec6b957426edea88f80ee65f5ea856ac879b0bcf1f33f920eb238ea154134d23","dweb:/ipfs/QmSfV8i3zKoDxgD8tFhLKKnDcokaPCrptstiuj2FZfKhjv"],"license":"AGPL-3.0-only"}},"version":1},"storageLayout":{"storage":[],"types":{}},"ast":{"absolutePath":"pkg/contracts/src/interfaces/ICollateralVault.sol","id":79381,"exportedSymbols":{"ICollateralVault":[79380]},"nodeType":"SourceUnit","src":"42:393:126","nodes":[{"id":79349,"nodeType":"PragmaDirective","src":"42:24:126","nodes":[],"literals":["solidity","^","0.8",".19"]},{"id":79380,"nodeType":"ContractDefinition","src":"68:366:126","nodes":[{"id":79352,"nodeType":"FunctionDefinition","src":"101:31:126","nodes":[],"functionSelector":"8129fc1c","implemented":false,"kind":"function","modifiers":[],"name":"initialize","nameLocation":"110:10:126","parameters":{"id":79350,"nodeType":"ParameterList","parameters":[],"src":"120:2:126"},"returnParameters":{"id":79351,"nodeType":"ParameterList","parameters":[],"src":"131:0:126"},"scope":79380,"stateMutability":"nonpayable","virtual":false,"visibility":"external"},{"id":79359,"nodeType":"FunctionDefinition","src":"138:78:126","nodes":[],"functionSelector":"481fef8a","implemented":false,"kind":"function","modifiers":[],"name":"depositCollateral","nameLocation":"147:17:126","parameters":{"id":79357,"nodeType":"ParameterList","parameters":[{"constant":false,"id":79354,"mutability":"mutable","name":"proposalId","nameLocation":"173:10:126","nodeType":"VariableDeclaration","scope":79359,"src":"165:18:126","stateVariable":false,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"},"typeName":{"id":79353,"name":"uint256","nodeType":"ElementaryTypeName","src":"165:7:126","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}},"visibility":"internal"},{"constant":false,"id":79356,"mutability":"mutable","name":"user","nameLocation":"193:4:126","nodeType":"VariableDeclaration","scope":79359,"src":"185:12:126","stateVariable":false,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"},"typeName":{"id":79355,"name":"address","nodeType":"ElementaryTypeName","src":"185:7:126","stateMutability":"nonpayable","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"}},"visibility":"internal"}],"src":"164:34:126"},"returnParameters":{"id":79358,"nodeType":"ParameterList","parameters":[],"src":"215:0:126"},"scope":79380,"stateMutability":"payable","virtual":false,"visibility":"external"},{"id":79368,"nodeType":"FunctionDefinition","src":"222:90:126","nodes":[],"functionSelector":"99ea56b0","implemented":false,"kind":"function","modifiers":[],"name":"withdrawCollateral","nameLocation":"231:18:126","parameters":{"id":79366,"nodeType":"ParameterList","parameters":[{"constant":false,"id":79361,"mutability":"mutable","name":"_proposalId","nameLocation":"258:11:126","nodeType":"VariableDeclaration","scope":79368,"src":"250:19:126","stateVariable":false,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"},"typeName":{"id":79360,"name":"uint256","nodeType":"ElementaryTypeName","src":"250:7:126","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}},"visibility":"internal"},{"constant":false,"id":79363,"mutability":"mutable","name":"_user","nameLocation":"279:5:126","nodeType":"VariableDeclaration","scope":79368,"src":"271:13:126","stateVariable":false,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"},"typeName":{"id":79362,"name":"address","nodeType":"ElementaryTypeName","src":"271:7:126","stateMutability":"nonpayable","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"}},"visibility":"internal"},{"constant":false,"id":79365,"mutability":"mutable","name":"_amount","nameLocation":"294:7:126","nodeType":"VariableDeclaration","scope":79368,"src":"286:15:126","stateVariable":false,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"},"typeName":{"id":79364,"name":"uint256","nodeType":"ElementaryTypeName","src":"286:7:126","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}},"visibility":"internal"}],"src":"249:53:126"},"returnParameters":{"id":79367,"nodeType":"ParameterList","parameters":[],"src":"311:0:126"},"scope":79380,"stateMutability":"nonpayable","virtual":false,"visibility":"external"},{"id":79379,"nodeType":"FunctionDefinition","src":"318:114:126","nodes":[],"functionSelector":"8969ab53","implemented":false,"kind":"function","modifiers":[],"name":"withdrawCollateralFor","nameLocation":"327:21:126","parameters":{"id":79377,"nodeType":"ParameterList","parameters":[{"constant":false,"id":79370,"mutability":"mutable","name":"_proposalId","nameLocation":"357:11:126","nodeType":"VariableDeclaration","scope":79379,"src":"349:19:126","stateVariable":false,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"},"typeName":{"id":79369,"name":"uint256","nodeType":"ElementaryTypeName","src":"349:7:126","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}},"visibility":"internal"},{"constant":false,"id":79372,"mutability":"mutable","name":"_fromUser","nameLocation":"378:9:126","nodeType":"VariableDeclaration","scope":79379,"src":"370:17:126","stateVariable":false,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"},"typeName":{"id":79371,"name":"address","nodeType":"ElementaryTypeName","src":"370:7:126","stateMutability":"nonpayable","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"}},"visibility":"internal"},{"constant":false,"id":79374,"mutability":"mutable","name":"_toUser","nameLocation":"397:7:126","nodeType":"VariableDeclaration","scope":79379,"src":"389:15:126","stateVariable":false,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"},"typeName":{"id":79373,"name":"address","nodeType":"ElementaryTypeName","src":"389:7:126","stateMutability":"nonpayable","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"}},"visibility":"internal"},{"constant":false,"id":79376,"mutability":"mutable","name":"_amount","nameLocation":"414:7:126","nodeType":"VariableDeclaration","scope":79379,"src":"406:15:126","stateVariable":false,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"},"typeName":{"id":79375,"name":"uint256","nodeType":"ElementaryTypeName","src":"406:7:126","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}},"visibility":"internal"}],"src":"348:74:126"},"returnParameters":{"id":79378,"nodeType":"ParameterList","parameters":[],"src":"431:0:126"},"scope":79380,"stateMutability":"nonpayable","virtual":false,"visibility":"external"}],"abstract":false,"baseContracts":[],"canonicalName":"ICollateralVault","contractDependencies":[],"contractKind":"interface","fullyImplemented":false,"linearizedBaseContracts":[79380],"name":"ICollateralVault","nameLocation":"78:16:126","scope":79381,"usedErrors":[]}],"license":"AGPL-3.0-only"},"id":126} |