onlypwner LIQUID STAKING WriteUp

onlypwner LIQUID STAKING WriteUp

onlypwner LIQUID STAKING WriteUp-魔法少女雪殇
onlypwner LIQUID STAKING WriteUp
此内容为付费阅读,请付费后查看
10
立即购买
您当前未登录!建议登陆后购买,可保存购买订单
付费阅读

LIQUID STAKING

卡了我三天,字母哥一句话就思路畅通了,无敌了。

还是先看部署合约

pragma solidity 0.8.21;

import {PoolVault} from "src/PoolVault.sol";
import {SyntheticTokenFactory} from "src/SyntheticTokenFactory.sol";

import {Script} from "forge-std/Script.sol";
import {console} from "forge-std/console.sol";

contract Deploy is Script {
    function run() external {
        address user = vm.envAddress("USER");

        vm.startBroadcast();
        user.call{value: 100 ether}("");

        PoolVault pv = new PoolVault();
        SyntheticTokenFactory stf = new SyntheticTokenFactory(address(this), pv);

        console.log("address:PoolVault", address(pv));
        console.log("address:SyntheticTokenFactory", address(stf));

        vm.stopBroadcast();
    }
}

题目部署了两个合约,并给user100个eth。

看下解决条件,

pragma solidity 0.8.21;

import {PoolVault} from "src/PoolVault.sol";
import {SyntheticTokenFactory} from "src/SyntheticTokenFactory.sol";

import {Script} from "forge-std/Script.sol";
import {console} from "forge-std/console.sol";

contract Deploy is Script {
    function run() external {
        address user = vm.envAddress("USER");

        vm.startBroadcast();
        user.call{value: 100 ether}("");

        PoolVault pv = new PoolVault();
        SyntheticTokenFactory stf = new SyntheticTokenFactory(address(this), pv);

        console.log("address:PoolVault", address(pv));
        console.log("address:SyntheticTokenFactory", address(stf));

        vm.stopBroadcast();
    }
}

要求stf.syntheticsLength() > 0或user.blance>=100。

© 版权声明
THE END
喜欢就支持一下吧
点赞9 分享
评论 抢沙发
头像
欢迎您留下宝贵的见解!
提交
头像

昵称

取消
昵称表情

    暂无评论内容