Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 3 additions & 3 deletions arc-0020/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ Teams that have already deployed tokens to `token_registry.aleo` can make them A

`token_registry.aleo` functions take an extra `token_id: field` parameter:
```
token_registry.aleo/transfer_public(token_id, recipient, amount) // 3 params
token_registry.aleo::transfer_public(token_id, recipient, amount) // 3 params
ARC20/transfer_public(recipient, amount) // 2 params
```
This signature mismatch means `token_registry.aleo` cannot directly implement the ARC20 interface.
Expand All @@ -284,8 +284,8 @@ This signature mismatch means `token_registry.aleo` cannot directly implement th
2. Set a `WRAPPED_TOKEN_ID` constant for your token's ID in the registry
3. Maintain local `balances: address => u128` and `allowances` mappings
4. Implement deposit/withdraw to bridge between the wrapper and the registry:
- `deposit_token_public(amount)`: calls `token_registry.aleo/transfer_public_as_signer(TOKEN_ID, self.address, amount)`, increments local balance
- `withdraw_token_public(amount)`: decrements local balance, calls `token_registry.aleo/transfer_public(TOKEN_ID, withdrawer, amount)`
- `deposit_token_public(amount)`: calls `token_registry.aleo::transfer_public_as_signer(TOKEN_ID, self.address, amount)`, increments local balance
- `withdraw_token_public(amount)`: decrements local balance, calls `token_registry.aleo::transfer_public(TOKEN_ID, withdrawer, amount)`
5. Implement all ARC20 functions (`transfer_public`, `shield`, `approve_public`, etc.) operating on local balances

### Deposit/Withdraw Flow
Expand Down
2 changes: 1 addition & 1 deletion arc-0020/dummy_exchange/build/program.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "0.1.0",
"description": "",
"license": "",
"leo": "3.4.0",
"leo": "3.5.0",
"dependencies": null,
"dev_dependencies": null
}
2 changes: 1 addition & 1 deletion arc-0020/dummy_exchange/program.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "0.1.0",
"description": "Dummy exchange for testing spendable allowance",
"license": "MIT",
"leo": "3.4.0",
"leo": "3.5.0",
"dependencies": [],
"dev_dependencies": null
}
23 changes: 17 additions & 6 deletions arc-0020/dummy_exchange/src/main.leo
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,12 @@ program dummy_exchange.aleo {
public amount: u128,
) -> Final {
let f: Final = _dynamic_call::[Final](
token_id, NETWORK_ALEO, TRANSFER_FROM_PUBLIC_ID,
owner, recipient, amount
token_id,
NETWORK_ALEO,
TRANSFER_FROM_PUBLIC_ID,
owner,
recipient,
amount,
);
return final {
f.run();
Expand All @@ -41,13 +45,20 @@ program dummy_exchange.aleo {
) -> Final {
// Pull token_in from signer via allowance
let pull: Final = _dynamic_call::[Final](
token_in, NETWORK_ALEO, TRANSFER_FROM_PUBLIC_ID,
self.signer, self.address, amount_in
token_in,
NETWORK_ALEO,
TRANSFER_FROM_PUBLIC_ID,
self.signer,
self.address,
amount_in,
);
// Send token_out to signer from this program's balance
let push: Final = _dynamic_call::[Final](
token_out, NETWORK_ALEO, TRANSFER_PUBLIC_ID,
self.signer, amount_out
token_out,
NETWORK_ALEO,
TRANSFER_PUBLIC_ID,
self.signer,
amount_out,
);
return final {
pull.run();
Expand Down
16 changes: 1 addition & 15 deletions arc-0020/tests/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions arc-0020/tests/wrapped-credits.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,10 @@ describe("wrapped_credits.aleo", () => {
});

test("deposit_credits_private (positive): accepts a credits record and returns a Token", async () => {
// Create a credits.aleo/credits record for addr0.
// Create a credits.aleo::credits record for addr0.
const creditsExec = await AleoUtils.leoExecute(
programPath,
"credits.aleo/transfer_public_to_private",
"credits.aleo::transfer_public_to_private",
[addr0, "500u64"],
{ privateKey: pk0 },
);
Expand Down Expand Up @@ -102,7 +102,7 @@ describe("wrapped_credits.aleo", () => {
test("deposit_credits_private (negative): rejects when amount exceeds record value", async () => {
const creditsExec = await AleoUtils.leoExecute(
programPath,
"credits.aleo/transfer_public_to_private",
"credits.aleo::transfer_public_to_private",
[addr0, "50u64"],
{ privateKey: pk0 },
);
Expand Down
Loading
Loading