Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
79 commits
Select commit Hold shift + click to select a range
e9afd46
Setup deploy scripts
RubenSousaDinis Oct 15, 2024
8418b4a
Add generation scripts for TGE unlocks
RubenSousaDinis Oct 18, 2024
1e64032
Apply linting to unlock scripts
0xleal Oct 25, 2024
acccf1d
Add TGE unlock based on timestamp
0xleal Oct 25, 2024
2f5f935
Add Talent Vault base contract
0xleal Oct 25, 2024
8e4502a
apply lint
0xleal Oct 25, 2024
af420a6
Add different tiers
0xleal Oct 26, 2024
c3a629b
Setup deploy scripts
RubenSousaDinis Oct 15, 2024
62a34fb
Add generation scripts for TGE unlocks
RubenSousaDinis Oct 18, 2024
de55590
Apply linting to unlock scripts
0xleal Oct 25, 2024
5dd9b55
Add TGE unlock based on timestamp
0xleal Oct 25, 2024
6bd71b9
Add Talent Vault base contract
0xleal Oct 25, 2024
fce1d8d
apply lint
0xleal Oct 25, 2024
a195663
Add different tiers
0xleal Oct 26, 2024
3c88a66
Update for final vesting deploy
0xleal Oct 28, 2024
a70c90d
Remove console logs from tests
0xleal Oct 28, 2024
45d761a
Slight improvement on the constructor and some missing tests on it
pmatsinopoulos Oct 28, 2024
7f81726
Merge remote-tracking branch 'origin/add-talent-vault' into some-opti…
pmatsinopoulos Oct 28, 2024
124e23e
Add setup for main wallet configuration on mainnet
0xleal Oct 28, 2024
dd19b82
Integrate main wallet changes to TalentRewardClaim
0xleal Oct 28, 2024
22794a7
Update Talent VAULT with more tests
0xleal Oct 28, 2024
d68554c
WiP
pmatsinopoulos Oct 28, 2024
f79f2ab
Merge remote-tracking branch 'origin/add-talent-vault' into some-opti…
pmatsinopoulos Oct 28, 2024
d6a101f
Constructor allows some initial balance on the owner
pmatsinopoulos Oct 29, 2024
500f59c
Transferrability is switched off for TalentVault and Deposit struct r…
pmatsinopoulos Oct 29, 2024
fcefc39
Name and Symbol SHOULD reflect the underlying token's name and symbol
pmatsinopoulos Oct 29, 2024
aa3eb65
Test that talentVault#asset returns the address of the contract
pmatsinopoulos Oct 29, 2024
27656e3
TalentVault#totalAccess() implemented
pmatsinopoulos Oct 29, 2024
d8375f0
TalentVault#setMaxDeposit,#maxDeposit
pmatsinopoulos Oct 29, 2024
fdd788f
TODO Note whether we want the smart contract to be Pausable
pmatsinopoulos Oct 29, 2024
fb31537
WIP to make it ERC4626
pmatsinopoulos Oct 30, 2024
fe552bd
Some comments
pmatsinopoulos Oct 30, 2024
35ce9b3
Add hardhat-storage-layout
pmatsinopoulos Oct 30, 2024
150af90
All tested except the refresh part
pmatsinopoulos Oct 30, 2024
3871b86
Now with more tests and better calculation logic
pmatsinopoulos Oct 30, 2024
8f9a26b
TalentVault#withdrawAll() tested
pmatsinopoulos Oct 31, 2024
cecb1e4
Removed commented out code
pmatsinopoulos Oct 31, 2024
2bcb8de
Removed the import of hardhat console
pmatsinopoulos Oct 31, 2024
179ec99
Added back the test for #setYieldRate()
pmatsinopoulos Oct 31, 2024
138428c
Stop/Start Yielding Interest
pmatsinopoulos Oct 31, 2024
25a528b
[spec] Removed commented out code and console.log not needed
pmatsinopoulos Oct 31, 2024
703f297
[spec] Deploy contracts only once, at the beginning of the test suite…
pmatsinopoulos Oct 31, 2024
8c1e22d
[spec] Added yieldSource address print at the beginning
pmatsinopoulos Oct 31, 2024
5bd0e8f
[spec] Removed comments not needed
pmatsinopoulos Oct 31, 2024
64521e2
Removed yieldXXXX state properties which were not used
pmatsinopoulos Oct 31, 2024
83c8dee
[spec] - Add arguments to revertedWith and then fix a test
pmatsinopoulos Oct 31, 2024
a319903
[spec] Better handling of block.timestamp for testing
pmatsinopoulos Oct 31, 2024
cbe70fb
[spec] hardhat reset at the beginning of TalentVault suite
pmatsinopoulos Oct 31, 2024
fb19b5d
WIP failing tests
pmatsinopoulos Oct 31, 2024
cb8e367
Improve Talent Reward Claim
0xleal Oct 31, 2024
b501df4
Remove tests of internal functions
0xleal Oct 31, 2024
18a0c10
Add setYieldSource function
0xleal Oct 31, 2024
c0d958d
Update calculating interest to be a view function
0xleal Oct 31, 2024
23bcfe1
Add deploy TalentVault script
0xleal Oct 31, 2024
020401f
Solc version pinned for asdf
pmatsinopoulos Oct 31, 2024
24efcf0
Minor: Reorganization of the function definitions, first external, th…
pmatsinopoulos Oct 31, 2024
c72e93a
Allow withdraw only after lock period
pmatsinopoulos Oct 31, 2024
e419d51
Set lockPeriod only by owner
pmatsinopoulos Oct 31, 2024
d843540
[lint] Fixed a long line comment
pmatsinopoulos Oct 31, 2024
e035715
Optimizer runs to 2**32 - 1
pmatsinopoulos Nov 1, 2024
6176122
Gas reporter to show method signatures
pmatsinopoulos Nov 1, 2024
fe09674
Minor: Removed a comment that was not relevant any more
pmatsinopoulos Nov 1, 2024
fe4bda4
Update deploy scripts for Vault
0xleal Nov 4, 2024
ca1a01e
Merge pull request #105 from talentprotocol/use-openzeppelin-erc4626
0xleal Nov 4, 2024
cfb0637
Add extra comments to solidity file
0xleal Nov 4, 2024
596643d
Apply lint
0xleal Nov 4, 2024
d6fd401
Update tests to match new interest rates
0xleal Nov 4, 2024
b71bdc8
Update tests to new reward levels
0xleal Nov 5, 2024
7599b97
Use rewards as a term
0xleal Nov 5, 2024
f195cfa
Merge pull request #100 from talentprotocol/scripts-for-generation
RubenSousaDinis Dec 4, 2024
21b8c79
Remove function not needed in TalentTGEUnlock
RubenSousaDinis Dec 4, 2024
78058d6
Merge branch 'master' into add-talent-vault
0xleal Jan 15, 2025
a39b0c1
Add simple ERC4626 contract to stake and receive sTALENT
0xleal Jan 15, 2025
5cc1c23
Add whitelisting of vault strategies/options
0xleal Jan 15, 2025
c014f02
Add VaultOption with integration test
0xleal Jan 16, 2025
87f742f
Update TalentVault for new requirements
0xleal Jan 17, 2025
1cb7163
Update deploy vault script
0xleal Jan 17, 2025
e7e1628
Add coverage for max amount in vault
0xleal Jan 17, 2025
3fc5b99
Update vault with wallet registry
0xleal Jan 18, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
nodejs 20.12.2
solidity 0.8.24
7 changes: 6 additions & 1 deletion contracts/talent/TalentRewardClaim.sol
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,15 @@ import "@openzeppelin/contracts/utils/math/Math.sol";
import "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
import "./TalentProtocolToken.sol";
import "../passport/PassportBuilderScore.sol";
import "../passport/PassportWalletRegistry.sol";
import "../merkle/MerkleProof.sol";

