diff --git a/smart-contracts/assembly/contracts/FT/__tests__/ft-burn.spec.ts b/smart-contracts/assembly/contracts/FT/__tests__/ft-burn.spec.ts index df0e3b5..31d4784 100644 --- a/smart-contracts/assembly/contracts/FT/__tests__/ft-burn.spec.ts +++ b/smart-contracts/assembly/contracts/FT/__tests__/ft-burn.spec.ts @@ -12,18 +12,18 @@ import { u256ToBytes, } from '@massalabs/as-types'; import { - ft1_balanceOf, - ft1_totalSupply, - ft1_name, - ft1_symbol, - ft1_decimals, - ft1_version, + balanceOf, + totalSupply, + name, + symbol, + decimals, + version, constructor, - ft1_increaseAllowance, - ft1_transfer, - ft1_allowance, + increaseAllowance, + transfer, + allowance, } from '../token'; -import { ft1_burn, ft1_burnFrom } from '../burnable/burn'; +import { burn, burnFrom } from '../burnable/burn'; import { ownerAddress } from '../../utils/ownership'; import { u256 } from 'as-bignum/assembly'; @@ -60,23 +60,23 @@ describe('ERC20 BURN - Initialization', () => { ); test('total supply is properly initialized', () => { - expect(ft1_totalSupply([])).toStrictEqual(u256ToBytes(TOTAL_SUPPLY)); + expect(totalSupply([])).toStrictEqual(u256ToBytes(TOTAL_SUPPLY)); }); test('token name is properly initialized', () => { - expect(ft1_name([])).toStrictEqual(stringToBytes(TOKEN_NAME)); + expect(name([])).toStrictEqual(stringToBytes(TOKEN_NAME)); }); test('symbol is properly initialized', () => { - expect(ft1_symbol([])).toStrictEqual(stringToBytes(TOKEN_SYMBOL)); + expect(symbol([])).toStrictEqual(stringToBytes(TOKEN_SYMBOL)); }); test('decimals is properly initialized', () => { - expect(ft1_decimals([])).toStrictEqual(u8toByte(DECIMALS)); + expect(decimals([])).toStrictEqual(u8toByte(DECIMALS)); }); test('version is properly initialized', () => { - expect(ft1_version([])).toStrictEqual(stringToBytes('0.0.0')); + expect(version([])).toStrictEqual(stringToBytes('0.0.0')); }); test('owner is properly initialized', () => { @@ -88,16 +88,16 @@ const burnAmount = new u256(5000, 0, 1); describe('Burn ERC20 to U1', () => { test('Should burn ERC20', () => { - ft1_burn(new Args().add(burnAmount).serialize()); + burn(new Args().add(burnAmount).serialize()); // check balance of U1 expect( - bytesToU256(ft1_balanceOf(new Args().add(user1Address).serialize())), + bytesToU256(balanceOf(new Args().add(user1Address).serialize())), // @ts-ignore ).toBe(TOTAL_SUPPLY - burnAmount); // check totalSupply update - expect(ft1_totalSupply([])).toStrictEqual( + expect(totalSupply([])).toStrictEqual( // @ts-ignore u256ToBytes(TOTAL_SUPPLY - burnAmount), ); @@ -106,7 +106,7 @@ describe('Burn ERC20 to U1', () => { describe('Fails burn ERC20', () => { throws('Fails to burn because of underflow ', () => - ft1_burn(new Args().add(u256.Max).serialize()), + burn(new Args().add(u256.Max).serialize()), ); }); @@ -116,14 +116,14 @@ describe('burnFrom', () => { switchUser(user3Address); // Increase allowance for U1 to spend U3 tokens - ft1_increaseAllowance( + increaseAllowance( new Args().add(user1Address).add(allowAmount).serialize(), ); switchUser(user1Address); }); throws('on insufficient allowance ', () => { - ft1_burnFrom( + burnFrom( new Args() .add(user3Address) // @ts-ignore @@ -133,36 +133,30 @@ describe('burnFrom', () => { }); throws('on insufficient balance', () => - ft1_burnFrom(new Args().add(user2Address).add(allowAmount).serialize()), + burnFrom(new Args().add(user2Address).add(allowAmount).serialize()), ); test('should burn tokens from an other address', () => { - const u1balanceBefore = ft1_balanceOf( - new Args().add(user1Address).serialize(), - ); - const u3balanceBefore = ft1_balanceOf( - new Args().add(user3Address).serialize(), - ); + const u1balanceBefore = balanceOf(new Args().add(user1Address).serialize()); + const u3balanceBefore = balanceOf(new Args().add(user3Address).serialize()); - ft1_transfer(new Args().add(user3Address).add(allowAmount).serialize()); + transfer(new Args().add(user3Address).add(allowAmount).serialize()); - ft1_burnFrom(new Args().add(user3Address).add(allowAmount).serialize()); + burnFrom(new Args().add(user3Address).add(allowAmount).serialize()); // Check balance changes - expect( - ft1_balanceOf(new Args().add(user1Address).serialize()), - ).toStrictEqual( + expect(balanceOf(new Args().add(user1Address).serialize())).toStrictEqual( // @ts-ignore u256ToBytes(bytesToU256(u1balanceBefore) - allowAmount), ); - expect( - ft1_balanceOf(new Args().add(user3Address).serialize()), - ).toStrictEqual(u3balanceBefore); + expect(balanceOf(new Args().add(user3Address).serialize())).toStrictEqual( + u3balanceBefore, + ); // Verify allowances after transferFrom expect( - ft1_allowance(new Args().add(user1Address).add(user3Address).serialize()), + allowance(new Args().add(user1Address).add(user3Address).serialize()), ).toStrictEqual(u256ToBytes(u256.Zero)); }); }); diff --git a/smart-contracts/assembly/contracts/FT/__tests__/ft-mint.spec.ts b/smart-contracts/assembly/contracts/FT/__tests__/ft-mint.spec.ts index d1e121a..a676067 100644 --- a/smart-contracts/assembly/contracts/FT/__tests__/ft-mint.spec.ts +++ b/smart-contracts/assembly/contracts/FT/__tests__/ft-mint.spec.ts @@ -10,15 +10,15 @@ import { u8toByte, u256ToBytes, } from '@massalabs/as-types'; -import { ft1_mint } from '../mintable/mint'; +import { mint } from '../mintable/mint'; import { - ft1_balanceOf, + balanceOf, constructor, - ft1_decimals, - ft1_name, - ft1_symbol, - ft1_totalSupply, - ft1_version, + decimals, + name, + symbol, + totalSupply, + version, } from '../token'; import { ownerAddress } from '../../utils/ownership'; import { u256 } from 'as-bignum/assembly'; @@ -54,23 +54,23 @@ beforeAll(() => { describe('ERC20 MINT - Initialization', () => { test('total supply is properly initialized', () => { - expect(ft1_totalSupply([])).toStrictEqual(u256ToBytes(TOTAL_SUPPLY)); + expect(totalSupply([])).toStrictEqual(u256ToBytes(TOTAL_SUPPLY)); }); test('token name is properly initialized', () => { - expect(ft1_name([])).toStrictEqual(stringToBytes(TOKEN_NAME)); + expect(name([])).toStrictEqual(stringToBytes(TOKEN_NAME)); }); test('symbol is properly initialized', () => { - expect(ft1_symbol([])).toStrictEqual(stringToBytes(TOKEN_SYMBOL)); + expect(symbol([])).toStrictEqual(stringToBytes(TOKEN_SYMBOL)); }); test('decimals is properly initialized', () => { - expect(ft1_decimals([])).toStrictEqual(u8toByte(DECIMALS)); + expect(decimals([])).toStrictEqual(u8toByte(DECIMALS)); }); test('version is properly initialized', () => { - expect(ft1_version([])).toStrictEqual(stringToBytes('0.0.0')); + expect(version([])).toStrictEqual(stringToBytes('0.0.0')); }); test('owner is properly initialized', () => { @@ -82,14 +82,14 @@ const mintAmount = new u256(5000, 33); describe('Mint ERC20 to U2', () => { test('Should mint ERC20', () => { - ft1_mint(new Args().add(user2Address).add(mintAmount).serialize()); + mint(new Args().add(user2Address).add(mintAmount).serialize()); // check balance of U2 - expect( - ft1_balanceOf(new Args().add(user2Address).serialize()), - ).toStrictEqual(u256ToBytes(mintAmount)); + expect(balanceOf(new Args().add(user2Address).serialize())).toStrictEqual( + u256ToBytes(mintAmount), + ); // check totalSupply update - expect(ft1_totalSupply([])).toStrictEqual( + expect(totalSupply([])).toStrictEqual( // @ts-ignore u256ToBytes(mintAmount + TOTAL_SUPPLY), ); @@ -98,17 +98,17 @@ describe('Mint ERC20 to U2', () => { describe('Fails mint ERC20', () => { throws('Should overflow ERC20', () => - ft1_mint(new Args().add(user2Address).add(U64.MAX_VALUE).serialize()), + mint(new Args().add(user2Address).add(U64.MAX_VALUE).serialize()), ); switchUser(user2Address); throws('Should fail because the owner is not the tx emitter', () => - ft1_mint(new Args().add(user1Address).add(u64(5000)).serialize()), + mint(new Args().add(user1Address).add(u64(5000)).serialize()), ); test("Should check totalSupply didn't change", () => { - expect(ft1_totalSupply([])).toStrictEqual( + expect(totalSupply([])).toStrictEqual( // @ts-ignore u256ToBytes(mintAmount + TOTAL_SUPPLY), ); diff --git a/smart-contracts/assembly/contracts/FT/__tests__/ft.spec.ts b/smart-contracts/assembly/contracts/FT/__tests__/ft.spec.ts index 9d0ea86..27480b2 100644 --- a/smart-contracts/assembly/contracts/FT/__tests__/ft.spec.ts +++ b/smart-contracts/assembly/contracts/FT/__tests__/ft.spec.ts @@ -12,17 +12,17 @@ import { u256ToBytes, } from '@massalabs/as-types'; import { - ft1_transfer, - ft1_balanceOf, - ft1_totalSupply, - ft1_name, - ft1_symbol, - ft1_decimals, - ft1_version, - ft1_transferFrom, - ft1_allowance, - ft1_increaseAllowance, - ft1_decreaseAllowance, + transfer, + balanceOf, + totalSupply, + name, + symbol, + decimals, + version, + transferFrom, + allowance, + increaseAllowance, + decreaseAllowance, constructor, } from '../token'; import { u256 } from 'as-bignum/assembly'; @@ -60,36 +60,36 @@ beforeAll(() => { describe('Initialization', () => { test('total supply is properly initialized', () => - expect(ft1_totalSupply([])).toStrictEqual(u256ToBytes(TOTAL_SUPPLY))); + expect(totalSupply([])).toStrictEqual(u256ToBytes(TOTAL_SUPPLY))); test('token name is properly initialized', () => - expect(ft1_name([])).toStrictEqual(stringToBytes(TOKEN_NAME))); + expect(name([])).toStrictEqual(stringToBytes(TOKEN_NAME))); test('symbol is properly initialized', () => - expect(ft1_symbol([])).toStrictEqual(stringToBytes(TOKEN_SYMBOL))); + expect(symbol([])).toStrictEqual(stringToBytes(TOKEN_SYMBOL))); test('decimals is properly initialized', () => - expect(ft1_decimals([])).toStrictEqual(u8toByte(DECIMALS))); + expect(decimals([])).toStrictEqual(u8toByte(DECIMALS))); test('version is properly initialized', () => - expect(ft1_version([])).toStrictEqual(stringToBytes('0.0.0'))); + expect(version([])).toStrictEqual(stringToBytes('0.0.0'))); }); describe('BalanceOf', () => { test('Check an empty balance', () => - expect( - ft1_balanceOf(new Args().add(contractAddr).serialize()), - ).toStrictEqual(u256ToBytes(u256.Zero))); + expect(balanceOf(new Args().add(contractAddr).serialize())).toStrictEqual( + u256ToBytes(u256.Zero), + )); test('Check a non empty balance', () => expect( - bytesToU256(ft1_balanceOf(new Args().add(user1Address).serialize())), + bytesToU256(balanceOf(new Args().add(user1Address).serialize())), ).toBe(TOTAL_SUPPLY)); test('Check balance of invalid address', () => { const invalidAddress = new Address('A12AZDefef'); expect( - ft1_balanceOf(new Args().add(invalidAddress.toString()).serialize()), + balanceOf(new Args().add(invalidAddress.toString()).serialize()), ).toStrictEqual(u256ToBytes(u256.Zero)); }); }); @@ -98,28 +98,28 @@ describe('Transfer', () => { test('Transfer from U1 => U2', () => { const transferAmount = new u256(10, 10); - ft1_transfer(new Args().add(user2Address).add(transferAmount).serialize()); + transfer(new Args().add(user2Address).add(transferAmount).serialize()); // Check user1 balance expect( - ft1_balanceOf(new Args().add(user1Address).serialize()), + balanceOf(new Args().add(user1Address).serialize()), // @ts-ignore ).toStrictEqual(u256ToBytes(TOTAL_SUPPLY - transferAmount)); // Check user2 balance - expect( - ft1_balanceOf(new Args().add(user2Address).serialize()), - ).toStrictEqual(u256ToBytes(transferAmount)); + expect(balanceOf(new Args().add(user2Address).serialize())).toStrictEqual( + u256ToBytes(transferAmount), + ); }); throws('Insuficient balance to transfer from U1 => U2', () => { // @ts-ignore const invalidAmount = TOTAL_SUPPLY + u256.One; - ft1_transfer(new Args().add(user2Address).add(invalidAmount).serialize()); + transfer(new Args().add(user2Address).add(invalidAmount).serialize()); }); throws('Overflow', () => - ft1_transfer(new Args().add(user2Address).add(u256.Max).serialize()), + transfer(new Args().add(user2Address).add(u256.Max).serialize()), ); }); @@ -127,48 +127,44 @@ let u1u2AllowAmount = new u256(20, 20); describe('Allowance', () => { test('Increase user1 allowance for user2 to spend', () => { - ft1_increaseAllowance( + increaseAllowance( new Args().add(user2Address).add(u1u2AllowAmount).serialize(), ); // check new allowance expect( - ft1_allowance(new Args().add(user1Address).add(user2Address).serialize()), + allowance(new Args().add(user1Address).add(user2Address).serialize()), ).toStrictEqual(u256ToBytes(u1u2AllowAmount)); }); test('Increase user1 allowance to max amount for user2 to spend', () => { - ft1_increaseAllowance( - new Args().add(user2Address).add(u256.Max).serialize(), - ); + increaseAllowance(new Args().add(user2Address).add(u256.Max).serialize()); // check new allowance expect( - ft1_allowance(new Args().add(user1Address).add(user2Address).serialize()), + allowance(new Args().add(user1Address).add(user2Address).serialize()), ).toStrictEqual(u256ToBytes(u256.Max)); }); test('Decreases allowance U1 => U2', () => { const decreaseAmount = u256.fromU64(666); - ft1_decreaseAllowance( + decreaseAllowance( new Args().add(user2Address).add(decreaseAmount).serialize(), ); // check new allowance expect( - ft1_allowance(new Args().add(user1Address).add(user2Address).serialize()), + allowance(new Args().add(user1Address).add(user2Address).serialize()), // @ts-ignore ).toStrictEqual(u256ToBytes(u256.Max - decreaseAmount)); }); test('Decrease user1 allowance to 0 for user2', () => - ft1_decreaseAllowance( - new Args().add(user2Address).add(u256.Max).serialize(), - )); + decreaseAllowance(new Args().add(user2Address).add(u256.Max).serialize())); test('check allowance is set to 0', () => expect( - ft1_allowance(new Args().add(user1Address).add(user2Address).serialize()), + allowance(new Args().add(user1Address).add(user2Address).serialize()), ).toStrictEqual(u256ToBytes(u256.Zero))); }); @@ -179,7 +175,7 @@ describe('transferFrom', () => { switchUser(user3Address); // Increase allowance for U1 to spend U3 tokens - ft1_increaseAllowance( + increaseAllowance( new Args().add(user1Address).add(allowAmount).serialize(), ); @@ -187,7 +183,7 @@ describe('transferFrom', () => { }); throws('Fails because not enough allowance U3 => U1 ', () => { - ft1_transferFrom( + transferFrom( new Args() .add(user3Address) .add(user2Address) @@ -198,7 +194,7 @@ describe('transferFrom', () => { }); throws('Fails because not enough token on U3', () => - ft1_transferFrom( + transferFrom( new Args() .add(user3Address) .add(user2Address) @@ -208,19 +204,13 @@ describe('transferFrom', () => { ); test('u1 send tokens to u3 then transfer tokens from u3 to u2 ', () => { - const u1balanceBefore = ft1_balanceOf( - new Args().add(user1Address).serialize(), - ); - const u2balanceBefore = ft1_balanceOf( - new Args().add(user2Address).serialize(), - ); - const u3balanceBefore = ft1_balanceOf( - new Args().add(user3Address).serialize(), - ); + const u1balanceBefore = balanceOf(new Args().add(user1Address).serialize()); + const u2balanceBefore = balanceOf(new Args().add(user2Address).serialize()); + const u3balanceBefore = balanceOf(new Args().add(user3Address).serialize()); - ft1_transfer(new Args().add(user3Address).add(allowAmount).serialize()); + transfer(new Args().add(user3Address).add(allowAmount).serialize()); - ft1_transferFrom( + transferFrom( new Args() .add(user3Address) .add(user2Address) @@ -229,27 +219,23 @@ describe('transferFrom', () => { ); // Check balance changes - expect( - ft1_balanceOf(new Args().add(user1Address).serialize()), - ).toStrictEqual( + expect(balanceOf(new Args().add(user1Address).serialize())).toStrictEqual( // @ts-ignore u256ToBytes(bytesToU256(u1balanceBefore) - allowAmount), ); - expect( - ft1_balanceOf(new Args().add(user2Address).serialize()), - ).toStrictEqual( + expect(balanceOf(new Args().add(user2Address).serialize())).toStrictEqual( // @ts-ignore u256ToBytes(bytesToU256(u2balanceBefore) + allowAmount), ); - expect( - ft1_balanceOf(new Args().add(user3Address).serialize()), - ).toStrictEqual(u3balanceBefore); + expect(balanceOf(new Args().add(user3Address).serialize())).toStrictEqual( + u3balanceBefore, + ); // Verify allowances after transferFrom expect( - ft1_allowance(new Args().add(user1Address).add(user3Address).serialize()), + allowance(new Args().add(user1Address).add(user3Address).serialize()), ).toStrictEqual(u256ToBytes(u256.Zero)); }); }); diff --git a/smart-contracts/assembly/contracts/FT/burnable/burn-internal.ts b/smart-contracts/assembly/contracts/FT/burnable/burn-internal.ts index 18cbcc3..c524550 100644 --- a/smart-contracts/assembly/contracts/FT/burnable/burn-internal.ts +++ b/smart-contracts/assembly/contracts/FT/burnable/burn-internal.ts @@ -2,7 +2,7 @@ import { Address, Storage } from '@massalabs/massa-as-sdk'; import { _balance, _setBalance } from '../token-internals'; import { u256 } from 'as-bignum/assembly'; import { bytesToU256, u256ToBytes } from '@massalabs/as-types'; -import { TOTAL_SUPPLY_KEY, ft1_totalSupply } from '../token'; +import { TOTAL_SUPPLY_KEY, totalSupply } from '../token'; /** * Theses function are internal to the burnable token. @@ -39,7 +39,7 @@ export function _burn(addressToBurn: Address, amount: u256): void { * @returns true if the total supply has been decreased */ export function _decreaseTotalSupply(amount: u256): void { - const oldTotalSupply = bytesToU256(ft1_totalSupply([])); + const oldTotalSupply = bytesToU256(totalSupply([])); // @ts-ignore const newTotalSupply: u256 = oldTotalSupply - amount; diff --git a/smart-contracts/assembly/contracts/FT/burnable/burn.ts b/smart-contracts/assembly/contracts/FT/burnable/burn.ts index b01b4b5..698ffbd 100644 --- a/smart-contracts/assembly/contracts/FT/burnable/burn.ts +++ b/smart-contracts/assembly/contracts/FT/burnable/burn.ts @@ -18,7 +18,7 @@ const BURN_EVENT = 'BURN'; * @param binaryArgs - byte string with the following format: * - the amount of tokens to burn obn the caller address (u256). */ -export function ft1_burn(binaryArgs: StaticArray): void { +export function burn(binaryArgs: StaticArray): void { const args = new Args(binaryArgs); const amount = args .nextU256() @@ -41,7 +41,7 @@ export function ft1_burn(binaryArgs: StaticArray): void { * - the amount of tokens to burn on the caller address (u256). * */ -export function ft1_burnFrom(binaryArgs: StaticArray): void { +export function burnFrom(binaryArgs: StaticArray): void { const args = new Args(binaryArgs); const owner = new Address( args.nextString().expect('owner argument is missing or invalid'), diff --git a/smart-contracts/assembly/contracts/FT/mintable/mint-internal.ts b/smart-contracts/assembly/contracts/FT/mintable/mint-internal.ts index d264d04..d5a2e7f 100644 --- a/smart-contracts/assembly/contracts/FT/mintable/mint-internal.ts +++ b/smart-contracts/assembly/contracts/FT/mintable/mint-internal.ts @@ -1,7 +1,7 @@ import { Args, bytesToU256, u256ToBytes } from '@massalabs/as-types'; import { _balance, _setBalance } from '../token-internals'; import { Address, Storage, generateEvent } from '@massalabs/massa-as-sdk'; -import { TOTAL_SUPPLY_KEY, ft1_totalSupply } from '../token'; +import { TOTAL_SUPPLY_KEY, totalSupply } from '../token'; import { u256 } from 'as-bignum/assembly'; /** @@ -64,7 +64,7 @@ export function _increaseBalance(recipient: Address, amount: u256): void { * @param amount - how much you want to increase the total supply */ export function _increaseTotalSupply(amount: u256): void { - const oldTotalSupply = bytesToU256(ft1_totalSupply([])); + const oldTotalSupply = bytesToU256(totalSupply([])); // @ts-ignore const newTotalSupply = oldTotalSupply + amount; diff --git a/smart-contracts/assembly/contracts/FT/mintable/mint.ts b/smart-contracts/assembly/contracts/FT/mintable/mint.ts index 66f337c..c59dc6c 100644 --- a/smart-contracts/assembly/contracts/FT/mintable/mint.ts +++ b/smart-contracts/assembly/contracts/FT/mintable/mint.ts @@ -18,7 +18,7 @@ import { _mint } from './mint-internal'; * - the recipient's account (address) * - the amount of tokens to mint (u256). */ -export function ft1_mint(binaryArgs: StaticArray): void { +export function mint(binaryArgs: StaticArray): void { onlyOwner(); _mint(binaryArgs); } diff --git a/smart-contracts/assembly/contracts/FT/token.ts b/smart-contracts/assembly/contracts/FT/token.ts index 517d7b7..14c29ba 100644 --- a/smart-contracts/assembly/contracts/FT/token.ts +++ b/smart-contracts/assembly/contracts/FT/token.ts @@ -82,7 +82,7 @@ export function constructor(stringifyArgs: StaticArray): void { * @param _ - unused see https://github.com/massalabs/massa-sc-std/issues/18 * @returns token version */ -export function ft1_version(_: StaticArray): StaticArray { +export function version(_: StaticArray): StaticArray { return stringToBytes('0.0.0'); } @@ -96,7 +96,7 @@ export function ft1_version(_: StaticArray): StaticArray { * @param _ - unused see https://github.com/massalabs/massa-sc-std/issues/18 * @returns token name. */ -export function ft1_name(_: StaticArray): StaticArray { +export function name(_: StaticArray): StaticArray { return Storage.get(NAME_KEY); } @@ -105,7 +105,7 @@ export function ft1_name(_: StaticArray): StaticArray { * @param _ - unused see https://github.com/massalabs/massa-sc-std/issues/18 * @returns token symbol. */ -export function ft1_symbol(_: StaticArray): StaticArray { +export function symbol(_: StaticArray): StaticArray { return Storage.get(SYMBOL_KEY); } @@ -117,7 +117,7 @@ export function ft1_symbol(_: StaticArray): StaticArray { * @param _ - unused see https://github.com/massalabs/massa-sc-std/issues/18 * @returns u256 */ -export function ft1_totalSupply(_: StaticArray): StaticArray { +export function totalSupply(_: StaticArray): StaticArray { return Storage.get(TOTAL_SUPPLY_KEY); } @@ -128,7 +128,7 @@ export function ft1_totalSupply(_: StaticArray): StaticArray { * @param _ - unused see https://github.com/massalabs/massa-sc-std/issues/18 * @returns */ -export function ft1_decimals(_: StaticArray): StaticArray { +export function decimals(_: StaticArray): StaticArray { return Storage.get(DECIMALS_KEY); } @@ -141,7 +141,7 @@ export function ft1_decimals(_: StaticArray): StaticArray { * * @param binaryArgs - Args object serialized as a string containing an owner's account (Address). */ -export function ft1_balanceOf(binaryArgs: StaticArray): StaticArray { +export function balanceOf(binaryArgs: StaticArray): StaticArray { const args = new Args(binaryArgs); const addr = new Address( @@ -162,7 +162,7 @@ export function ft1_balanceOf(binaryArgs: StaticArray): StaticArray { * - the recipient's account (address) * - the number of tokens (u256). */ -export function ft1_transfer(binaryArgs: StaticArray): void { +export function transfer(binaryArgs: StaticArray): void { const owner = Context.caller(); const args = new Args(binaryArgs); @@ -217,7 +217,7 @@ function _transfer(from: Address, to: Address, amount: u256): void { * - the owner's account (address) * - the spender's account (address). */ -export function ft1_allowance(binaryArgs: StaticArray): StaticArray { +export function allowance(binaryArgs: StaticArray): StaticArray { const args = new Args(binaryArgs); const owner = new Address( args.nextString().expect('owner argument is missing or invalid'), @@ -238,7 +238,7 @@ export function ft1_allowance(binaryArgs: StaticArray): StaticArray { * - the spender's account (address); * - the amount (u256). */ -export function ft1_increaseAllowance(binaryArgs: StaticArray): void { +export function increaseAllowance(binaryArgs: StaticArray): void { const owner = Context.caller(); const args = new Args(binaryArgs); @@ -275,7 +275,7 @@ export function ft1_increaseAllowance(binaryArgs: StaticArray): void { * - the spender's account (address); * - the amount (u256). */ -export function ft1_decreaseAllowance(binaryArgs: StaticArray): void { +export function decreaseAllowance(binaryArgs: StaticArray): void { const owner = Context.caller(); const args = new Args(binaryArgs); @@ -320,7 +320,7 @@ export function ft1_decreaseAllowance(binaryArgs: StaticArray): void { * - the recipient's account (address); * - the amount (u256). */ -export function ft1_transferFrom(binaryArgs: StaticArray): void { +export function transferFrom(binaryArgs: StaticArray): void { const spenderAddress = Context.caller(); const args = new Args(binaryArgs); diff --git a/smart-contracts/assembly/contracts/FT/wrapper.ts b/smart-contracts/assembly/contracts/FT/wrapper.ts index bdd753e..82b5799 100644 --- a/smart-contracts/assembly/contracts/FT/wrapper.ts +++ b/smart-contracts/assembly/contracts/FT/wrapper.ts @@ -35,7 +35,7 @@ export class TokenWrapper { * @returns */ version(): string { - return bytesToString(call(this._origin, 'ft1_version', NoArg, 0)); + return bytesToString(call(this._origin, 'version', NoArg, 0)); } /** @@ -44,7 +44,7 @@ export class TokenWrapper { * @returns name of the token. */ name(): string { - return bytesToString(call(this._origin, 'ft1_name', NoArg, 0)); + return bytesToString(call(this._origin, 'name', NoArg, 0)); } /** Returns the symbol of the token. @@ -52,7 +52,7 @@ export class TokenWrapper { * @returns token symbol. */ symbol(): string { - return bytesToString(call(this._origin, 'ft1_symbol', NoArg, 0)); + return bytesToString(call(this._origin, 'symbol', NoArg, 0)); } /** @@ -63,7 +63,7 @@ export class TokenWrapper { * @returns number of minted tokens. */ totalSupply(): u256 { - return bytesToU256(call(this._origin, 'ft1_totalSupply', NoArg, 0)); + return bytesToU256(call(this._origin, 'totalSupply', NoArg, 0)); } /** @@ -73,7 +73,7 @@ export class TokenWrapper { */ balanceOf(account: Address): u256 { return bytesToU256( - call(this._origin, 'ft1_balanceOf', new Args().add(account), 0), + call(this._origin, 'balanceOf', new Args().add(account), 0), ); } @@ -84,12 +84,7 @@ export class TokenWrapper { * @param nbTokens - */ transfer(toAccount: Address, nbTokens: u256): void { - call( - this._origin, - 'ft1_transfer', - new Args().add(toAccount).add(nbTokens), - 0, - ); + call(this._origin, 'transfer', new Args().add(toAccount).add(nbTokens), 0); } /** @@ -102,7 +97,7 @@ export class TokenWrapper { return bytesToU256( call( this._origin, - 'ft1_allowance', + 'allowance', new Args().add(ownerAccount).add(spenderAccount), 0, ), @@ -121,7 +116,7 @@ export class TokenWrapper { increaseAllowance(spenderAccount: Address, nbTokens: u256): void { call( this._origin, - 'ft1_increaseAllowance', + 'increaseAllowance', new Args().add(spenderAccount).add(nbTokens), 0, ); @@ -139,7 +134,7 @@ export class TokenWrapper { decreaseAllowance(spenderAccount: Address, nbTokens: u256): void { call( this._origin, - 'ft1_decreaseAllowance', + 'decreaseAllowance', new Args().add(spenderAccount).add(nbTokens), 0, ); @@ -165,7 +160,7 @@ export class TokenWrapper { ): void { call( this._origin, - 'ft1_transferFrom', + 'transferFrom', new Args().add(ownerAccount).add(recipientAccount).add(nbTokens), 0, ); @@ -178,7 +173,7 @@ export class TokenWrapper { * @param nbTokens - */ mint(toAccount: Address, nbTokens: u64): void { - call(this._origin, 'ft1_mint', new Args().add(toAccount).add(nbTokens), 0); + call(this._origin, 'mint', new Args().add(toAccount).add(nbTokens), 0); } /** @@ -187,6 +182,6 @@ export class TokenWrapper { * @param nbTokens - */ burn(nbTokens: u64): void { - call(this._origin, 'ft1_burn', new Args().add(nbTokens), 0); + call(this._origin, 'burn', new Args().add(nbTokens), 0); } }