Skip to content

Commit c9ff22d

Browse files
committed
Add set delegation parameters to the cli
1 parent 95aa28e commit c9ff22d

File tree

3 files changed

+67
-17
lines changed

3 files changed

+67
-17
lines changed

addresses.json

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -360,13 +360,13 @@
360360
],
361361
"creationCodeHash": "0x27b19762861db0d7205933031f5318603d0d44c2f94f2d8ef89871694f4fceee",
362362
"runtimeCodeHash": "0xed96c5619d707fbe2b70980bd85c03aac8b77fc34d90170598dacf76df0809c4",
363-
"txHash": "0x503ee5c503d5a45f9e2cb800ed1f9b1f321576b9b3bcfb2e8aa95497da3f3e60",
363+
"txHash": "0x4076305ae5acabd1786244ea3da63dafaf400947cd730fe6a11f6314b7b72a22",
364364
"proxy": true,
365365
"implementation": {
366366
"address": "0xCfEB869F69431e42cdB54A4F4f105C19C080A601",
367367
"creationCodeHash": "0x7bec2f1b1ae07d9431a8c3166f629ebe5dfc7d43d0514f62de60b1bc6f5a229c",
368368
"runtimeCodeHash": "0x9a82808388ad5583ea8d8ed5b1db11bd0c01aef0b681784c9375946029091ecf",
369-
"txHash": "0xb7f0b54c76cdd994a21e9cf1468b6550c87ab0b6c9b03fc4db0ad47285fc9f3b"
369+
"txHash": "0x7ffee30597e56d75fcbc7d7875f5a2533934b4e46036e8816518d70fef074416"
370370
}
371371
},
372372
"GNS": {
@@ -387,7 +387,7 @@
387387
],
388388
"creationCodeHash": "0x6fa2fd5803eee3482daebb46e5ee7082abd736e456b8e698ba3abe2692eb0ac0",
389389
"runtimeCodeHash": "0xf17df064c930175fed00782cf844d0faf3ee230386f50ea0637669ce7cd468b0",
390-
"txHash": "0x300189ff613cf1e2e30915c828a339b8ec2aa10f54193c3717074d95e6b88744"
390+
"txHash": "0xeff059a3f1662b56593f3b31540db4bf7538940b0e120fe76222e43667d7df18"
391391
},
392392
"GraphToken": {
393393
"address": "0xD833215cBcc3f914bD1C9ece3EE7BF8B14f841bb",
@@ -399,13 +399,13 @@
399399
],
400400
"creationCodeHash": "0x92f69e9909f2b6f4b1e189dca93cb31dda22733ee0a09d43298e6a2a8df2ee69",
401401
"runtimeCodeHash": "0xa794d1444606a3d5578834e8f1406e9bd3486955ac93eeed0c3b5a2d7fb28b76",
402-
"txHash": "0x04bb91d00b5303c64d8411e345bedea78e661d988cbd921934ce85df7c4d43e0"
402+
"txHash": "0x137c7262ee186434dd76c979c63c596145c84ea7e0d8362d313a94ef99e7a8d6"
403403
},
404404
"ServiceRegistry": {
405405
"address": "0x9561C133DD8580860B6b7E504bC5Aa500f0f06a7",
406406
"creationCodeHash": "0x365b21babad64eb7f7bc7d902be9f0c196a63b221743a6a71df73238b969a78e",
407407
"runtimeCodeHash": "0xd0a2b0c2a20cbc493180afa412f85327aec5f658d9e98de242f23d3132fe0223",
408-
"txHash": "0x13f3357d86dd96be62a8661efd8fa9b55d1f985ae6fa608a77293dc1f97f8fe5"
408+
"txHash": "0x39dbb3e138adb3adabc5904bd1bee6e34b0835c98b15be13c087df959d216662"
409409
},
410410
"Curation": {
411411
"address": "0x59d3631c86BbE35EF041872d502F218A39FBa150",
@@ -429,13 +429,13 @@
429429
],
430430
"creationCodeHash": "0x27b19762861db0d7205933031f5318603d0d44c2f94f2d8ef89871694f4fceee",
431431
"runtimeCodeHash": "0xed96c5619d707fbe2b70980bd85c03aac8b77fc34d90170598dacf76df0809c4",
432-
"txHash": "0x700fb472d61e709cc4a1b5274e7155227fd7120fe1a20bedaba7f2e2b8e57d1b",
432+
"txHash": "0x53c0a3fdfc806979b57360eec3b8dbddca37dd7cc7ea1e2cd38b87adedf90901",
433433
"proxy": true,
434434
"implementation": {
435435
"address": "0xe982E462b094850F12AF94d21D470e21bE9D0E9C",
436436
"creationCodeHash": "0x6fae98fdb377aba500431c6a8f98d4b3b5385f073d83f775cab680753513a390",
437437
"runtimeCodeHash": "0x9d0d644107435d7f226a661a2f1074f9294c6437b9e401de4ed958c2472b954c",
438-
"txHash": "0x6be2448684ce008b175edda4753f3e1247bb906da5526f4a5d393c737e766797"
438+
"txHash": "0xd9bc2b772178cdb2a90f878eb3a19fa8cb761838c372c4a2a9e67534238c1210"
439439
}
440440
},
441441
"RewardsManager": {
@@ -448,13 +448,13 @@
448448
],
449449
"creationCodeHash": "0x27b19762861db0d7205933031f5318603d0d44c2f94f2d8ef89871694f4fceee",
450450
"runtimeCodeHash": "0xed96c5619d707fbe2b70980bd85c03aac8b77fc34d90170598dacf76df0809c4",
451-
"txHash": "0x35f149678efe305005db468f5e6688cc043b8a5c12730c39569706b5a95dae1b",
451+
"txHash": "0x87451daca9d73efffb28c35838e956f646a525b8d66f4e6a8d183c5dc623dd74",
452452
"proxy": true,
453453
"implementation": {
454454
"address": "0x630589690929E9cdEFDeF0734717a9eF3Ec7Fcfe",
455455
"creationCodeHash": "0xfcbdd687019bc3866f6985b0a211aa204fcacd376695cffa7c64380c3887b5d8",
456456
"runtimeCodeHash": "0x810e5fd6d9085ecad036d6c363209f4f987a3292ced98688d9c39f28209eedf5",
457-
"txHash": "0xdad8671237e021e8594f1c928baae89aade98a8e8d5fa1ec6b6684374558d2f6"
457+
"txHash": "0x65add0ca70f64528031f0bbe9045bf11b6435db05cc1e211dae105194cf7edbb"
458458
}
459459
},
460460
"Staking": {
@@ -467,13 +467,13 @@
467467
],
468468
"creationCodeHash": "0x27b19762861db0d7205933031f5318603d0d44c2f94f2d8ef89871694f4fceee",
469469
"runtimeCodeHash": "0xed96c5619d707fbe2b70980bd85c03aac8b77fc34d90170598dacf76df0809c4",
470-
"txHash": "0x75e6144ceab3032df3bd230d5c784d4660c8868de34f41fb37cc5fe0260bfe29",
470+
"txHash": "0xb992f479be03232156002303ebf6ae5507fdecd9a51d925a1a6a3ab7ee592add",
471471
"proxy": true,
472472
"implementation": {
473473
"address": "0x2612Af3A521c2df9EAF28422Ca335b04AdF3ac66",
474474
"creationCodeHash": "0x8f60acd822042ee02c7fdd37f7a3f887d3af4128f1c53bcda31fa65230fb231b",
475475
"runtimeCodeHash": "0x48a748afc605b3e1fc3c67bb04e956b67950d5976d20b19d562998cac57c9cca",
476-
"txHash": "0x38705b7ef0bce8c0403f85430aaa3f54019e6891e8a2272a22c41ebcdcd5443e",
476+
"txHash": "0x6af60ecbcaa2f53a56969d41db601a568be837c7350b4b09c41f5148569fd9ce",
477477
"libraries": {
478478
"LibCobbDouglas": "0x67B5656d60a809915323Bf2C40A8bEF15A152e3e"
479479
}
@@ -505,19 +505,19 @@
505505
],
506506
"creationCodeHash": "0x80aefcf962933633dadd5b4b11e2225dd4028e04f67f1388cd0348b8768f6287",
507507
"runtimeCodeHash": "0xa0fd499f4770f404ad06d30ea8f40e887f6f38e583487e5ee978aa3ce4523db9",
508-
"txHash": "0xedf38e1bc227f60f5479733a7ecde2fc5122453cab742d0b3e56fc313d102a48"
508+
"txHash": "0xc13becebdbd080d2ccfba452150d7639c56ca5ee76b4f4e8de96c7f85b5987d5"
509509
},
510510
"Controller": {
511511
"address": "0x5b1869D9A4C187F2EAa108f3062412ecf0526b24",
512512
"creationCodeHash": "0x12fd95eeb25b66f179d359d4ad761b3a67ea2526d85bc21f4bd3abbecf616f5b",
513513
"runtimeCodeHash": "0xa13b72f2a1f7c283d1fddec1b9c6e739cee7007a8988ca2880387f9abe6e4f2e",
514-
"txHash": "0x0eba8285a759da55fed384c588874a4cc0d0a985486202866de1629d3fc3325f"
514+
"txHash": "0xb8c8590b338679c3a76cc3b78582441b98d2cff01cf686d291cfb0b1e04189d5"
515515
},
516516
"BancorFormula": {
517517
"address": "0xe78A0F7E598Cc8b0Bb87894B0F60dD2a88d6a8Ab",
518518
"creationCodeHash": "0x2826b7b3e57b89d22e500ffdccd50bbf48787cf51bc56739b23f94f34970379d",
519519
"runtimeCodeHash": "0xbe050e7d7bbc793dd689b941720e1b1dff2e1e5f94331af014078bc90177b51f",
520-
"txHash": "0x70e22b035f63cdd12a4979a6a79cb3179903d45d5eb250c959329f6f8ea420bd"
520+
"txHash": "0xe47679e58808d8c6c842a28de69c35d46be23f29a88ea5dcafab30f9aa97c232"
521521
}
522522
}
523523
}

