Skip to content

0xdapper/gearbox-CA-scripts

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gearbox-CA-scripts

Some scripted interactions I have used for my credit account. Demonstrates how one can use forge scripting to script the credit account multicalls. Fork this repo and get started with everything setup for writing gearbox scripts.

Install

forge install
cd lib/core-v2; yarn // gearbox uses openzeppelin, need to get their source from npm
cd lib/integrations-v2; yarn // gearbox uses openzeppelin, need to get their source from npm

Write a script

contract InteractionScript is Script {
    function interaction(address _creditAccount) external {
        MultiCall[] memory multicalls = new MultiCall[](3);
        multicalls[0] = MultiCall({
            target: "", // adapter address
            abi.encodeWithSelector(Adapter.method.selector, ...) // encoding calldata
        });

        vm.broadcast();
        facade.multicall(multicalls);
    }
}

Run a script

forge script ./script/script-file.sol --sig "interaction(address)" <CREDIT_ACCOUNT> --rpc-url https://eth.llamarpc.com --broadcast -vvvv --private-key <PRIVATE_KEY>

This will run the script against local fork, sign the tx and send it. Remove the --broadcast option if you dont want to broadcast.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors