Skip to content

Commit 68409be

Browse files
committed
Update grant disbursement program to handle funding using only credits transfers
1 parent 015fcfe commit 68409be

22 files changed

+2389
-2202
lines changed

grant_disbursement/README.md

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,31 +20,48 @@ The amount of vested credits is `= (current_block_height - start_block) / (fully
2020

2121
## Available methods
2222

23-
### create_grant
23+
### initialize
2424

25-
Used to create and start the grant.
25+
Used to create all of the grants. All grants must be hard coded into the initialize method so they can be funded by a simple credits.aleo/transfer_public
2626

27-
The `paleo_amount` should be calculated similarly to a deposit in Pondo to maximize the pAleo received and minimize the slippage.
27+
The `paleo_amount` is set to 0 initially.
2828
```
2929
async transition create_grant(
3030
public id: u64,
3131
public credits_amount: u64,
32-
public paleo_amount: u64,
32+
public paleo_amount: u128,
3333
public recipient_rewards_key: address,
3434
public recipient_principal_key: address,
3535
public cliff_block: u32,
3636
public fully_vested_block: u32
3737
) -> Future
3838
```
3939

40+
### process_grant
41+
42+
The actual funder for the grant is expected to transfer credits (using credits.aleo transfer_public or transfer_public_as_signer) directly to the program address.
43+
44+
Once the credits are transferred to the program. Anyone can call `process_grant` to deposit the credits into pAleo.
45+
By default, the pondo deposit is constrained to be within 99.99% of the ideal pAleo minted given a certain credits balance.
46+
47+
Calling `process_grant` deposits the credits into the Pondo Protocol, mints the near ideal pAleo and then transfers the pAleo to this program, later to be distributed.
48+
49+
```
50+
async transition process_grant(
51+
grant_id: u8,
52+
credits_amount: u64,
53+
paleo_amount: u128,
54+
) -> Future
55+
```
56+
4057
### withdraw_rewards
4158

4259
Used by the grantee with the `recipient_rewards_key` to claim `pAleo` without touching the principal before the `cliff_block`
4360

4461
```
4562
async transition withdraw_rewards(
46-
id: u64,
47-
paleo_amount: u64
63+
id: u8,
64+
paleo_amount: u128
4865
) -> Future
4966
```
5067

@@ -54,7 +71,7 @@ Used by the grantee with the `recipient_principal_key` to claim `pAleo` vested p
5471

5572
```
5673
async transition withdraw_principal(
57-
id: u64,
58-
paleo_amount: u64
74+
id: u8,
75+
paleo_amount: u128
5976
) -> Future
6077
```

grant_disbursement/build/imports/pondo_staked_aleo_token.aleo renamed to grant_disbursement/build/imports/paleo_token.aleo

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ struct TokenOwner:
2323

2424
function register_token:
2525
assert.eq self.caller pondo_protocol.aleo;
26-
call token_registry.aleo/register_token 1751493913335802797273486270793650302076377624243810059080883537084141842600field 1631421259099656974472467909989204u128 482131854671u128 6u8 1_000_000_000_000_000u128 false paleo_token.aleo into r0;
26+
call token_registry.aleo/register_token 1751493913335802797273486270793650302076377624243810059080883537084141842600field 1631421259099656974472467909989204u128 482131854671u128 6u8 10_000_000_000_000_000u128 false paleo_token.aleo into r0;
2727
call token_registry.aleo/set_role 1751493913335802797273486270793650302076377624243810059080883537084141842600field pondo_protocol.aleo 3u8 into r1;
2828
async register_token r0 r1 into r2;
2929
output r2 as paleo_token.aleo/register_token.future;

0 commit comments

Comments
 (0)