Skip to content

Commit 064d362

Browse files
committed
Merge remote-tracking branch 'origin/dev' into ariel/zero-alloc
2 parents e112c85 + bc90412 commit 064d362

File tree

20 files changed

+280
-169
lines changed

20 files changed

+280
-169
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
![License: GPL](https://img.shields.io/badge/license-GPL-blue)
2-
![Version Badge](https://img.shields.io/badge/version-1.6.0-lightgrey.svg)
1+
![License: GPL](https://img.shields.io/badge/license-GPLv2-blue)
2+
![Version Badge](https://img.shields.io/badge/version-1.11.0-lightgrey.svg)
33
![CI Status](https://github.com/graphprotocol/contracts/actions/workflows/npmtest.yml/badge.svg)
44
[![codecov](https://codecov.io/gh/graphprotocol/contracts/branch/dev/graph/badge.svg?token=S8JWGR9SBN)](https://codecov.io/gh/graphprotocol/contracts)
55

addresses.json

Lines changed: 126 additions & 94 deletions
Large diffs are not rendered by default.
Binary file not shown.

cli/commands/contracts/staking.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ export const allocate = async (cli: CLIEnvironment, cliArgs: CLIArgs): Promise<v
3636
const staking = cli.contracts.Staking
3737

3838
logger.info(`Allocating ${cliArgs.amount} tokens on ${subgraphDeploymentID}...`)
39-
await sendTransaction(cli.wallet, staking, 'allocate', [
39+
await sendTransaction(cli.wallet, staking, 'allocateFrom', [
40+
cli.walletAddress,
4041
subgraphDeploymentID,
4142
amount,
4243
allocationID,

contracts/staking/Staking.sol

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ pragma abicoder v2;
55

66
import "@openzeppelin/contracts/cryptography/ECDSA.sol";
77

8+
import "../base/Multicall.sol";
89
import "../upgrades/GraphUpgradeable.sol";
910
import "../utils/TokenUtils.sol";
1011

@@ -20,7 +21,7 @@ import "./libs/Stakes.sol";
2021
* Allocations on a Subgraph. It also allows Delegators to Delegate towards an Indexer. The
2122
* contract also has the slashing functionality.
2223
*/
23-
contract Staking is StakingV2Storage, GraphUpgradeable, IStaking {
24+
contract Staking is StakingV2Storage, GraphUpgradeable, IStaking, Multicall {
2425
using SafeMath for uint256;
2526
using Stakes for Stakes.Indexer;
2627
using Rebates for Rebates.Pool;

hardhat.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ const config: HardhatUserConfig = {
125125
mnemonic: DEFAULT_TEST_MNEMONIC,
126126
},
127127
mining: {
128-
auto: true,
128+
auto: false,
129129
interval: 30000,
130130
},
131131
hardfork: 'london',

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@graphprotocol/contracts",
3-
"version": "1.10.1",
3+
"version": "1.11.1",
44
"description": "Contracts for the Graph Protocol",
55
"directories": {
66
"test": "test"
@@ -103,7 +103,7 @@
103103
"lint": "yarn lint:ts && yarn lint:sol",
104104
"lint:fix": "yarn lint:ts:fix && yarn lint:sol:fix",
105105
"lint:ts": "eslint '*/**/*.{js,ts}'",
106-
"lint:ts:fix": "prettier:ts && eslint '*/**/*.{js,ts}' --fix",
106+
"lint:ts:fix": "yarn prettier:ts && eslint '*/**/*.{js,ts}' --fix",
107107
"lint:sol": "solhint './contracts/**/*.sol'",
108108
"lint:sol:fix": "yarn prettier:sol && solhint --fix './contracts/**/*.sol'",
109109
"prettier": "yarn prettier:ts && yarn prettier:sol",
@@ -134,8 +134,8 @@
134134
"type": "git",
135135
"url": "git+https://github.com/graphprotocol/contracts.git"
136136
},
137-
"author": "TheGraph Team",
138-
"license": "MIT",
137+
"author": "The Graph Team",
138+
"license": "GPL-2.0-or-later",
139139
"bugs": {
140140
"url": "https://github.com/graphprotocol/contracts/issues"
141141
},

scripts/test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ fi
4141
mkdir -p reports
4242

4343
# Run using the standalone evm instance
44-
npx hardhat test --network hardhat
44+
npx hardhat test --network hardhat $@
4545

4646
### Cleanup
4747

tasks/contracts/functions.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,14 @@ task('contracts:functions', 'Print function hashes for contracts')
2020
console.log(fnSig, '->', hre.ethers.utils.id(fnSig).slice(0, 10))
2121
}
2222
}
23+
24+
console.log('## GNS ##')
25+
for (const fn of Object.entries(env.contracts.GNS.functions)) {
26+
const [fnSig] = fn
27+
if (fnSig.indexOf('(') != -1) {
28+
console.log(fnSig, '->', hre.ethers.utils.id(fnSig).slice(0, 10))
29+
}
30+
}
2331
})
2432

2533
task('contracts:layout', 'Display storage layout').setAction(async (_, hre) => {

test/disputes/poi.test.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,8 @@ describe('DisputeManager:POI', async () => {
7979
await staking.connect(indexerAccount.signer).stake(indexerTokens)
8080
await staking
8181
.connect(indexerAccount.signer)
82-
.allocate(
82+
.allocateFrom(
83+
indexerAccount.address,
8384
subgraphDeploymentID,
8485
indexerAllocatedTokens,
8586
allocationID,
@@ -147,7 +148,8 @@ describe('DisputeManager:POI', async () => {
147148
await staking.connect(indexer.signer).stake(indexerTokens)
148149
const tx1 = await staking
149150
.connect(indexer.signer)
150-
.allocate(
151+
.allocateFrom(
152+
indexer.address,
151153
subgraphDeploymentID,
152154
indexerAllocatedTokens,
153155
allocationID,

0 commit comments

Comments
 (0)