Skip to content

Commit

Permalink
Merge pull request #508 from humanprotocol/develop
Browse files Browse the repository at this point in the history
fix addReward event and improve contracts CD (#507)
  • Loading branch information
portuu3 authored May 26, 2023
2 parents dcb4ba6 + 6eab891 commit 534648d
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 23 deletions.
24 changes: 19 additions & 5 deletions .github/workflows/cd-deploy-contracts.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -121,35 +121,49 @@ jobs:
REWARD_POOL_ADDRESS: ${{ steps.networks.outputs.reward_pool }}

- name: Verify Escrow Factory Proxy
if: github.event.inputs.escrowFactory == 'true'
if: always() && github.event.inputs.escrowFactory == 'true'
run: npx hardhat verify --network ${{ github.event.inputs.network }} ${{ steps.networks.outputs.escrow_factory }}
working-directory: ./packages/core
- name: Verify Staking Proxy
if: github.event.inputs.staking == 'true'
if: always() && github.event.inputs.staking == 'true'
run: npx hardhat verify --network ${{ github.event.inputs.network }} ${{ steps.networks.outputs.staking }}
working-directory: ./packages/core
- name: Verify Reward Pool Proxy
if: github.event.inputs.rewardPool== 'true'
if: always() && github.event.inputs.rewardPool== 'true'
run: npx hardhat verify --network ${{ github.event.inputs.network }} ${{ steps.networks.outputs.reward_pool }}
working-directory: ./packages/core
- name: Check for Changes
if: always()
id: check_changes
run: |
git fetch
if [[ -n "$(git diff --name-only)" ]]; then
echo "Changes detected."
echo "::set-output name=changes::true"
else
echo "No changes detected."
echo "::set-output name=changes::false"
fi
- name: Commit changes
if: ${{ success() }}
if: always() && steps.check_changes.outputs.changes == 'true'
uses: EndBug/add-and-commit@v9
with:
add: "['./packages/core/.openzeppelin', './packages/sdk/typescript/subgraph/config']"
message: 'Update grafting and upgrade file from CD'
default_author: github_actions
tag_push: '--force'
- name: Checkout develop
if: always() && steps.check_changes.outputs.changes == 'true'
uses: actions/checkout@v3
with:
ref: develop
- name: Rebase develop
if: always() && steps.check_changes.outputs.changes == 'true'
run: |
git fetch
git rebase origin/main
git push --force
- name: Trigger Another Workflow
- name: Trigger Subgraph Workflow
uses: benc-uk/workflow-dispatch@v1
with:
workflow: Subgraph deployment
Expand Down
22 changes: 11 additions & 11 deletions packages/core/.openzeppelin/polygon-mumbai.json
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@
"label": "stakes",
"offset": 0,
"slot": "205",
"type": "t_mapping(t_address,t_struct(Staker)6260_storage)",
"type": "t_mapping(t_address,t_struct(Staker)3453_storage)",
"contract": "Staking",
"src": "contracts/Staking.sol:38"
},
Expand All @@ -268,7 +268,7 @@
"label": "allocations",
"offset": 0,
"slot": "207",
"type": "t_mapping(t_address,t_struct(Allocation)6120_storage)",
"type": "t_mapping(t_address,t_struct(Allocation)3313_storage)",
"contract": "Staking",
"src": "contracts/Staking.sol:44"
},
Expand Down Expand Up @@ -306,15 +306,15 @@
"label": "bool",
"numberOfBytes": "1"
},
"t_mapping(t_address,t_struct(Allocation)6120_storage)": {
"t_mapping(t_address,t_struct(Allocation)3313_storage)": {
"label": "mapping(address => struct IStaking.Allocation)",
"numberOfBytes": "32"
},
"t_mapping(t_address,t_struct(Staker)6260_storage)": {
"t_mapping(t_address,t_struct(Staker)3453_storage)": {
"label": "mapping(address => struct Stakes.Staker)",
"numberOfBytes": "32"
},
"t_struct(Allocation)6120_storage": {
"t_struct(Allocation)3313_storage": {
"label": "struct IStaking.Allocation",
"members": [
{
Expand Down Expand Up @@ -350,7 +350,7 @@
],
"numberOfBytes": "160"
},
"t_struct(Staker)6260_storage": {
"t_struct(Staker)3453_storage": {
"label": "struct Stakes.Staker",
"members": [
{
Expand Down Expand Up @@ -485,7 +485,7 @@
"label": "rewards",
"offset": 0,
"slot": "204",
"type": "t_mapping(t_address,t_array(t_struct(Reward)6066_storage)dyn_storage)",
"type": "t_mapping(t_address,t_array(t_struct(Reward)3259_storage)dyn_storage)",
"contract": "RewardPool",
"src": "contracts/RewardPool.sol:30"
},
Expand All @@ -503,15 +503,15 @@
"slot": "206",
"type": "t_array(t_uint256)45_storage",
"contract": "RewardPool",
"src": "contracts/RewardPool.sol:146"
"src": "contracts/RewardPool.sol:150"
}
],
"types": {
"t_address": {
"label": "address",
"numberOfBytes": "20"
},
"t_array(t_struct(Reward)6066_storage)dyn_storage": {
"t_array(t_struct(Reward)3259_storage)dyn_storage": {
"label": "struct IRewardPool.Reward[]",
"numberOfBytes": "32"
},
Expand All @@ -531,11 +531,11 @@
"label": "bool",
"numberOfBytes": "1"
},
"t_mapping(t_address,t_array(t_struct(Reward)6066_storage)dyn_storage)": {
"t_mapping(t_address,t_array(t_struct(Reward)3259_storage)dyn_storage)": {
"label": "mapping(address => struct IRewardPool.Reward[])",
"numberOfBytes": "32"
},
"t_struct(Reward)6066_storage": {
"t_struct(Reward)3259_storage": {
"label": "struct IRewardPool.Reward",
"members": [
{
Expand Down
7 changes: 1 addition & 6 deletions packages/core/contracts/RewardPool.sol
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,7 @@ contract RewardPool is IRewardPool, OwnableUpgradeable, UUPSUpgradeable {
totalFee = totalFee + fees;

// Add reward record
Reward memory reward = Reward(
_escrowAddress,
_staker,
_slasher,
rewardAfterFee
);
Reward memory reward = Reward(_escrowAddress, _slasher, rewardAfterFee);
rewards[_escrowAddress].push(reward);

emit RewardAdded(_escrowAddress, _staker, _slasher, rewardAfterFee);
Expand Down
1 change: 0 additions & 1 deletion packages/core/contracts/interfaces/IRewardPool.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ interface IRewardPool {
*/
struct Reward {
address escrowAddress;
address staker;
address slasher;
uint256 tokens; // Tokens allocated to a escrowAddress
}
Expand Down

8 comments on commit 534648d

@vercel
Copy link

@vercel vercel bot commented on 534648d May 26, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

fortune-exchange-oracle-server – ./packages/examples/fortune/exchange-oracle/server

exchange-server.humanprotocol.org
fortune-exchange-oracle-server.vercel.app
fortune-exchange-oracle-server-git-main-humanprotocol.vercel.app
fortune-exchange-oracle-server-humanprotocol.vercel.app

@vercel
Copy link

@vercel vercel bot commented on 534648d May 26, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

fortune-job-launcher-server – ./packages/examples/fortune/launcher/server

job-launcher-server.vercel.app
fortune-job-launcher-server-humanprotocol.vercel.app
fortune-job-launcher-server-git-main-humanprotocol.vercel.app
job-launcher-server.humanprotocol.org

@vercel
Copy link

@vercel vercel bot commented on 534648d May 26, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

escrow-dashboard – ./packages/apps/escrow-dashboard

escrow-dashboard-git-main-humanprotocol.vercel.app
escrow-dashboard-humanprotocol.vercel.app
dashboard.humanprotocol.org

@vercel
Copy link

@vercel vercel bot commented on 534648d May 26, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

faucet-server – ./packages/apps/faucet-server/

faucet-server-git-main-humanprotocol.vercel.app
faucet-server.vercel.app
faucet-server-humanprotocol.vercel.app

@vercel
Copy link

@vercel vercel bot commented on 534648d May 26, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

fortune-reputation-oracle – ./packages/examples/fortune/reputation-oracle

reputation-server.humanprotocol.org
fortune-reputation-oracle-git-main-humanprotocol.vercel.app
fortune-reputation-oracle-humanprotocol.vercel.app
fortune-reputation-oracle.vercel.app

@vercel
Copy link

@vercel vercel bot commented on 534648d May 26, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

fortune-exchange-oracle – ./packages/examples/fortune/exchange-oracle/client

fortune-exchange-oracle-humanprotocol.vercel.app
fortune-exchange-oracle.vercel.app
fortune-exchange-oracle-git-main-humanprotocol.vercel.app
exchange.humanprotocol.org

@vercel
Copy link

@vercel vercel bot commented on 534648d May 26, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

fortune-recording-oracle – ./packages/examples/fortune/recording-oracle

fortune-recording-oracle.vercel.app
fortune-recording-oracle-humanprotocol.vercel.app
recording-server.humanprotocol.org
fortune-recording-oracle-git-main-humanprotocol.vercel.app

@vercel
Copy link

@vercel vercel bot commented on 534648d May 26, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

fortune-job-launcher-client – ./packages/examples/fortune/launcher/client

job-launcher-client.vercel.app
fortune-job-launcher-client-humanprotocol.vercel.app
fortune-job-launcher-client-git-main-humanprotocol.vercel.app
job-launcher.humanprotocol.org

Please sign in to comment.