-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix cetus, added cronos-token project
- Loading branch information
Showing
11 changed files
with
1,544 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,296 @@ | ||
[ | ||
{ | ||
"inputs": [ | ||
{ "internalType": "address", "name": "_x2y2Token", "type": "address" }, | ||
{ | ||
"internalType": "address", | ||
"name": "_tokenSplitter", | ||
"type": "address" | ||
}, | ||
{ "internalType": "uint256", "name": "_startBlock", "type": "uint256" }, | ||
{ | ||
"internalType": "uint256[]", | ||
"name": "_rewardsPerBlockForStaking", | ||
"type": "uint256[]" | ||
}, | ||
{ | ||
"internalType": "uint256[]", | ||
"name": "_rewardsPerBlockForOthers", | ||
"type": "uint256[]" | ||
}, | ||
{ | ||
"internalType": "uint256[]", | ||
"name": "_periodLengthesInBlocks", | ||
"type": "uint256[]" | ||
}, | ||
{ "internalType": "uint256", "name": "_numberPeriods", "type": "uint256" } | ||
], | ||
"stateMutability": "nonpayable", | ||
"type": "constructor" | ||
}, | ||
{ | ||
"anonymous": false, | ||
"inputs": [ | ||
{ | ||
"indexed": true, | ||
"internalType": "address", | ||
"name": "user", | ||
"type": "address" | ||
}, | ||
{ | ||
"indexed": false, | ||
"internalType": "uint256", | ||
"name": "harvestedAmount", | ||
"type": "uint256" | ||
} | ||
], | ||
"name": "Compound", | ||
"type": "event" | ||
}, | ||
{ | ||
"anonymous": false, | ||
"inputs": [ | ||
{ | ||
"indexed": true, | ||
"internalType": "address", | ||
"name": "user", | ||
"type": "address" | ||
}, | ||
{ | ||
"indexed": false, | ||
"internalType": "uint256", | ||
"name": "amount", | ||
"type": "uint256" | ||
}, | ||
{ | ||
"indexed": false, | ||
"internalType": "uint256", | ||
"name": "harvestedAmount", | ||
"type": "uint256" | ||
} | ||
], | ||
"name": "Deposit", | ||
"type": "event" | ||
}, | ||
{ | ||
"anonymous": false, | ||
"inputs": [ | ||
{ | ||
"indexed": true, | ||
"internalType": "uint256", | ||
"name": "currentPhase", | ||
"type": "uint256" | ||
}, | ||
{ | ||
"indexed": false, | ||
"internalType": "uint256", | ||
"name": "startBlock", | ||
"type": "uint256" | ||
}, | ||
{ | ||
"indexed": false, | ||
"internalType": "uint256", | ||
"name": "rewardPerBlockForStaking", | ||
"type": "uint256" | ||
}, | ||
{ | ||
"indexed": false, | ||
"internalType": "uint256", | ||
"name": "rewardPerBlockForOthers", | ||
"type": "uint256" | ||
} | ||
], | ||
"name": "NewRewardsPerBlock", | ||
"type": "event" | ||
}, | ||
{ | ||
"anonymous": false, | ||
"inputs": [ | ||
{ | ||
"indexed": true, | ||
"internalType": "address", | ||
"name": "user", | ||
"type": "address" | ||
}, | ||
{ | ||
"indexed": false, | ||
"internalType": "uint256", | ||
"name": "amount", | ||
"type": "uint256" | ||
}, | ||
{ | ||
"indexed": false, | ||
"internalType": "uint256", | ||
"name": "harvestedAmount", | ||
"type": "uint256" | ||
} | ||
], | ||
"name": "Withdraw", | ||
"type": "event" | ||
}, | ||
{ | ||
"inputs": [], | ||
"name": "NUMBER_PERIODS", | ||
"outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], | ||
"stateMutability": "view", | ||
"type": "function" | ||
}, | ||
{ | ||
"inputs": [], | ||
"name": "PRECISION_FACTOR", | ||
"outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], | ||
"stateMutability": "view", | ||
"type": "function" | ||
}, | ||
{ | ||
"inputs": [], | ||
"name": "START_BLOCK", | ||
"outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], | ||
"stateMutability": "view", | ||
"type": "function" | ||
}, | ||
{ | ||
"inputs": [], | ||
"name": "accTokenPerShare", | ||
"outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], | ||
"stateMutability": "view", | ||
"type": "function" | ||
}, | ||
{ | ||
"inputs": [{ "internalType": "address", "name": "user", "type": "address" }], | ||
"name": "calculatePendingRewards", | ||
"outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], | ||
"stateMutability": "view", | ||
"type": "function" | ||
}, | ||
{ | ||
"inputs": [], | ||
"name": "currentPhase", | ||
"outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], | ||
"stateMutability": "view", | ||
"type": "function" | ||
}, | ||
{ | ||
"inputs": [{ "internalType": "uint256", "name": "amount", "type": "uint256" }], | ||
"name": "deposit", | ||
"outputs": [], | ||
"stateMutability": "nonpayable", | ||
"type": "function" | ||
}, | ||
{ | ||
"inputs": [], | ||
"name": "endBlock", | ||
"outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], | ||
"stateMutability": "view", | ||
"type": "function" | ||
}, | ||
{ | ||
"inputs": [], | ||
"name": "harvestAndCompound", | ||
"outputs": [], | ||
"stateMutability": "nonpayable", | ||
"type": "function" | ||
}, | ||
{ | ||
"inputs": [], | ||
"name": "lastRewardBlock", | ||
"outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], | ||
"stateMutability": "view", | ||
"type": "function" | ||
}, | ||
{ | ||
"inputs": [], | ||
"name": "rewardPerBlockForOthers", | ||
"outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], | ||
"stateMutability": "view", | ||
"type": "function" | ||
}, | ||
{ | ||
"inputs": [], | ||
"name": "rewardPerBlockForStaking", | ||
"outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], | ||
"stateMutability": "view", | ||
"type": "function" | ||
}, | ||
{ | ||
"inputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], | ||
"name": "stakingPeriod", | ||
"outputs": [ | ||
{ | ||
"internalType": "uint256", | ||
"name": "rewardPerBlockForStaking", | ||
"type": "uint256" | ||
}, | ||
{ | ||
"internalType": "uint256", | ||
"name": "rewardPerBlockForOthers", | ||
"type": "uint256" | ||
}, | ||
{ | ||
"internalType": "uint256", | ||
"name": "periodLengthInBlock", | ||
"type": "uint256" | ||
} | ||
], | ||
"stateMutability": "view", | ||
"type": "function" | ||
}, | ||
{ | ||
"inputs": [], | ||
"name": "tokenSplitter", | ||
"outputs": [{ "internalType": "address", "name": "", "type": "address" }], | ||
"stateMutability": "view", | ||
"type": "function" | ||
}, | ||
{ | ||
"inputs": [], | ||
"name": "totalAmountStaked", | ||
"outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], | ||
"stateMutability": "view", | ||
"type": "function" | ||
}, | ||
{ | ||
"inputs": [], | ||
"name": "updatePool", | ||
"outputs": [], | ||
"stateMutability": "nonpayable", | ||
"type": "function" | ||
}, | ||
{ | ||
"inputs": [{ "internalType": "address", "name": "", "type": "address" }], | ||
"name": "userInfo", | ||
"outputs": [ | ||
{ "internalType": "uint256", "name": "amount", "type": "uint256" }, | ||
{ "internalType": "uint256", "name": "rewardDebt", "type": "uint256" } | ||
], | ||
"stateMutability": "view", | ||
"type": "function" | ||
}, | ||
{ | ||
"inputs": [{ "internalType": "uint256", "name": "amount", "type": "uint256" }], | ||
"name": "withdraw", | ||
"outputs": [], | ||
"stateMutability": "nonpayable", | ||
"type": "function" | ||
}, | ||
{ | ||
"inputs": [], | ||
"name": "withdrawAll", | ||
"outputs": [], | ||
"stateMutability": "nonpayable", | ||
"type": "function" | ||
}, | ||
{ | ||
"inputs": [], | ||
"name": "x2y2Token", | ||
"outputs": [ | ||
{ | ||
"internalType": "contract IMintableERC20", | ||
"name": "", | ||
"type": "address" | ||
} | ||
], | ||
"stateMutability": "view", | ||
"type": "function" | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
/** @type {import('ts-jest/dist/types').JestConfigWithTsJest} */ | ||
export default { | ||
preset: 'ts-jest/presets/default-esm', | ||
modulePathIgnorePatterns: ['<rootDir>/dist/'], | ||
moduleNameMapper: { | ||
'^(\\.{1,2}/.*)\\.js$': '$1', | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"private": true, | ||
"name": "cronos-token-holder", | ||
"version": "1.0.0", | ||
"type": "module", | ||
"scripts": { | ||
"build": "sentio build", | ||
"gen": "sentio gen", | ||
"test": "sentio test", | ||
"upload": "sentio upload", | ||
"postinstall": "sentio gen" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
project: cronos-token-holder |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { TestProcessorServer, firstCounterValue } from '@sentio/sdk/testing' | ||
import { mockTransferLog } from '@sentio/sdk/eth/builtin/erc20' | ||
|
||
describe('Test Processor', () => { | ||
const service = new TestProcessorServer(() => import('./processor.js')) | ||
|
||
beforeAll(async () => { | ||
await service.start() | ||
}) | ||
|
||
test('has valid config', async () => { | ||
const config = await service.getConfig({}) | ||
expect(config.contractConfigs.length > 0).toBeTruthy() | ||
}) | ||
|
||
test('check transfer event handling', async () => { | ||
const resp = await service.eth.testLog( | ||
mockTransferLog('0x1e4ede388cbc9f4b5c79681b7f94d36a11abebc9', { | ||
from: '0x0000000000000000000000000000000000000000', | ||
to: '0xb329e39ebefd16f40d38f07643652ce17ca5bac1', | ||
value: 10n ** 18n * 10n, | ||
}) | ||
) | ||
|
||
const tokenCounter = firstCounterValue(resp.result, 'token') | ||
expect(tokenCounter).toEqual(10n) | ||
}) | ||
}) |
Oops, something went wrong.