Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: linea script #42

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion helpers/createProposal.sh
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ function main {
echo "Running on chains $chainIds"

export CHAIN_IDS=$chainIds
FOUNDRY_PROFILE=dev forge script $script
FOUNDRY_PROFILE=dev forge script $script -vvvv

if [ $? -ne 0 ]; then
echo ""
Expand Down
2 changes: 1 addition & 1 deletion lib/utils
Submodule utils updated 2 files
+106 −35 src/CommonUtils.sol
+1 −0 src/Constants.sol
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"url": "https://github.com/AngleProtocol/boilerplate/issues"
},
"devDependencies": {
"@angleprotocol/sdk": "^v2.14.0",
"@angleprotocol/sdk": "^v2.19.0",
"@layerzerolabs/lz-sdk": "^0.0.75",
"discord.js": "^14.14.1",
"prettier": "^2.0.0",
Expand Down
2 changes: 1 addition & 1 deletion scripts/Constants.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,4 @@ uint64 constant fourPoint3Rate = 1335019428339023872;

string constant pathProposal = "/scripts/proposals/payload.json";
address constant proposer = 0xfdA462548Ce04282f4B6D6619823a7C64Fdc0185;
address constant whale = 0x41Bc7d0687e6Cea57Fa26da78379DfDC5627C56d;
address constant whale = 0xD13F8C25CceD32cdfA79EB5eD654Ce3e484dCAF5;
20 changes: 20 additions & 0 deletions scripts/Interfaces.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ interface IAccessControlWriteVyper {
function accept_transfer_ownership() external;
}

interface IProxyAdmin {
function upgrade(address proxy, address implementation) external;
}

interface IVaultManagerGovernance {
function setUint64(uint64 param, bytes32 what) external;

Expand All @@ -29,11 +33,27 @@ interface INameable {
function setNameAndSymbol(string memory name, string memory symbol) external;
}

interface ITreasuryGovernance {
function addMinter(address minter) external;

function setCore(address _core) external;

function core() external view returns (address);
}

interface ISavings {
function setRate(uint208 newRate) external;

function setMaxRate(uint256 newMaxRate) external;

function toggleTrusted(address trustedAddress) external;

function isTrustedUpdater(address) external view returns (uint256);

function rate() external view returns (uint208);

function maxRate() external view returns (uint256);

function accessControlManager() external view returns (address);
}

Expand Down
2 changes: 1 addition & 1 deletion scripts/proposals/Wrapper.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ contract Wrapper is Utils {
hex""
);

values[finalPropLength] = nativeFee;
values[finalPropLength] = (nativeFee * GAS_MULTIPLIER) / BASE_GAS;

finalPropLength += 1;
i += count;
Expand Down
77 changes: 77 additions & 0 deletions scripts/proposals/nameable/SetupLinea.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.19;

import { console } from "forge-std/console.sol";
import { Wrapper } from "../Wrapper.s.sol";
import "../../Constants.s.sol";
import { ProxyAdmin } from "oz/proxy/transparent/ProxyAdmin.sol";

contract SetupLinea is Wrapper {
SubCall[] private subCalls;
// Linea
uint256 public constant chainId = CHAIN_LINEA;

function _setMaxRateSavings(address savings, address treasury, uint256 maxRate, address keeper) private {
bytes memory maxRateData = abi.encodeWithSelector(ISavings.setMaxRate.selector, maxRate);
bytes memory keeperData = abi.encodeWithSelector(ISavings.toggleTrusted.selector, keeper);
bytes memory minterData = abi.encodeWithSelector(ITreasuryGovernance.addMinter.selector, savings);
subCalls.push(SubCall(chainId, treasury, 0, minterData));
subCalls.push(SubCall(chainId, savings, 0, maxRateData));
subCalls.push(SubCall(chainId, savings, 0, keeperData));
}

function _setNameAndSymbol(address token, address implem, string memory name, string memory symbol) private {
bytes memory upgradeData = abi.encodeWithSelector(IProxyAdmin.upgrade.selector, token, implem);
bytes memory nameAndSymbolData = abi.encodeWithSelector(INameable.setNameAndSymbol.selector, name, symbol);
subCalls.push(SubCall(chainId, 0x1D941EF0D3Bba4ad67DBfBCeE5262F4CEE53A32b, 0, upgradeData));
subCalls.push(SubCall(chainId, token, 0, nameAndSymbolData));
}

function run() external {
address stUSD = 0x0022228a2cc5E7eF0274A7Baa600d44da5aB5776;
address stEUR = 0x004626A008B1aCdC4c74ab51644093b155e59A23;
address treasuryUSD = 0x840b25c87B626a259CA5AC32124fA752F0230a72;
address treasuryEUR = 0xf1dDcACA7D17f8030Ab2eb54f2D9811365EFe123;

{
bytes memory treasuryData = abi.encodeWithSelector(
ITreasuryGovernance.setCore.selector,
// AccessControlManager Core
0x4b1E2c2762667331Bc91648052F646d1b0d35984
);
subCalls.push(SubCall(chainId, treasuryUSD, 0, treasuryData));
}

{
address savingsNameableImplem = 0x2C28Bd22aB59341892e85aD76d159d127c4B03FA;
_setNameAndSymbol(stUSD, savingsNameableImplem, "Staked USDA", "stUSD");
_setNameAndSymbol(stEUR, savingsNameableImplem, "Staked EURA", "stEUR");
}

{
address agTokenNameableImplem = 0xc42b7A34Cb37eE450cc8059B10D839e4753229d5;
address EURA = 0x1a7e4e63778B4f12a199C062f3eFdD288afCBce8;
address USDA = 0x0000206329b97DB379d5E1Bf586BbDB969C63274;
_setNameAndSymbol(EURA, agTokenNameableImplem, "EURA", "EURA");
_setNameAndSymbol(USDA, agTokenNameableImplem, "USDA", "USDA");
}

{
address keeper = 0xa9bbbDDe822789F123667044443dc7001fb43C01;
uint256 maxRateUSD = 10669464645118865408;
uint256 maxRateEUR = 3022265993024575488;
_setMaxRateSavings(stUSD, treasuryUSD, maxRateUSD, keeper);
_setMaxRateSavings(stEUR, treasuryEUR, maxRateEUR, keeper);
}

string memory description = "ipfs://QmRSdyuXeemVEn97RPRSiit6UEUonvwVr9we7bEe2w8v2E";

(
address[] memory targets,
uint256[] memory values,
bytes[] memory calldatas,
uint256[] memory chainIds2
) = _wrap(subCalls);
_serializeJson(targets, values, calldatas, chainIds2, description);
}
}
11 changes: 9 additions & 2 deletions scripts/proposals/nameable/UpgradeAgTokenNameable.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,14 @@ contract UpgradeAgTokenNameable is Wrapper {
mapping(uint256 => address) private _chainToToken;
mapping(uint256 => address) private _chainToImplementation;

function _upgradeAgToken(uint256 chainId, string memory name, string memory symbol, address proxy, address implementation, address proxyAdmin) private {
function _upgradeAgToken(
uint256 chainId,
string memory name,
string memory symbol,
address proxy,
address implementation,
address proxyAdmin
) private {
vm.selectFork(forkIdentifier[chainId]);

bytes memory nameAndSymbolData = abi.encodeWithSelector(INameable.setNameAndSymbol.selector, name, symbol);
Expand All @@ -23,7 +30,7 @@ contract UpgradeAgTokenNameable is Wrapper {

function run() external {
uint256[] memory chainIds = vm.envUint("CHAIN_IDS", ",");
string memory description = "ipfs://QmRSdyuXeemVEn97RPRSiit6UEUonvwVr9we7bEe2w8v2E";
string memory description = "ipfs://QmbFMke1KXqnYyBBWxB74N4c5SBnJMVAiMNRcGu6x1AwQH";

/** TODO complete */
string memory name = "EURA"; // previously "agEUR"
Expand Down
8 changes: 4 additions & 4 deletions scripts/proposals/payload.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
{
"calldatas": {
"0": "0x8f2a0bb000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000120000000000000000000000000000000000000000000000000000000000000018000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001517f0000000000000000000000000000000000000000000000000000000000000002000000000000000000000000748ba9cd5a5ddba5aba70a4ac861b2413dca4436000000000000000000000000748ba9cd5a5ddba5aba70a4ac861b2413dca44360000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000002406f3f9e6000000000000000000000000000000000000000000000000000000000000001900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002443ec3e09000000000000000000000000000000000000000000000000000000000000004b00000000000000000000000000000000000000000000000000000000"
"0": "0xbb5a944f00000000000000000000000000000000000000000000000000000000000000b7000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000011c00000000000000000000000000000000000000000000000000000000000001140000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000001600000000000000000000000000000000000000000000000000000000000000001000000000000000000000000d23b51d6f2cb3ec7ca9599d4332a2f10c3cfdf8500000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000f648f2a0bb000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000002c000000000000000000000000000000000000000000000000000000000000004c000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001517f000000000000000000000000000000000000000000000000000000000000000f000000000000000000000000840b25c87b626a259ca5ac32124fa752f0230a720000000000000000000000001d941ef0d3bba4ad67dbfbcee5262f4cee53a32b0000000000000000000000000022228a2cc5e7ef0274a7baa600d44da5ab57760000000000000000000000001d941ef0d3bba4ad67dbfbcee5262f4cee53a32b000000000000000000000000004626a008b1acdc4c74ab51644093b155e59a230000000000000000000000001d941ef0d3bba4ad67dbfbcee5262f4cee53a32b0000000000000000000000001a7e4e63778b4f12a199c062f3efdd288afcbce80000000000000000000000001d941ef0d3bba4ad67dbfbcee5262f4cee53a32b0000000000000000000000000000206329b97db379d5e1bf586bbdb969c63274000000000000000000000000840b25c87b626a259ca5ac32124fa752f0230a720000000000000000000000000022228a2cc5e7ef0274a7baa600d44da5ab57760000000000000000000000000022228a2cc5e7ef0274a7baa600d44da5ab5776000000000000000000000000f1ddcaca7d17f8030ab2eb54f2d9811365efe123000000000000000000000000004626a008b1acdc4c74ab51644093b155e59a23000000000000000000000000004626a008b1acdc4c74ab51644093b155e59a23000000000000000000000000000000000000000000000000000000000000000f000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000f00000000000000000000000000000000000000000000000000000000000001e0000000000000000000000000000000000000000000000000000000000000024000000000000000000000000000000000000000000000000000000000000002c000000000000000000000000000000000000000000000000000000000000003c00000000000000000000000000000000000000000000000000000000000000440000000000000000000000000000000000000000000000000000000000000054000000000000000000000000000000000000000000000000000000000000005c000000000000000000000000000000000000000000000000000000000000006c00000000000000000000000000000000000000000000000000000000000000740000000000000000000000000000000000000000000000000000000000000084000000000000000000000000000000000000000000000000000000000000008a00000000000000000000000000000000000000000000000000000000000000900000000000000000000000000000000000000000000000000000000000000096000000000000000000000000000000000000000000000000000000000000009c00000000000000000000000000000000000000000000000000000000000000a200000000000000000000000000000000000000000000000000000000000000024800096300000000000000000000000004b1e2c2762667331bc91648052f646d1b0d3598400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004499a88ec40000000000000000000000000022228a2cc5e7ef0274a7baa600d44da5ab57760000000000000000000000002c28bd22ab59341892e85ad76d159d127c4b03fa0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c45a44621500000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000b5374616b656420555344410000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005737455534400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004499a88ec4000000000000000000000000004626a008b1acdc4c74ab51644093b155e59a230000000000000000000000002c28bd22ab59341892e85ad76d159d127c4b03fa0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c45a44621500000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000b5374616b656420455552410000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005737445555200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004499a88ec40000000000000000000000001a7e4e63778b4f12a199c062f3efdd288afcbce8000000000000000000000000c42b7a34cb37ee450cc8059b10d839e4753229d50000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c45a44621500000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000445555241000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004455552410000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004499a88ec40000000000000000000000000000206329b97db379d5e1bf586bbdb969c63274000000000000000000000000c42b7a34cb37ee450cc8059b10d839e4753229d50000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c45a446215000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000004555344410000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000045553444100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000024983b2d560000000000000000000000000022228a2cc5e7ef0274a7baa600d44da5ab5776000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000024aa4abe7f00000000000000000000000000000000000000000000000094118d90c3e630000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000247ee84349000000000000000000000000a9bbbdde822789f123667044443dc7001fb43c01000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000024983b2d56000000000000000000000000004626a008b1acdc4c74ab51644093b155e59a23000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000024aa4abe7f00000000000000000000000000000000000000000000000029f13ee872f918000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000247ee84349000000000000000000000000a9bbbdde822789f123667044443dc7001fb43c01000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000220001000000000000000000000000000000000000000000000000000000000005f4e7000000000000000000000000000000000000000000000000000000000000"
},
"chainIds": {
"0": 1
"0": 59144
},
"description": "ipfs://QmRSdyuXeemVEn97RPRSiit6UEUonvwVr9we7bEe2w8v2E",
"targets": {
"0": "0x09D81464c7293C774203E46E3C921559c8E9D53f"
"0": "0x896D64B4B7265273dDCD00808f3579563f9790A8"
},
"values": {
"0": 0
"0": 482036851897461
}
}
Loading
Loading