Skip to content

Commit

Permalink
ftso update
Browse files Browse the repository at this point in the history
  • Loading branch information
Siddharth2207 committed Aug 8, 2024
1 parent 84ad1fb commit 1668323
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 18 deletions.
21 changes: 11 additions & 10 deletions strategies/flare/wflr-streaming-dca.rain
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ deployers:
network: flare-community

tokens:
flare-eusdt:
flare-usdc:
network: flare-community
address: 0x96B41289D90444B8adD57e6F265DB5aE8651DF29
address: 0xFbDa5F676cB37624f28265A144A48B0d6e87d3b6
decimals: 6
flare-wflr:
network: flare-community
Expand All @@ -49,17 +49,18 @@ scenarios:
# Ask for now, registry in future.
uniswap-words: 0xAFF83Dd453f9EE510d6F623d09322A68E8ee29A3
orderbook-subparser: 0x77991674ca8887D4ee1b583DB7324B41d5f894c4
flare-subparser: 0x57c613381deadaE520eC33556C1d51c9Dcb0adb3

# Uniswap V3 factory addresses and init code
uniswap-v2-factory: 0x28b70f6Ed97429E40FE9a9CD3EB8E86BCBA11dd4
uniswap-v2-init-code: 0xa1ab3f6a293fb82d68afb63ad2a5352fc49d5f3dfa28b151a85c382a91dd574b
uniswap-v2-factory: 0x440602f459D7Dd500a74528003e6A20A46d6e2A6
uniswap-v2-init-code: 0xbf4c1c435583a2bb8d763765a34a46e376071c3b3d80e5bbac0950aeecdf31cb

scenarios:
buy-wflr:
bindings:
# Input and Output token addresses from perspective of order
input-token-address: 0x1D80c49BbBCd1C0911346656B529DF9E5c2F783d
output-token-address: 0x96B41289D90444B8adD57e6F265DB5aE8651DF29
output-token-address: 0xFbDa5F676cB37624f28265A144A48B0d6e87d3b6

# If the order's input-output tokens are NOT paired on the uniswap v3 pool,
# then the reserve token address is the address of the token which is paired with order's output token on uniswapv3 pool.
Expand All @@ -79,7 +80,7 @@ scenarios:
# Unix timestamp for strating of the strategy.
# Ideally set it 15 minutes ahead of the whatever the timestamp is while you're deploying the order.
# https://www.epochconverter.com/
strat-start-time: 1723131051
strat-start-time: 1723114226

# Bounty amount denominated in input tokens
#
Expand Down Expand Up @@ -183,6 +184,7 @@ charts:

#uniswap-words !The subparser for the Uniswap words
#orderbook-subparser !The subparser for the Orderbook words
#flare-subparser !The subparser for flare ftso words.
#uniswap-v3-factory !Uniswap v3 factory.
#uniswap-v3-init-code !Uniswap v3 factory init code.
#uniswap-v2-factory !Uniswap v2 factory.
Expand Down Expand Up @@ -223,10 +225,9 @@ charts:

#calculate-budget-input
current-budget: ,
output-to-reserve: uniswap-v2-quote-exact-input(
output-token-address input-token-address
output-to-reserve: mul(
inv(ftso-current-price-usd("FLR" 1))
current-budget
uniswap-v2-factory uniswap-v2-init-code
),
output-to-input: call<'quote-multiplier>(output-to-reserve);

Expand Down Expand Up @@ -267,7 +268,7 @@ charts:
);

#calculate-io
using-words-from uniswap-words orderbook-subparser
using-words-from uniswap-words orderbook-subparser flare-subparser

current-time last-time: call<'get-last-time>(),
elapsed-time: saturating-sub(current-time last-time),
Expand Down
16 changes: 8 additions & 8 deletions test/Flare/FlrStreamingTest.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@ uint256 constant VAULT_ID = uint256(keccak256("vault"));
/// @dev https://flarescan.com/token/0x1D80c49BbBCd1C0911346656B529DF9E5c2F783d
IERC20 constant FLARE_WFLR= IERC20(0x1D80c49BbBCd1C0911346656B529DF9E5c2F783d);

/// @dev https://flarescan.com/address/0x96B41289D90444B8adD57e6F265DB5aE8651DF29
IERC20 constant FLARE_EUSDT = IERC20(0x96B41289D90444B8adD57e6F265DB5aE8651DF29);
/// @dev https://flarescan.com/address/0xFbDa5F676cB37624f28265A144A48B0d6e87d3b6
IERC20 constant FLARE_USDC = IERC20(0xFbDa5F676cB37624f28265A144A48B0d6e87d3b6);

function flareWflrIo() pure returns (IO memory) {
return IO(address(FLARE_WFLR), 18, VAULT_ID);
}

function flareEusdtIo() pure returns (IO memory) {
return IO(address(FLARE_EUSDT), 6, VAULT_ID);
function flareUsdcIo() pure returns (IO memory) {
return IO(address(FLARE_USDC), 6, VAULT_ID);
}

contract FlrStreamingTest is StrategyTests {
Expand Down Expand Up @@ -75,9 +75,9 @@ contract FlrStreamingTest is StrategyTests {
inputVaults[0] = flareWflrIo();

IO[] memory outputVaults = new IO[](1);
outputVaults[0] = flareEusdtIo();
outputVaults[0] = flareUsdcIo();

uint256 expectedRatio = 60.098521370017216084e18;
uint256 expectedRatio = 61.628395061728395059e18;
uint256 expectedAmount = 4999999999999999920;

LibStrategyDeployment.StrategyDeployment memory strategy = LibStrategyDeployment.StrategyDeployment(
Expand All @@ -96,7 +96,7 @@ contract FlrStreamingTest is StrategyTests {
inputVaults,
outputVaults
);

OrderV3 memory order = addOrderDepositOutputTokens(strategy);

vm.warp(block.timestamp + 3600);
Expand All @@ -116,7 +116,7 @@ contract FlrStreamingTest is StrategyTests {

function getEncodedBuyWflrRoute() internal pure returns (bytes memory) {
bytes memory BUY_WFLR_ROUTE =
hex"0296B41289D90444B8adD57e6F265DB5aE8651DF2901ffff007520005032F43229F606d3ACeae97045b9D6F7ea00C1A14cE2fd58A3A2f99deCb8eDd866204eE07f8D000bb8";
hex"02FbDa5F676cB37624f28265A144A48B0d6e87d3b601ffff00B1eC7ef55fa2E84eb6fF9FF0fa1e33387f892f6800C1A14cE2fd58A3A2f99deCb8eDd866204eE07f8D000bb8";

return abi.encode(BUY_WFLR_ROUTE);
}
Expand Down

0 comments on commit 1668323

Please sign in to comment.