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

Update structure & solidity version #3

Merged
merged 14 commits into from
Feb 2, 2022
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Forge
out/
cache/
6 changes: 6 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[submodule "lib/ds-test"]
path = lib/ds-test
url = https://github.com/dapphub/ds-test
[submodule "lib/openzeppelin-contracts"]
path = lib/openzeppelin-contracts
url = https://github.com/OpenZeppelin/openzeppelin-contracts
1 change: 0 additions & 1 deletion 2021/sep/proposal.sol

This file was deleted.

677 changes: 677 additions & 0 deletions LICENSE

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Load `.env` file and export variables.
-include .env

# Test
test:; forge test -f https://fee7372b6e224441b747bf1fde15b2bd.eth.rpc.rivet.cloud --sender 0xEC3281124d4c2FCA8A88e3076C1E7749CfEcb7F2 --tx-origin 0xEC3281124d4c2FCA8A88e3076C1E7749CfEcb7F2 --verbosity 3
24 changes: 22 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,22 @@
# onchain
Yam On Chain Proposals
# Yam On Chain Proposals

**[Triggered Proposals](https://yam.finance/#/governance)**

## Development

For the development we use the [foundry](https://github.com/gakonst/foundry) toolkit.

```sh
# Install rustup.
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
```

```sh
# Install the foundry binary.
cargo install --git https://github.com/gakonst/foundry --bin forge --locked
```

```sh
# Run forked network tests.
make test
```
1 change: 1 addition & 0 deletions lib/ds-test
Submodule ds-test added at 0a5da5
1 change: 1 addition & 0 deletions lib/openzeppelin-contracts
Submodule openzeppelin-contracts added at 7d17ac
123 changes: 123 additions & 0 deletions src/Proposal19.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
// SPDX-License-Identifier: Unlicense
pragma solidity 0.8.10;

// Interfaces
import {IERC20} from "openzeppelin-contracts/token/ERC20/IERC20.sol";

// Contracts
import {YAMTokenInterface} from "./utils/YAMTokenInterface.sol";
import {VestingPool} from "./utils/VestingPool.sol";

interface YVault {
function deposit(uint256 amount, address recipient)
external
returns (uint256);

function withdraw(uint256 amount) external returns (uint256);
}


contract Proposal19 {
/// @notice Contracts for paying contributors in `USDC`.
address internal constant RESERVES = address(0x97990B693835da58A281636296D2Bf02787DEa17);
VestingPool internal constant pool = VestingPool(0xDCf613db29E4d0B35e7e15e93BF6cc6315eB0b82);
YVault internal constant yUSDC = YVault(0x5f18C75AbDAe578b483E5F43f12a39cF75b973a9);
IERC20 internal constant USDC = IERC20(0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48);

function execute() public {
/// @dev Transfer the total yUSDC balance from `RESERVES` to `this` contract.
IERC20(address(yUSDC)).transferFrom(RESERVES, address(this), IERC20(address(yUSDC)).balanceOf(RESERVES));
/// @dev Withdraw `USDC` for `yUSDC`.
yUSDC.withdraw(type(uint256).max);

/**
* @notice Transfer `USDC` to contributors.
*/

// E
USDC.transfer(
0x8A8acf1cEcC4ed6Fe9c408449164CE2034AdC03f,
yearlyUSDToMonthlyUSD(120000 * (10**6))
);

// Nate
USDC.transfer(
0xEC3281124d4c2FCA8A88e3076C1E7749CfEcb7F2,
yearlyUSDToMonthlyUSD(105000 * (10**6))
);

// Chilly
USDC.transfer(
0x01e0C7b70E0E05a06c7cC8deeb97Fa03d6a77c9C,
yearlyUSDToMonthlyUSD(84000 * (10**6))
);

// Krguman
USDC.transfer(
0xcc506b3c2967022094C3B00276617883167BF32B,
yearlyUSDToMonthlyUSD(30000 * (10**6))
);

// Designer
USDC.transfer(
0x3FdcED6B5C1f176b543E5E0b841cB7224596C33C,
yearlyUSDToMonthlyUSD(96000 * (10**6))
);

// Ross
USDC.transfer(
0x88c868B1024ECAefDc648eb152e91C57DeA984d0,
yearlyUSDToMonthlyUSD(84000 * (10**6))
);

// Jason
USDC.transfer(
0x43fD74401B4BF04095590a5308B6A5e3Db44b9e3,
yearlyUSDToMonthlyUSD(48000 * (10**6))
);

// Blokku
USDC.transfer(
0x392027fDc620d397cA27F0c1C3dCB592F27A4dc3,
yearlyUSDToMonthlyUSD(22500 * (10**6))
);

// Kris
USDC.transfer(
0x386568164bdC5B105a66D8Ae83785D4758939eE6,
yearlyUSDToMonthlyUSD(15000 * (10**6))
);

// Jono
USDC.transfer(
0xFcB4f3a1710FefA583e7b003F3165f2E142bC725,
yearlyUSDToMonthlyUSD(42000 * (10**6))
);

// Will
USDC.transfer(
0x31920DF2b31B5f7ecf65BDb2c497DE31d299d472,
yearlyUSDToMonthlyUSD(84000 * (10**6))
);

/// @dev Deposit the remainding `USDC` balance back into the `yUSDC` vault.
uint256 usdcBalance = USDC.balanceOf(address(this));
USDC.approve(address(yUSDC), usdcBalance);
yUSDC.deposit(usdcBalance, RESERVES);

/**
* @notice Setup `YAM` streams.
*/

// Update Ross stream
pool.openStream(
0x88c868B1024ECAefDc648eb152e91C57DeA984d0,
180 days,
1250 * (10**24) * 6
);
}

function yearlyUSDToMonthlyUSD(uint256 yearlyUSD) internal pure returns (uint256) {
return ((yearlyUSD / uint256(12)));
}
}
63 changes: 63 additions & 0 deletions src/test/Proposal19.t.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
// SPDX-License-Identifier: Unlicense
pragma solidity 0.8.10;

// Interfaces
import {IERC20} from "openzeppelin-contracts/token/ERC20/IERC20.sol";

// Contracts
import {Proposal19} from "../Proposal19.sol";
import "../utils/YAMTest.sol";
import {YAMDelegate3} from "../utils/YAMDelegate3.sol";


// Proposal for July contributor payment and stream setup.
contract Proposal19Test is YAMTest {
Proposal19 private proposal;

function setUp() public {
setUpYAMTest();
proposal = new Proposal19();
}

function testProposal19() public {
address[] memory targets = new address[](2);
uint256[] memory values = new uint256[](2);
string[] memory signatures = new string[](2);
bytes[] memory calldatas = new bytes[](2);
string memory description = "Setup proposol as sub gov on vestingPool, whitelist withdrawals for contributor payments.";

/// @notice Set proposal as sub gov for vesting pool.
targets[0] = address(vestingPool);
signatures[0] = "setSubGov(address,bool)";
calldatas[0] = abi.encode(address(proposal), true);

/// @notice Whitelist propogal to withdraw usdc.
targets[1] = address(reserves);
signatures[1] = "whitelistWithdrawals(address[],uint256[],address[])";
address[] memory whos = new address[](1);
uint256[] memory amounts = new uint256[](1);
address[] memory tokens = new address[](1);
whos[0] = address(proposal);
amounts[0] = type(uint256).max;
tokens[0] = address(yUSDC);
calldatas[1] = abi.encode(whos, amounts, tokens);

/// @notice Get quorum for test proposal.
getQuorum(yamDelegator, proposer);
vm.roll(block.number + 1);

/// @notice Post and vote on proposal.
rollProposal(targets, values, signatures, calldatas, description);

vm.roll(block.number + 1);
proposal.execute();
ff(61 minutes);

// Assert reserves have the yUSDC we should have.
assertTrue(IERC20(address(yUSDC)).balanceOf(address(reserves)) > 760000 * (10**6));

// Assert no USDC or yUSDC was left in the proposal.
assertEq(IERC20(USDC).balanceOf(address(proposal)), 0);
assertEq(IERC20(yUSDC).balanceOf(address(proposal)), 0);
}
}
Loading