Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
contract
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Odysseus
contract
Commits
992770e9
Commit
992770e9
authored
Mar 14, 2024
by
贾浩@五瓣科技
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
df627af6
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
1 deletion
+26
-1
Validator.sol
contracts/Validator.sol
+4
-1
add_address.js
scripts/add_address.js
+22
-0
No files found.
contracts/Validator.sol
View file @
992770e9
...
...
@@ -28,7 +28,7 @@ contract Validator is IValidator, Ownable {
// 记录每天的 merkle sum root
mapping(uint256 => bytes32) public dailyMerkleSumRootMap;
uint256 public dailyDistribution;
uint256 public dailyDistribution
= 10000 ether
;
constructor() Ownable(msg.sender) {
validatorSet.add(msg.sender); // for test
...
...
@@ -50,6 +50,9 @@ contract Validator is IValidator, Ownable {
}
function getWorkloadDistribution(uint256 dailyWorkload) view public returns (uint256) {
if (dailyWorkload == 0) {
return 0;
}
return dailyDistribution / dailyWorkload;
}
...
...
scripts/add_address.js
0 → 100644
View file @
992770e9
// We require the Hardhat Runtime Environment explicitly here. This is optional
// but useful for running the script in a standalone fashion through `node <script>`.
//
// You can also run a script with `npx hardhat run <script>`. If you do that, Hardhat
// will compile your contracts, add the Hardhat Runtime Environment's members to the
// global scope, and execute the script.
const
hre
=
require
(
"
hardhat
"
);
async
function
main
()
{
const
Storage
=
await
hre
.
ethers
.
getContractFactory
(
"
AddressStorage
"
);
const
storage
=
Storage
.
attach
(
"
0x7Cd36Bc2a477f60A14f08442179B2f626bE026Ea
"
)
const
ret
=
await
storage
.
setContainerAddress
(
"
0x7Cd36Bc2a477f60A14f08442179B2f626bE026Ea
"
,
true
);
console
.
log
(
ret
.
hash
);
}
// We recommend this pattern to be able to use async/await everywhere
// and properly handle errors.
main
().
catch
((
error
)
=>
{
console
.
error
(
error
);
process
.
exitCode
=
1
;
});
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment