Skip to content

Commit

Permalink
Merge pull request #3 from Tenderize/nv/curve-updates
Browse files Browse the repository at this point in the history
Curve updates and other fixes
  • Loading branch information
kyriediculous authored Nov 30, 2023
2 parents e36f78c + 660d781 commit 444ce1c
Show file tree
Hide file tree
Showing 14 changed files with 660 additions and 212 deletions.
6 changes: 3 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
[submodule "lib/clones-with-immutable-args"]
path = lib/clones-with-immutable-args
url = https://github.com/wighawag/clones-with-immutable-args
[submodule "lib/staking"]
path = lib/staking
url = https://github.com/Tenderize/staking
[submodule "lib/solmate"]
path = lib/solmate
url = https://github.com/transmissions11/solmate
[submodule "lib/staking"]
path = lib/staking
url = https://github.com/tenderize/staking
44 changes: 21 additions & 23 deletions foundry.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# Full reference https://github.com/foundry-rs/foundry/tree/master/config

# Full reference https://github.com/foundry-rs/foundry/tree/master/config

[profile.default]
bytecode_hash = "none"
fuzz = { runs = 1_000 }
Expand All @@ -25,25 +23,25 @@ quote_style = "double"
tab_width = 4
wrap_comments = true

[etherscan]
arbitrum_one = { key = "${API_KEY_ARBISCAN}" }
avalanche = { key = "${API_KEY_SNOWTRACE}" }
bnb_smart_chain = { key = "${API_KEY_BSCSCAN}" }
gnosis_chain = { key = "${API_KEY_GNOSISSCAN}" }
goerli = { key = "${API_KEY_ETHERSCAN}" }
mainnet = { key = "${API_KEY_ETHERSCAN}" }
optimism = { key = "${API_KEY_OPTIMISTIC_ETHERSCAN}" }
polygon = { key = "${API_KEY_POLYGONSCAN}" }
sepolia = { key = "${API_KEY_ETHERSCAN}" }
# [etherscan]
# arbitrum_one = { key = "${API_KEY_ARBISCAN}" }
# avalanche = { key = "${API_KEY_SNOWTRACE}" }
# bnb_smart_chain = { key = "${API_KEY_BSCSCAN}" }
# gnosis_chain = { key = "${API_KEY_GNOSISSCAN}" }
# goerli = { key = "${API_KEY_ETHERSCAN}" }
# mainnet = { key = "${API_KEY_ETHERSCAN}" }
# optimism = { key = "${API_KEY_OPTIMISTIC_ETHERSCAN}" }
# polygon = { key = "${API_KEY_POLYGONSCAN}" }
# sepolia = { key = "${API_KEY_ETHERSCAN}" }

[rpc_endpoints]
arbitrum_one = "https://arbitrum-mainnet.infura.io/v3/${API_KEY_INFURA}"
avalanche = "https://avalanche-mainnet.infura.io/v3/${API_KEY_INFURA}"
bnb_smart_chain = "https://bsc-dataseed.binance.org"
gnosis_chain = "https://rpc.gnosischain.com"
goerli = "https://goerli.infura.io/v3/${API_KEY_INFURA}"
localhost = "http://localhost:8545"
mainnet = "https://eth-mainnet.g.alchemy.com/v2/${API_KEY_ALCHEMY}"
optimism = "https://optimism-mainnet.infura.io/v3/${API_KEY_INFURA}"
polygon = "https://polygon-mainnet.infura.io/v3/${API_KEY_INFURA}"
sepolia = "https://sepolia.infura.io/v3/${API_KEY_INFURA}"
# [rpc_endpoints]
# arbitrum_one = "https://arbitrum-mainnet.infura.io/v3/${API_KEY_INFURA}"
# avalanche = "https://avalanche-mainnet.infura.io/v3/${API_KEY_INFURA}"
# bnb_smart_chain = "https://bsc-dataseed.binance.org"
# gnosis_chain = "https://rpc.gnosischain.com"
# goerli = "https://goerli.infura.io/v3/${API_KEY_INFURA}"
# localhost = "http://localhost:8545"
# mainnet = "https://eth-mainnet.g.alchemy.com/v2/${API_KEY_ALCHEMY}"
# optimism = "https://optimism-mainnet.infura.io/v3/${API_KEY_INFURA}"
# polygon = "https://polygon-mainnet.infura.io/v3/${API_KEY_INFURA}"
# sepolia = "https://sepolia.infura.io/v3/${API_KEY_INFURA}"
2 changes: 1 addition & 1 deletion lib/staking
Submodule staking updated 42 files
+1 −0 .gitignore
+3 −0 .gitmodules
+4 −0 foundry.toml
+1 −0 lib/uniswap-v3-core
+2 −2 package.json
+1 −0 remappings.txt
+2 −0 script/Adapter_Deploy.s.sol
+3 −1 script/Tenderize_Deploy.s.sol
+92 −14 script/XYZ_Data.s.sol
+21 −18 script/XYZ_Deploy.s.sol
+52 −0 script/XYZ_Faucet.s.sol
+30 −2 script/anvil_xyz.sh
+44 −0 script/arbgoerli_testnet.sh
+4 −0 src/adapters/Adapter.sol
+24 −22 src/adapters/GraphAdapter.sol
+39 −32 src/adapters/LivepeerAdapter.sol
+163 −0 src/adapters/PolygonAdapter.sol
+5 −1 src/adapters/interfaces/IGraph.sol
+2 −0 src/adapters/interfaces/ILivepeer.sol
+42 −0 src/adapters/interfaces/IPolygon.sol
+2 −0 src/tenderizer/ITenderizer.sol
+22 −30 src/tenderizer/Tenderizer.sol
+5 −0 src/tenderizer/TenderizerBase.sol
+9 −5 src/tendertoken/TToken.sol
+4 −4 src/unlocks/Base64.sol
+4 −4 src/unlocks/Renderer.sol
+38 −23 src/unlocks/Unlocks.sol
+36 −0 src/utils/Multicall.sol
+76 −0 src/utils/SelfPermit.sol
+29 −0 src/utils/StaticCall.sol
+43 −0 src/utils/TWAP.sol
+28 −0 src/utils/Utils.sol
+13 −32 test/adapters/GraphAdapter.t.sol
+98 −0 test/adapters/PolygonAdapter.t.sol
+70 −0 test/helpers/Faucet.sol
+27 −10 test/helpers/StakingXYZ.sol
+10 −2 test/helpers/XYZAdapter.sol
+1 −4 test/tenderizer/Tenderizer.harness.sol
+5 −4 test/tenderizer/Tenderizer.t.sol
+9 −11 test/tendertoken/TToken.t.sol
+1 −1 test/unlocks/Renderer.t.sol
+12 −4 test/unlocks/Unlocks.t.sol
40 changes: 40 additions & 0 deletions script/Add_Liquidity.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;

