-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
973ff36
commit 6707924
Showing
14 changed files
with
1,042 additions
and
30 deletions.
There are no files selected for viewing
Submodule hevm.libs.I6fvF
added at
bae462
Submodule hevm.libs.TfyzQ
added at
0b537f
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
ds-test/=lib/ds-test/src/ | ||
ds-test=lib/ds-test/src/index.sol | ||
openzeppelin/=lib/openzeppelin-contracts/contracts/ | ||
openzeppelin=lib/openzeppelin-contracts/contracts/index.sol | ||
@openzeppelin/=lib/openzeppelin-contracts/contracts/ | ||
@openzeppelin=lib/openzeppelin-contracts/contracts/index.sol |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity 0.8.6; | ||
|
||
import "@openzeppelin/access/Ownable.sol"; | ||
import "./interfaces/IGovernanceToken.sol"; | ||
|
||
/** | ||
* @title Delegator Contract | ||
* @author Cryptex.Finance | ||
* @notice Contract in charge of handling delegations. | ||
*/ | ||
|
||
contract Delegator is Ownable { | ||
address public immutable token; | ||
|
||
constructor(address delegatee_, address token_) { | ||
token = token_; | ||
IGovernanceToken(token_).delegate(delegatee_); | ||
} | ||
|
||
function delegatee() public returns (address) { | ||
return IGovernanceToken(token).delegates(address(this)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity 0.8.6; | ||
|
||
import "@openzeppelin/access/Ownable.sol"; | ||
import "./interfaces/IGovernanceToken.sol"; | ||
import "./Delegator.sol"; | ||
|
||
/** | ||
* @title Delegator Contract Factory | ||
* @author Cryptex.Finance | ||
* @notice Contract in charge of generating Delegator contracts, handling delegations and CTX balance map, rewards. | ||
*/ | ||
|
||
contract DelegatorFactory is Ownable { | ||
address public immutable token; | ||
mapping(address => address) public delegatorToDelegatee; | ||
mapping(address => address) public delegateeToDelegator; | ||
|
||
constructor(address token_) { | ||
token = token_; | ||
} | ||
|
||
function createDelegator(address delegatee_) public { | ||
require(delegatee_ != address(0), "Delegatee can't be 0"); | ||
require( | ||
delegateeToDelegator[delegatee_] == address(0), | ||
"Delegator already created" | ||
); | ||
Delegator delegator = new Delegator(delegatee_, token); | ||
delegateeToDelegator[delegatee_] = address(delegator); | ||
delegatorToDelegatee[address(delegator)] = delegatee_; | ||
} | ||
|
||
// function stake(uint256 amount_) public onlyOwner {} | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity 0.8.6; | ||
|
||
interface IGovernanceToken { | ||
function delegate(address delegatee) external; | ||
|
||
function delegates(address delegator) external returns (address); | ||
} |
Oops, something went wrong.