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.
26 lines
604 B
26 lines
604 B
2 years ago
|
// Pseudo staking contract for the tests
|
||
|
import "./messages";
|
||
|
|
||
|
contract PseudoStaking {
|
||
|
stakes: map[Address]Int;
|
||
|
init() {}
|
||
|
|
||
|
receive("Deposit") {
|
||
|
let ctx: Context = context();
|
||
|
let sender: Address = ctx.sender;
|
||
|
let ex_stake: Int? = self.stakes.get(sender);
|
||
|
if (ex_stake == null) {
|
||
|
ex_stake = 0;
|
||
|
}
|
||
|
self.stakes.set(sender, ex_stake!! + ctx.value);
|
||
|
}
|
||
|
|
||
|
receive(msg: StakingWithdraw) {
|
||
|
let ctx: Context = context();
|
||
|
send(SendParameters {
|
||
|
value: msg.value,
|
||
|
to: ctx.sender
|
||
|
});
|
||
|
}
|
||
|
}
|