Skip to content

feat: governance voting, token vesting, permit gasless approval, and … - #366

Merged
DeFiVC merged 2 commits into
ChainLearnOfficial:mainfrom
emwulrd:main
Aug 30, 2026
Merged

feat: governance voting, token vesting, permit gasless approval, and …#366
DeFiVC merged 2 commits into
ChainLearnOfficial:mainfrom
emwulrd:main

Conversation

@emwulrd

@emwulrd emwulrd commented Aug 30, 2026

Copy link
Copy Markdown
Contributor

Closes #226, Closes #225, Closes #224, Closes #223

Summary of Changes

  • Token Governance Voting (. Add token governance voting #226): Added Proposal struct, create_proposal, vote, and execute_proposal functions using token snapshots for voting power.
  • Token Vesting Schedules (. Add token vesting schedules #225): Added VestingSchedule struct, create_vesting admin function, and claim_vested beneficiary function with linear vesting after cliff.
  • Token Permit Function (. Add token permit function #224): Added permit gasless allowance function with authorization and replay-prevention nonce tracking (permit_nonce).
  • Course Completion Certificate Generation (. Add course completion certificate generation #223): Added generate_certificate and get_certificate_uri functions to generate and store unique certificate URIs on-chain in credential metadata.
  • Repository Maintenance: Updated .gitignore with mimo related ignore patterns.

@drips-wave

drips-wave Bot commented Aug 30, 2026

Copy link
Copy Markdown

@emwulrd Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@DeFiVC
DeFiVC merged commit 37f847d into ChainLearnOfficial:main Aug 30, 2026
DeFiVC added a commit that referenced this pull request Aug 30, 2026
…ddress minting, claim history, and pause (#373)

* fix(learn-token): remove duplicate is_paused/set_paused definitions

storage.rs defined is_paused/set_paused twice with identical bodies --
once under the original Emergency Pause section (#189) and again under
the pause-events section (#238), added by two PRs merged back to back
without either noticing the other had already added the same pair.
Rust rejects the duplicate definitions (E0428), so main currently
fails to build. Keep the original definitions and drop the redundant
pair; both events and pause/unpause logic already call through the
one storage.rs API surface, so nothing else changes.

* fix(learn-token): repair test suite broken by role-gated mint/pause

PR #365 added Minter/Pauser role checks to mint(), pause(), and
unpause(), giving each an extra caller: Address parameter, and updated
the call sites that existed at the time. It landed back to back with
two other PRs (#363, #366) that added their own tests calling the
pre-refactor 2-and-0-argument signatures, or referencing an admin
binding some of those same tests never captured (destructured as _ or
_admin because they didn't need it before). None of the three PRs
conflicted at the git-diff level, so all three merged cleanly and the
test suite has been failing to compile since.

Capture admin from setup() wherever a fixed test now needs it as the
mint/pause/unpause caller, and fix one unrelated pre-existing
get_proposal(prop_id) call that needed a borrow. No behavioral changes
-- cargo test -p learn-token now compiles and all 63 tests pass.

* feat(learn-token): add persistent storage entry-count tracking

Soroban prices persistent storage by entry count and size but gives a
contract no host API to enumerate or count its own keys, so there is
currently no way to answer "how much storage is this contract using"
short of an off-chain state export.

Add get_storage_size(), backed by a StorageEntryCount counter that
storage.rs increments/decrements around every write to a per-entity
key -- reward claims, claim history, roles, whitelist entries,
snapshots, vesting schedules and claimed amounts, proposals, votes,
allowance-spender registries, permit nonces, and per-address minting
totals -- guarded by a has() check so overwriting an existing entry
never double-counts it.

Deliberately excluded: singleton config (admin, name/symbol/decimal,
total/max supply, metadata, transfer restriction, wasm hash, upgrade
version, paused flag, proposal counter) since those don't grow with
usage, and Balance/Allowance since balances are written on every
transfer/mint/burn (the issue's "no performance impact" criterion
argues against adding a has() check to that path) and allowances live
in temporary rather than persistent storage.

Closes #254

* test(learn-token): extend coverage for per-address minting, claim history, and pause

total_minted_to() (#251), get_claim_history() (#252), and pause/unpause
(#253) were already implemented and tested on main (merged in #363 for
near-duplicate issues #236/#237/#238, before this repo's issue numbers
#251-253 were filed against the same scope). Add the edge cases their
existing coverage didn't reach:

- total_minted_to: a zero-amount mint is allowed (only negative amounts
  are rejected) and should leave the queryable total at 0.
- get_claim_history: existing tests only covered multiple quizzes
  within one course; verify records also stay correctly distinguished
  by course_id when a learner claims across different courses.
- pause: existing coverage only exercised transfer and mint; burn,
  claim_reward, and claim_vested are also gated by
  require_not_paused() and hadn't been exercised while paused.

Closes #251, Closes #252, Closes #253

---------

Co-authored-by: DeFiVC <136683573+DeFiVC@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

. Add token governance voting . Add token vesting schedules . Add token permit function . Add course completion certificate generation

2 participants