You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

63 lines
1.5 KiB

2 years ago
// import "@stdlib/jetton";
import "./messages";
import "./wallet";
import "./linker";
import "./jetton_trait";
import "./staking";
2 years ago
import "./constants";
import "./pseudostaking";
2 years ago
message Deposit {
amount: Int as coins;
2 years ago
}
message Withdraw {
amount: Int;
}
2 years ago
2 years ago
contract TONB with TONBTrait {
2 years ago
totalSupply: Int as coins;
owner: Address;
content: Cell?;
mintable: Bool;
first_linker: Address?;
last_linker: Address?;
n_linkers: Int = 0;
staking_pool: Address?;
in_the_pool: Int = 0;
withdrawal_requests: WithdrawalRequests;
2 years ago
init(owner: Address, content: Cell?, staking_pool: Address?) {
2 years ago
self.totalSupply = 0;
self.owner = owner;
self.mintable = true;
self.content = content;
self.staking_pool = staking_pool;
2 years ago
self.withdrawal_requests = WithdrawalRequests {
addresses: emptyMap(),
amounts: emptyMap()
};
2 years ago
}
receive(msg: Deposit) {
2 years ago
let ctx: Context = context();
require(ctx.value >= deposit_gas_consumption + msg.amount + linker_credit + wallet_credit, "not enough money for deposit");
2 years ago
self.mint(ctx.sender, msg.amount, ctx.sender);
2 years ago
self.sendStake();
2 years ago
}
receive() {}
receive(msg: Withdraw) {
let ctx: Context = context();
require(ctx.value >= withdraw_gas_consumption, "not enough money for withdraw");
self.burn(ctx.sender, msg.amount, ctx.sender);
}
2 years ago
receive(msg: SetStakingPool) {
self.staking_pool = msg.staking_pool;
}
2 years ago
}