Skip to content

Commit

Permalink
Merge pull request #4 from sturgeon-protocol/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
a17 authored Jan 29, 2024
2 parents e03ade1 + 95330cb commit 227f580
Show file tree
Hide file tree
Showing 23 changed files with 593 additions and 102 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ out/
!/broadcast
/broadcast/*/31337/
/broadcast/*/5/
/broadcast/*/18231/
/broadcast/**/dry-run/

# Docs
Expand Down
51 changes: 41 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Sturgeon contracts

**Under development**

## Usage

### Compile, test, etc

```shell
forge install
forge build
Expand All @@ -12,15 +12,46 @@ forge coverage
forge fmt
```

### Add liquidator routes

Example of adding USDC-DAI route for Unreal testnet:

```shell
cast send -i --legacy --rpc-url https://rpc.unreal.gelato.digital 0xE0D142466d1BF88FE23D5D265d76068077E4D6F0 'addLargestPools((address,address,address,address)[],bool)' '[("0x1933cB66cB5A2b47A93753773C556ab6CA825831","0x95b012C1D02c859dab6b302F4b72941Ba4E3C3C3","0xabAa4C39cf3dF55480292BBDd471E88de8Cc3C97","0x665D4921fe931C0eA1390Ca4e0C422ba34d26169")]' false
```

### View underlying share price

```shell
cast call --rpc-url https://rpc.unreal.gelato.digital 0x35bf701C24357FD0C7F60376044323A2a830ad78 'getLiquidBoxSharePrice(address,address)(uint256)' 0x67048eA97Ca5DFDAe111A2304af1aED5115C7946 0xabAa4C39cf3dF55480292BBDd471E88de8Cc3C97
```

## Deployments

### Unreal testnet

