Skip to content

Instantly share code, notes, and snippets.

View 0xtuytuy's full-sized avatar
💻
Building the DeFi for the next 50M users

0xtuytuy 0xtuytuy

💻
Building the DeFi for the next 50M users
  • GetAlluo & Unblock
  • Metaverse
  • 12:37 (UTC -12:00)
  • X @0xtuytuy
View GitHub Profile
@0xtuytuy
0xtuytuy / logo-lg.svg
Last active April 14, 2022 16:05
Alluo - Logo
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@0xtuytuy
0xtuytuy / voteExecutor.sol
Last active March 8, 2022 22:18
Alluo - Extract of voteExecutor.sol main function
function execute(Entry[] memory _entries) external onlyRole(DEFAULT_ADMIN_ROLE){
uint8 totalWeight;
for(uint256 i = 0; i < _entries.length; i++){
totalWeight += _entries[i].weight;
require(entryTokens.contains(_entries[i].entryToken), "There is no such entry token");
}
require(totalWeight <= 100, "Total weight more then 100");
uint256 totalBalance = getTotalBalance();
@0xtuytuy
0xtuytuy / adaptor.sol
Last active March 8, 2022 22:12
Alluo - Extract 3CRV Adatptor
function executeSwap(
address pool,
address fromToken,
address toToken,
uint256 amount
) external payable returns (uint256) {
ICurve3Crv pool3crv = ICurve3Crv(pool);
if (toToken == address(token3crv)) {
// enter 3crv pool to get 3crv token
daiWethRoute = [
// DAI - USDT - WETH
{ swapProtocol: 1, pool: fraxPoolAddress, fromCoin: dai.address, toCoin: usdt.address },
{ swapProtocol: 2, pool: renbtcAddress, fromCoin: usdt.address, toCoin: weth.address },
];
[
{
"weight":50,
"entryToken"://address of the token we hold that we want to use to enter the Cure pool A,
"curvePool"://address of the Curve pool A to enter,
"poolToken"://address of the token we want to enter the Curve pool A with,
"poolSize"://how many entry coins does this Curve pool A have,
"tokenIndexInCurve"://what index in the previous list is our prefered poolToken,
"convexPoolAddress": //address of the Convex pool A we want to invest the Cuve LP tokens into,
"convexPoold"://id of the Convex pool A