Skip to content

Commit

Permalink
feat: migrate and refactor A+ staking code
Browse files Browse the repository at this point in the history
  • Loading branch information
alexandermendes committed Nov 6, 2024
1 parent a3ccec8 commit f557672
Show file tree
Hide file tree
Showing 18 changed files with 6,268 additions and 39 deletions.
19 changes: 18 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,21 @@ yarn add @aurora-is-near/staking

## Usage

TODO
Wrap your application in a `StakingProvider`, for example:

```tsx
<StackingProvider
isConnected
network="mainnet"
>
<p>Hello, World!</p>
</StackingProvider>
```

Then access the staking functionality via the `useStaking` hook:

```tsx
const staking = useStaking();

console.log(staking.balance) // => 1337
```
10 changes: 10 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,14 @@
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
}
},
"peerDependencies": {
"react": "*"
},
"dependencies": {
"date-fns": "^4.1.0",
"ethers": "5.6.9",
"wagmi": "2.5.19"
},
"devDependencies": {
"@aurora-is-near/eslint-config": "^1.0.0",
"@aurora-is-near/semantic-release-config": "^1.1.1",
Expand All @@ -31,10 +39,12 @@
"@commitlint/config-conventional": "^19.2.2",
"@types/jest": "^29.0.0",
"@types/node": "^17.0.31",
"@types/react": "^18.3.12",
"eslint": "^8.57.0",
"husky": "^9.0.11",
"jest": "^29.0.0",
"prettier": "^3.2.5",
"react": "18.3.1",
"rimraf": "^3.0.2",
"semantic-release": "^24.0.0",
"ts-jest": "^29.1.0",
Expand Down
163 changes: 163 additions & 0 deletions src/abis/erc20.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,163 @@
export const erc20abi = [
{ inputs: [], stateMutability: 'nonpayable', type: 'constructor' },
{
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: 'from', type: 'address' },
{ indexed: true, internalType: 'address', name: 'to', type: 'address' },
{
indexed: false,
internalType: 'uint256',
name: 'value',
type: 'uint256',
},
],
name: 'Transfer',
type: 'event',
},
{
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: 'spender', type: 'address' },
{ internalType: 'uint256', name: 'amount', type: 'uint256' },
],
name: 'approve',
outputs: [{ internalType: 'bool', name: '', type: 'bool' }],
stateMutability: 'nonpayable',
type: 'function',
},
{
inputs: [{ internalType: 'address', name: 'account', type: 'address' }],
name: 'balanceOf',
outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }],
stateMutability: 'view',
type: 'function',
},
{
inputs: [{ internalType: 'uint256', name: 'amount', type: 'uint256' }],
name: 'burn',
outputs: [],
stateMutability: 'nonpayable',
type: 'function',
},
{
inputs: [
{ internalType: 'address', name: 'account', type: 'address' },
{ internalType: 'uint256', name: 'amount', type: 'uint256' },
],
name: 'burnFrom',
outputs: [],
stateMutability: 'nonpayable',
type: 'function',
},
{
inputs: [],
name: 'decimals',
outputs: [{ internalType: 'uint8', name: '', type: 'uint8' }],
stateMutability: 'view',
type: 'function',
},
{
inputs: [
{ internalType: 'address', name: 'spender', type: 'address' },
{ internalType: 'uint256', name: 'subtractedValue', type: 'uint256' },
],
name: 'decreaseAllowance',
outputs: [{ internalType: 'bool', name: '', type: 'bool' }],
stateMutability: 'nonpayable',
type: 'function',
},
{
inputs: [
{ internalType: 'address', name: 'spender', type: 'address' },
{ internalType: 'uint256', name: 'addedValue', type: 'uint256' },
],
name: 'increaseAllowance',
outputs: [{ internalType: 'bool', name: '', type: 'bool' }],
stateMutability: 'nonpayable',
type: 'function',
},
{
inputs: [{ internalType: 'uint256', name: 'amount', type: 'uint256' }],
name: 'mint',
outputs: [],
stateMutability: 'nonpayable',
type: 'function',
},
{
inputs: [],
name: 'name',
outputs: [{ internalType: 'string', name: '', type: 'string' }],
stateMutability: 'view',
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: 'recipient', type: 'address' },
{ internalType: 'uint256', name: 'amount', type: 'uint256' },
],
name: 'transfer',
outputs: [{ internalType: 'bool', name: '', type: 'bool' }],
stateMutability: 'nonpayable',
type: 'function',
},
{
inputs: [
{ internalType: 'address', name: 'sender', type: 'address' },
{ internalType: 'address', name: 'recipient', type: 'address' },
{ internalType: 'uint256', name: 'amount', type: 'uint256' },
],
name: 'transferFrom',
outputs: [{ internalType: 'bool', name: '', type: 'bool' }],
stateMutability: 'nonpayable',
type: 'function',
},
];
Loading

0 comments on commit f557672

Please sign in to comment.