cli/commands/contracts/staking.ts

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,28 @@ export const withdrawDelegated = async (cli: CLIEnvironment, cliArgs: CLIArgs):
103103
await sendTransaction(cli.wallet, staking, 'withdrawDelegated', ...[indexer, newIndexer])
104104
}
105105

106+
export const setDelegationParameters = async (
107+
cli: CLIEnvironment,
108+
cliArgs: CLIArgs,
109+
): Promise<void> => {
110+
const indexingRewardCut = cliArgs.indexingRewardCut
111+
const queryFeeCut = cliArgs.queryFeeCut
112+
const cooldownBlocks = cliArgs.cooldownBlocks
113+
const staking = cli.contracts.Staking
114+
115+
logger.log(`Setting the following delegation parameters for indexer ${cli.walletAddress}
116+
indexingRewardCut = ${indexingRewardCut}
117+
queryFeeCut = ${queryFeeCut}
118+
cooldownBlocks = ${cooldownBlocks}
119+
`)
120+
await sendTransaction(
121+
cli.wallet,
122+
staking,
123+
'setDelegationParameters',
124+
...[indexingRewardCut, queryFeeCut, cooldownBlocks],
125+
)
126+
}
127+
106128
export const stakingCommand = {
107129
command: 'staking',
108130
describe: 'Staking contract calls',
@@ -317,6 +339,34 @@ export const stakingCommand = {
317339
return withdrawDelegated(await loadEnv(argv), argv)
318340
},
319341
})
342+
.command({
343+
command: 'setDelegationParameters',
344+
describe: 'Sets the delegation parameters for an indexer',
345+
builder: (yargs: Argv) => {
346+
return yargs
347+
.option('indexingRewardCut', {
348+
description: 'Percentage of indexing rewards left for delegators',
349+
type: 'number',
350+
requiresArg: true,
351+
demandOption: true,
352+
})
353+
.option('queryFeeCut', {
354+
description: 'Percentage of query fees left for delegators',
355+
type: 'number',
356+
requiresArg: true,
357+
demandOption: true,
358+
})
359+
.option('cooldownBlocks', {
360+
description: 'Period that need to pass to update delegation parameters',
361+
type: 'number',
362+
requiresArg: true,
363+
demandOption: true,
364+
})
365+
},
366+
handler: async (argv: CLIArgs): Promise<void> => {
367+
return setDelegationParameters(await loadEnv(argv), argv)
368+
},
369+
})
320370
},
321371
handler: (): void => {
322372
yargs.showHelp()

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,9 @@
7373
"clean": "rm -rf build/ cache/ dist/",
7474
"compile": "buidler compile",
7575
"deploy": "buidler migrate",
76-
"deploy-ganache": "npm run deploy -- --force",
77-
"deploy-kovan": "npm run deploy -- --force --network kovan",
78-
"deploy-rinkeby": "npm run deploy -- --force --network rinkeby",
76+
"deploy-ganache": "npm run deploy -- --force && ./cli/cli.ts transferTeamTokens --amount 1000000",
77+
"deploy-ganache-manual": "npm run deploy -- --network ganache --force && ./cli/cli.ts transferTeamTokens --amount 1000000",
78+
"deploy-rinkeby": "npm run deploy -- --force --network rinkeby && ./cli/cli.ts transferTeamTokens --amount 1000000",
7979
"test": "scripts/test",
8080
"test:gas": "RUN_EVM=true REPORT_GAS=true scripts/test",
8181
"test:coverage": "scripts/coverage",

0 commit comments

Comments
 (0)