编译器
0.8.19+commit.7dd6d404
文件 1 的 4:Errors.sol
pragma solidity ^0.8.0;
library Errors {
string public constant VOTING_PORTALS_COUNT_NOT_0 = '1';
string public constant AT_LEAST_ONE_PAYLOAD = '2';
string public constant VOTING_PORTAL_NOT_APPROVED = '3';
string public constant PROPOSITION_POWER_IS_TOO_LOW = '4';
string public constant PROPOSAL_NOT_IN_CREATED_STATE = '5';
string public constant PROPOSAL_NOT_IN_ACTIVE_STATE = '6';
string public constant PROPOSAL_NOT_IN_QUEUED_STATE = '7';
string public constant VOTING_START_COOLDOWN_PERIOD_NOT_PASSED = '8';
string public constant CALLER_NOT_A_VALID_VOTING_PORTAL = '9';
string public constant QUEUE_COOLDOWN_PERIOD_NOT_PASSED = '10';
string public constant PROPOSAL_NOT_IN_THE_CORRECT_STATE = '11';
string public constant CALLER_NOT_GOVERNANCE = '12';
string public constant VOTER_ALREADY_VOTED_ON_PROPOSAL = '13';
string public constant WRONG_MESSAGE_ORIGIN = '14';
string public constant NO_VOTING_ASSETS = '15';
string public constant PROPOSAL_VOTE_ALREADY_CREATED = '16';
string public constant INVALID_SIGNATURE = '17';
string public constant PROPOSAL_VOTE_NOT_FINISHED = '18';
string public constant PROPOSAL_VOTE_NOT_IN_ACTIVE_STATE = '19';
string public constant PROPOSAL_VOTE_ALREADY_EXISTS = '20';
string public constant VOTE_ONCE_FOR_ASSET = '21';
string public constant USER_BALANCE_DOES_NOT_EXISTS = '22';
string public constant USER_VOTING_BALANCE_IS_ZERO = '23';
string public constant MISSING_AAVE_ROOTS = '24';
string public constant MISSING_STK_AAVE_ROOTS = '25';
string public constant MISSING_STK_AAVE_SLASHING_EXCHANGE_RATE = '26';
string public constant UNPROCESSED_STORAGE_ROOT = '27';
string public constant NOT_ENOUGH_MSG_VALUE = '28';
string public constant FAILED_ACTION_EXECUTION = '29';
string public constant SHOULD_BE_AT_LEAST_ONE_EXECUTOR = '30';
string public constant INVALID_EMPTY_TARGETS = '31';
string public constant EXECUTOR_WAS_NOT_SPECIFIED_FOR_REQUESTED_ACCESS_LEVEL =
'32';
string public constant PAYLOAD_NOT_IN_QUEUED_STATE = '33';
string public constant TIMELOCK_NOT_FINISHED = '34';
string public constant PAYLOAD_NOT_IN_THE_CORRECT_STATE = '35';
string public constant PAYLOAD_NOT_IN_CREATED_STATE = '36';
string public constant MISSING_A_AAVE_ROOTS = '37';
string public constant MISSING_PROPOSAL_BLOCK_HASH = '38';
string public constant PROPOSAL_VOTE_CONFIGURATION_ALREADY_BRIDGED = '39';
string public constant INVALID_VOTING_PORTAL_ADDRESS = '40';
string public constant INVALID_POWER_STRATEGY = '41';
string public constant INVALID_EXECUTOR_ADDRESS = '42';
string public constant EXECUTOR_ALREADY_SET_IN_DIFFERENT_LEVEL = '43';
string public constant INVALID_VOTING_DURATION = '44';
string public constant VOTING_DURATION_NOT_PASSED = '45';
string public constant INVALID_PROPOSAL_ACCESS_LEVEL = '46';
string public constant PAYLOAD_NOT_CREATED_BEFORE_PROPOSAL = '47';
string public constant INVALID_CROSS_CHAIN_CONTROLLER_ADDRESS = '48';
string public constant INVALID_MESSAGE_ORIGINATOR_ADDRESS = '49';
string public constant INVALID_ORIGIN_CHAIN_ID = '50';
string public constant INVALID_ACTION_TARGET = '51';
string public constant INVALID_ACTION_ACCESS_LEVEL = '52';
string public constant INVALID_EXECUTOR_ACCESS_LEVEL = '53';
string public constant INVALID_VOTING_PORTAL_CROSS_CHAIN_CONTROLLER = '54';
string public constant INVALID_VOTING_PORTAL_VOTING_MACHINE = '55';
string public constant INVALID_VOTING_PORTAL_GOVERNANCE = '56';
string public constant INVALID_VOTING_MACHINE_CHAIN_ID = '57';
string public constant G_INVALID_CROSS_CHAIN_CONTROLLER_ADDRESS = '58';
string public constant G_INVALID_IPFS_HASH = '59';
string public constant G_INVALID_PAYLOAD_ACCESS_LEVEL = '60';
string public constant G_INVALID_PAYLOADS_CONTROLLER = '61';
string public constant G_INVALID_PAYLOAD_CHAIN = '62';
string public constant POWER_STRATEGY_HAS_NO_TOKENS = '63';
string public constant INVALID_VOTING_CONFIG_ACCESS_LEVEL = '64';
string public constant VOTING_DURATION_TOO_SMALL = '65';
string public constant NO_BRIDGED_VOTING_ASSETS = '66';
string public constant INVALID_VOTER = '67';
string public constant INVALID_DATA_WAREHOUSE = '68';
string public constant INVALID_VOTING_MACHINE_CROSS_CHAIN_CONTROLLER = '69';
string public constant INVALID_L1_VOTING_PORTAL = '70';
string public constant INVALID_VOTING_PORTAL_CHAIN_ID = '71';
string public constant INVALID_VOTING_STRATEGY = '72';
string public constant INVALID_VOTE_CONFIGURATION_BLOCKHASH = '73';
string public constant INVALID_VOTE_CONFIGURATION_VOTING_DURATION = '74';
string public constant INVALID_GAS_LIMIT = '75';
string public constant INVALID_VOTING_CONFIGS = '76';
string public constant INVALID_EXECUTOR_DELAY = '77';
string public constant REPEATED_STRATEGY_ASSET = '78';
string public constant EMPTY_ASSET_STORAGE_SLOTS = '79';
string public constant REPEATED_STRATEGY_ASSET_SLOT = '80';
string public constant INVALID_EXECUTION_TARGET = '81';
string public constant MISSING_VOTING_CONFIGURATIONS = '82';
string public constant INVALID_PROPOSITION_POWER = '83';
string public constant INVALID_YES_THRESHOLD = '84';
string public constant INVALID_YES_NO_DIFFERENTIAL = '85';
string public constant ETH_TRANSFER_FAILED = '86';
string public constant INVALID_INITIAL_VOTING_CONFIGS = '87';
string public constant INVALID_VOTING_PORTAL_ADDRESS_IN_VOTING_MACHINE = '88';
string public constant INVALID_VOTING_PORTAL_OWNER = '89';
string public constant CANCELLATION_FEE_REDEEM_FAILED = '90';
string public constant INVALID_CANCELLATION_FEE_COLLECTOR = '91';
string public constant INVALID_CANCELLATION_FEE_SENT = '92';
string public constant CANCELLATION_FEE_ALREADY_REDEEMED = '93';
string public constant INVALID_STATE_TO_REDEEM_CANCELLATION_FEE = '94';
string public constant MISSING_REPRESENTATION_ROOTS = '95';
string public constant CALLER_IS_NOT_VOTER_REPRESENTATIVE = '96';
string public constant VM_INVALID_GOVERNANCE_ADDRESS = '97';
string public constant ALL_DELEGATION_ACTIONS_FAILED = '98';
}
文件 2 的 4:IGovernancePowerDelegationToken.sol
pragma solidity ^0.8.0;
interface IGovernancePowerDelegationToken {
enum GovernancePowerType {
VOTING,
PROPOSITION
}
event DelegateChanged(
address indexed delegator,
address indexed delegatee,
GovernancePowerType delegationType
);
function delegateByType(address delegatee, GovernancePowerType delegationType) external;
function delegate(address delegatee) external;
function getDelegateeByType(address delegator, GovernancePowerType delegationType)
external
view
returns (address);
function getDelegates(address delegator)
external
view
returns (address, address);
function getPowerCurrent(address user, GovernancePowerType delegationType)
external
view
returns (uint256);
function getPowersCurrent(address user)
external
view
returns (uint256, uint256);
function metaDelegateByType(
address delegator,
address delegatee,
GovernancePowerType delegationType,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) external;
function metaDelegate(
address delegator,
address delegatee,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) external;
}
文件 3 的 4:IMetaDelegateHelper.sol
pragma solidity ^0.8.0;
import {IGovernancePowerDelegationToken} from 'aave-token-v3/interfaces/IGovernancePowerDelegationToken.sol';
interface IMetaDelegateHelper {
enum DelegationType {
VOTING,
PROPOSITION,
ALL
}
struct MetaDelegateParams {
IGovernancePowerDelegationToken underlyingAsset;
DelegationType delegationType;
address delegator;
address delegatee;
uint256 deadline;
uint8 v;
bytes32 r;
bytes32 s;
}
function batchMetaDelegate(MetaDelegateParams[] calldata delegateParams)
external;
}
文件 4 的 4:MetaDelegateHelper.sol
pragma solidity ^0.8.0;
import {IGovernancePowerDelegationToken} from 'aave-token-v3/interfaces/IGovernancePowerDelegationToken.sol';
import {IMetaDelegateHelper} from './interfaces/IMetaDelegateHelper.sol';
import {Errors} from '../libraries/Errors.sol';
contract MetaDelegateHelper is IMetaDelegateHelper {
function batchMetaDelegate(
MetaDelegateParams[] calldata delegateParams
) external {
bool atLeastOnePassed = false;
for (uint256 i = 0; i < delegateParams.length; i++) {
if (delegateParams[i].delegationType == DelegationType.ALL) {
try
delegateParams[i].underlyingAsset.metaDelegate(
delegateParams[i].delegator,
delegateParams[i].delegatee,
delegateParams[i].deadline,
delegateParams[i].v,
delegateParams[i].r,
delegateParams[i].s
)
{
atLeastOnePassed = true;
} catch {}
} else {
try
delegateParams[i].underlyingAsset.metaDelegateByType(
delegateParams[i].delegator,
delegateParams[i].delegatee,
delegateParams[i].delegationType == DelegationType.VOTING
? IGovernancePowerDelegationToken.GovernancePowerType.VOTING
: IGovernancePowerDelegationToken.GovernancePowerType.PROPOSITION,
delegateParams[i].deadline,
delegateParams[i].v,
delegateParams[i].r,
delegateParams[i].s
)
{
atLeastOnePassed = true;
} catch {}
}
}
require(atLeastOnePassed, Errors.ALL_DELEGATION_ACTIONS_FAILED);
}
}
{
"compilationTarget": {
"src/contracts/dataHelpers/MetaDelegateHelper.sol": "MetaDelegateHelper"
},
"evmVersion": "paris",
"libraries": {},
"metadata": {
"bytecodeHash": "ipfs"
},
"optimizer": {
"enabled": true,
"runs": 200
},
"remappings": [
":@aave/core-v3/=lib/aave-address-book/lib/aave-v3-core/",
":@aave/periphery-v3/=lib/aave-address-book/lib/aave-v3-periphery/",
":@openzeppelin/=lib/aave-crosschain-infra/lib/openzeppelin-contracts/",
":aave-address-book/=lib/aave-address-book/src/",
":aave-crosschain-infra-scripts/=lib/aave-crosschain-infra/scripts/",
":aave-crosschain-infra/=lib/aave-crosschain-infra/src/",
":aave-token-v2/=lib/aave-token-v3/lib/aave-token-v2/contracts/",
":aave-token-v3/=lib/aave-token-v3/src/",
":aave-v3-core/=lib/aave-address-book/lib/aave-v3-core/",
":aave-v3-periphery/=lib/aave-address-book/lib/aave-v3-periphery/",
":ds-test/=lib/forge-std/lib/ds-test/src/",
":erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/",
":forge-std/=lib/forge-std/src/",
":hyperlane-monorepo/=lib/aave-crosschain-infra/lib/hyperlane-monorepo/",
":nitro-contracts/=lib/aave-crosschain-infra/lib/nitro-contracts/src/",
":openzeppelin-contracts/=lib/openzeppelin-contracts/",
":openzeppelin/=lib/openzeppelin-contracts/contracts/",
":solidity-examples/=lib/aave-crosschain-infra/lib/solidity-examples/contracts/",
":solidity-utils/=lib/solidity-utils/src/"
]
}
[{"inputs":[{"components":[{"internalType":"contract IGovernancePowerDelegationToken","name":"underlyingAsset","type":"address"},{"internalType":"enum IMetaDelegateHelper.DelegationType","name":"delegationType","type":"uint8"},{"internalType":"address","name":"delegator","type":"address"},{"internalType":"address","name":"delegatee","type":"address"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"internalType":"struct IMetaDelegateHelper.MetaDelegateParams[]","name":"delegateParams","type":"tuple[]"}],"name":"batchMetaDelegate","outputs":[],"stateMutability":"nonpayable","type":"function"}]