Skip to content

Commit

Permalink
Add handler and tests for CarrotStaker contract
Browse files Browse the repository at this point in the history
  • Loading branch information
9inpachi committed Feb 18, 2025
1 parent d606343 commit 55aeede
Show file tree
Hide file tree
Showing 4 changed files with 568 additions and 0 deletions.
348 changes: 348 additions & 0 deletions lib/contracts/abis/mainnet/CarrotStaker.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,348 @@
export const CarrotStaker = <const>[
{
inputs: [
{ internalType: 'address', name: 'carrot', type: 'address' },
{ internalType: 'address', name: 'initialOwner', type: 'address' },
],
stateMutability: 'nonpayable',
type: 'constructor',
},
{
inputs: [
{ internalType: 'address', name: 'spender', type: 'address' },
{ internalType: 'uint256', name: 'allowance', type: 'uint256' },
{ internalType: 'uint256', name: 'needed', type: 'uint256' },
],
name: 'ERC20InsufficientAllowance',
type: 'error',
},
{
inputs: [
{ internalType: 'address', name: 'sender', type: 'address' },
{ internalType: 'uint256', name: 'balance', type: 'uint256' },
{ internalType: 'uint256', name: 'needed', type: 'uint256' },
],
name: 'ERC20InsufficientBalance',
type: 'error',
},
{
inputs: [{ internalType: 'address', name: 'approver', type: 'address' }],
name: 'ERC20InvalidApprover',
type: 'error',
},
{
inputs: [{ internalType: 'address', name: 'receiver', type: 'address' }],
name: 'ERC20InvalidReceiver',
type: 'error',
},
{
inputs: [{ internalType: 'address', name: 'sender', type: 'address' }],
name: 'ERC20InvalidSender',
type: 'error',
},
{
inputs: [{ internalType: 'address', name: 'spender', type: 'address' }],
name: 'ERC20InvalidSpender',
type: 'error',
},
{ inputs: [], name: 'InvalidAddress', type: 'error' },
{ inputs: [], name: 'MethodNotAllowed', type: 'error' },
{
inputs: [{ internalType: 'address', name: 'owner', type: 'address' }],
name: 'OwnableInvalidOwner',
type: 'error',
},
{
inputs: [{ internalType: 'address', name: 'account', type: 'address' }],
name: 'OwnableUnauthorizedAccount',
type: 'error',
},
{ inputs: [], name: 'UnauthorizedUnstakeEnable', type: 'error' },
{ inputs: [], name: 'UnstakingNotAllowed', type: 'error' },
{
anonymous: false,
inputs: [
{
indexed: true,
internalType: 'address',
name: 'owner',
type: 'address',
},
{
indexed: true,
internalType: 'address',
name: 'spender',
type: 'address',
},
{
indexed: false,
internalType: 'uint256',
name: 'value',
type: 'uint256',
},
],
name: 'Approval',
type: 'event',
},
{
anonymous: false,
inputs: [
{
indexed: true,
internalType: 'address',
name: 'previousOwner',
type: 'address',
},
{
indexed: true,
internalType: 'address',
name: 'newOwner',
type: 'address',
},
],
name: 'OwnershipTransferStarted',
type: 'event',
},
{
anonymous: false,
inputs: [
{
indexed: true,
internalType: 'address',
name: 'previousOwner',
type: 'address',
},
{
indexed: true,
internalType: 'address',
name: 'newOwner',
type: 'address',
},
],
name: 'OwnershipTransferred',
type: 'event',
},
{
anonymous: false,
inputs: [
{
indexed: true,
internalType: 'address',
name: 'staker',
type: 'address',
},
{
indexed: false,
internalType: 'uint256',
name: 'amount',
type: 'uint256',
},
],
name: 'Staked',
type: 'event',
},
{
anonymous: false,
inputs: [
{ indexed: true, internalType: 'address', name: 'from', type: 'address' },
{ indexed: true, internalType: 'address', name: 'to', type: 'address' },
{
indexed: false,
internalType: 'uint256',
name: 'value',
type: 'uint256',
},
],
name: 'Transfer',
type: 'event',
},
{
anonymous: false,
inputs: [
{
indexed: true,
internalType: 'address',
name: 'staker',
type: 'address',
},
{
indexed: true,
internalType: 'address',
name: 'recipient',
type: 'address',
},
{
indexed: false,
internalType: 'uint256',
name: 'amount',
type: 'uint256',
},
],
name: 'Unstaked',
type: 'event',
},
{
anonymous: false,
inputs: [
{ indexed: false, internalType: 'bool', name: 'allowed', type: 'bool' },
],
name: 'UnstakingAllowed',
type: 'event',
},
{
inputs: [],
name: 'CARROT',
outputs: [{ internalType: 'contract IERC20', name: '', type: 'address' }],
stateMutability: 'view',
type: 'function',
},
{
inputs: [],
name: 'UNSTAKING_OPEN_TIMESTAMP',
outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }],
stateMutability: 'view',
type: 'function',
},
{
inputs: [],
name: 'acceptOwnership',
outputs: [],
stateMutability: 'nonpayable',
type: 'function',
},
{
inputs: [],
name: 'allowUnstake',
outputs: [],
stateMutability: 'nonpayable',
type: 'function',
},
{
inputs: [
{ internalType: 'address', name: 'owner', type: 'address' },
{ internalType: 'address', name: 'spender', type: 'address' },
],
name: 'allowance',
outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }],
stateMutability: 'view',
type: 'function',
},
{
inputs: [
{ internalType: 'address', name: '', type: 'address' },
{ internalType: 'uint256', name: '', type: 'uint256' },
],
name: 'approve',
outputs: [{ internalType: 'bool', name: '', type: 'bool' }],
stateMutability: 'pure',
type: 'function',
},
{
inputs: [{ internalType: 'address', name: 'account', type: 'address' }],
name: 'balanceOf',
outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }],
stateMutability: 'view',
type: 'function',
},
{
inputs: [],
name: 'decimals',
outputs: [{ internalType: 'uint8', name: '', type: 'uint8' }],
stateMutability: 'view',
type: 'function',
},
{
inputs: [],
name: 'isUnstakingAllowed',
outputs: [{ internalType: 'bool', name: '', type: 'bool' }],
stateMutability: 'view',
type: 'function',
},
{
inputs: [],
name: 'name',
outputs: [{ internalType: 'string', name: '', type: 'string' }],
stateMutability: 'view',
type: 'function',
},
{
inputs: [],
name: 'owner',
outputs: [{ internalType: 'address', name: '', type: 'address' }],
stateMutability: 'view',
type: 'function',
},
{
inputs: [],
name: 'pendingOwner',
outputs: [{ internalType: 'address', name: '', type: 'address' }],
stateMutability: 'view',
type: 'function',
},
{
inputs: [],
name: 'renounceOwnership',
outputs: [],
stateMutability: 'nonpayable',
type: 'function',
},
{
inputs: [{ internalType: 'uint256', name: 'amount', type: 'uint256' }],
name: 'stake',
outputs: [],
stateMutability: 'nonpayable',
type: 'function',
},
{
inputs: [],
name: 'symbol',
outputs: [{ internalType: 'string', name: '', type: 'string' }],
stateMutability: 'view',
type: 'function',
},
{
inputs: [],
name: 'totalSupply',
outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }],
stateMutability: 'view',
type: 'function',
},
{
inputs: [
{ internalType: 'address', name: '', type: 'address' },
{ internalType: 'uint256', name: '', type: 'uint256' },
],
name: 'transfer',
outputs: [{ internalType: 'bool', name: '', type: 'bool' }],
stateMutability: 'pure',
type: 'function',
},
{
inputs: [
{ internalType: 'address', name: '', type: 'address' },
{ internalType: 'address', name: '', type: 'address' },
{ internalType: 'uint256', name: '', type: 'uint256' },
],
name: 'transferFrom',
outputs: [{ internalType: 'bool', name: '', type: 'bool' }],
stateMutability: 'pure',
type: 'function',
},
{
inputs: [{ internalType: 'address', name: 'newOwner', type: 'address' }],
name: 'transferOwnership',
outputs: [],
stateMutability: 'nonpayable',
type: 'function',
},
{
inputs: [
{ internalType: 'uint256', name: 'amount', type: 'uint256' },
{ internalType: 'address', name: 'recipient', type: 'address' },
],
name: 'unstake',
outputs: [],
stateMutability: 'nonpayable',
type: 'function',
},
];
1 change: 1 addition & 0 deletions lib/contracts/addresses.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export const CONTRACT_ADDRESSES = {
L2RewardManager: '0x0000000000000000000000000000000000000000',
PufferWithdrawalManager: '0xDdA0483184E75a5579ef9635ED14BacCf9d50283',
NucleusAtomicQueue: '0xc7287780bfa0C5D2dD74e3e51E238B1cd9B221ee',
CarrotStaker: '0x99c599227c65132822f0290d9e5b4b0430d6c0d6',
},
[Chain.Holesky]: {
PufferVault: '0x9196830bB4c05504E0A8475A0aD566AceEB6BeC9',
Expand Down
Loading

0 comments on commit 55aeede

Please sign in to comment.