Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add wamGHST pool #19

Merged
merged 34 commits into from
Mar 16, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
45800cb
forge install: protocol-v2
Timidan Jan 31, 2022
4e4bd37
push all changes
Timidan Feb 8, 2022
98b9bb2
remvoe unused interfaces and add console.logs, matic rewards
Timidan Feb 9, 2022
2f552cf
fix names
cinnabarhorse Feb 10, 2022
aabaf0f
Update staticAmGHST.sol
cinnabarhorse Feb 10, 2022
0bffea8
make little changes
Timidan Feb 10, 2022
eff082f
make changes based on Nicks review
Timidan Feb 13, 2022
9982e10
make name changes
Timidan Feb 13, 2022
de72bd8
allow permissionless staking
Timidan Feb 17, 2022
4d62dfe
add address checks
Timidan Feb 19, 2022
915505b
update imports
cinnabarhorse Feb 20, 2022
3dc9265
add StakingFacet sanity checks
Timidan Feb 21, 2022
7d28750
allow permissionless mints
Timidan Feb 28, 2022
b6c888f
remove router privileges
Timidan Feb 28, 2022
56cbe49
make changes
Timidan Mar 1, 2022
c43fa0b
allow direct deposits and withdrawals for amGHST
Timidan Mar 3, 2022
d1c8714
Update amGHSTRouter.sol
cinnabarhorse Mar 3, 2022
72ccd05
Update amGHSTRouter.sol
cinnabarhorse Mar 3, 2022
1cca0a0
remove unused files
Timidan Mar 3, 2022
1979f8f
Delete yarn.lock
Timidan Mar 3, 2022
2c01d23
remove extra files
Timidan Mar 4, 2022
fab7d67
Removed aave dependencies
Timidan Mar 5, 2022
b14f806
update rates in stkwamghst script
cinnabarhorse Mar 7, 2022
79b8108
Update stkwamGHSTTest.ts
cinnabarhorse Mar 7, 2022
5ba1018
Update deploystkwamGHST.ts
cinnabarhorse Mar 7, 2022
fb55fc3
check frens
Timidan Mar 7, 2022
1d45a9c
fix epoch time issue
cinnabarhorse Mar 7, 2022
ecc164c
fix duration
cinnabarhorse Mar 8, 2022
1b520ff
Update StakingFacet.sol
cinnabarhorse Mar 9, 2022
14cbc86
fix bug
Timidan Mar 10, 2022
6c1d6ff
correct commit
Timidan Mar 11, 2022
82b65da
add in owner methods
cinnabarhorse Mar 15, 2022
651a5d8
preparing to deploy
cinnabarhorse Mar 15, 2022
e6a5f82
finalize upgrade
cinnabarhorse Mar 15, 2022
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
File renamed without changes.
43 changes: 26 additions & 17 deletions contracts/wamGHST.sol
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,11 @@ contract StaticATokenLM is ERC20("Wrapped amGHST", "wamGHST") {
address constant wMatic = 0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270;
bytes32 public constant PERMIT_TYPEHASH = keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)");
bytes public constant EIP712_REVISION = bytes("1");
bytes32 internal constant EIP712_DOMAIN = keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)");
bytes32 public immutable DOMAIN_SEPARATOR;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#21 solved here


//TODO: Define maticTreasury
address public maticTreasury;
address public contractOwner;
event Initialized(address indexed pool, address aToken, string staticATokenName, string staticATokenSymbol);

constructor(
Expand All @@ -62,6 +64,7 @@ contract StaticATokenLM is ERC20("Wrapped amGHST", "wamGHST") {
string memory staticATokenName,
string memory staticATokenSymbol
) public {
contractOwner = msg.sender;
LENDING_POOL = pool;
ATOKEN = IERC20(aToken);
_name = staticATokenName;
Expand All @@ -76,16 +79,38 @@ contract StaticATokenLM is ERC20("Wrapped amGHST", "wamGHST") {
REWARD_TOKEN = IERC20(INCENTIVES_CONTROLLER.REWARD_TOKEN());
}
} catch {}
DOMAIN_SEPARATOR = getDomainSeparator();
emit Initialized(address(pool), aToken, staticATokenName, staticATokenSymbol);
}

function changeMaticTreasury(address _newTreasuryAddress) external {
require(msg.sender == contractOwner, "Not Owner");
maticTreasury = _newTreasuryAddress;
}

function claimMaticRewards() external {
IERC20 m = IERC20(wMatic);
if (m.balanceOf(address(this)) > 0) {
m.transfer(maticTreasury, m.balanceOf(address(this)));
}
}

function getDomainSeparator() internal view returns (bytes32) {
uint256 chainId;
assembly {
chainId := chainid()
}
keccak256(
abi.encode(
keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"),
keccak256(bytes(name())),
keccak256(bytes(EIP712_REVISION)),
chainId,
address(this)
)
);
}

function deposit(
address recipient,
uint256 amount,
Expand All @@ -104,14 +129,6 @@ contract StaticATokenLM is ERC20("Wrapped amGHST", "wamGHST") {
return _withdraw(_from, recipient, amount, 0, toUnderlying);
}

function withdrawDynamicAmount(
address recipient,
uint256 amount,
bool toUnderlying
) external returns (uint256, uint256) {
return _withdraw(msg.sender, recipient, 0, amount, toUnderlying);
}

function dynamicBalanceOf(address account) external view returns (uint256) {
return _staticToDynamicAmount(balanceOf(account), rate());
}
Expand Down Expand Up @@ -350,14 +367,6 @@ contract StaticATokenLM is ERC20("Wrapped amGHST", "wamGHST") {
_claimRewardsOnBehalf(msg.sender, msg.sender, forceUpdate);
}

function getDomainSeparator() public view returns (bytes32) {
uint256 chainId;
assembly {
chainId := chainid()
}
return keccak256(abi.encode(EIP712_DOMAIN, keccak256(bytes(name())), keccak256(EIP712_REVISION), chainId, address(this)));
}

/**
* @notice Update the rewardDebt for a user with balance as his balance
* @param user The user to update
Expand Down