* Controller 0x4F69329E8dE13aA7EAc664368C5858AF6371FA4c [Blockscout](https://unreal.blockscout.com/address/0x4F69329E8dE13aA7EAc664368C5858AF6371FA4c?tab=contract)
* IFO 0x3222eb4824cEb0E9CcfE11018C83429105dFE00F [Blockscout](https://unreal.blockscout.com/address/0x3222eb4824cEb0E9CcfE11018C83429105dFE00F?tab=contract)
* STGN 0x609e0d74fAB81085283df92B563750624054F8bE [Blockscout](https://unreal.blockscout.com/address/0x609e0d74fAB81085283df92B563750624054F8bE?tab=contract)
* veSTGN proxy 0x029Dfd1a79e0AD9305d773fb8F3c01D8eF9b913d [Blockscout](https://unreal.blockscout.com/address/0x029Dfd1a79e0AD9305d773fb8F3c01D8eF9b913d?tab=contract)
* Multigauge proxy 0x5B0Ad247bc0Fac75d76D1337932fc29b1eCb8eE6 [Blockscout](https://unreal.blockscout.com/address/0x5B0Ad247bc0Fac75d76D1337932fc29b1eCb8eE6?tab=contract)
* Factory proxy 0x045c8A060474874c5918717eCd55F07B62C59a90 [Blockscout](https://unreal.blockscout.com/address/0x045c8A060474874c5918717eCd55F07B62C59a90?tab=contract)
* VeDistributor proxy 0xAf95468B1a624605bbFb862B0FB6e9C73Ad847b8 [Blockscout](https://unreal.blockscout.com/address/0xAf95468B1a624605bbFb862B0FB6e9C73Ad847b8?tab=contract)
* Frontend 0xA38588970eD3c17C6De6A77D4E06C914B58A4F30 [Blockscout](https://unreal.blockscout.com/address/0xA38588970eD3c17C6De6A77D4E06C914B58A4F30?tab=contract)
* DepositHelper 0x7c8d0C7B63249A314df84707F8690F62CF625820 [Blockscout](https://unreal.blockscout.com/address/0x7c8d0C7B63249A314df84707F8690F62CF625820?tab=contract)
* Compounder proxy 0x89c06219C24ab4aBd762A49cdE97ce69B05f3EAF [Blockscout](https://unreal.blockscout.com/address/0x89c06219C24ab4aBd762A49cdE97ce69B05f3EAF?tab=contract)

### Goerli testnet

* Controller 0xE3f1d1B8ea9721FF0399cF6c2990A4bE5e4fc023
* IFO 0xE0D142466d1BF88FE23D5D265d76068077E4D6F0
* STGN 0x95b012C1D02c859dab6b302F4b72941Ba4E3C3C3
* veSTGN proxy 0x33222Ee7eAb1aBE6fC1724eAce207fA3Fa62C7C3
* Multigauge 0xee7751bF946Da4cbb39A76fd8dD99a8872871a7F
* IFO Harvester 0x4e02AbD5Aa2731bdD1655D3a0a936912Ea5f0857
* Harvester 0x9FeCf0827e7253F4dd3e9bF92cDd7A0ebC547D16
* CompunderVault 0x0A45e97ACEBa96650F47DA979bde3A8642f26739
* Controller 0x8216C9afFC982428aF33D1D9F165bAf9D75AebBa
* IFO 0x029Dfd1a79e0AD9305d773fb8F3c01D8eF9b913d
* STGN 0x5B0Ad247bc0Fac75d76D1337932fc29b1eCb8eE6
* veSTGN proxy 0x87eDeA5aea52BA12Ebf4eBc253Ec3218C1090C70
* Multigauge 0xAf95468B1a624605bbFb862B0FB6e9C73Ad847b8
* Factory 0xBD5296DC2603942F116B375c8Ee373674be86f56
* VeDistributor proxy 0x7c8d0C7B63249A314df84707F8690F62CF625820
* MockGauge 0x54F22378E03BeA25a05A071b60357d31Ce535Bb9
* MockLiquidator 0x97B56FEAdA7fb2D7A0A8576635f05314f184f0C2
* MockA 0xBcA14CF8Cc2417a5B4ed242bA45aE4835aF4d5Df
* MockC 0x609e0d74fAB81085283df92B563750624054F8bE
* MockD 0x635B1F7dD7d0172533BA9fE5Cfe2D83D9848f701
8 changes: 4 additions & 4 deletions chains/TestnetLib.sol → chains/GoerliLib.sol
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ import {console} from "forge-std/Test.sol";
import "../script/lib/DeployLib.sol";
import "../test/mock/MockTetuLiquidator.sol";

library TestnetLib {
library GoerliLib {
address public constant TOKEN_WETH = 0x7b79995e5f793A07Bc00c21412e50Ecae098E7f9;

function runDeploy(bool showLog) internal returns(address) {
function runDeploy(address rewardToken, bool showLog) internal returns(address) {
address governance = 0x3d0c177E035C30bb8681e5859EB98d114b48b935; // test deployer
address[] memory vestingClaimant = new address[](3);
uint[] memory vestingAmount = new uint[](3);
Expand All @@ -17,7 +17,7 @@ library TestnetLib {
vestingClaimant[2] = 0xcc16d636dD05b52FF1D8B9CE09B09BC62b11412B; // Tetu
vestingAmount[0] = 375_000e18;
vestingAmount[1] = 375_000e18;
vestingAmount[1] = 250_000e18;
vestingAmount[2] = 250_000e18;

MockTetuLiquidator l = new MockTetuLiquidator();

Expand All @@ -30,7 +30,7 @@ library TestnetLib {
vestingAmount: vestingAmount,
vestingPeriod: 365 days,
vestingCliff: 180 days,
rewardToken: TOKEN_WETH,
rewardToken: rewardToken,
liquidator: address(l)
})
)
Expand Down
2 changes: 1 addition & 1 deletion chains/PolygonLib.sol
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ library PolygonLib {
vestingClaimant[2] = 0xcc16d636dD05b52FF1D8B9CE09B09BC62b11412B; // Tetu
vestingAmount[0] = 375_000e18;
vestingAmount[1] = 375_000e18;
vestingAmount[1] = 250_000e18;
vestingAmount[2] = 250_000e18;

Controller _c = Controller(
DeployLib.deployPlatform(
Expand Down
62 changes: 62 additions & 0 deletions chains/UnrealLib.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.21;

import {console} from "forge-std/Test.sol";
import "../script/lib/DeployLib.sol";

library UnrealLib {
// Unreal tokens
address public constant TOKEN_USDC = 0xabAa4C39cf3dF55480292BBDd471E88de8Cc3C97;
address public constant TOKEN_DAI = 0x665D4921fe931C0eA1390Ca4e0C422ba34d26169;
address public constant TOKEN_PEARL = 0x1ef116600bBb2e99Ce6CE96B7E66A0df71AF5980;
address public constant TOKEN_CVR = 0xC716C749106B21aa4e8231b7ec891bdEab9bFB30;

// Pearl DeX
address public constant POOL_PEARL_CVR_3000 = 0x6592E84E1903B990C5015F1Ff1A6cc27405EABfB;
address public constant POOL_DAI_USDC_1000 = 0x1933cB66cB5A2b47A93753773C556ab6CA825831;
address public constant POOL_DAI_PEARL_3000 = 0xeC491B6bC5554f76348FB40eEfbf0Ed60cd22Bd2;
address public constant POOL_PEARL_USDC_3000 = 0x76994b9683e17B0A9Ed344fCD432A8E3BF7E22C1;
// Trident TDT-DAI-USDC
address public constant LIQUID_BOX_DAI_USDC = 0x8B9184243B8a787eaff8C304b17ED23fFD6F8c23;

// IGaugeV2ALM
address public constant ALM_GAUGE_DAI_USDC = 0x659f401aE8194e00673fe58367Ed77137542faA3;

// Sturgeon infrastructure
address public constant LIQUIDATOR = 0xE0D142466d1BF88FE23D5D265d76068077E4D6F0;

function runDeploy(bool showLog) internal returns(address) {
address governance = 0x3d0c177E035C30bb8681e5859EB98d114b48b935; // test deployer
address[] memory vestingClaimant = new address[](3);
uint[] memory vestingAmount = new uint[](3);
vestingClaimant[0] = 0x520Ab98a23100369E5280d214799b1E1c0123045; // Claw
vestingClaimant[1] = 0xe25e4df0432Ea55Fd76816fD8d4A21226dEE4bFF; // Minion
vestingClaimant[2] = 0xcc16d636dD05b52FF1D8B9CE09B09BC62b11412B; // Tetu
vestingAmount[0] = 375_000e18;
vestingAmount[1] = 375_000e18;
vestingAmount[2] = 250_000e18;

Controller _c = Controller(
DeployLib.deployPlatform(
DeployLib.DeployParams({
governance: governance,
ifoRate: 12e17,
vestingClaimant: vestingClaimant,
vestingAmount: vestingAmount,
vestingPeriod: 365 days,
vestingCliff: 180 days,
rewardToken: TOKEN_PEARL,
liquidator: LIQUIDATOR
})
)
);

if (showLog) {
console.log("Deployed. Controller:", address(_c));
}

return address(_c);
}

function testA() public {}
}
39 changes: 39 additions & 0 deletions script/Deploy.Goerli.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.21;

import "forge-std/Script.sol";
import "../chains/GoerliLib.sol";
import "../src/HarvesterVault.sol";
import "../src/PearlStrategy.sol";
import "../src/CompounderVault.sol";
import "../test/mock/MockERC20.sol";
import "../test/mock/MockPearlGaugeV2.sol";

contract DeployGoerli is Script {
function run() external {
uint deployerPrivateKey = vm.envUint("PRIVATE_KEY");
vm.startBroadcast(deployerPrivateKey);
console.log("deployer", vm.addr(deployerPrivateKey));

// deploy mocks
address tokenA = address(new MockERC20("Mock Token A", "MOCK_A", 18));
address tokenC = address(new MockERC20("Mock Token C", "MOCK_C", 18));
address tokenD = address(new MockERC20("Mock Token D", "MOCK_D", 18));
IGaugeV2ALM pearlGauge = IGaugeV2ALM(address(new MockPearlGaugeV2(tokenA, tokenC)));

IController controller = IController(GoerliLib.runDeploy(tokenC, true));
Factory factory = Factory(controller.factory());

// deploy IFO harvester
factory.deployIfoHarvester(tokenA, address(pearlGauge), "IFO Harvester MOCK_A", "xTokenA");

// deploy compounder + harvester
CompounderVault compounderVault =
CompounderVault(factory.deployCompounder(tokenD, "Compounder vault for xTokenA", "xxTokenA"));
factory.deployHarvester(tokenA, address(pearlGauge), "Harvester MOCK_A", "xTokenA", address(compounderVault));

vm.stopBroadcast();
}

function testDeployPolygon() external {}
}
48 changes: 0 additions & 48 deletions script/Deploy.Testnet.s.sol

This file was deleted.

42 changes: 42 additions & 0 deletions script/Deploy.Unreal.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.21;

import "forge-std/Script.sol";
import "../chains/UnrealLib.sol";
import "../src/HarvesterVault.sol";
import "../src/PearlStrategy.sol";
import "../src/CompounderVault.sol";
import "../test/mock/MockERC20.sol";
import "../test/mock/MockPearlGaugeV2.sol";

contract DeployUnreal is Script {
function run() external {
uint deployerPrivateKey = vm.envUint("PRIVATE_KEY");
vm.startBroadcast(deployerPrivateKey);
console.log("deployer", vm.addr(deployerPrivateKey));

IController controller = IController(UnrealLib.runDeploy(true));

Factory factory = Factory(controller.factory());

// deploy IFO harvester
factory.deployIfoHarvester(
UnrealLib.LIQUID_BOX_DAI_USDC, UnrealLib.ALM_GAUGE_DAI_USDC, "IFO Harvester DAI-USDC", "ifoTDT-DAI-USDC"
);

// deploy compounder + harvester
CompounderVault compounderVault =
CompounderVault(factory.deployCompounder(UnrealLib.TOKEN_CVR, "Compounder CVR", "cCVR"));
factory.deployHarvester(
UnrealLib.LIQUID_BOX_DAI_USDC,
UnrealLib.ALM_GAUGE_DAI_USDC,
"Harvester DAI-USDC",
"xTDT-DAI-USDC",
address(compounderVault)
);

vm.stopBroadcast();
}

function testDeployPolygon() external {}
}
22 changes: 22 additions & 0 deletions script/DeployCompounder.Unreal.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.21;

import "forge-std/Script.sol";
import "../src/Frontend.sol";
import "../src/ControllableProxy.sol";
import "../src/Compounder.sol";

contract DeployCompounderUnreal is Script {
function run() external {
uint deployerPrivateKey = vm.envUint("PRIVATE_KEY");
vm.startBroadcast(deployerPrivateKey);
ControllableProxy proxy = new ControllableProxy();
address impl = address(new Compounder());
proxy.initProxy(impl);
Compounder compounder = Compounder(address(proxy));
compounder.init(0x4F69329E8dE13aA7EAc664368C5858AF6371FA4c);
vm.stopBroadcast();
}

function testDeployFrontendTestnet() external {}
}
16 changes: 16 additions & 0 deletions script/DeployDepositHelper.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.21;

import "forge-std/Script.sol";
import "../src/DepositHelper.sol";

contract DeployDepositHelper is Script {
function run() external {
uint deployerPrivateKey = vm.envUint("PRIVATE_KEY");
vm.startBroadcast(deployerPrivateKey);
new DepositHelper();
vm.stopBroadcast();
}

function testDeploy_() external {}
}
16 changes: 16 additions & 0 deletions script/DeployFrontend.Goerli.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.21;

import "forge-std/Script.sol";
import "../src/Frontend.sol";

contract DeployFrontendGoerli is Script {
function run() external {
uint deployerPrivateKey = vm.envUint("PRIVATE_KEY");
vm.startBroadcast(deployerPrivateKey);
new Frontend(0x8216C9afFC982428aF33D1D9F165bAf9D75AebBa);
vm.stopBroadcast();
}

function testDeployFrontendTestnet() external {}
}
16 changes: 16 additions & 0 deletions script/DeployFrontend.Unreal.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.21;

import "forge-std/Script.sol";
import "../src/Frontend.sol";

contract DeployFrontendUnreal is Script {
function run() external {
uint deployerPrivateKey = vm.envUint("PRIVATE_KEY");
vm.startBroadcast(deployerPrivateKey);
new Frontend(0x4F69329E8dE13aA7EAc664368C5858AF6371FA4c);
vm.stopBroadcast();
}

function testDeployFrontendTestnet() external {}
}
Loading

0 comments on commit 227f580

Please sign in to comment.