contract TalentRewardClaim is Ownable, ReentrancyGuard {
using Math for uint256;

TalentProtocolToken public talentToken;
PassportBuilderScore public passportBuilderScore;
PassportWalletRegistry public passportWalletRegistry;
address public holdingWallet;
uint256 public constant WEEKLY_CLAIM_AMOUNT = 2000 ether;
uint256 public constant WEEK_DURATION = 7 days;
Expand All @@ -36,13 +38,15 @@ contract TalentRewardClaim is Ownable, ReentrancyGuard {
constructor(
TalentProtocolToken _talentToken,
PassportBuilderScore _passportBuilderScore,
PassportWalletRegistry _passportWalletRegistry,
address _holdingWallet,
address initialOwner,
bytes32 _merkleRoot
) Ownable(initialOwner) {
merkleRoot = _merkleRoot;
talentToken = _talentToken;
passportBuilderScore = _passportBuilderScore;
passportWalletRegistry = _passportWalletRegistry;
holdingWallet = _holdingWallet;
}

Expand Down Expand Up @@ -80,6 +84,7 @@ contract TalentRewardClaim is Ownable, ReentrancyGuard {
uint256 amountAllocated
) external nonReentrant {
require(startTime > 0, "Start time not set");
require(block.timestamp >= startTime, "Claiming has not started yet");

verify(merkleProof, amountAllocated);

Expand All @@ -89,7 +94,7 @@ contract TalentRewardClaim is Ownable, ReentrancyGuard {
UserInfo storage user = userInfo[msg.sender];
require(amountToClaim > 0, "No tokens owed");

uint256 passportId = passportBuilderScore.passportRegistry().passportId(beneficiary);
uint256 passportId = passportWalletRegistry.passportId(beneficiary);
uint256 builderScore = passportBuilderScore.getScore(passportId);

uint256 claimMultiplier = (builderScore > 40) ? 5 : 1;
Expand Down
16 changes: 3 additions & 13 deletions contracts/talent/TalentTGEUnlock.sol
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,11 @@ contract TalentTGEUnlock is Ownable {
verifyAmount(merkleProofClaim, amountAllocated);

address beneficiary = msg.sender;
uint256 amountToClaim = calculate(beneficiary, amountAllocated);

claimed[beneficiary] += amountToClaim;
IERC20(token).safeTransfer(beneficiary, amountToClaim);
claimed[beneficiary] += amountAllocated;
IERC20(token).safeTransfer(beneficiary, amountAllocated);

emit Claimed(beneficiary, amountToClaim, 0);
emit Claimed(beneficiary, amountAllocated, 0);
}

function verifyAmount(
Expand All @@ -84,15 +83,6 @@ contract TalentTGEUnlock is Ownable {
);
}

function calculate(
address beneficiary,
uint256 amountAllocated
) internal view returns (uint256 amountToClaim) {
uint256 amountClaimed = claimed[beneficiary];
assert(amountClaimed <= amountAllocated);
amountToClaim = amountAllocated - amountClaimed;
}

function setMerkleRoot(bytes32 nextMerkleRoot) external onlyOwner {
merkleRoot = nextMerkleRoot;
}
Expand Down
95 changes: 95 additions & 0 deletions contracts/talent/TalentTGEUnlockTimestamp.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
// SPDX-License-Identifier: MIT
// Based on: https://github.com/gnosis/safe-token-distribution/blob/master/tooling/contracts/MerkleDistribution.sol
pragma solidity ^0.8.24;

import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";

import "../merkle/MerkleProof.sol";

contract TalentTGEUnlockTimestamp is Ownable {
using SafeERC20 for IERC20;

event Claimed(address indexed claimer, uint256 amount, uint256 burned);

address public immutable token;
bytes32 public merkleRoot;
bool public isContractEnabled;
uint256 public unlockTimestamp;
mapping(address => uint256) public claimed;

constructor(
address _token,
bytes32 _merkleRoot,
address owner,
uint256 _unlockTimestamp
) Ownable(owner) {
token = _token;
merkleRoot = _merkleRoot;
isContractEnabled = false;
unlockTimestamp = _unlockTimestamp;
}

function setUnlockTimestamp(uint256 _unlockTimestamp) external onlyOwner {
unlockTimestamp = _unlockTimestamp;
}

function disableContract() external onlyOwner {
isContractEnabled = false;
}

function enableContract() external onlyOwner {
isContractEnabled = true;
}

function claim(
bytes32[] calldata merkleProofClaim,
uint256 amountAllocated
) external {
require(isContractEnabled, "Contracts are disabled");
require(block.timestamp >= unlockTimestamp, "Unlock period not started");
require(claimed[msg.sender] == 0, "Already claimed");
verifyAmount(merkleProofClaim, amountAllocated);

address beneficiary = msg.sender;
uint256 amountToClaim = calculate(beneficiary, amountAllocated);

claimed[beneficiary] += amountToClaim;
IERC20(token).safeTransfer(beneficiary, amountToClaim);

emit Claimed(beneficiary, amountToClaim, 0);
}

function verifyAmount(
bytes32[] calldata proof,
uint256 amountAllocated
) internal view {
bytes32 root = merkleRoot;
bytes32 leaf = keccak256(
bytes.concat(keccak256(abi.encode(msg.sender, amountAllocated)))
);

require(
MerkleProof.verify(proof, root, leaf),
"Invalid Allocation Proof"
);
}

function calculate(
address beneficiary,
uint256 amountAllocated
) internal view returns (uint256 amountToClaim) {
uint256 amountClaimed = claimed[beneficiary];
assert(amountClaimed <= amountAllocated);
amountToClaim = amountAllocated - amountClaimed;
}

function setMerkleRoot(bytes32 nextMerkleRoot) external onlyOwner {
merkleRoot = nextMerkleRoot;
}

function withdraw() external onlyOwner {
IERC20(token).transfer(owner(), IERC20(token).balanceOf(address(this)));
}
}
Loading
Loading