Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v0.8.15 #189

Merged
merged 23 commits into from
May 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
04501e1
fix(nodemgr): remove duplicated 'l' alias for pool [ledger] command. …
pbennett May 24, 2024
8d963c3
feat(contracts): Add 'emptyTokenRewards' call.
pbennett May 24, 2024
1be84b0
fix(nodemgr): fail early if validator id outside of valid range inste…
pbennett May 24, 2024
de28748
Merge branch 'dev' into feat/emptyTokenRewards
pbennett May 24, 2024
1dca3ee
Merge pull request #182 from TxnLab/feat/emptyTokenRewards
pbennett May 24, 2024
35c9370
feat(ui): fetch and display pool APYs and validator avg APY (#181)
drichar May 25, 2024
a613c74
chore: Update node daemon link in main readme to gitbook docs (w/ mor…
pbennett May 26, 2024
b101ee4
fix(nodemgr): if validator didn't complete step 2 of the pool creatio…
pbennett May 27, 2024
cefeb77
chore: v0.8.15
pbennett May 27, 2024
8fc819c
fix(contracts): increase 'topoff' threshold for node manager to 2.1 A…
pbennett May 27, 2024
8f063e3
chore(ui): upgrade @tanstack/react-router (#188)
drichar May 27, 2024
ecc1dc3
fix(ui): pin dependency query-string to 9.0.0 (#186)
renovate[bot] May 27, 2024
1569c7a
fix(ui): update non-major dependencies (#187)
renovate[bot] May 27, 2024
97548ee
fix(bootstrap): update dependency @algorandfoundation/algokit-utils t…
renovate[bot] May 27, 2024
ddf3369
fix(deps): update dependency @algorandfoundation/algokit-utils to v6.…
renovate[bot] May 27, 2024
6d207e1
chore(contracts): update dependency ts-jest to v29.1.3 (#180)
renovate[bot] May 27, 2024
be38096
feat(ui): expandable rows in ValidatorTable (#183)
drichar May 28, 2024
3a906be
fix(nodemgr): rename 'dumpAllStakers' to 'exportAllStakers' command. …
pbennett May 28, 2024
61634b6
fix(ui): don't mutate cached params in addValidator (#190)
drichar May 28, 2024
d27fd5c
fix(nodemgr): refunding stakers w/ reward tokens ready to claim wasn'…
pbennett May 28, 2024
c0b5ec1
fix(contracts): change bootstrap of validator and creation of staking…
pbennett May 28, 2024
21947fc
feat(nodemgr): add emptyTokenRewards command for returning excess tok…
pbennett May 28, 2024
ac138c8
Merge remote-tracking branch 'origin/dev' into dev
pbennett May 28, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ This section provides instructions for running the protocol and UI in a local Al
## Additional Resources

- **TEALScript Contracts**: Explore the smart contracts that power the protocol. [Read more](./contracts/README.md)
- **Node Daemon**: Learn about the CLI / service daemon which node runners will run as a background service. [Read more](./docs/technical-implementation/reti-node-daemon/README.md)
- **Node Daemon**: Learn about the CLI / service daemon which node runners will run as a background service. [Read more](https://txnlab.gitbook.io/reti-open-pooling/technical-implementation/reti-node-daemon)
- **Example UI**: A Vite React project that serves as a dashboard for staking and validator management. [Read more](./ui/README.md)

## Discord
Expand Down
56 changes: 54 additions & 2 deletions contracts/__test__/contracts.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ beforeAll(async () => {
algod,
)

const validatorApp = await validatorMasterClient.create.createApplication({})
const validatorApp = await validatorMasterClient.create.createApplication({}, { schema: { extraPages: 3 } })
// verify that the constructed validator contract is initialized as expected
expect(validatorApp.appId).toBeDefined()
expect(validatorApp.appAddress).toBeDefined()
Expand Down Expand Up @@ -1749,6 +1749,7 @@ describe('StakeWTokenWRewards', () => {

let validatorId: number
let validatorOwnerAccount: Account
let tokenCreatorAccount: Account
let validatorConfig: ValidatorConfig
const stakerAccounts: Account[] = []
let poolAppId: bigint
Expand All @@ -1764,7 +1765,7 @@ describe('StakeWTokenWRewards', () => {
// add validator and 1 pool for subsequent stake tests
beforeAll(async () => {
// Create a reward token to pay out to stakers
const tokenCreatorAccount = await getTestAccount(
tokenCreatorAccount = await getTestAccount(
{ initialFunds: AlgoAmount.Algos(5000), suppressLog: true },
fixture.context.algod,
fixture.context.kmd,
Expand Down Expand Up @@ -2077,6 +2078,57 @@ describe('StakeWTokenWRewards', () => {
stakersAfterReward,
epochRoundLength,
)

// DON'T claim! we want some tokens remaining to be paid out left for following reclaimTokenRewards test
})

test('reclaimTokenRewards', async () => {
// as 'owner' get tokens back from reward pool - but we should only get back what's not held back
// so we verify some are held back and that we receive everything but that.
const pool1Address = getApplicationAddress(firstPoolKey.poolAppId)
const rewardTokenBalance = await fixture.context.algod
.accountAssetInformation(pool1Address, Number(rewardTokenID))
.do()

const validatorCurState = await getValidatorState(validatorMasterClient, validatorId)
const tokensHeldBack = validatorCurState.rewardTokenHeldBack
expect(tokensHeldBack).toBeGreaterThan(0n)

const ownerTokenBalPre = await fixture.context.algod
.accountAssetInformation(tokenCreatorAccount.addr, Number(rewardTokenID))
.do()

// should fail - not owner of validator
await expect(
validatorMasterClient.emptyTokenRewards(
{ validatorId, receiver: tokenCreatorAccount.addr },
{ sendParams: { fee: AlgoAmount.MicroAlgos(3000), populateAppCallResources: true } },
),
).rejects.toThrowError()
// now get client with our owner as caller
const valAppRef = await validatorMasterClient.appClient.getAppReference()
const validatorClient = new ValidatorRegistryClient(
{
sender: validatorOwnerAccount,
resolveBy: 'id',
id: valAppRef.appId,
},
fixture.context.algod,
)

const sentAmount = (
await validatorClient.emptyTokenRewards(
{ validatorId, receiver: tokenCreatorAccount.addr },
{ sendParams: { fee: AlgoAmount.MicroAlgos(3000), populateAppCallResources: true } },
)
).return!
expect(sentAmount).toEqual(BigInt(rewardTokenBalance['asset-holding'].amount) - tokensHeldBack)
const ownerTokenBal = await fixture.context.algod
.accountAssetInformation(tokenCreatorAccount.addr, Number(rewardTokenID))
.do()
expect(ownerTokenBal['asset-holding'].amount).toEqual(
ownerTokenBalPre['asset-holding'].amount + Number(sentAmount),
)
})
})

Expand Down
8 changes: 5 additions & 3 deletions contracts/bootstrap/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,10 @@ async function main() {
algod,
)
}
validatorApp = await validatorClient.create.createApplication({})
validatorApp = await validatorClient.create.createApplication({}, { schema: { extraPages: 3 } })

console.log(`Validator registry app id is:${validatorApp.appId}`)
console.log(`Validator Contract HASH is:${validatorApp.compiledApproval.compiledHash}`)

// Fund the validator w/ 2 ALGO for contract mbr reqs.
await algokit.transferAlgos(
Expand All @@ -194,6 +197,7 @@ async function main() {
{},
{ sendParams: { populateAppCallResources: true } },
)
console.log(`application ${args.id} updated`)
}

console.log(
Expand All @@ -215,8 +219,6 @@ async function main() {
}
await composer.finalizeStakingContract({}).execute({ populateAppCallResources: true, suppressLog: true })

console.log(`Validator registry app id is:${validatorApp.appId}`)

if (args.network === 'localnet') {
kmd = algokit.getAlgoKmdClient(localConfig.kmdConfig)
// generate two dummy stakers - each w/ 100 million
Expand Down
4 changes: 2 additions & 2 deletions contracts/bootstrap/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "bootstrap",
"version": "0.8.14",
"version": "0.8.15",
"description": "",
"main": "index.ts",
"scripts": {
Expand All @@ -11,7 +11,7 @@
},
"license": "MIT",
"dependencies": {
"@algorandfoundation/algokit-utils": "6.0.5-beta.1",
"@algorandfoundation/algokit-utils": "6.0.5",
"algosdk": "2.7.0",
"prompts": "^2.4.2",
"yargs": "^17.7.2"
Expand Down
Loading
Loading