import { Script, console2 } from "forge-std/Script.sol";
import { ERC20 } from "solmate/tokens/ERC20.sol";
import { TenderSwap, Config } from "@tenderize/swap/Swap.sol";

contract Add_Liquidity is Script {
// Contracts are deployed deterministically.
// e.g. `foo = new Foo{salt: salt}(constructorArgs)`
// The presence of the salt argument tells forge to use https://github.com/Arachnid/deterministic-deployment-proxy
bytes32 private constant salt = 0x0;

// Start broadcasting with private key from `.env` file
uint256 deployerPrivateKey = vm.envUint("PRIVATE_KEY");
address underlying = vm.envAddress("UNDERLYING");

function run() public {
vm.startBroadcast(deployerPrivateKey);
TenderSwap swap = TenderSwap(0x4ec6faD51A1957cAb7E8a62e43f0A0a0c2143d3f);
ERC20(underlying).approve(address(swap), 500_000 ether);
swap.deposit(500_000 ether);
console2.log("liabilities", swap.liabilities());
console2.log("liquidity", swap.liquidity());
// ERC20(0x2eaC4210B90D13666f7E88635096BdC17C51FB70).approve(address(swap), 10 ether);

// (uint256 out, uint256 fee) = swap.quote(0x2eaC4210B90D13666f7E88635096BdC17C51FB70, 10 ether);
// console2.log("quote", out);
// ERC20(0x2eaC4210B90D13666f7E88635096BdC17C51FB70).approve(address(swap), 10 ether);
// // (out, fee) = swap.swap(0x2eaC4210B90D13666f7E88635096BdC17C51FB70, 10 ether, 0);
// console2.log("out", out);
// console2.log("fee", fee);

// // Other Tenderizer: 0xD58Fed21106A046093086903909478AD96D310a8
// (out, fee) = swap.quote(0xD58Fed21106A046093086903909478AD96D310a8, 10 ether);
// console2.log("quote", out);

vm.stopBroadcast();
}
}
41 changes: 0 additions & 41 deletions script/Base.s.sol

This file was deleted.

27 changes: 27 additions & 0 deletions script/Swap_Deploy.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;

import { Script, console2 } from "forge-std/Script.sol";
import { ERC20 } from "solmate/tokens/ERC20.sol";
import { TenderSwap, Config } from "@tenderize/swap/Swap.sol";

contract Swap_Deploy is Script {
// Contracts are deployed deterministically.
// e.g. `foo = new Foo{salt: salt}(constructorArgs)`
// The presence of the salt argument tells forge to use https://github.com/Arachnid/deterministic-deployment-proxy
bytes32 private constant salt = 0x0;

// Start broadcasting with private key from `.env` file
uint256 deployerPrivateKey = vm.envUint("PRIVATE_KEY");
address underlying = vm.envAddress("UNDERLYING");
address registry = vm.envAddress("REGISTRY");
address unlocks = vm.envAddress("UNLOCKS");
Config cfg = Config({ underlying: ERC20(underlying), registry: registry, unlocks: unlocks });

function run() public {
vm.startBroadcast(deployerPrivateKey);
TenderSwap swap = new TenderSwap{salt: salt}(cfg);
console2.log("TenderSwap deployed at: ", address(swap));
vm.stopBroadcast();
}
}
Loading

0 comments on commit 444ce1c

Please sign in to comment.