Tornado Contrib 2024-09-21 18:11:39 +00:00
parent 6741664a89
commit 44b4d70f86
Signed by: tornadocontrib
GPG Key ID: 60B4DF1A076C64B1
30 changed files with 360 additions and 62 deletions

@ -98,6 +98,7 @@ contract RelayerRegistry is Initializable {
event MinimumStakeAmount(uint256 minStakeAmount); event MinimumStakeAmount(uint256 minStakeAmount);
event RouterRegistered(address tornadoRouter); event RouterRegistered(address tornadoRouter);
event RelayerRegistered(bytes32 relayer, string ensName, address relayerAddress, uint256 stakedAmount); event RelayerRegistered(bytes32 relayer, string ensName, address relayerAddress, uint256 stakedAmount);
event RelayerUnregistered(address relayer);
modifier onlyGovernance() { modifier onlyGovernance() {
require(msg.sender == governance, "only governance"); require(msg.sender == governance, "only governance");
@ -114,9 +115,7 @@ contract RelayerRegistry is Initializable {
_; _;
} }
constructor(address _torn, address _governance, address _ens, address _staking, address _feeManager) constructor(address _torn, address _governance, address _ens, address _staking, address _feeManager) public {
public
{
torn = TORN(_torn); torn = TORN(_torn);
governance = _governance; governance = _governance;
ens = IENS(_ens); ens = IENS(_ens);
@ -141,9 +140,7 @@ contract RelayerRegistry is Initializable {
* @param stake the initial amount of stake in TORN the relayer is depositing * @param stake the initial amount of stake in TORN the relayer is depositing
* *
*/ */
function register(string calldata ensName, uint256 stake, address[] calldata workersToRegister) function register(string calldata ensName, uint256 stake, address[] calldata workersToRegister) external {
external
{
_register(msg.sender, ensName, stake, workersToRegister); _register(msg.sender, ensName, stake, workersToRegister);
} }
@ -172,7 +169,11 @@ contract RelayerRegistry is Initializable {
address[] calldata workersToRegister address[] calldata workersToRegister
) internal { ) internal {
bytes32 ensHash = bytes(ensName).namehash(); bytes32 ensHash = bytes(ensName).namehash();
require(relayer == ens.owner(ensHash), "only ens owner"); address domainOwner = ens.owner(ensHash);
address ensNameWrapper = 0xD4416b13d2b3a9aBae7AcD5D6C2BbDBE25686401;
require(domainOwner != ensNameWrapper, "only unwrapped ens domains");
require(relayer == domainOwner, "only ens domain owner");
require(workers[relayer] == address(0), "cant register again"); require(workers[relayer] == address(0), "cant register again");
RelayerState storage metadata = relayers[relayer]; RelayerState storage metadata = relayers[relayer];
@ -225,6 +226,18 @@ contract RelayerRegistry is Initializable {
workers[worker] = address(0); workers[worker] = address(0);
} }
/**
* @notice This function should allow governance to unregister relayer
* @param relayer Address of the relayer
*
*/
function unregisterRelayer(address relayer) external onlyGovernance {
nullifyBalance(relayer);
delete relayers[relayer];
delete workers[relayer];
emit RelayerUnregistered(relayer);
}
/** /**
* @notice This function should allow anybody to stake to a relayer more TORN * @notice This function should allow anybody to stake to a relayer more TORN
* @param relayer Relayer main address to stake to * @param relayer Relayer main address to stake to
@ -314,7 +327,7 @@ contract RelayerRegistry is Initializable {
* @param relayer address of relayer who's balance is to nullify * @param relayer address of relayer who's balance is to nullify
* *
*/ */
function nullifyBalance(address relayer) external onlyGovernance { function nullifyBalance(address relayer) public onlyGovernance {
address masterAddress = workers[relayer]; address masterAddress = workers[relayer];
require(relayer == masterAddress, "must be master"); require(relayer == masterAddress, "must be master");
relayers[masterAddress].balance = 0; relayers[masterAddress].balance = 0;

@ -103,6 +103,21 @@ contract TornadoStakingRewards is Initializable {
accumulatedRewards[account] = accumulatedRewards[account].add(claimed); accumulatedRewards[account] = accumulatedRewards[account].add(claimed);
} }
/**
* @notice This function should allow governance to directly set accumulated rewards amount for an account
* @dev IMPORTANT FUNCTION:
* Do NOT use to update rewards in normal cases, see `updateRewardsOnLockedBalanceChange` function
* for this purposes. This function should be used only for fix bugs with rewards.
* You need to replenish Staking contract with TORN, if you increase staker rewards
* amount with this function, or withdraw TORN from Staking contract, if staker rewards decreased.
* @param account address of account to set rewards amount
* @param amount expected account accumulated rewards balance
*
*/
function setReward(address account, uint256 amount) external onlyGovernance {
accumulatedRewards[account] = amount;
}
/** /**
* @notice This function should allow governance rescue tokens from the staking rewards contract * @notice This function should allow governance rescue tokens from the staking rewards contract
* *

@ -1,8 +1,8 @@
import type { BaseContract, BigNumberish, BytesLike, FunctionFragment, Result, Interface, EventFragment, AddressLike, ContractRunner, ContractMethod, Listener } from "ethers"; import type { BaseContract, BigNumberish, BytesLike, FunctionFragment, Result, Interface, EventFragment, AddressLike, ContractRunner, ContractMethod, Listener } from "ethers";
import type { TypedContractEvent, TypedDeferredTopicFilter, TypedEventLog, TypedLogDescription, TypedListener, TypedContractMethod } from "../../../common"; import type { TypedContractEvent, TypedDeferredTopicFilter, TypedEventLog, TypedLogDescription, TypedListener, TypedContractMethod } from "../../../common";
export interface RelayerRegistryInterface extends Interface { export interface RelayerRegistryInterface extends Interface {
getFunction(nameOrSignature: "burn" | "ens" | "feeManager" | "getRelayerBalance" | "getRelayerEnsHash" | "governance" | "initialize" | "isRelayer" | "isRelayerRegistered" | "minStakeAmount" | "nullifyBalance" | "register" | "registerPermit" | "registerWorker" | "relayers" | "setMinStakeAmount" | "setTornadoRouter" | "stakeToRelayer" | "stakeToRelayerPermit" | "staking" | "torn" | "tornadoRouter" | "unregisterWorker" | "workers"): FunctionFragment; getFunction(nameOrSignature: "burn" | "ens" | "feeManager" | "getRelayerBalance" | "getRelayerEnsHash" | "governance" | "initialize" | "isRelayer" | "isRelayerRegistered" | "minStakeAmount" | "nullifyBalance" | "register" | "registerPermit" | "registerWorker" | "relayers" | "setMinStakeAmount" | "setTornadoRouter" | "stakeToRelayer" | "stakeToRelayerPermit" | "staking" | "torn" | "tornadoRouter" | "unregisterRelayer" | "unregisterWorker" | "workers"): FunctionFragment;
getEvent(nameOrSignatureOrTopic: "MinimumStakeAmount" | "RelayerBalanceNullified" | "RelayerRegistered" | "RouterRegistered" | "StakeAddedToRelayer" | "StakeBurned" | "WorkerRegistered" | "WorkerUnregistered"): EventFragment; getEvent(nameOrSignatureOrTopic: "MinimumStakeAmount" | "RelayerBalanceNullified" | "RelayerRegistered" | "RelayerUnregistered" | "RouterRegistered" | "StakeAddedToRelayer" | "StakeBurned" | "WorkerRegistered" | "WorkerUnregistered"): EventFragment;
encodeFunctionData(functionFragment: "burn", values: [AddressLike, AddressLike, AddressLike]): string; encodeFunctionData(functionFragment: "burn", values: [AddressLike, AddressLike, AddressLike]): string;
encodeFunctionData(functionFragment: "ens", values?: undefined): string; encodeFunctionData(functionFragment: "ens", values?: undefined): string;
encodeFunctionData(functionFragment: "feeManager", values?: undefined): string; encodeFunctionData(functionFragment: "feeManager", values?: undefined): string;
@ -42,6 +42,7 @@ export interface RelayerRegistryInterface extends Interface {
encodeFunctionData(functionFragment: "staking", values?: undefined): string; encodeFunctionData(functionFragment: "staking", values?: undefined): string;
encodeFunctionData(functionFragment: "torn", values?: undefined): string; encodeFunctionData(functionFragment: "torn", values?: undefined): string;
encodeFunctionData(functionFragment: "tornadoRouter", values?: undefined): string; encodeFunctionData(functionFragment: "tornadoRouter", values?: undefined): string;
encodeFunctionData(functionFragment: "unregisterRelayer", values: [AddressLike]): string;
encodeFunctionData(functionFragment: "unregisterWorker", values: [AddressLike]): string; encodeFunctionData(functionFragment: "unregisterWorker", values: [AddressLike]): string;
encodeFunctionData(functionFragment: "workers", values: [AddressLike]): string; encodeFunctionData(functionFragment: "workers", values: [AddressLike]): string;
decodeFunctionResult(functionFragment: "burn", data: BytesLike): Result; decodeFunctionResult(functionFragment: "burn", data: BytesLike): Result;
@ -66,6 +67,7 @@ export interface RelayerRegistryInterface extends Interface {
decodeFunctionResult(functionFragment: "staking", data: BytesLike): Result; decodeFunctionResult(functionFragment: "staking", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "torn", data: BytesLike): Result; decodeFunctionResult(functionFragment: "torn", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "tornadoRouter", data: BytesLike): Result; decodeFunctionResult(functionFragment: "tornadoRouter", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "unregisterRelayer", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "unregisterWorker", data: BytesLike): Result; decodeFunctionResult(functionFragment: "unregisterWorker", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "workers", data: BytesLike): Result; decodeFunctionResult(functionFragment: "workers", data: BytesLike): Result;
} }
@ -115,6 +117,17 @@ export declare namespace RelayerRegisteredEvent {
type Log = TypedEventLog<Event>; type Log = TypedEventLog<Event>;
type LogDescription = TypedLogDescription<Event>; type LogDescription = TypedLogDescription<Event>;
} }
export declare namespace RelayerUnregisteredEvent {
type InputTuple = [relayer: AddressLike];
type OutputTuple = [relayer: string];
interface OutputObject {
relayer: string;
}
type Event = TypedContractEvent<InputTuple, OutputTuple, OutputObject>;
type Filter = TypedDeferredTopicFilter<Event>;
type Log = TypedEventLog<Event>;
type LogDescription = TypedLogDescription<Event>;
}
export declare namespace RouterRegisteredEvent { export declare namespace RouterRegisteredEvent {
type InputTuple = [tornadoRouter: AddressLike]; type InputTuple = [tornadoRouter: AddressLike];
type OutputTuple = [tornadoRouter: string]; type OutputTuple = [tornadoRouter: string];
@ -291,6 +304,11 @@ export interface RelayerRegistry extends BaseContract {
staking: TypedContractMethod<[], [string], "view">; staking: TypedContractMethod<[], [string], "view">;
torn: TypedContractMethod<[], [string], "view">; torn: TypedContractMethod<[], [string], "view">;
tornadoRouter: TypedContractMethod<[], [string], "view">; tornadoRouter: TypedContractMethod<[], [string], "view">;
unregisterRelayer: TypedContractMethod<[
relayer: AddressLike
], [
void
], "nonpayable">;
unregisterWorker: TypedContractMethod<[ unregisterWorker: TypedContractMethod<[
worker: AddressLike worker: AddressLike
], [ ], [
@ -379,11 +397,13 @@ export interface RelayerRegistry extends BaseContract {
getFunction(nameOrSignature: "staking"): TypedContractMethod<[], [string], "view">; getFunction(nameOrSignature: "staking"): TypedContractMethod<[], [string], "view">;
getFunction(nameOrSignature: "torn"): TypedContractMethod<[], [string], "view">; getFunction(nameOrSignature: "torn"): TypedContractMethod<[], [string], "view">;
getFunction(nameOrSignature: "tornadoRouter"): TypedContractMethod<[], [string], "view">; getFunction(nameOrSignature: "tornadoRouter"): TypedContractMethod<[], [string], "view">;
getFunction(nameOrSignature: "unregisterRelayer"): TypedContractMethod<[relayer: AddressLike], [void], "nonpayable">;
getFunction(nameOrSignature: "unregisterWorker"): TypedContractMethod<[worker: AddressLike], [void], "nonpayable">; getFunction(nameOrSignature: "unregisterWorker"): TypedContractMethod<[worker: AddressLike], [void], "nonpayable">;
getFunction(nameOrSignature: "workers"): TypedContractMethod<[arg0: AddressLike], [string], "view">; getFunction(nameOrSignature: "workers"): TypedContractMethod<[arg0: AddressLike], [string], "view">;
getEvent(key: "MinimumStakeAmount"): TypedContractEvent<MinimumStakeAmountEvent.InputTuple, MinimumStakeAmountEvent.OutputTuple, MinimumStakeAmountEvent.OutputObject>; getEvent(key: "MinimumStakeAmount"): TypedContractEvent<MinimumStakeAmountEvent.InputTuple, MinimumStakeAmountEvent.OutputTuple, MinimumStakeAmountEvent.OutputObject>;
getEvent(key: "RelayerBalanceNullified"): TypedContractEvent<RelayerBalanceNullifiedEvent.InputTuple, RelayerBalanceNullifiedEvent.OutputTuple, RelayerBalanceNullifiedEvent.OutputObject>; getEvent(key: "RelayerBalanceNullified"): TypedContractEvent<RelayerBalanceNullifiedEvent.InputTuple, RelayerBalanceNullifiedEvent.OutputTuple, RelayerBalanceNullifiedEvent.OutputObject>;
getEvent(key: "RelayerRegistered"): TypedContractEvent<RelayerRegisteredEvent.InputTuple, RelayerRegisteredEvent.OutputTuple, RelayerRegisteredEvent.OutputObject>; getEvent(key: "RelayerRegistered"): TypedContractEvent<RelayerRegisteredEvent.InputTuple, RelayerRegisteredEvent.OutputTuple, RelayerRegisteredEvent.OutputObject>;
getEvent(key: "RelayerUnregistered"): TypedContractEvent<RelayerUnregisteredEvent.InputTuple, RelayerUnregisteredEvent.OutputTuple, RelayerUnregisteredEvent.OutputObject>;
getEvent(key: "RouterRegistered"): TypedContractEvent<RouterRegisteredEvent.InputTuple, RouterRegisteredEvent.OutputTuple, RouterRegisteredEvent.OutputObject>; getEvent(key: "RouterRegistered"): TypedContractEvent<RouterRegisteredEvent.InputTuple, RouterRegisteredEvent.OutputTuple, RouterRegisteredEvent.OutputObject>;
getEvent(key: "StakeAddedToRelayer"): TypedContractEvent<StakeAddedToRelayerEvent.InputTuple, StakeAddedToRelayerEvent.OutputTuple, StakeAddedToRelayerEvent.OutputObject>; getEvent(key: "StakeAddedToRelayer"): TypedContractEvent<StakeAddedToRelayerEvent.InputTuple, StakeAddedToRelayerEvent.OutputTuple, StakeAddedToRelayerEvent.OutputObject>;
getEvent(key: "StakeBurned"): TypedContractEvent<StakeBurnedEvent.InputTuple, StakeBurnedEvent.OutputTuple, StakeBurnedEvent.OutputObject>; getEvent(key: "StakeBurned"): TypedContractEvent<StakeBurnedEvent.InputTuple, StakeBurnedEvent.OutputTuple, StakeBurnedEvent.OutputObject>;
@ -396,6 +416,8 @@ export interface RelayerRegistry extends BaseContract {
RelayerBalanceNullified: TypedContractEvent<RelayerBalanceNullifiedEvent.InputTuple, RelayerBalanceNullifiedEvent.OutputTuple, RelayerBalanceNullifiedEvent.OutputObject>; RelayerBalanceNullified: TypedContractEvent<RelayerBalanceNullifiedEvent.InputTuple, RelayerBalanceNullifiedEvent.OutputTuple, RelayerBalanceNullifiedEvent.OutputObject>;
"RelayerRegistered(bytes32,string,address,uint256)": TypedContractEvent<RelayerRegisteredEvent.InputTuple, RelayerRegisteredEvent.OutputTuple, RelayerRegisteredEvent.OutputObject>; "RelayerRegistered(bytes32,string,address,uint256)": TypedContractEvent<RelayerRegisteredEvent.InputTuple, RelayerRegisteredEvent.OutputTuple, RelayerRegisteredEvent.OutputObject>;
RelayerRegistered: TypedContractEvent<RelayerRegisteredEvent.InputTuple, RelayerRegisteredEvent.OutputTuple, RelayerRegisteredEvent.OutputObject>; RelayerRegistered: TypedContractEvent<RelayerRegisteredEvent.InputTuple, RelayerRegisteredEvent.OutputTuple, RelayerRegisteredEvent.OutputObject>;
"RelayerUnregistered(address)": TypedContractEvent<RelayerUnregisteredEvent.InputTuple, RelayerUnregisteredEvent.OutputTuple, RelayerUnregisteredEvent.OutputObject>;
RelayerUnregistered: TypedContractEvent<RelayerUnregisteredEvent.InputTuple, RelayerUnregisteredEvent.OutputTuple, RelayerUnregisteredEvent.OutputObject>;
"RouterRegistered(address)": TypedContractEvent<RouterRegisteredEvent.InputTuple, RouterRegisteredEvent.OutputTuple, RouterRegisteredEvent.OutputObject>; "RouterRegistered(address)": TypedContractEvent<RouterRegisteredEvent.InputTuple, RouterRegisteredEvent.OutputTuple, RouterRegisteredEvent.OutputObject>;
RouterRegistered: TypedContractEvent<RouterRegisteredEvent.InputTuple, RouterRegisteredEvent.OutputTuple, RouterRegisteredEvent.OutputObject>; RouterRegistered: TypedContractEvent<RouterRegisteredEvent.InputTuple, RouterRegisteredEvent.OutputTuple, RouterRegisteredEvent.OutputObject>;
"StakeAddedToRelayer(address,uint256)": TypedContractEvent<StakeAddedToRelayerEvent.InputTuple, StakeAddedToRelayerEvent.OutputTuple, StakeAddedToRelayerEvent.OutputObject>; "StakeAddedToRelayer(address,uint256)": TypedContractEvent<StakeAddedToRelayerEvent.InputTuple, StakeAddedToRelayerEvent.OutputTuple, StakeAddedToRelayerEvent.OutputObject>;

@ -1,7 +1,7 @@
import type { BaseContract, BigNumberish, BytesLike, FunctionFragment, Result, Interface, EventFragment, AddressLike, ContractRunner, ContractMethod, Listener } from "ethers"; import type { BaseContract, BigNumberish, BytesLike, FunctionFragment, Result, Interface, EventFragment, AddressLike, ContractRunner, ContractMethod, Listener } from "ethers";
import type { TypedContractEvent, TypedDeferredTopicFilter, TypedEventLog, TypedLogDescription, TypedListener, TypedContractMethod } from "../../../common"; import type { TypedContractEvent, TypedDeferredTopicFilter, TypedEventLog, TypedLogDescription, TypedListener, TypedContractMethod } from "../../../common";
export interface TornadoStakingRewardsInterface extends Interface { export interface TornadoStakingRewardsInterface extends Interface {
getFunction(nameOrSignature: "Governance" | "accumulatedRewardPerTorn" | "accumulatedRewardRateOnLastUpdate" | "accumulatedRewards" | "addBurnRewards" | "checkReward" | "getReward" | "ratioConstant" | "relayerRegistry" | "torn" | "updateRewardsOnLockedBalanceChange" | "withdrawTorn"): FunctionFragment; getFunction(nameOrSignature: "Governance" | "accumulatedRewardPerTorn" | "accumulatedRewardRateOnLastUpdate" | "accumulatedRewards" | "addBurnRewards" | "checkReward" | "getReward" | "ratioConstant" | "relayerRegistry" | "setReward" | "torn" | "updateRewardsOnLockedBalanceChange" | "withdrawTorn"): FunctionFragment;
getEvent(nameOrSignatureOrTopic: "RewardsClaimed" | "RewardsUpdated"): EventFragment; getEvent(nameOrSignatureOrTopic: "RewardsClaimed" | "RewardsUpdated"): EventFragment;
encodeFunctionData(functionFragment: "Governance", values?: undefined): string; encodeFunctionData(functionFragment: "Governance", values?: undefined): string;
encodeFunctionData(functionFragment: "accumulatedRewardPerTorn", values?: undefined): string; encodeFunctionData(functionFragment: "accumulatedRewardPerTorn", values?: undefined): string;
@ -12,6 +12,7 @@ export interface TornadoStakingRewardsInterface extends Interface {
encodeFunctionData(functionFragment: "getReward", values?: undefined): string; encodeFunctionData(functionFragment: "getReward", values?: undefined): string;
encodeFunctionData(functionFragment: "ratioConstant", values?: undefined): string; encodeFunctionData(functionFragment: "ratioConstant", values?: undefined): string;
encodeFunctionData(functionFragment: "relayerRegistry", values?: undefined): string; encodeFunctionData(functionFragment: "relayerRegistry", values?: undefined): string;
encodeFunctionData(functionFragment: "setReward", values: [AddressLike, BigNumberish]): string;
encodeFunctionData(functionFragment: "torn", values?: undefined): string; encodeFunctionData(functionFragment: "torn", values?: undefined): string;
encodeFunctionData(functionFragment: "updateRewardsOnLockedBalanceChange", values: [AddressLike, BigNumberish]): string; encodeFunctionData(functionFragment: "updateRewardsOnLockedBalanceChange", values: [AddressLike, BigNumberish]): string;
encodeFunctionData(functionFragment: "withdrawTorn", values: [BigNumberish]): string; encodeFunctionData(functionFragment: "withdrawTorn", values: [BigNumberish]): string;
@ -24,6 +25,7 @@ export interface TornadoStakingRewardsInterface extends Interface {
decodeFunctionResult(functionFragment: "getReward", data: BytesLike): Result; decodeFunctionResult(functionFragment: "getReward", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "ratioConstant", data: BytesLike): Result; decodeFunctionResult(functionFragment: "ratioConstant", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "relayerRegistry", data: BytesLike): Result; decodeFunctionResult(functionFragment: "relayerRegistry", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "setReward", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "torn", data: BytesLike): Result; decodeFunctionResult(functionFragment: "torn", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "updateRewardsOnLockedBalanceChange", data: BytesLike): Result; decodeFunctionResult(functionFragment: "updateRewardsOnLockedBalanceChange", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "withdrawTorn", data: BytesLike): Result; decodeFunctionResult(functionFragment: "withdrawTorn", data: BytesLike): Result;
@ -86,6 +88,12 @@ export interface TornadoStakingRewards extends BaseContract {
getReward: TypedContractMethod<[], [void], "nonpayable">; getReward: TypedContractMethod<[], [void], "nonpayable">;
ratioConstant: TypedContractMethod<[], [bigint], "view">; ratioConstant: TypedContractMethod<[], [bigint], "view">;
relayerRegistry: TypedContractMethod<[], [string], "view">; relayerRegistry: TypedContractMethod<[], [string], "view">;
setReward: TypedContractMethod<[
account: AddressLike,
amount: BigNumberish
], [
void
], "nonpayable">;
torn: TypedContractMethod<[], [string], "view">; torn: TypedContractMethod<[], [string], "view">;
updateRewardsOnLockedBalanceChange: TypedContractMethod<[ updateRewardsOnLockedBalanceChange: TypedContractMethod<[
account: AddressLike, account: AddressLike,
@ -108,6 +116,12 @@ export interface TornadoStakingRewards extends BaseContract {
getFunction(nameOrSignature: "getReward"): TypedContractMethod<[], [void], "nonpayable">; getFunction(nameOrSignature: "getReward"): TypedContractMethod<[], [void], "nonpayable">;
getFunction(nameOrSignature: "ratioConstant"): TypedContractMethod<[], [bigint], "view">; getFunction(nameOrSignature: "ratioConstant"): TypedContractMethod<[], [bigint], "view">;
getFunction(nameOrSignature: "relayerRegistry"): TypedContractMethod<[], [string], "view">; getFunction(nameOrSignature: "relayerRegistry"): TypedContractMethod<[], [string], "view">;
getFunction(nameOrSignature: "setReward"): TypedContractMethod<[
account: AddressLike,
amount: BigNumberish
], [
void
], "nonpayable">;
getFunction(nameOrSignature: "torn"): TypedContractMethod<[], [string], "view">; getFunction(nameOrSignature: "torn"): TypedContractMethod<[], [string], "view">;
getFunction(nameOrSignature: "updateRewardsOnLockedBalanceChange"): TypedContractMethod<[ getFunction(nameOrSignature: "updateRewardsOnLockedBalanceChange"): TypedContractMethod<[
account: AddressLike, account: AddressLike,

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -14,7 +14,7 @@ export declare class TornadoProxyLight__factory extends ContractFactory {
deploymentTransaction(): ContractTransactionResponse; deploymentTransaction(): ContractTransactionResponse;
}>; }>;
connect(runner: ContractRunner | null): TornadoProxyLight__factory; connect(runner: ContractRunner | null): TornadoProxyLight__factory;
static readonly bytecode = "0x608060405234801561001057600080fd5b506104f6806100206000396000f3fe6080604052600436106100345760003560e01c806313d98d13146100395780636485ba2a1461004e578063b438689f1461006e575b600080fd5b61004c6100473660046102c7565b610081565b005b34801561005a57600080fd5b5061004c610069366004610258565b61012a565b61004c61007c366004610321565b610198565b60405163b214faa560e01b81526001600160a01b0385169063b214faa59034906100af9087906004016103ec565b6000604051808303818588803b1580156100c857600080fd5b505af11580156100dc573d6000803e3d6000fd5b5050505050336001600160a01b03167ffa28df43db3553771f7209dcef046f3bdfea15870ab625dcda30ac58b82b4008838360405161011c9291906103f5565b60405180910390a250505050565b60005b8181101561019357337ffa28df43db3553771f7209dcef046f3bdfea15870ab625dcda30ac58b82b400884848481811061016357fe5b90506020028101906101759190610463565b6040516101839291906103f5565b60405180910390a260010161012d565b505050565b6040516310d056db60e11b81526001600160a01b038a16906321a0adb69034906101d4908c908c908c908c908c908c908c908c90600401610411565b6000604051808303818588803b1580156101ed57600080fd5b505af1158015610201573d6000803e3d6000fd5b5050505050505050505050505050565b60008083601f840112610222578182fd5b50813567ffffffffffffffff811115610239578182fd5b60208301915083602082850101111561025157600080fd5b9250929050565b6000806020838503121561026a578182fd5b823567ffffffffffffffff80821115610281578384fd5b818501915085601f830112610294578384fd5b8135818111156102a2578485fd5b86602080830285010111156102b5578485fd5b60209290920196919550909350505050565b600080600080606085870312156102dc578182fd5b84356102e7816104a8565b935060208501359250604085013567ffffffffffffffff811115610309578283fd5b61031587828801610211565b95989497509550505050565b60008060008060008060008060006101008a8c03121561033f578485fd5b893561034a816104a8565b985060208a013567ffffffffffffffff811115610365578586fd5b6103718c828d01610211565b90995097505060408a0135955060608a0135945060808a0135610393816104a8565b935060a08a01356103a3816104a8565b8093505060c08a0135915060e08a013590509295985092959850929598565b60008284528282602086013780602084860101526020601f19601f85011685010190509392505050565b90815260200190565b6000602082526104096020830184866103c2565b949350505050565b600060e0825261042560e083018a8c6103c2565b60208301989098525060408101959095526001600160a01b03938416606086015291909216608084015260a083019190915260c09091015292915050565b6000808335601e19843603018112610479578283fd5b83018035915067ffffffffffffffff821115610493578283fd5b60200191503681900382131561025157600080fd5b6001600160a01b03811681146104bd57600080fd5b5056fea26469706673582212209e714d6385e2c86cc03186c5204b41573676ba810258f1b09d9b7e267ca73d2f64736f6c634300060c0033"; static readonly bytecode = "0x608060405234801561001057600080fd5b506104f6806100206000396000f3fe6080604052600436106100345760003560e01c806313d98d13146100395780636485ba2a1461004e578063b438689f1461006e575b600080fd5b61004c6100473660046102c7565b610081565b005b34801561005a57600080fd5b5061004c610069366004610258565b61012a565b61004c61007c366004610321565b610198565b60405163b214faa560e01b81526001600160a01b0385169063b214faa59034906100af9087906004016103ec565b6000604051808303818588803b1580156100c857600080fd5b505af11580156100dc573d6000803e3d6000fd5b5050505050336001600160a01b03167ffa28df43db3553771f7209dcef046f3bdfea15870ab625dcda30ac58b82b4008838360405161011c9291906103f5565b60405180910390a250505050565b60005b8181101561019357337ffa28df43db3553771f7209dcef046f3bdfea15870ab625dcda30ac58b82b400884848481811061016357fe5b90506020028101906101759190610463565b6040516101839291906103f5565b60405180910390a260010161012d565b505050565b6040516310d056db60e11b81526001600160a01b038a16906321a0adb69034906101d4908c908c908c908c908c908c908c908c90600401610411565b6000604051808303818588803b1580156101ed57600080fd5b505af1158015610201573d6000803e3d6000fd5b5050505050505050505050505050565b60008083601f840112610222578182fd5b50813567ffffffffffffffff811115610239578182fd5b60208301915083602082850101111561025157600080fd5b9250929050565b6000806020838503121561026a578182fd5b823567ffffffffffffffff80821115610281578384fd5b818501915085601f830112610294578384fd5b8135818111156102a2578485fd5b86602080830285010111156102b5578485fd5b60209290920196919550909350505050565b600080600080606085870312156102dc578182fd5b84356102e7816104a8565b935060208501359250604085013567ffffffffffffffff811115610309578283fd5b61031587828801610211565b95989497509550505050565b60008060008060008060008060006101008a8c03121561033f578485fd5b893561034a816104a8565b985060208a013567ffffffffffffffff811115610365578586fd5b6103718c828d01610211565b90995097505060408a0135955060608a0135945060808a0135610393816104a8565b935060a08a01356103a3816104a8565b8093505060c08a0135915060e08a013590509295985092959850929598565b60008284528282602086013780602084860101526020601f19601f85011685010190509392505050565b90815260200190565b6000602082526104096020830184866103c2565b949350505050565b600060e0825261042560e083018a8c6103c2565b60208301989098525060408101959095526001600160a01b03938416606086015291909216608084015260a083019190915260c09091015292915050565b6000808335601e19843603018112610479578283fd5b83018035915067ffffffffffffffff821115610493578283fd5b60200191503681900382131561025157600080fd5b6001600160a01b03811681146104bd57600080fd5b5056fea2646970667358221220a833625c5e7cc02dff95b380fd1e6d47b08cffea90c70cfe6739960deee47b8364736f6c634300060c0033";
static readonly abi: readonly [{ static readonly abi: readonly [{
readonly anonymous: false; readonly anonymous: false;
readonly inputs: readonly [{ readonly inputs: readonly [{

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

72
dist/index.js vendored

File diff suppressed because one or more lines are too long

72
dist/index.mjs vendored

File diff suppressed because one or more lines are too long

@ -1,6 +1,6 @@
{ {
"name": "@tornado/contracts", "name": "@tornado/contracts",
"version": "1.0.0", "version": "1.0.1",
"main": "./dist/index.js", "main": "./dist/index.js",
"module": "./dist/index.mjs", "module": "./dist/index.mjs",
"types": "./dist/index.d.ts", "types": "./dist/index.d.ts",

@ -48,6 +48,7 @@ export interface RelayerRegistryInterface extends Interface {
| "staking" | "staking"
| "torn" | "torn"
| "tornadoRouter" | "tornadoRouter"
| "unregisterRelayer"
| "unregisterWorker" | "unregisterWorker"
| "workers" | "workers"
): FunctionFragment; ): FunctionFragment;
@ -57,6 +58,7 @@ export interface RelayerRegistryInterface extends Interface {
| "MinimumStakeAmount" | "MinimumStakeAmount"
| "RelayerBalanceNullified" | "RelayerBalanceNullified"
| "RelayerRegistered" | "RelayerRegistered"
| "RelayerUnregistered"
| "RouterRegistered" | "RouterRegistered"
| "StakeAddedToRelayer" | "StakeAddedToRelayer"
| "StakeBurned" | "StakeBurned"
@ -160,6 +162,10 @@ export interface RelayerRegistryInterface extends Interface {
functionFragment: "tornadoRouter", functionFragment: "tornadoRouter",
values?: undefined values?: undefined
): string; ): string;
encodeFunctionData(
functionFragment: "unregisterRelayer",
values: [AddressLike]
): string;
encodeFunctionData( encodeFunctionData(
functionFragment: "unregisterWorker", functionFragment: "unregisterWorker",
values: [AddressLike] values: [AddressLike]
@ -227,6 +233,10 @@ export interface RelayerRegistryInterface extends Interface {
functionFragment: "tornadoRouter", functionFragment: "tornadoRouter",
data: BytesLike data: BytesLike
): Result; ): Result;
decodeFunctionResult(
functionFragment: "unregisterRelayer",
data: BytesLike
): Result;
decodeFunctionResult( decodeFunctionResult(
functionFragment: "unregisterWorker", functionFragment: "unregisterWorker",
data: BytesLike data: BytesLike
@ -283,6 +293,18 @@ export namespace RelayerRegisteredEvent {
export type LogDescription = TypedLogDescription<Event>; export type LogDescription = TypedLogDescription<Event>;
} }
export namespace RelayerUnregisteredEvent {
export type InputTuple = [relayer: AddressLike];
export type OutputTuple = [relayer: string];
export interface OutputObject {
relayer: string;
}
export type Event = TypedContractEvent<InputTuple, OutputTuple, OutputObject>;
export type Filter = TypedDeferredTopicFilter<Event>;
export type Log = TypedEventLog<Event>;
export type LogDescription = TypedLogDescription<Event>;
}
export namespace RouterRegisteredEvent { export namespace RouterRegisteredEvent {
export type InputTuple = [tornadoRouter: AddressLike]; export type InputTuple = [tornadoRouter: AddressLike];
export type OutputTuple = [tornadoRouter: string]; export type OutputTuple = [tornadoRouter: string];
@ -510,6 +532,12 @@ export interface RelayerRegistry extends BaseContract {
tornadoRouter: TypedContractMethod<[], [string], "view">; tornadoRouter: TypedContractMethod<[], [string], "view">;
unregisterRelayer: TypedContractMethod<
[relayer: AddressLike],
[void],
"nonpayable"
>;
unregisterWorker: TypedContractMethod< unregisterWorker: TypedContractMethod<
[worker: AddressLike], [worker: AddressLike],
[void], [void],
@ -641,6 +669,9 @@ export interface RelayerRegistry extends BaseContract {
getFunction( getFunction(
nameOrSignature: "tornadoRouter" nameOrSignature: "tornadoRouter"
): TypedContractMethod<[], [string], "view">; ): TypedContractMethod<[], [string], "view">;
getFunction(
nameOrSignature: "unregisterRelayer"
): TypedContractMethod<[relayer: AddressLike], [void], "nonpayable">;
getFunction( getFunction(
nameOrSignature: "unregisterWorker" nameOrSignature: "unregisterWorker"
): TypedContractMethod<[worker: AddressLike], [void], "nonpayable">; ): TypedContractMethod<[worker: AddressLike], [void], "nonpayable">;
@ -669,6 +700,13 @@ export interface RelayerRegistry extends BaseContract {
RelayerRegisteredEvent.OutputTuple, RelayerRegisteredEvent.OutputTuple,
RelayerRegisteredEvent.OutputObject RelayerRegisteredEvent.OutputObject
>; >;
getEvent(
key: "RelayerUnregistered"
): TypedContractEvent<
RelayerUnregisteredEvent.InputTuple,
RelayerUnregisteredEvent.OutputTuple,
RelayerUnregisteredEvent.OutputObject
>;
getEvent( getEvent(
key: "RouterRegistered" key: "RouterRegistered"
): TypedContractEvent< ): TypedContractEvent<
@ -739,6 +777,17 @@ export interface RelayerRegistry extends BaseContract {
RelayerRegisteredEvent.OutputObject RelayerRegisteredEvent.OutputObject
>; >;
"RelayerUnregistered(address)": TypedContractEvent<
RelayerUnregisteredEvent.InputTuple,
RelayerUnregisteredEvent.OutputTuple,
RelayerUnregisteredEvent.OutputObject
>;
RelayerUnregistered: TypedContractEvent<
RelayerUnregisteredEvent.InputTuple,
RelayerUnregisteredEvent.OutputTuple,
RelayerUnregisteredEvent.OutputObject
>;
"RouterRegistered(address)": TypedContractEvent< "RouterRegistered(address)": TypedContractEvent<
RouterRegisteredEvent.InputTuple, RouterRegisteredEvent.InputTuple,
RouterRegisteredEvent.OutputTuple, RouterRegisteredEvent.OutputTuple,

@ -35,6 +35,7 @@ export interface TornadoStakingRewardsInterface extends Interface {
| "getReward" | "getReward"
| "ratioConstant" | "ratioConstant"
| "relayerRegistry" | "relayerRegistry"
| "setReward"
| "torn" | "torn"
| "updateRewardsOnLockedBalanceChange" | "updateRewardsOnLockedBalanceChange"
| "withdrawTorn" | "withdrawTorn"
@ -77,6 +78,10 @@ export interface TornadoStakingRewardsInterface extends Interface {
functionFragment: "relayerRegistry", functionFragment: "relayerRegistry",
values?: undefined values?: undefined
): string; ): string;
encodeFunctionData(
functionFragment: "setReward",
values: [AddressLike, BigNumberish]
): string;
encodeFunctionData(functionFragment: "torn", values?: undefined): string; encodeFunctionData(functionFragment: "torn", values?: undefined): string;
encodeFunctionData( encodeFunctionData(
functionFragment: "updateRewardsOnLockedBalanceChange", functionFragment: "updateRewardsOnLockedBalanceChange",
@ -117,6 +122,7 @@ export interface TornadoStakingRewardsInterface extends Interface {
functionFragment: "relayerRegistry", functionFragment: "relayerRegistry",
data: BytesLike data: BytesLike
): Result; ): Result;
decodeFunctionResult(functionFragment: "setReward", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "torn", data: BytesLike): Result; decodeFunctionResult(functionFragment: "torn", data: BytesLike): Result;
decodeFunctionResult( decodeFunctionResult(
functionFragment: "updateRewardsOnLockedBalanceChange", functionFragment: "updateRewardsOnLockedBalanceChange",
@ -227,6 +233,12 @@ export interface TornadoStakingRewards extends BaseContract {
relayerRegistry: TypedContractMethod<[], [string], "view">; relayerRegistry: TypedContractMethod<[], [string], "view">;
setReward: TypedContractMethod<
[account: AddressLike, amount: BigNumberish],
[void],
"nonpayable"
>;
torn: TypedContractMethod<[], [string], "view">; torn: TypedContractMethod<[], [string], "view">;
updateRewardsOnLockedBalanceChange: TypedContractMethod< updateRewardsOnLockedBalanceChange: TypedContractMethod<
@ -272,6 +284,13 @@ export interface TornadoStakingRewards extends BaseContract {
getFunction( getFunction(
nameOrSignature: "relayerRegistry" nameOrSignature: "relayerRegistry"
): TypedContractMethod<[], [string], "view">; ): TypedContractMethod<[], [string], "view">;
getFunction(
nameOrSignature: "setReward"
): TypedContractMethod<
[account: AddressLike, amount: BigNumberish],
[void],
"nonpayable"
>;
getFunction( getFunction(
nameOrSignature: "torn" nameOrSignature: "torn"
): TypedContractMethod<[], [string], "view">; ): TypedContractMethod<[], [string], "view">;

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long