Skip to content

Commit ee777dc

Browse files
committed
Add FixedBuilderScore contract and deployment script
Replace PassportBuilderScore with a dummy contract that returns a fixed score for all users. Admin can update the score via setFixedScore(). Includes deployment script that also updates TalentVault to use the new contract.
1 parent 87af96c commit ee777dc

3 files changed

Lines changed: 85 additions & 0 deletions

File tree

.tool-versions

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
nodejs 20.12.2
22
solidity 0.8.24
3+
yarn 1.22.19
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
// SPDX-License-Identifier: MIT
2+
pragma solidity ^0.8.24;
3+
4+
import "@openzeppelin/contracts/access/Ownable.sol";
5+
6+
/// @title Fixed Builder Score
7+
/// @notice A dummy PassportBuilderScore that returns a fixed score for all users
8+
contract FixedBuilderScore is Ownable {
9+
uint256 public fixedScore;
10+
11+
event FixedScoreUpdated(uint256 oldScore, uint256 newScore);
12+
13+
constructor(uint256 _fixedScore, address _owner) Ownable(_owner) {
14+
fixedScore = _fixedScore;
15+
}
16+
17+
/// @notice Set the fixed score returned for all passport IDs
18+
/// @param _fixedScore The new fixed score
19+
function setFixedScore(uint256 _fixedScore) external onlyOwner {
20+
uint256 oldScore = fixedScore;
21+
fixedScore = _fixedScore;
22+
emit FixedScoreUpdated(oldScore, _fixedScore);
23+
}
24+
25+
/// @notice Returns the fixed score for any passport ID
26+
/// @param passportId Ignored - returns the same score for all
27+
/// @return The fixed score
28+
function getScore(uint256 _passportId) external view returns (uint256) {
29+
return fixedScore;
30+
}
31+
}
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
import { ethers, network } from "hardhat";
2+
3+
const TALENT_VAULT_MAINNET = "0x23Ff3256A29847d7EF760943bd6679b565CbdE5a";
4+
5+
// Set to 60 to give everyone the bonus yield rate, or 0 for base rate only
6+
const INITIAL_FIXED_SCORE = 60;
7+
8+
async function main() {
9+
const isMainnet = network.name === "mainnet" || network.name === "base";
10+
11+
if (!isMainnet) {
12+
return;
13+
}
14+
15+
const talentVaultAddress = TALENT_VAULT_MAINNET;
16+
17+
console.log(`Deploying Fixed Builder Score at ${network.name}`);
18+
19+
const [admin] = await ethers.getSigners();
20+
21+
console.log(`Admin/Owner will be ${admin.address}`);
22+
23+
// Deploy FixedBuilderScore
24+
const fixedBuilderScoreContract = await ethers.getContractFactory("FixedBuilderScore");
25+
const fixedBuilderScore = await fixedBuilderScoreContract.deploy(INITIAL_FIXED_SCORE, admin.address);
26+
await fixedBuilderScore.deployed();
27+
28+
console.log(`Fixed Builder Score deployed at ${fixedBuilderScore.address}`);
29+
console.log(`Initial fixed score: ${INITIAL_FIXED_SCORE}`);
30+
console.log(`Owner: ${admin.address}`);
31+
32+
// Update TalentVault to use the new FixedBuilderScore
33+
console.log(`\nUpdating TalentVault at ${talentVaultAddress}...`);
34+
const talentVault = await ethers.getContractAt("TalentVault", talentVaultAddress);
35+
const tx = await talentVault.setPassportBuilderScore(fixedBuilderScore.address);
36+
await tx.wait();
37+
38+
console.log(`TalentVault.setPassportBuilderScore updated to ${fixedBuilderScore.address}`);
39+
40+
console.log("\n--- Verification Command ---");
41+
console.log(
42+
`npx hardhat verify --network ${network.name} ${fixedBuilderScore.address} ${INITIAL_FIXED_SCORE} ${admin.address}`
43+
);
44+
45+
console.log("\nDone");
46+
}
47+
48+
main()
49+
.then(() => process.exit(0))
50+
.catch((error) => {
51+
console.error(error);
52+
process.exit(1);
53+
});

0 commit comments

Comments
 (0)