Smart Contract πŸ₯š
All core have been driven by smart contracts that are open-source, anyone can review, access and utilize while the marketplace module is rely on the external 3rd party which is QuickSwap, all contracts have been deployed on Polygon chain at the moment, we will soon support more chain in the near future.

Addresses

Contract Name
Address
Network
HKD
0xFC48e2670cEebc8021a8CF51f884540ce350cC8a
Polygon
TokenManager (HKD)
0x38b073e96434Ec00A10eBb2f87f2Ee31579cb040
Polygon
USDC/TAMG Pair
0x197B24748D801419d39021bd1B76b9A609D45e5d
Polygon
USDC/HKD Pair
0x5b301158BEAC5F9Bd5F0CedaACd3Eb14F31d777d
Polygon
TokenFactory
0xd7Dc81E4D199A4a325AA0a7cAaaaC02C26B8AB55
Polygon
TamagoToken
0x53BDA082677a4965C79086D3Fe69A6182d6Af1B8
Polygon
Reward
0x6F75644C7bBcB102292A0B27B181361d2cA89aCC
Polygon

Functions

The solidity TokenManager.sol contract acts as a single endpoint for mint and redeem synthetic tokens, the contract is tightly integrated with Chainlink Oracle in order to fetch the market price of the underlying asset.
The contract contains a several of main operations for the minter to mint assets from pre-defined collateral assets as well as maintain the debt position and finally burn the synthetic asset to get collateral assets back to the original wallet.

Mint

function mint(uint256 baseCollateral, uint256 supportCollateral, uint256 numTokens)
Parameter
Type
Description
baseCollateral
uint256
Non-stablecoin token amount
supportCollateral
uint256
Stablecoin token amount
numTokens
uint256
Total synthetic tokens to be created
This is the function where the minter mints synthetic tokens with a combination of stablecoin and non-stablecoin collateral assets, the process will be failed if the sufficient collateralization level is not yet met, once completed, the minter is obligated to maintain the ratio to be above than the liquidation ratio all in time unless someone else will come and take liquidate the position.

Deposit

function deposit(uint256 baseCollateral, uint256 supportCollateral)
Parameter
Type
Description
baseCollateral
uint256
Non-stablecoin tokens to be deposited
supportCollateral
uint256
Stablecoin tokens to be deposited
This use for make a deposit more collateral assets to help increase the collateralization level away from being liquidated or adjust the level of collateral assets to be aligned with current market situation.
This function won't mint more synthetic tokens if the minter want it more considering to use mint().

Withdraw

function withdraw(uint256 baseCollateral, uint256 supportCollateral)
Parameter
Type
Description
baseCollateral
uint256
Non-stablecoin tokens to be withdrawn
supportCollateral
uint256
Stablecoin tokens to be withdrawn
If the collateralization ratio is too high, the minter can decrease it and get the collateral assets back as long as the new ratio still above the liquidation ratio.

Redeem

function redeem(uint256 baseCollateral, uint256 supportCollateral)
Parameter
Type
Description
baseCollateral
uint256
Non-stablecoin tokens to be redeemed
supportCollateral
uint256
Stablecoin tokens to be redeemed
When redeem assets, the collateralization ratio won't be changed, the minter need to burn synthetic assets that equivalent of the given collateral assets, prior to the call, the minter can estimate the amount of synthetic tokens that need with estimateTokensOut().

Redeem All

function redeemAll()
Parameter
Type
Description
None
​
​
This function use for close the debt position, the minter will need to burn all outstanding synthetic tokens, all deposited collateral assets will be returned to the minter after.
The documentation is still work-in-progress. Stay tuned for more updates soon.
​
Last modified 2mo ago